1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the QtGui module of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 3 requirements |
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
24 | ** |
25 | ** GNU General Public License Usage |
26 | ** Alternatively, this file may be used under the terms of the GNU |
27 | ** General Public License version 2.0 or (at your option) the GNU General |
28 | ** Public license version 3 or any later version approved by the KDE Free |
29 | ** Qt Foundation. The licenses are as published by the Free Software |
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
31 | ** included in the packaging of this file. Please review the following |
32 | ** information to ensure the GNU General Public License requirements will |
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
35 | ** |
36 | ** $QT_END_LICENSE$ |
37 | ** |
38 | ****************************************************************************/ |
39 | |
40 | #ifndef QTEXTFORMAT_H |
41 | #define QTEXTFORMAT_H |
42 | |
43 | #include <QtGui/qbrush.h> |
44 | #include <QtGui/qcolor.h> |
45 | #include <QtGui/qfont.h> |
46 | #include <QtGui/qpen.h> |
47 | #include <QtGui/qtextoption.h> |
48 | #include <QtGui/qtguiglobal.h> |
49 | |
50 | #include <QtCore/qlist.h> |
51 | #include <QtCore/qshareddata.h> |
52 | #include <QtCore/qvariant.h> |
53 | |
54 | QT_BEGIN_NAMESPACE |
55 | |
56 | |
57 | class QString; |
58 | class QVariant; |
59 | class QFont; |
60 | |
61 | class QTextFormatCollection; |
62 | class QTextFormatPrivate; |
63 | class QTextBlockFormat; |
64 | class QTextCharFormat; |
65 | class QTextListFormat; |
66 | class QTextTableFormat; |
67 | class QTextFrameFormat; |
68 | class QTextImageFormat; |
69 | class QTextTableCellFormat; |
70 | class QTextFormat; |
71 | class QTextObject; |
72 | class QTextCursor; |
73 | class QTextDocument; |
74 | class QTextLength; |
75 | |
76 | #ifndef QT_NO_DATASTREAM |
77 | Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextLength &); |
78 | Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextLength &); |
79 | #endif |
80 | |
81 | #ifndef QT_NO_DEBUG_STREAM |
82 | Q_GUI_EXPORT QDebug operator<<(QDebug, const QTextLength &); |
83 | #endif |
84 | |
85 | class Q_GUI_EXPORT QTextLength |
86 | { |
87 | public: |
88 | enum Type { VariableLength = 0, FixedLength, PercentageLength }; |
89 | |
90 | inline QTextLength() : lengthType(VariableLength), fixedValueOrPercentage(0) {} |
91 | |
92 | inline explicit QTextLength(Type type, qreal value); |
93 | |
94 | inline Type type() const { return lengthType; } |
95 | inline qreal value(qreal maximumLength) const |
96 | { |
97 | switch (lengthType) { |
98 | case FixedLength: return fixedValueOrPercentage; |
99 | case VariableLength: return maximumLength; |
100 | case PercentageLength: return fixedValueOrPercentage * maximumLength / qreal(100); |
101 | } |
102 | return -1; |
103 | } |
104 | |
105 | inline qreal rawValue() const { return fixedValueOrPercentage; } |
106 | |
107 | inline bool operator==(const QTextLength &other) const |
108 | { return lengthType == other.lengthType |
109 | && qFuzzyCompare(fixedValueOrPercentage, other.fixedValueOrPercentage); } |
110 | inline bool operator!=(const QTextLength &other) const |
111 | { return lengthType != other.lengthType |
112 | || !qFuzzyCompare(fixedValueOrPercentage, other.fixedValueOrPercentage); } |
113 | operator QVariant() const; |
114 | |
115 | private: |
116 | Type lengthType; |
117 | qreal fixedValueOrPercentage; |
118 | friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextLength &); |
119 | friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextLength &); |
120 | }; |
121 | Q_DECLARE_TYPEINFO(QTextLength, Q_PRIMITIVE_TYPE); |
122 | |
123 | inline QTextLength::QTextLength(Type atype, qreal avalue) |
124 | : lengthType(atype), fixedValueOrPercentage(avalue) {} |
125 | |
126 | #ifndef QT_NO_DATASTREAM |
127 | Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextFormat &); |
128 | Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextFormat &); |
129 | #endif |
130 | |
131 | #ifndef QT_NO_DEBUG_STREAM |
132 | Q_GUI_EXPORT QDebug operator<<(QDebug, const QTextFormat &); |
133 | #endif |
134 | |
135 | class Q_GUI_EXPORT QTextFormat |
136 | { |
137 | Q_GADGET |
138 | public: |
139 | enum FormatType { |
140 | InvalidFormat = -1, |
141 | BlockFormat = 1, |
142 | CharFormat = 2, |
143 | ListFormat = 3, |
144 | FrameFormat = 5, |
145 | |
146 | UserFormat = 100 |
147 | }; |
148 | Q_ENUM(FormatType) |
149 | |
150 | enum Property { |
151 | ObjectIndex = 0x0, |
152 | |
153 | // paragraph and char |
154 | CssFloat = 0x0800, |
155 | LayoutDirection = 0x0801, |
156 | |
157 | OutlinePen = 0x810, |
158 | BackgroundBrush = 0x820, |
159 | ForegroundBrush = 0x821, |
160 | // Internal to qtextlayout.cpp: ObjectSelectionBrush = 0x822 |
161 | BackgroundImageUrl = 0x823, |
162 | |
163 | // paragraph |
164 | BlockAlignment = 0x1010, |
165 | BlockTopMargin = 0x1030, |
166 | BlockBottomMargin = 0x1031, |
167 | BlockLeftMargin = 0x1032, |
168 | BlockRightMargin = 0x1033, |
169 | TextIndent = 0x1034, |
170 | TabPositions = 0x1035, |
171 | BlockIndent = 0x1040, |
172 | LineHeight = 0x1048, |
173 | LineHeightType = 0x1049, |
174 | BlockNonBreakableLines = 0x1050, |
175 | BlockTrailingHorizontalRulerWidth = 0x1060, |
176 | HeadingLevel = 0x1070, |
177 | BlockQuoteLevel = 0x1080, |
178 | BlockCodeLanguage = 0x1090, |
179 | BlockCodeFence = 0x1091, |
180 | BlockMarker = 0x10A0, |
181 | |
182 | // character properties |
183 | FirstFontProperty = 0x1FE0, |
184 | FontCapitalization = FirstFontProperty, |
185 | FontLetterSpacing = 0x1FE1, |
186 | FontWordSpacing = 0x1FE2, |
187 | FontStyleHint = 0x1FE3, |
188 | FontStyleStrategy = 0x1FE4, |
189 | FontKerning = 0x1FE5, |
190 | FontHintingPreference = 0x1FE6, |
191 | FontFamilies = 0x1FE7, |
192 | FontStyleName = 0x1FE8, |
193 | FontLetterSpacingType = 0x1FE9, |
194 | FontStretch = 0x1FEA, |
195 | FontFamily = 0x2000, |
196 | FontPointSize = 0x2001, |
197 | FontSizeAdjustment = 0x2002, |
198 | FontSizeIncrement = FontSizeAdjustment, // old name, compat |
199 | FontWeight = 0x2003, |
200 | FontItalic = 0x2004, |
201 | FontUnderline = 0x2005, // deprecated, use TextUnderlineStyle instead |
202 | FontOverline = 0x2006, |
203 | FontStrikeOut = 0x2007, |
204 | FontFixedPitch = 0x2008, |
205 | FontPixelSize = 0x2009, |
206 | LastFontProperty = FontPixelSize, |
207 | |
208 | TextUnderlineColor = 0x2020, |
209 | TextVerticalAlignment = 0x2021, |
210 | TextOutline = 0x2022, |
211 | TextUnderlineStyle = 0x2023, |
212 | TextToolTip = 0x2024, |
213 | TextSuperScriptBaseline = 0x2025, |
214 | TextSubScriptBaseline = 0x2026, |
215 | TextBaselineOffset = 0x2027, |
216 | |
217 | IsAnchor = 0x2030, |
218 | AnchorHref = 0x2031, |
219 | AnchorName = 0x2032, |
220 | |
221 | // Included for backwards compatibility with old QDataStreams. |
222 | // Should not be referenced in user code. |
223 | OldFontLetterSpacingType = 0x2033, |
224 | OldFontStretch = 0x2034, |
225 | |
226 | ObjectType = 0x2f00, |
227 | |
228 | // list properties |
229 | ListStyle = 0x3000, |
230 | ListIndent = 0x3001, |
231 | ListNumberPrefix = 0x3002, |
232 | ListNumberSuffix = 0x3003, |
233 | |
234 | // table and frame properties |
235 | FrameBorder = 0x4000, |
236 | FrameMargin = 0x4001, |
237 | FramePadding = 0x4002, |
238 | FrameWidth = 0x4003, |
239 | FrameHeight = 0x4004, |
240 | FrameTopMargin = 0x4005, |
241 | FrameBottomMargin = 0x4006, |
242 | FrameLeftMargin = 0x4007, |
243 | FrameRightMargin = 0x4008, |
244 | FrameBorderBrush = 0x4009, |
245 | FrameBorderStyle = 0x4010, |
246 | |
247 | TableColumns = 0x4100, |
248 | TableColumnWidthConstraints = 0x4101, |
249 | TableCellSpacing = 0x4102, |
250 | TableCellPadding = 0x4103, |
251 | = 0x4104, |
252 | TableBorderCollapse = 0x4105, |
253 | |
254 | // table cell properties |
255 | TableCellRowSpan = 0x4810, |
256 | TableCellColumnSpan = 0x4811, |
257 | |
258 | TableCellTopPadding = 0x4812, |
259 | TableCellBottomPadding = 0x4813, |
260 | TableCellLeftPadding = 0x4814, |
261 | TableCellRightPadding = 0x4815, |
262 | |
263 | TableCellTopBorder = 0x4816, |
264 | TableCellBottomBorder = 0x4817, |
265 | TableCellLeftBorder = 0x4818, |
266 | TableCellRightBorder = 0x4819, |
267 | |
268 | TableCellTopBorderStyle = 0x481a, |
269 | TableCellBottomBorderStyle = 0x481b, |
270 | TableCellLeftBorderStyle = 0x481c, |
271 | TableCellRightBorderStyle = 0x481d, |
272 | |
273 | TableCellTopBorderBrush = 0x481e, |
274 | TableCellBottomBorderBrush = 0x481f, |
275 | TableCellLeftBorderBrush = 0x4820, |
276 | TableCellRightBorderBrush = 0x4821, |
277 | |
278 | // image properties |
279 | ImageName = 0x5000, |
280 | ImageTitle = 0x5001, |
281 | ImageAltText = 0x5002, |
282 | ImageWidth = 0x5010, |
283 | ImageHeight = 0x5011, |
284 | ImageQuality = 0x5014, |
285 | |
286 | // internal |
287 | /* |
288 | SuppressText = 0x5012, |
289 | SuppressBackground = 0x513 |
290 | */ |
291 | |
292 | // selection properties |
293 | FullWidthSelection = 0x06000, |
294 | |
295 | // page break properties |
296 | PageBreakPolicy = 0x7000, |
297 | |
298 | // -- |
299 | UserProperty = 0x100000 |
300 | }; |
301 | Q_ENUM(Property) |
302 | |
303 | enum ObjectTypes { |
304 | NoObject, |
305 | ImageObject, |
306 | TableObject, |
307 | TableCellObject, |
308 | |
309 | UserObject = 0x1000 |
310 | }; |
311 | Q_ENUM(ObjectTypes) |
312 | |
313 | enum PageBreakFlag { |
314 | PageBreak_Auto = 0, |
315 | PageBreak_AlwaysBefore = 0x001, |
316 | PageBreak_AlwaysAfter = 0x010 |
317 | // PageBreak_AlwaysInside = 0x100 |
318 | }; |
319 | Q_DECLARE_FLAGS(PageBreakFlags, PageBreakFlag) |
320 | |
321 | QTextFormat(); |
322 | |
323 | explicit QTextFormat(int type); |
324 | |
325 | QTextFormat(const QTextFormat &rhs); |
326 | QTextFormat &operator=(const QTextFormat &rhs); |
327 | ~QTextFormat(); |
328 | |
329 | void swap(QTextFormat &other) |
330 | { qSwap(d, other.d); qSwap(format_type, other.format_type); } |
331 | |
332 | void merge(const QTextFormat &other); |
333 | |
334 | inline bool isValid() const { return type() != InvalidFormat; } |
335 | inline bool isEmpty() const { return propertyCount() == 0; } |
336 | |
337 | int type() const; |
338 | |
339 | int objectIndex() const; |
340 | void setObjectIndex(int object); |
341 | |
342 | QVariant property(int propertyId) const; |
343 | void setProperty(int propertyId, const QVariant &value); |
344 | void clearProperty(int propertyId); |
345 | bool hasProperty(int propertyId) const; |
346 | |
347 | bool boolProperty(int propertyId) const; |
348 | int intProperty(int propertyId) const; |
349 | qreal doubleProperty(int propertyId) const; |
350 | QString stringProperty(int propertyId) const; |
351 | QColor colorProperty(int propertyId) const; |
352 | QPen penProperty(int propertyId) const; |
353 | QBrush brushProperty(int propertyId) const; |
354 | QTextLength lengthProperty(int propertyId) const; |
355 | QList<QTextLength> lengthVectorProperty(int propertyId) const; |
356 | |
357 | void setProperty(int propertyId, const QList<QTextLength> &lengths); |
358 | |
359 | QMap<int, QVariant> properties() const; |
360 | int propertyCount() const; |
361 | |
362 | inline void setObjectType(int type); |
363 | inline int objectType() const |
364 | { return intProperty(ObjectType); } |
365 | |
366 | inline bool isCharFormat() const { return type() == CharFormat; } |
367 | inline bool isBlockFormat() const { return type() == BlockFormat; } |
368 | inline bool isListFormat() const { return type() == ListFormat; } |
369 | inline bool isFrameFormat() const { return type() == FrameFormat; } |
370 | inline bool isImageFormat() const { return type() == CharFormat && objectType() == ImageObject; } |
371 | inline bool isTableFormat() const { return type() == FrameFormat && objectType() == TableObject; } |
372 | inline bool isTableCellFormat() const { return type() == CharFormat && objectType() == TableCellObject; } |
373 | |
374 | QTextBlockFormat toBlockFormat() const; |
375 | QTextCharFormat toCharFormat() const; |
376 | QTextListFormat toListFormat() const; |
377 | QTextTableFormat toTableFormat() const; |
378 | QTextFrameFormat toFrameFormat() const; |
379 | QTextImageFormat toImageFormat() const; |
380 | QTextTableCellFormat toTableCellFormat() const; |
381 | |
382 | bool operator==(const QTextFormat &rhs) const; |
383 | inline bool operator!=(const QTextFormat &rhs) const { return !operator==(rhs); } |
384 | operator QVariant() const; |
385 | |
386 | inline void setLayoutDirection(Qt::LayoutDirection direction) |
387 | { setProperty(QTextFormat::LayoutDirection, direction); } |
388 | inline Qt::LayoutDirection layoutDirection() const |
389 | { return Qt::LayoutDirection(intProperty(QTextFormat::LayoutDirection)); } |
390 | |
391 | inline void setBackground(const QBrush &brush) |
392 | { setProperty(BackgroundBrush, brush); } |
393 | inline QBrush background() const |
394 | { return brushProperty(BackgroundBrush); } |
395 | inline void clearBackground() |
396 | { clearProperty(BackgroundBrush); } |
397 | |
398 | inline void setForeground(const QBrush &brush) |
399 | { setProperty(ForegroundBrush, brush); } |
400 | inline QBrush foreground() const |
401 | { return brushProperty(ForegroundBrush); } |
402 | inline void clearForeground() |
403 | { clearProperty(ForegroundBrush); } |
404 | |
405 | private: |
406 | QSharedDataPointer<QTextFormatPrivate> d; |
407 | qint32 format_type; |
408 | |
409 | friend class QTextFormatCollection; |
410 | friend class QTextCharFormat; |
411 | friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextFormat &); |
412 | friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextFormat &); |
413 | }; |
414 | |
415 | Q_DECLARE_SHARED(QTextFormat) |
416 | |
417 | inline void QTextFormat::setObjectType(int atype) |
418 | { setProperty(ObjectType, atype); } |
419 | |
420 | Q_DECLARE_OPERATORS_FOR_FLAGS(QTextFormat::PageBreakFlags) |
421 | |
422 | class Q_GUI_EXPORT QTextCharFormat : public QTextFormat |
423 | { |
424 | public: |
425 | enum VerticalAlignment { |
426 | AlignNormal = 0, |
427 | AlignSuperScript, |
428 | AlignSubScript, |
429 | AlignMiddle, |
430 | AlignTop, |
431 | AlignBottom, |
432 | AlignBaseline |
433 | }; |
434 | enum UnderlineStyle { // keep in sync with Qt::PenStyle! |
435 | NoUnderline, |
436 | SingleUnderline, |
437 | DashUnderline, |
438 | DotLine, |
439 | DashDotLine, |
440 | DashDotDotLine, |
441 | WaveUnderline, |
442 | SpellCheckUnderline |
443 | }; |
444 | |
445 | QTextCharFormat(); |
446 | |
447 | bool isValid() const { return isCharFormat(); } |
448 | |
449 | enum FontPropertiesInheritanceBehavior { |
450 | FontPropertiesSpecifiedOnly, |
451 | FontPropertiesAll |
452 | }; |
453 | void setFont(const QFont &font, FontPropertiesInheritanceBehavior behavior = FontPropertiesAll); |
454 | QFont font() const; |
455 | |
456 | inline void setFontFamily(const QString &family) |
457 | { setProperty(FontFamily, family); } |
458 | inline QString fontFamily() const |
459 | { return stringProperty(FontFamily); } |
460 | |
461 | inline void setFontFamilies(const QStringList &families) |
462 | { setProperty(FontFamilies, QVariant(families)); } |
463 | inline QVariant fontFamilies() const |
464 | { return property(FontFamilies); } |
465 | |
466 | inline void setFontStyleName(const QString &styleName) |
467 | { setProperty(FontStyleName, styleName); } |
468 | inline QVariant fontStyleName() const |
469 | { return property(FontStyleName); } |
470 | |
471 | inline void setFontPointSize(qreal size) |
472 | { setProperty(FontPointSize, size); } |
473 | inline qreal fontPointSize() const |
474 | { return doubleProperty(FontPointSize); } |
475 | |
476 | inline void setFontWeight(int weight) |
477 | { setProperty(FontWeight, weight); } |
478 | inline int fontWeight() const |
479 | { return hasProperty(FontWeight) ? intProperty(FontWeight) : QFont::Normal; } |
480 | inline void setFontItalic(bool italic) |
481 | { setProperty(FontItalic, italic); } |
482 | inline bool fontItalic() const |
483 | { return boolProperty(FontItalic); } |
484 | inline void setFontCapitalization(QFont::Capitalization capitalization) |
485 | { setProperty(FontCapitalization, capitalization); } |
486 | inline QFont::Capitalization fontCapitalization() const |
487 | { return static_cast<QFont::Capitalization>(intProperty(FontCapitalization)); } |
488 | inline void setFontLetterSpacingType(QFont::SpacingType letterSpacingType) |
489 | { setProperty(FontLetterSpacingType, letterSpacingType); } |
490 | inline QFont::SpacingType fontLetterSpacingType() const |
491 | { return static_cast<QFont::SpacingType>(intProperty(FontLetterSpacingType)); } |
492 | inline void setFontLetterSpacing(qreal spacing) |
493 | { setProperty(FontLetterSpacing, spacing); } |
494 | inline qreal fontLetterSpacing() const |
495 | { return doubleProperty(FontLetterSpacing); } |
496 | inline void setFontWordSpacing(qreal spacing) |
497 | { setProperty(FontWordSpacing, spacing); } |
498 | inline qreal fontWordSpacing() const |
499 | { return doubleProperty(FontWordSpacing); } |
500 | |
501 | inline void setFontUnderline(bool underline) |
502 | { setProperty(TextUnderlineStyle, underline ? SingleUnderline : NoUnderline); } |
503 | bool fontUnderline() const; |
504 | |
505 | inline void setFontOverline(bool overline) |
506 | { setProperty(FontOverline, overline); } |
507 | inline bool fontOverline() const |
508 | { return boolProperty(FontOverline); } |
509 | |
510 | inline void setFontStrikeOut(bool strikeOut) |
511 | { setProperty(FontStrikeOut, strikeOut); } |
512 | inline bool fontStrikeOut() const |
513 | { return boolProperty(FontStrikeOut); } |
514 | |
515 | inline void setUnderlineColor(const QColor &color) |
516 | { setProperty(TextUnderlineColor, color); } |
517 | inline QColor underlineColor() const |
518 | { return colorProperty(TextUnderlineColor); } |
519 | |
520 | inline void setFontFixedPitch(bool fixedPitch) |
521 | { setProperty(FontFixedPitch, fixedPitch); } |
522 | inline bool fontFixedPitch() const |
523 | { return boolProperty(FontFixedPitch); } |
524 | |
525 | inline void setFontStretch(int factor) |
526 | { setProperty(FontStretch, factor); } |
527 | inline int fontStretch() const |
528 | { return intProperty(FontStretch); } |
529 | |
530 | inline void setFontStyleHint(QFont::StyleHint hint, QFont::StyleStrategy strategy = QFont::PreferDefault) |
531 | { setProperty(FontStyleHint, hint); setProperty(FontStyleStrategy, strategy); } |
532 | inline void setFontStyleStrategy(QFont::StyleStrategy strategy) |
533 | { setProperty(FontStyleStrategy, strategy); } |
534 | QFont::StyleHint fontStyleHint() const |
535 | { return static_cast<QFont::StyleHint>(intProperty(FontStyleHint)); } |
536 | QFont::StyleStrategy fontStyleStrategy() const |
537 | { return static_cast<QFont::StyleStrategy>(intProperty(FontStyleStrategy)); } |
538 | |
539 | inline void setFontHintingPreference(QFont::HintingPreference hintingPreference) |
540 | { |
541 | setProperty(FontHintingPreference, hintingPreference); |
542 | } |
543 | |
544 | inline QFont::HintingPreference fontHintingPreference() const |
545 | { |
546 | return static_cast<QFont::HintingPreference>(intProperty(FontHintingPreference)); |
547 | } |
548 | |
549 | inline void setFontKerning(bool enable) |
550 | { setProperty(FontKerning, enable); } |
551 | inline bool fontKerning() const |
552 | { return boolProperty(FontKerning); } |
553 | |
554 | void setUnderlineStyle(UnderlineStyle style); |
555 | inline UnderlineStyle underlineStyle() const |
556 | { return static_cast<UnderlineStyle>(intProperty(TextUnderlineStyle)); } |
557 | |
558 | inline void setVerticalAlignment(VerticalAlignment alignment) |
559 | { setProperty(TextVerticalAlignment, alignment); } |
560 | inline VerticalAlignment verticalAlignment() const |
561 | { return static_cast<VerticalAlignment>(intProperty(TextVerticalAlignment)); } |
562 | |
563 | inline void setTextOutline(const QPen &pen) |
564 | { setProperty(TextOutline, pen); } |
565 | inline QPen textOutline() const |
566 | { return penProperty(TextOutline); } |
567 | |
568 | inline void setToolTip(const QString &tip) |
569 | { setProperty(TextToolTip, tip); } |
570 | inline QString toolTip() const |
571 | { return stringProperty(TextToolTip); } |
572 | |
573 | inline void setSuperScriptBaseline(qreal baseline) |
574 | { setProperty(TextSuperScriptBaseline, baseline); } |
575 | inline qreal superScriptBaseline() const |
576 | { return hasProperty(TextSuperScriptBaseline) ? doubleProperty(TextSuperScriptBaseline) : 50.0; } |
577 | |
578 | inline void setSubScriptBaseline(qreal baseline) |
579 | { setProperty(TextSubScriptBaseline, baseline); } |
580 | inline qreal subScriptBaseline() const |
581 | { return hasProperty(TextSubScriptBaseline) ? doubleProperty(TextSubScriptBaseline) : 100.0 / 6.0; } |
582 | |
583 | inline void setBaselineOffset(qreal baseline) |
584 | { setProperty(TextBaselineOffset, baseline); } |
585 | inline qreal baselineOffset() const |
586 | { return hasProperty(TextBaselineOffset) ? doubleProperty(TextBaselineOffset) : 0.0; } |
587 | |
588 | inline void setAnchor(bool anchor) |
589 | { setProperty(IsAnchor, anchor); } |
590 | inline bool isAnchor() const |
591 | { return boolProperty(IsAnchor); } |
592 | |
593 | inline void setAnchorHref(const QString &value) |
594 | { setProperty(AnchorHref, value); } |
595 | inline QString anchorHref() const |
596 | { return stringProperty(AnchorHref); } |
597 | |
598 | inline void setAnchorNames(const QStringList &names) |
599 | { setProperty(AnchorName, names); } |
600 | QStringList anchorNames() const; |
601 | |
602 | inline void setTableCellRowSpan(int tableCellRowSpan); |
603 | inline int tableCellRowSpan() const |
604 | { int s = intProperty(TableCellRowSpan); if (s == 0) s = 1; return s; } |
605 | inline void setTableCellColumnSpan(int tableCellColumnSpan); |
606 | inline int tableCellColumnSpan() const |
607 | { int s = intProperty(TableCellColumnSpan); if (s == 0) s = 1; return s; } |
608 | |
609 | protected: |
610 | explicit QTextCharFormat(const QTextFormat &fmt); |
611 | friend class QTextFormat; |
612 | }; |
613 | |
614 | Q_DECLARE_SHARED(QTextCharFormat) |
615 | |
616 | inline void QTextCharFormat::setTableCellRowSpan(int _tableCellRowSpan) |
617 | { |
618 | if (_tableCellRowSpan <= 1) |
619 | clearProperty(TableCellRowSpan); // the getter will return 1 here. |
620 | else |
621 | setProperty(TableCellRowSpan, _tableCellRowSpan); |
622 | } |
623 | |
624 | inline void QTextCharFormat::setTableCellColumnSpan(int _tableCellColumnSpan) |
625 | { |
626 | if (_tableCellColumnSpan <= 1) |
627 | clearProperty(TableCellColumnSpan); // the getter will return 1 here. |
628 | else |
629 | setProperty(TableCellColumnSpan, _tableCellColumnSpan); |
630 | } |
631 | |
632 | class Q_GUI_EXPORT QTextBlockFormat : public QTextFormat |
633 | { |
634 | public: |
635 | enum LineHeightTypes { |
636 | SingleHeight = 0, |
637 | ProportionalHeight = 1, |
638 | FixedHeight = 2, |
639 | MinimumHeight = 3, |
640 | LineDistanceHeight = 4 |
641 | }; |
642 | |
643 | enum class MarkerType { |
644 | NoMarker = 0, |
645 | Unchecked = 1, |
646 | Checked = 2 |
647 | }; |
648 | |
649 | QTextBlockFormat(); |
650 | |
651 | bool isValid() const { return isBlockFormat(); } |
652 | |
653 | inline void setAlignment(Qt::Alignment alignment); |
654 | inline Qt::Alignment alignment() const |
655 | { int a = intProperty(BlockAlignment); if (a == 0) a = Qt::AlignLeft; return QFlag(a); } |
656 | |
657 | inline void setTopMargin(qreal margin) |
658 | { setProperty(BlockTopMargin, margin); } |
659 | inline qreal topMargin() const |
660 | { return doubleProperty(BlockTopMargin); } |
661 | |
662 | inline void setBottomMargin(qreal margin) |
663 | { setProperty(BlockBottomMargin, margin); } |
664 | inline qreal bottomMargin() const |
665 | { return doubleProperty(BlockBottomMargin); } |
666 | |
667 | inline void setLeftMargin(qreal margin) |
668 | { setProperty(BlockLeftMargin, margin); } |
669 | inline qreal leftMargin() const |
670 | { return doubleProperty(BlockLeftMargin); } |
671 | |
672 | inline void setRightMargin(qreal margin) |
673 | { setProperty(BlockRightMargin, margin); } |
674 | inline qreal rightMargin() const |
675 | { return doubleProperty(BlockRightMargin); } |
676 | |
677 | inline void setTextIndent(qreal aindent) |
678 | { setProperty(TextIndent, aindent); } |
679 | inline qreal textIndent() const |
680 | { return doubleProperty(TextIndent); } |
681 | |
682 | inline void setIndent(int indent); |
683 | inline int indent() const |
684 | { return intProperty(BlockIndent); } |
685 | |
686 | inline void setHeadingLevel(int alevel) |
687 | { setProperty(HeadingLevel, alevel); } |
688 | inline int headingLevel() const |
689 | { return intProperty(HeadingLevel); } |
690 | |
691 | inline void setLineHeight(qreal height, int heightType) |
692 | { setProperty(LineHeight, height); setProperty(LineHeightType, heightType); } |
693 | inline qreal lineHeight(qreal scriptLineHeight, qreal scaling) const; |
694 | inline qreal lineHeight() const |
695 | { return doubleProperty(LineHeight); } |
696 | inline int lineHeightType() const |
697 | { return intProperty(LineHeightType); } |
698 | |
699 | inline void setNonBreakableLines(bool b) |
700 | { setProperty(BlockNonBreakableLines, b); } |
701 | inline bool nonBreakableLines() const |
702 | { return boolProperty(BlockNonBreakableLines); } |
703 | |
704 | inline void setPageBreakPolicy(PageBreakFlags flags) |
705 | { setProperty(PageBreakPolicy, int(flags)); } |
706 | inline PageBreakFlags pageBreakPolicy() const |
707 | { return PageBreakFlags(intProperty(PageBreakPolicy)); } |
708 | |
709 | void setTabPositions(const QList<QTextOption::Tab> &tabs); |
710 | QList<QTextOption::Tab> tabPositions() const; |
711 | |
712 | inline void setMarker(MarkerType marker) |
713 | { setProperty(BlockMarker, int(marker)); } |
714 | inline MarkerType marker() const |
715 | { return MarkerType(intProperty(BlockMarker)); } |
716 | |
717 | protected: |
718 | explicit QTextBlockFormat(const QTextFormat &fmt); |
719 | friend class QTextFormat; |
720 | }; |
721 | |
722 | Q_DECLARE_SHARED(QTextBlockFormat) |
723 | |
724 | inline void QTextBlockFormat::setAlignment(Qt::Alignment aalignment) |
725 | { setProperty(BlockAlignment, int(aalignment)); } |
726 | |
727 | inline void QTextBlockFormat::setIndent(int aindent) |
728 | { setProperty(BlockIndent, aindent); } |
729 | |
730 | inline qreal QTextBlockFormat::lineHeight(qreal scriptLineHeight, qreal scaling = 1.0) const |
731 | { |
732 | switch(intProperty(LineHeightType)) { |
733 | case SingleHeight: |
734 | return(scriptLineHeight); |
735 | case ProportionalHeight: |
736 | return(scriptLineHeight * doubleProperty(LineHeight) / 100.0); |
737 | case FixedHeight: |
738 | return(doubleProperty(LineHeight) * scaling); |
739 | case MinimumHeight: |
740 | return(qMax(scriptLineHeight, doubleProperty(LineHeight) * scaling)); |
741 | case LineDistanceHeight: |
742 | return(scriptLineHeight + doubleProperty(LineHeight) * scaling); |
743 | } |
744 | return(0); |
745 | } |
746 | |
747 | class Q_GUI_EXPORT QTextListFormat : public QTextFormat |
748 | { |
749 | public: |
750 | QTextListFormat(); |
751 | |
752 | bool isValid() const { return isListFormat(); } |
753 | |
754 | enum Style { |
755 | ListDisc = -1, |
756 | ListCircle = -2, |
757 | ListSquare = -3, |
758 | ListDecimal = -4, |
759 | ListLowerAlpha = -5, |
760 | ListUpperAlpha = -6, |
761 | ListLowerRoman = -7, |
762 | ListUpperRoman = -8, |
763 | ListStyleUndefined = 0 |
764 | }; |
765 | |
766 | inline void setStyle(Style style); |
767 | inline Style style() const |
768 | { return static_cast<Style>(intProperty(ListStyle)); } |
769 | |
770 | inline void setIndent(int indent); |
771 | inline int indent() const |
772 | { return intProperty(ListIndent); } |
773 | |
774 | inline void setNumberPrefix(const QString &numberPrefix); |
775 | inline QString numberPrefix() const |
776 | { return stringProperty(ListNumberPrefix); } |
777 | |
778 | inline void setNumberSuffix(const QString &numberSuffix); |
779 | inline QString numberSuffix() const |
780 | { return stringProperty(ListNumberSuffix); } |
781 | |
782 | protected: |
783 | explicit QTextListFormat(const QTextFormat &fmt); |
784 | friend class QTextFormat; |
785 | }; |
786 | |
787 | Q_DECLARE_SHARED(QTextListFormat) |
788 | |
789 | inline void QTextListFormat::setStyle(Style astyle) |
790 | { setProperty(ListStyle, astyle); } |
791 | |
792 | inline void QTextListFormat::setIndent(int aindent) |
793 | { setProperty(ListIndent, aindent); } |
794 | |
795 | inline void QTextListFormat::setNumberPrefix(const QString &np) |
796 | { setProperty(ListNumberPrefix, np); } |
797 | |
798 | inline void QTextListFormat::setNumberSuffix(const QString &ns) |
799 | { setProperty(ListNumberSuffix, ns); } |
800 | |
801 | class Q_GUI_EXPORT QTextImageFormat : public QTextCharFormat |
802 | { |
803 | public: |
804 | QTextImageFormat(); |
805 | |
806 | bool isValid() const { return isImageFormat(); } |
807 | |
808 | inline void setName(const QString &name); |
809 | inline QString name() const |
810 | { return stringProperty(ImageName); } |
811 | |
812 | inline void setWidth(qreal width); |
813 | inline qreal width() const |
814 | { return doubleProperty(ImageWidth); } |
815 | |
816 | inline void setHeight(qreal height); |
817 | inline qreal height() const |
818 | { return doubleProperty(ImageHeight); } |
819 | |
820 | inline void setQuality(int quality = 100); |
821 | inline int quality() const |
822 | { return intProperty(ImageQuality); } |
823 | |
824 | protected: |
825 | explicit QTextImageFormat(const QTextFormat &format); |
826 | friend class QTextFormat; |
827 | }; |
828 | |
829 | Q_DECLARE_SHARED(QTextImageFormat) |
830 | |
831 | inline void QTextImageFormat::setName(const QString &aname) |
832 | { setProperty(ImageName, aname); } |
833 | |
834 | inline void QTextImageFormat::setWidth(qreal awidth) |
835 | { setProperty(ImageWidth, awidth); } |
836 | |
837 | inline void QTextImageFormat::setHeight(qreal aheight) |
838 | { setProperty(ImageHeight, aheight); } |
839 | |
840 | inline void QTextImageFormat::setQuality(int aquality) |
841 | { setProperty(ImageQuality, aquality); } |
842 | |
843 | class Q_GUI_EXPORT QTextFrameFormat : public QTextFormat |
844 | { |
845 | public: |
846 | QTextFrameFormat(); |
847 | |
848 | bool isValid() const { return isFrameFormat(); } |
849 | |
850 | enum Position { |
851 | InFlow, |
852 | FloatLeft, |
853 | FloatRight |
854 | // ###### |
855 | // Absolute |
856 | }; |
857 | |
858 | enum BorderStyle { |
859 | BorderStyle_None, |
860 | BorderStyle_Dotted, |
861 | BorderStyle_Dashed, |
862 | BorderStyle_Solid, |
863 | BorderStyle_Double, |
864 | BorderStyle_DotDash, |
865 | BorderStyle_DotDotDash, |
866 | BorderStyle_Groove, |
867 | BorderStyle_Ridge, |
868 | BorderStyle_Inset, |
869 | BorderStyle_Outset |
870 | }; |
871 | |
872 | inline void setPosition(Position f) |
873 | { setProperty(CssFloat, f); } |
874 | inline Position position() const |
875 | { return static_cast<Position>(intProperty(CssFloat)); } |
876 | |
877 | inline void setBorder(qreal border); |
878 | inline qreal border() const |
879 | { return doubleProperty(FrameBorder); } |
880 | |
881 | inline void setBorderBrush(const QBrush &brush) |
882 | { setProperty(FrameBorderBrush, brush); } |
883 | inline QBrush borderBrush() const |
884 | { return brushProperty(FrameBorderBrush); } |
885 | |
886 | inline void setBorderStyle(BorderStyle style) |
887 | { setProperty(FrameBorderStyle, style); } |
888 | inline BorderStyle borderStyle() const |
889 | { return static_cast<BorderStyle>(intProperty(FrameBorderStyle)); } |
890 | |
891 | void setMargin(qreal margin); |
892 | inline qreal margin() const |
893 | { return doubleProperty(FrameMargin); } |
894 | |
895 | inline void setTopMargin(qreal margin); |
896 | qreal topMargin() const; |
897 | |
898 | inline void setBottomMargin(qreal margin); |
899 | qreal bottomMargin() const; |
900 | |
901 | inline void setLeftMargin(qreal margin); |
902 | qreal leftMargin() const; |
903 | |
904 | inline void setRightMargin(qreal margin); |
905 | qreal rightMargin() const; |
906 | |
907 | inline void setPadding(qreal padding); |
908 | inline qreal padding() const |
909 | { return doubleProperty(FramePadding); } |
910 | |
911 | inline void setWidth(qreal width); |
912 | inline void setWidth(const QTextLength &length) |
913 | { setProperty(FrameWidth, length); } |
914 | inline QTextLength width() const |
915 | { return lengthProperty(FrameWidth); } |
916 | |
917 | inline void setHeight(qreal height); |
918 | inline void setHeight(const QTextLength &height); |
919 | inline QTextLength height() const |
920 | { return lengthProperty(FrameHeight); } |
921 | |
922 | inline void setPageBreakPolicy(PageBreakFlags flags) |
923 | { setProperty(PageBreakPolicy, int(flags)); } |
924 | inline PageBreakFlags pageBreakPolicy() const |
925 | { return PageBreakFlags(intProperty(PageBreakPolicy)); } |
926 | |
927 | protected: |
928 | explicit QTextFrameFormat(const QTextFormat &fmt); |
929 | friend class QTextFormat; |
930 | }; |
931 | |
932 | Q_DECLARE_SHARED(QTextFrameFormat) |
933 | |
934 | inline void QTextFrameFormat::setBorder(qreal aborder) |
935 | { setProperty(FrameBorder, aborder); } |
936 | |
937 | inline void QTextFrameFormat::setPadding(qreal apadding) |
938 | { setProperty(FramePadding, apadding); } |
939 | |
940 | inline void QTextFrameFormat::setWidth(qreal awidth) |
941 | { setProperty(FrameWidth, QTextLength(QTextLength::FixedLength, awidth)); } |
942 | |
943 | inline void QTextFrameFormat::setHeight(qreal aheight) |
944 | { setProperty(FrameHeight, QTextLength(QTextLength::FixedLength, aheight)); } |
945 | inline void QTextFrameFormat::setHeight(const QTextLength &aheight) |
946 | { setProperty(FrameHeight, aheight); } |
947 | |
948 | inline void QTextFrameFormat::setTopMargin(qreal amargin) |
949 | { setProperty(FrameTopMargin, amargin); } |
950 | |
951 | inline void QTextFrameFormat::setBottomMargin(qreal amargin) |
952 | { setProperty(FrameBottomMargin, amargin); } |
953 | |
954 | inline void QTextFrameFormat::setLeftMargin(qreal amargin) |
955 | { setProperty(FrameLeftMargin, amargin); } |
956 | |
957 | inline void QTextFrameFormat::setRightMargin(qreal amargin) |
958 | { setProperty(FrameRightMargin, amargin); } |
959 | |
960 | class Q_GUI_EXPORT QTextTableFormat : public QTextFrameFormat |
961 | { |
962 | public: |
963 | QTextTableFormat(); |
964 | |
965 | inline bool isValid() const { return isTableFormat(); } |
966 | |
967 | inline int columns() const |
968 | { int cols = intProperty(TableColumns); if (cols == 0) cols = 1; return cols; } |
969 | inline void setColumns(int columns); |
970 | |
971 | inline void setColumnWidthConstraints(const QList<QTextLength> &constraints) |
972 | { setProperty(TableColumnWidthConstraints, constraints); } |
973 | |
974 | inline QList<QTextLength> columnWidthConstraints() const |
975 | { return lengthVectorProperty(TableColumnWidthConstraints); } |
976 | |
977 | inline void clearColumnWidthConstraints() |
978 | { clearProperty(TableColumnWidthConstraints); } |
979 | |
980 | inline qreal cellSpacing() const |
981 | { return doubleProperty(TableCellSpacing); } |
982 | inline void setCellSpacing(qreal spacing) |
983 | { setProperty(TableCellSpacing, spacing); } |
984 | |
985 | inline qreal cellPadding() const |
986 | { return doubleProperty(TableCellPadding); } |
987 | inline void setCellPadding(qreal padding); |
988 | |
989 | inline void setAlignment(Qt::Alignment alignment); |
990 | inline Qt::Alignment alignment() const |
991 | { return QFlag(intProperty(BlockAlignment)); } |
992 | |
993 | inline void (int count) |
994 | { setProperty(TableHeaderRowCount, count); } |
995 | inline int () const |
996 | { return intProperty(TableHeaderRowCount); } |
997 | |
998 | inline void setBorderCollapse(bool borderCollapse) |
999 | { setProperty(TableBorderCollapse, borderCollapse); } |
1000 | inline bool borderCollapse() const |
1001 | { return boolProperty(TableBorderCollapse); } |
1002 | |
1003 | protected: |
1004 | explicit QTextTableFormat(const QTextFormat &fmt); |
1005 | friend class QTextFormat; |
1006 | }; |
1007 | |
1008 | Q_DECLARE_SHARED(QTextTableFormat) |
1009 | |
1010 | inline void QTextTableFormat::setColumns(int acolumns) |
1011 | { |
1012 | if (acolumns == 1) |
1013 | acolumns = 0; |
1014 | setProperty(TableColumns, acolumns); |
1015 | } |
1016 | |
1017 | inline void QTextTableFormat::setCellPadding(qreal apadding) |
1018 | { setProperty(TableCellPadding, apadding); } |
1019 | |
1020 | inline void QTextTableFormat::setAlignment(Qt::Alignment aalignment) |
1021 | { setProperty(BlockAlignment, int(aalignment)); } |
1022 | |
1023 | class Q_GUI_EXPORT QTextTableCellFormat : public QTextCharFormat |
1024 | { |
1025 | public: |
1026 | QTextTableCellFormat(); |
1027 | |
1028 | inline bool isValid() const { return isTableCellFormat(); } |
1029 | |
1030 | inline void setTopPadding(qreal padding); |
1031 | inline qreal topPadding() const; |
1032 | |
1033 | inline void setBottomPadding(qreal padding); |
1034 | inline qreal bottomPadding() const; |
1035 | |
1036 | inline void setLeftPadding(qreal padding); |
1037 | inline qreal leftPadding() const; |
1038 | |
1039 | inline void setRightPadding(qreal padding); |
1040 | inline qreal rightPadding() const; |
1041 | |
1042 | inline void setPadding(qreal padding); |
1043 | |
1044 | inline void setTopBorder(qreal width) |
1045 | { setProperty(TableCellTopBorder, width); } |
1046 | inline qreal topBorder() const |
1047 | { return doubleProperty(TableCellTopBorder); } |
1048 | |
1049 | inline void setBottomBorder(qreal width) |
1050 | { setProperty(TableCellBottomBorder, width); } |
1051 | inline qreal bottomBorder() const |
1052 | { return doubleProperty(TableCellBottomBorder); } |
1053 | |
1054 | inline void setLeftBorder(qreal width) |
1055 | { setProperty(TableCellLeftBorder, width); } |
1056 | inline qreal leftBorder() const |
1057 | { return doubleProperty(TableCellLeftBorder); } |
1058 | |
1059 | inline void setRightBorder(qreal width) |
1060 | { setProperty(TableCellRightBorder, width); } |
1061 | inline qreal rightBorder() const |
1062 | { return doubleProperty(TableCellRightBorder); } |
1063 | |
1064 | inline void setBorder(qreal width); |
1065 | |
1066 | inline void setTopBorderStyle(QTextFrameFormat::BorderStyle style) |
1067 | { setProperty(TableCellTopBorderStyle, style); } |
1068 | inline QTextFrameFormat::BorderStyle topBorderStyle() const |
1069 | { return static_cast<QTextFrameFormat::BorderStyle>(intProperty(TableCellTopBorderStyle)); } |
1070 | |
1071 | inline void setBottomBorderStyle(QTextFrameFormat::BorderStyle style) |
1072 | { setProperty(TableCellBottomBorderStyle, style); } |
1073 | inline QTextFrameFormat::BorderStyle bottomBorderStyle() const |
1074 | { return static_cast<QTextFrameFormat::BorderStyle>(intProperty(TableCellBottomBorderStyle)); } |
1075 | |
1076 | inline void setLeftBorderStyle(QTextFrameFormat::BorderStyle style) |
1077 | { setProperty(TableCellLeftBorderStyle, style); } |
1078 | inline QTextFrameFormat::BorderStyle leftBorderStyle() const |
1079 | { return static_cast<QTextFrameFormat::BorderStyle>(intProperty(TableCellLeftBorderStyle)); } |
1080 | |
1081 | inline void setRightBorderStyle(QTextFrameFormat::BorderStyle style) |
1082 | { setProperty(TableCellRightBorderStyle, style); } |
1083 | inline QTextFrameFormat::BorderStyle rightBorderStyle() const |
1084 | { return static_cast<QTextFrameFormat::BorderStyle>(intProperty(TableCellRightBorderStyle)); } |
1085 | |
1086 | inline void setBorderStyle(QTextFrameFormat::BorderStyle style); |
1087 | |
1088 | inline void setTopBorderBrush(const QBrush &brush) |
1089 | { setProperty(TableCellTopBorderBrush, brush); } |
1090 | inline QBrush topBorderBrush() const |
1091 | { return brushProperty(TableCellTopBorderBrush); } |
1092 | |
1093 | inline void setBottomBorderBrush(const QBrush &brush) |
1094 | { setProperty(TableCellBottomBorderBrush, brush); } |
1095 | inline QBrush bottomBorderBrush() const |
1096 | { return brushProperty(TableCellBottomBorderBrush); } |
1097 | |
1098 | inline void setLeftBorderBrush(const QBrush &brush) |
1099 | { setProperty(TableCellLeftBorderBrush, brush); } |
1100 | inline QBrush leftBorderBrush() const |
1101 | { return brushProperty(TableCellLeftBorderBrush); } |
1102 | |
1103 | inline void setRightBorderBrush(const QBrush &brush) |
1104 | { setProperty(TableCellRightBorderBrush, brush); } |
1105 | inline QBrush rightBorderBrush() const |
1106 | { return brushProperty(TableCellRightBorderBrush); } |
1107 | |
1108 | inline void setBorderBrush(const QBrush &brush); |
1109 | |
1110 | protected: |
1111 | explicit QTextTableCellFormat(const QTextFormat &fmt); |
1112 | friend class QTextFormat; |
1113 | }; |
1114 | |
1115 | Q_DECLARE_SHARED(QTextTableCellFormat) |
1116 | |
1117 | inline void QTextTableCellFormat::setTopPadding(qreal padding) |
1118 | { |
1119 | setProperty(TableCellTopPadding, padding); |
1120 | } |
1121 | |
1122 | inline qreal QTextTableCellFormat::topPadding() const |
1123 | { |
1124 | return doubleProperty(TableCellTopPadding); |
1125 | } |
1126 | |
1127 | inline void QTextTableCellFormat::setBottomPadding(qreal padding) |
1128 | { |
1129 | setProperty(TableCellBottomPadding, padding); |
1130 | } |
1131 | |
1132 | inline qreal QTextTableCellFormat::bottomPadding() const |
1133 | { |
1134 | return doubleProperty(TableCellBottomPadding); |
1135 | } |
1136 | |
1137 | inline void QTextTableCellFormat::setLeftPadding(qreal padding) |
1138 | { |
1139 | setProperty(TableCellLeftPadding, padding); |
1140 | } |
1141 | |
1142 | inline qreal QTextTableCellFormat::leftPadding() const |
1143 | { |
1144 | return doubleProperty(TableCellLeftPadding); |
1145 | } |
1146 | |
1147 | inline void QTextTableCellFormat::setRightPadding(qreal padding) |
1148 | { |
1149 | setProperty(TableCellRightPadding, padding); |
1150 | } |
1151 | |
1152 | inline qreal QTextTableCellFormat::rightPadding() const |
1153 | { |
1154 | return doubleProperty(TableCellRightPadding); |
1155 | } |
1156 | |
1157 | inline void QTextTableCellFormat::setPadding(qreal padding) |
1158 | { |
1159 | setTopPadding(padding); |
1160 | setBottomPadding(padding); |
1161 | setLeftPadding(padding); |
1162 | setRightPadding(padding); |
1163 | } |
1164 | |
1165 | inline void QTextTableCellFormat::setBorder(qreal width) |
1166 | { |
1167 | setTopBorder(width); |
1168 | setBottomBorder(width); |
1169 | setLeftBorder(width); |
1170 | setRightBorder(width); |
1171 | } |
1172 | |
1173 | inline void QTextTableCellFormat::setBorderStyle(QTextFrameFormat::BorderStyle style) |
1174 | { |
1175 | setTopBorderStyle(style); |
1176 | setBottomBorderStyle(style); |
1177 | setLeftBorderStyle(style); |
1178 | setRightBorderStyle(style); |
1179 | } |
1180 | |
1181 | inline void QTextTableCellFormat::setBorderBrush(const QBrush &brush) |
1182 | { |
1183 | setTopBorderBrush(brush); |
1184 | setBottomBorderBrush(brush); |
1185 | setLeftBorderBrush(brush); |
1186 | setRightBorderBrush(brush); |
1187 | } |
1188 | |
1189 | QT_END_NAMESPACE |
1190 | |
1191 | #endif // QTEXTFORMAT_H |
1192 | |