| 1 | /**************************************************************************** | 
|---|
| 2 | ** $Id: qrichtext_p.h 2 2005-11-16 15:49:26Z dmik $ | 
|---|
| 3 | ** | 
|---|
| 4 | ** Definition of internal rich text classes | 
|---|
| 5 | ** | 
|---|
| 6 | ** Created : 990124 | 
|---|
| 7 | ** | 
|---|
| 8 | ** Copyright (C) 1999-2003 Trolltech AS.  All rights reserved. | 
|---|
| 9 | ** | 
|---|
| 10 | ** This file is part of the kernel module of the Qt GUI Toolkit. | 
|---|
| 11 | ** | 
|---|
| 12 | ** This file may be distributed under the terms of the Q Public License | 
|---|
| 13 | ** as defined by Trolltech AS of Norway and appearing in the file | 
|---|
| 14 | ** LICENSE.QPL included in the packaging of this file. | 
|---|
| 15 | ** | 
|---|
| 16 | ** This file may be distributed and/or modified under the terms of the | 
|---|
| 17 | ** GNU General Public License version 2 as published by the Free Software | 
|---|
| 18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 
|---|
| 19 | ** packaging of this file. | 
|---|
| 20 | ** | 
|---|
| 21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 
|---|
| 22 | ** licenses may use this file in accordance with the Qt Commercial License | 
|---|
| 23 | ** Agreement provided with the Software. | 
|---|
| 24 | ** | 
|---|
| 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 
|---|
| 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 
|---|
| 27 | ** | 
|---|
| 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 
|---|
| 29 | **   information about Qt Commercial License Agreements. | 
|---|
| 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 
|---|
| 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 
|---|
| 32 | ** | 
|---|
| 33 | ** Contact info@trolltech.com if any conditions of this licensing are | 
|---|
| 34 | ** not clear to you. | 
|---|
| 35 | ** | 
|---|
| 36 | **********************************************************************/ | 
|---|
| 37 |  | 
|---|
| 38 | #ifndef QRICHTEXT_P_H | 
|---|
| 39 | #define QRICHTEXT_P_H | 
|---|
| 40 |  | 
|---|
| 41 | // | 
|---|
| 42 | //  W A R N I N G | 
|---|
| 43 | //  ------------- | 
|---|
| 44 | // | 
|---|
| 45 | // This file is not part of the Qt API.  It exists for the convenience | 
|---|
| 46 | // of a number of Qt sources files.  This header file may change from | 
|---|
| 47 | // version to version without notice, or even be removed. | 
|---|
| 48 | // | 
|---|
| 49 | // We mean it. | 
|---|
| 50 | // | 
|---|
| 51 | // | 
|---|
| 52 |  | 
|---|
| 53 | #ifndef QT_H | 
|---|
| 54 | #include "qstring.h" | 
|---|
| 55 | #include "qptrlist.h" | 
|---|
| 56 | #include "qrect.h" | 
|---|
| 57 | #include "qfontmetrics.h" | 
|---|
| 58 | #include "qintdict.h" | 
|---|
| 59 | #include "qmap.h" | 
|---|
| 60 | #include "qstringlist.h" | 
|---|
| 61 | #include "qfont.h" | 
|---|
| 62 | #include "qcolor.h" | 
|---|
| 63 | #include "qsize.h" | 
|---|
| 64 | #include "qvaluelist.h" | 
|---|
| 65 | #include "qvaluestack.h" | 
|---|
| 66 | #include "qobject.h" | 
|---|
| 67 | #include "qdict.h" | 
|---|
| 68 | #include "qpixmap.h" | 
|---|
| 69 | #include "qstylesheet.h" | 
|---|
| 70 | #include "qptrvector.h" | 
|---|
| 71 | #include "qpainter.h" | 
|---|
| 72 | #include "qlayout.h" | 
|---|
| 73 | #include "qobject.h" | 
|---|
| 74 | #include "qapplication.h" | 
|---|
| 75 | #endif // QT_H | 
|---|
| 76 |  | 
|---|
| 77 | #ifndef QT_NO_RICHTEXT | 
|---|
| 78 |  | 
|---|
| 79 | class QTextDocument; | 
|---|
| 80 | class QTextString; | 
|---|
| 81 | class QTextPreProcessor; | 
|---|
| 82 | class QTextFormat; | 
|---|
| 83 | class QTextCursor; | 
|---|
| 84 | class QTextParagraph; | 
|---|
| 85 | class QTextFormatter; | 
|---|
| 86 | class QTextIndent; | 
|---|
| 87 | class QTextFormatCollection; | 
|---|
| 88 | class QStyleSheetItem; | 
|---|
| 89 | #ifndef QT_NO_TEXTCUSTOMITEM | 
|---|
| 90 | class QTextCustomItem; | 
|---|
| 91 | #endif | 
|---|
| 92 | class QTextFlow; | 
|---|
| 93 | struct QBidiContext; | 
|---|
| 94 |  | 
|---|
| 95 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 
|---|
| 96 |  | 
|---|
| 97 | class Q_EXPORT QTextStringChar | 
|---|
| 98 | { | 
|---|
| 99 | friend class QTextString; | 
|---|
| 100 |  | 
|---|
| 101 | public: | 
|---|
| 102 | // this is never called, initialize variables in QTextString::insert()!!! | 
|---|
| 103 | QTextStringChar() : nobreak(FALSE), lineStart( 0 ), type( Regular ) {d.format=0;} | 
|---|
| 104 | ~QTextStringChar(); | 
|---|
| 105 |  | 
|---|
| 106 | struct CustomData | 
|---|
| 107 | { | 
|---|
| 108 | QTextFormat *format; | 
|---|
| 109 | #ifndef QT_NO_TEXTCUSTOMITEM | 
|---|
| 110 | QTextCustomItem *custom; | 
|---|
| 111 | #endif | 
|---|
| 112 | QString anchorName; | 
|---|
| 113 | QString anchorHref; | 
|---|
| 114 | }; | 
|---|
| 115 | enum Type { Regular=0, Custom=1, Anchor=2, CustomAnchor=3 }; | 
|---|
| 116 |  | 
|---|
| 117 | QChar c; | 
|---|
| 118 | // this is the same struct as in qtextengine_p.h. Don't change! | 
|---|
| 119 | uchar softBreak      :1;     // Potential linebreak point | 
|---|
| 120 | uchar whiteSpace     :1;     // A unicode whitespace character, except NBSP, ZWNBSP | 
|---|
| 121 | uchar charStop       :1;     // Valid cursor position (for left/right arrow) | 
|---|
| 122 | uchar wordStop       :1;     // Valid cursor position (for ctrl + left/right arrow) | 
|---|
| 123 | uchar nobreak        :1; | 
|---|
| 124 |  | 
|---|
| 125 | uchar lineStart : 1; | 
|---|
| 126 | uchar /*Type*/ type : 2; | 
|---|
| 127 | uchar bidiLevel       :7; | 
|---|
| 128 | uchar rightToLeft : 1; | 
|---|
| 129 |  | 
|---|
| 130 | int x; | 
|---|
| 131 | union { | 
|---|
| 132 | QTextFormat* format; | 
|---|
| 133 | CustomData* custom; | 
|---|
| 134 | } d; | 
|---|
| 135 |  | 
|---|
| 136 |  | 
|---|
| 137 | int height() const; | 
|---|
| 138 | int ascent() const; | 
|---|
| 139 | int descent() const; | 
|---|
| 140 | bool isCustom() const { return (type & Custom) != 0; } | 
|---|
| 141 | QTextFormat *format() const; | 
|---|
| 142 | #ifndef QT_NO_TEXTCUSTOMITEM | 
|---|
| 143 | QTextCustomItem *customItem() const; | 
|---|
| 144 | #endif | 
|---|
| 145 | void setFormat( QTextFormat *f ); | 
|---|
| 146 | #ifndef QT_NO_TEXTCUSTOMITEM | 
|---|
| 147 | void setCustomItem( QTextCustomItem *i ); | 
|---|
| 148 | #endif | 
|---|
| 149 |  | 
|---|
| 150 | #ifndef QT_NO_TEXTCUSTOMITEM | 
|---|
| 151 | void loseCustomItem(); | 
|---|
| 152 | #endif | 
|---|
| 153 |  | 
|---|
| 154 |  | 
|---|
| 155 | bool isAnchor() const { return ( type & Anchor) != 0; } | 
|---|
| 156 | bool isLink() const { return isAnchor() && !!d.custom->anchorHref; } | 
|---|
| 157 | QString anchorName() const; | 
|---|
| 158 | QString anchorHref() const; | 
|---|
| 159 | void setAnchor( const QString& name, const QString& href ); | 
|---|
| 160 |  | 
|---|
| 161 | private: | 
|---|
| 162 | QTextStringChar &operator=( const QTextStringChar & ) { | 
|---|
| 163 | //abort(); | 
|---|
| 164 | return *this; | 
|---|
| 165 | } | 
|---|
| 166 | QTextStringChar( const QTextStringChar & ) { | 
|---|
| 167 | } | 
|---|
| 168 | friend class QTextParagraph; | 
|---|
| 169 | }; | 
|---|
| 170 |  | 
|---|
| 171 | #if defined(Q_TEMPLATEDLL) | 
|---|
| 172 | // MOC_SKIP_BEGIN | 
|---|
| 173 | Q_TEMPLATE_EXTERN template class Q_EXPORT QMemArray<QTextStringChar>; | 
|---|
| 174 | // MOC_SKIP_END | 
|---|
| 175 | #endif | 
|---|
| 176 |  | 
|---|
| 177 | class Q_EXPORT QTextString | 
|---|
| 178 | { | 
|---|
| 179 | public: | 
|---|
| 180 |  | 
|---|
| 181 | QTextString(); | 
|---|
| 182 | QTextString( const QTextString &s ); | 
|---|
| 183 | virtual ~QTextString(); | 
|---|
| 184 |  | 
|---|
| 185 | static QString toString( const QMemArray<QTextStringChar> &data ); | 
|---|
| 186 | QString toString() const; | 
|---|
| 187 |  | 
|---|
| 188 | inline QTextStringChar &at( int i ) const { return data[ i ]; } | 
|---|
| 189 | inline int length() const { return data.size(); } | 
|---|
| 190 |  | 
|---|
| 191 | int width( int idx ) const; | 
|---|
| 192 |  | 
|---|
| 193 | void insert( int index, const QString &s, QTextFormat *f ); | 
|---|
| 194 | void insert( int index, const QChar *unicode, int len, QTextFormat *f ); | 
|---|
| 195 | void insert( int index, QTextStringChar *c, bool doAddRefFormat = FALSE ); | 
|---|
| 196 | void truncate( int index ); | 
|---|
| 197 | void remove( int index, int len ); | 
|---|
| 198 | void clear(); | 
|---|
| 199 |  | 
|---|
| 200 | void setFormat( int index, QTextFormat *f, bool useCollection ); | 
|---|
| 201 |  | 
|---|
| 202 | void setBidi( bool b ) { bidi = b; } | 
|---|
| 203 | bool isBidi() const; | 
|---|
| 204 | bool isRightToLeft() const; | 
|---|
| 205 | QChar::Direction direction() const; | 
|---|
| 206 | void setDirection( QChar::Direction d ) { dir = d; bidiDirty = TRUE; } | 
|---|
| 207 |  | 
|---|
| 208 | QMemArray<QTextStringChar> rawData() const { return data.copy(); } | 
|---|
| 209 |  | 
|---|
| 210 | void operator=( const QString &s ) { clear(); insert( 0, s, 0 ); } | 
|---|
| 211 | void operator+=( const QString &s ) { insert( length(), s, 0 ); } | 
|---|
| 212 | void prepend( const QString &s ) { insert( 0, s, 0 ); } | 
|---|
| 213 |  | 
|---|
| 214 | // return next and previous valid cursor positions. | 
|---|
| 215 | bool validCursorPosition( int idx ); | 
|---|
| 216 | int nextCursorPosition( int idx ); | 
|---|
| 217 | int previousCursorPosition( int idx ); | 
|---|
| 218 |  | 
|---|
| 219 | private: | 
|---|
| 220 | void checkBidi() const; | 
|---|
| 221 |  | 
|---|
| 222 | QMemArray<QTextStringChar> data; | 
|---|
| 223 | uint bidiDirty : 1; | 
|---|
| 224 | uint bidi : 1; // true when the paragraph has right to left characters | 
|---|
| 225 | uint rightToLeft : 1; | 
|---|
| 226 | uint dir : 5; | 
|---|
| 227 | }; | 
|---|
| 228 |  | 
|---|
| 229 | inline bool QTextString::isBidi() const | 
|---|
| 230 | { | 
|---|
| 231 | if ( bidiDirty ) | 
|---|
| 232 | checkBidi(); | 
|---|
| 233 | return bidi; | 
|---|
| 234 | } | 
|---|
| 235 |  | 
|---|
| 236 | inline bool QTextString::isRightToLeft() const | 
|---|
| 237 | { | 
|---|
| 238 | if ( bidiDirty ) | 
|---|
| 239 | checkBidi(); | 
|---|
| 240 | return rightToLeft; | 
|---|
| 241 | } | 
|---|
| 242 |  | 
|---|
| 243 | inline QString QTextString::toString() const | 
|---|
| 244 | { | 
|---|
| 245 | return toString( data ); | 
|---|
| 246 | } | 
|---|
| 247 |  | 
|---|
| 248 | inline QChar::Direction QTextString::direction() const | 
|---|
| 249 | { | 
|---|
| 250 | return (QChar::Direction) dir; | 
|---|
| 251 | } | 
|---|
| 252 |  | 
|---|
| 253 | inline int QTextString::nextCursorPosition( int next ) | 
|---|
| 254 | { | 
|---|
| 255 | if ( bidiDirty ) | 
|---|
| 256 | checkBidi(); | 
|---|
| 257 |  | 
|---|
| 258 | const QTextStringChar *c = data.data(); | 
|---|
| 259 | int len = length(); | 
|---|
| 260 |  | 
|---|
| 261 | if ( next < len - 1 ) { | 
|---|
| 262 | next++; | 
|---|
| 263 | while ( next < len - 1 && !c[next].charStop ) | 
|---|
| 264 | next++; | 
|---|
| 265 | } | 
|---|
| 266 | return next; | 
|---|
| 267 | } | 
|---|
| 268 |  | 
|---|
| 269 | inline int QTextString::previousCursorPosition( int prev ) | 
|---|
| 270 | { | 
|---|
| 271 | if ( bidiDirty ) | 
|---|
| 272 | checkBidi(); | 
|---|
| 273 |  | 
|---|
| 274 | const QTextStringChar *c = data.data(); | 
|---|
| 275 |  | 
|---|
| 276 | if ( prev ) { | 
|---|
| 277 | prev--; | 
|---|
| 278 | while ( prev && !c[prev].charStop ) | 
|---|
| 279 | prev--; | 
|---|
| 280 | } | 
|---|
| 281 | return prev; | 
|---|
| 282 | } | 
|---|
| 283 |  | 
|---|
| 284 | inline bool QTextString::validCursorPosition( int idx ) | 
|---|
| 285 | { | 
|---|
| 286 | if ( bidiDirty ) | 
|---|
| 287 | checkBidi(); | 
|---|
| 288 |  | 
|---|
| 289 | return (at( idx ).charStop); | 
|---|
| 290 | } | 
|---|
| 291 |  | 
|---|
| 292 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 
|---|
| 293 |  | 
|---|
| 294 | #if defined(Q_TEMPLATEDLL) | 
|---|
| 295 | // MOC_SKIP_BEGIN | 
|---|
| 296 | Q_TEMPLATE_EXTERN template class Q_EXPORT QValueStack<int>; | 
|---|
| 297 | Q_TEMPLATE_EXTERN template class Q_EXPORT QValueStack<QTextParagraph*>; | 
|---|
| 298 | Q_TEMPLATE_EXTERN template class Q_EXPORT QValueStack<bool>; | 
|---|
| 299 | // MOC_SKIP_END | 
|---|
| 300 | #endif | 
|---|
| 301 |  | 
|---|
| 302 | class Q_EXPORT QTextCursor | 
|---|
| 303 | { | 
|---|
| 304 | public: | 
|---|
| 305 | QTextCursor( QTextDocument *d = 0 ); | 
|---|
| 306 | QTextCursor( const QTextCursor &c ); | 
|---|
| 307 | QTextCursor &operator=( const QTextCursor &c ); | 
|---|
| 308 | virtual ~QTextCursor() {} | 
|---|
| 309 |  | 
|---|
| 310 | bool operator==( const QTextCursor &c ) const; | 
|---|
| 311 | bool operator!=( const QTextCursor &c ) const { return !(*this == c); } | 
|---|
| 312 |  | 
|---|
| 313 | inline QTextParagraph *paragraph() const { return para; } | 
|---|
| 314 |  | 
|---|
| 315 | QTextDocument *document() const; | 
|---|
| 316 | int index() const; | 
|---|
| 317 |  | 
|---|
| 318 | void gotoPosition( QTextParagraph* p, int index = 0); | 
|---|
| 319 | void setIndex( int index ) { gotoPosition(paragraph(), index ); } | 
|---|
| 320 | void setParagraph( QTextParagraph*p ) { gotoPosition(p, 0 ); } | 
|---|
| 321 |  | 
|---|
| 322 | void gotoLeft(); | 
|---|
| 323 | void gotoRight(); | 
|---|
| 324 | void gotoNextLetter(); | 
|---|
| 325 | void gotoPreviousLetter(); | 
|---|
| 326 | void gotoUp(); | 
|---|
| 327 | void gotoDown(); | 
|---|
| 328 | void gotoLineEnd(); | 
|---|
| 329 | void gotoLineStart(); | 
|---|
| 330 | void gotoHome(); | 
|---|
| 331 | void gotoEnd(); | 
|---|
| 332 | void gotoPageUp( int visibleHeight ); | 
|---|
| 333 | void gotoPageDown( int visibleHeight ); | 
|---|
| 334 | void gotoNextWord( bool onlySpace = FALSE ); | 
|---|
| 335 | void gotoPreviousWord( bool onlySpace = FALSE ); | 
|---|
| 336 | void gotoWordLeft(); | 
|---|
| 337 | void gotoWordRight(); | 
|---|
| 338 |  | 
|---|
| 339 | void insert( const QString &s, bool checkNewLine, QMemArray<QTextStringChar> *formatting = 0 ); | 
|---|
| 340 | void splitAndInsertEmptyParagraph( bool ind = TRUE, bool updateIds = TRUE ); | 
|---|
| 341 | bool remove(); | 
|---|
| 342 | bool removePreviousChar(); | 
|---|
| 343 | void indent(); | 
|---|
| 344 |  | 
|---|
| 345 | bool atParagStart(); | 
|---|
| 346 | bool atParagEnd(); | 
|---|
| 347 |  | 
|---|
| 348 | int x() const; // x in current paragraph | 
|---|
| 349 | int y() const; // y in current paragraph | 
|---|
| 350 |  | 
|---|
| 351 | int globalX() const; | 
|---|
| 352 | int globalY() const; | 
|---|
| 353 |  | 
|---|
| 354 | QTextParagraph *topParagraph() const { return paras.isEmpty() ? para : paras.first(); } | 
|---|
| 355 | int offsetX() const { return ox; } // inner document  offset | 
|---|
| 356 | int offsetY() const { return oy; } // inner document offset | 
|---|
| 357 | int totalOffsetX() const; // total document offset | 
|---|
| 358 | int totalOffsetY() const; // total document offset | 
|---|
| 359 |  | 
|---|
| 360 | bool place( const QPoint &pos, QTextParagraph *s ) { return place( pos, s, FALSE ); } | 
|---|
| 361 | bool place( const QPoint &pos, QTextParagraph *s, bool link ); | 
|---|
| 362 | void restoreState(); | 
|---|
| 363 |  | 
|---|
| 364 |  | 
|---|
| 365 | int nestedDepth() const { return (int)indices.count(); } //### size_t/int cast | 
|---|
| 366 | void oneUp() { if ( !indices.isEmpty() ) pop(); } | 
|---|
| 367 | void setValid( bool b ) { valid = b; } | 
|---|
| 368 | bool isValid() const { return valid; } | 
|---|
| 369 |  | 
|---|
| 370 | void fixCursorPosition(); | 
|---|
| 371 | private: | 
|---|
| 372 | enum Operation { EnterBegin, EnterEnd, Next, Prev, Up, Down }; | 
|---|
| 373 |  | 
|---|
| 374 | void push(); | 
|---|
| 375 | void pop(); | 
|---|
| 376 | bool processNesting( Operation op ); | 
|---|
| 377 | void invalidateNested(); | 
|---|
| 378 | void gotoIntoNested( const QPoint &globalPos ); | 
|---|
| 379 |  | 
|---|
| 380 | QTextParagraph *para; | 
|---|
| 381 | int idx, tmpX; | 
|---|
| 382 | int ox, oy; | 
|---|
| 383 | QValueStack<int> indices; | 
|---|
| 384 | QValueStack<QTextParagraph*> paras; | 
|---|
| 385 | QValueStack<int> xOffsets; | 
|---|
| 386 | QValueStack<int> yOffsets; | 
|---|
| 387 | uint valid : 1; | 
|---|
| 388 |  | 
|---|
| 389 | }; | 
|---|
| 390 |  | 
|---|
| 391 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 
|---|
| 392 |  | 
|---|
| 393 | class Q_EXPORT QTextCommand | 
|---|
| 394 | { | 
|---|
| 395 | public: | 
|---|
| 396 | enum Commands { Invalid, Insert, Delete, Format, Style }; | 
|---|
| 397 |  | 
|---|
| 398 | QTextCommand( QTextDocument *d ) : doc( d ), cursor( d ) {} | 
|---|
| 399 | virtual ~QTextCommand(); | 
|---|
| 400 |  | 
|---|
| 401 | virtual Commands type() const; | 
|---|
| 402 |  | 
|---|
| 403 | virtual QTextCursor *execute( QTextCursor *c ) = 0; | 
|---|
| 404 | virtual QTextCursor *unexecute( QTextCursor *c ) = 0; | 
|---|
| 405 |  | 
|---|
| 406 | protected: | 
|---|
| 407 | QTextDocument *doc; | 
|---|
| 408 | QTextCursor cursor; | 
|---|
| 409 |  | 
|---|
| 410 | }; | 
|---|
| 411 |  | 
|---|
| 412 | #if defined(Q_TEMPLATEDLL) | 
|---|
| 413 | // MOC_SKIP_BEGIN | 
|---|
| 414 | Q_TEMPLATE_EXTERN template class Q_EXPORT QPtrList<QTextCommand>; | 
|---|
| 415 | // MOC_SKIP_END | 
|---|
| 416 | #endif | 
|---|
| 417 |  | 
|---|
| 418 | class Q_EXPORT QTextCommandHistory | 
|---|
| 419 | { | 
|---|
| 420 | public: | 
|---|
| 421 | QTextCommandHistory( int s ) : current( -1 ), steps( s ) { history.setAutoDelete( TRUE ); } | 
|---|
| 422 | virtual ~QTextCommandHistory(); | 
|---|
| 423 |  | 
|---|
| 424 | void clear() { history.clear(); current = -1; } | 
|---|
| 425 |  | 
|---|
| 426 | void addCommand( QTextCommand *cmd ); | 
|---|
| 427 | QTextCursor *undo( QTextCursor *c ); | 
|---|
| 428 | QTextCursor *redo( QTextCursor *c ); | 
|---|
| 429 |  | 
|---|
| 430 | bool isUndoAvailable(); | 
|---|
| 431 | bool isRedoAvailable(); | 
|---|
| 432 |  | 
|---|
| 433 | void setUndoDepth( int d ) { steps = d; } | 
|---|
| 434 | int undoDepth() const { return steps; } | 
|---|
| 435 |  | 
|---|
| 436 | int historySize() const { return history.count(); } | 
|---|
| 437 | int currentPosition() const { return current; } | 
|---|
| 438 |  | 
|---|
| 439 | private: | 
|---|
| 440 | QPtrList<QTextCommand> history; | 
|---|
| 441 | int current, steps; | 
|---|
| 442 |  | 
|---|
| 443 | }; | 
|---|
| 444 |  | 
|---|
| 445 | inline QTextCommandHistory::~QTextCommandHistory() | 
|---|
| 446 | { | 
|---|
| 447 | clear(); | 
|---|
| 448 | } | 
|---|
| 449 |  | 
|---|
| 450 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 
|---|
| 451 |  | 
|---|
| 452 | #ifndef QT_NO_TEXTCUSTOMITEM | 
|---|
| 453 | class Q_EXPORT QTextCustomItem | 
|---|
| 454 | { | 
|---|
| 455 | public: | 
|---|
| 456 | QTextCustomItem( QTextDocument *p ) | 
|---|
| 457 | :  xpos(0), ypos(-1), width(-1), height(0), parent( p ) | 
|---|
| 458 | {} | 
|---|
| 459 | virtual ~QTextCustomItem(); | 
|---|
| 460 | virtual void draw(QPainter* p, int x, int y, int cx, int cy, int cw, int ch, const QColorGroup& cg, bool selected ) = 0; | 
|---|
| 461 |  | 
|---|
| 462 | virtual void adjustToPainter( QPainter* ); | 
|---|
| 463 |  | 
|---|
| 464 | enum Placement { PlaceInline = 0, PlaceLeft, PlaceRight }; | 
|---|
| 465 | virtual Placement placement() const; | 
|---|
| 466 | bool placeInline() { return placement() == PlaceInline; } | 
|---|
| 467 |  | 
|---|
| 468 | virtual bool ownLine() const; | 
|---|
| 469 | virtual void resize( int nwidth ); | 
|---|
| 470 | virtual void invalidate(); | 
|---|
| 471 | virtual int ascent() const { return height; } | 
|---|
| 472 |  | 
|---|
| 473 | virtual bool isNested() const; | 
|---|
| 474 | virtual int minimumWidth() const; | 
|---|
| 475 |  | 
|---|
| 476 | virtual QString richText() const; | 
|---|
| 477 |  | 
|---|
| 478 | int xpos; // used for floating items | 
|---|
| 479 | int ypos; // used for floating items | 
|---|
| 480 | int width; | 
|---|
| 481 | int height; | 
|---|
| 482 |  | 
|---|
| 483 | QRect geometry() const { return QRect( xpos, ypos, width, height ); } | 
|---|
| 484 |  | 
|---|
| 485 | virtual bool enter( QTextCursor *, QTextDocument *&doc, QTextParagraph *¶g, int &idx, int &ox, int &oy, bool atEnd = FALSE ); | 
|---|
| 486 | virtual bool enterAt( QTextCursor *, QTextDocument *&doc, QTextParagraph *¶g, int &idx, int &ox, int &oy, const QPoint & ); | 
|---|
| 487 | virtual bool next( QTextCursor *, QTextDocument *&doc, QTextParagraph *¶g, int &idx, int &ox, int &oy ); | 
|---|
| 488 | virtual bool prev( QTextCursor *, QTextDocument *&doc, QTextParagraph *¶g, int &idx, int &ox, int &oy ); | 
|---|
| 489 | virtual bool down( QTextCursor *, QTextDocument *&doc, QTextParagraph *¶g, int &idx, int &ox, int &oy ); | 
|---|
| 490 | virtual bool up( QTextCursor *, QTextDocument *&doc, QTextParagraph *¶g, int &idx, int &ox, int &oy ); | 
|---|
| 491 |  | 
|---|
| 492 | void setParagraph( QTextParagraph *p ) { parag = p; } | 
|---|
| 493 | QTextParagraph *paragraph() const { return parag; } | 
|---|
| 494 |  | 
|---|
| 495 | QTextDocument *parent; | 
|---|
| 496 | QTextParagraph *parag; | 
|---|
| 497 |  | 
|---|
| 498 | virtual void pageBreak( int  y, QTextFlow* flow ); | 
|---|
| 499 | }; | 
|---|
| 500 | #endif | 
|---|
| 501 |  | 
|---|
| 502 | #if defined(Q_TEMPLATEDLL) | 
|---|
| 503 | // MOC_SKIP_BEGIN | 
|---|
| 504 | //Q_TEMPLATE_EXTERN template class Q_EXPORT QMap<QString, QString>; | 
|---|
| 505 | // MOC_SKIP_END | 
|---|
| 506 | #endif | 
|---|
| 507 |  | 
|---|
| 508 | #ifndef QT_NO_TEXTCUSTOMITEM | 
|---|
| 509 | class Q_EXPORT QTextImage : public QTextCustomItem | 
|---|
| 510 | { | 
|---|
| 511 | public: | 
|---|
| 512 | QTextImage( QTextDocument *p, const QMap<QString, QString> &attr, const QString& context, | 
|---|
| 513 | QMimeSourceFactory &factory ); | 
|---|
| 514 | virtual ~QTextImage(); | 
|---|
| 515 |  | 
|---|
| 516 | Placement placement() const { return place; } | 
|---|
| 517 | void adjustToPainter( QPainter* ); | 
|---|
| 518 | int minimumWidth() const { return width; } | 
|---|
| 519 |  | 
|---|
| 520 | QString richText() const; | 
|---|
| 521 |  | 
|---|
| 522 | void draw( QPainter* p, int x, int y, int cx, int cy, int cw, int ch, const QColorGroup& cg, bool selected ); | 
|---|
| 523 |  | 
|---|
| 524 | private: | 
|---|
| 525 | QRegion* reg; | 
|---|
| 526 | QPixmap pm; | 
|---|
| 527 | Placement place; | 
|---|
| 528 | int tmpwidth, tmpheight; | 
|---|
| 529 | QMap<QString, QString> attributes; | 
|---|
| 530 | QString imgId; | 
|---|
| 531 |  | 
|---|
| 532 | }; | 
|---|
| 533 | #endif | 
|---|
| 534 |  | 
|---|
| 535 | #ifndef QT_NO_TEXTCUSTOMITEM | 
|---|
| 536 | class Q_EXPORT QTextHorizontalLine : public QTextCustomItem | 
|---|
| 537 | { | 
|---|
| 538 | public: | 
|---|
| 539 | QTextHorizontalLine( QTextDocument *p, const QMap<QString, QString> &attr, const QString& context, | 
|---|
| 540 | QMimeSourceFactory &factory ); | 
|---|
| 541 | virtual ~QTextHorizontalLine(); | 
|---|
| 542 |  | 
|---|
| 543 | void adjustToPainter( QPainter* ); | 
|---|
| 544 | void draw(QPainter* p, int x, int y, int cx, int cy, int cw, int ch, const QColorGroup& cg, bool selected ); | 
|---|
| 545 | QString richText() const; | 
|---|
| 546 |  | 
|---|
| 547 | bool ownLine() const { return TRUE; } | 
|---|
| 548 |  | 
|---|
| 549 | private: | 
|---|
| 550 | int tmpheight; | 
|---|
| 551 | QColor color; | 
|---|
| 552 | bool shade; | 
|---|
| 553 |  | 
|---|
| 554 | }; | 
|---|
| 555 | #endif | 
|---|
| 556 |  | 
|---|
| 557 | #ifndef QT_NO_TEXTCUSTOMITEM | 
|---|
| 558 | #if defined(Q_TEMPLATEDLL) | 
|---|
| 559 | // MOC_SKIP_BEGIN | 
|---|
| 560 | Q_TEMPLATE_EXTERN template class Q_EXPORT QPtrList<QTextCustomItem>; | 
|---|
| 561 | // MOC_SKIP_END | 
|---|
| 562 | #endif | 
|---|
| 563 | #endif | 
|---|
| 564 |  | 
|---|
| 565 | class Q_EXPORT QTextFlow | 
|---|
| 566 | { | 
|---|
| 567 | friend class QTextDocument; | 
|---|
| 568 | #ifndef QT_NO_TEXTCUSTOMITEM | 
|---|
| 569 | friend class QTextTableCell; | 
|---|
| 570 | #endif | 
|---|
| 571 |  | 
|---|
| 572 | public: | 
|---|
| 573 | QTextFlow(); | 
|---|
| 574 | virtual ~QTextFlow(); | 
|---|
| 575 |  | 
|---|
| 576 | virtual void setWidth( int width ); | 
|---|
| 577 | int width() const; | 
|---|
| 578 |  | 
|---|
| 579 | virtual void setPageSize( int ps ); | 
|---|
| 580 | int pageSize() const { return pagesize; } | 
|---|
| 581 |  | 
|---|
| 582 | virtual int adjustLMargin( int yp, int h, int margin, int space ); | 
|---|
| 583 | virtual int adjustRMargin( int yp, int h, int margin, int space ); | 
|---|
| 584 |  | 
|---|
| 585 | #ifndef QT_NO_TEXTCUSTOMITEM | 
|---|
| 586 | virtual void registerFloatingItem( QTextCustomItem* item ); | 
|---|
| 587 | virtual void unregisterFloatingItem( QTextCustomItem* item ); | 
|---|
| 588 | #endif | 
|---|
| 589 | virtual QRect boundingRect() const; | 
|---|
| 590 | virtual void drawFloatingItems(QPainter* p, int cx, int cy, int cw, int ch, const QColorGroup& cg, bool selected ); | 
|---|
| 591 |  | 
|---|
| 592 | virtual int adjustFlow( int  y, int w, int h ); // adjusts y according to the defined pagesize. Returns the shift. | 
|---|
| 593 |  | 
|---|
| 594 | virtual bool isEmpty(); | 
|---|
| 595 |  | 
|---|
| 596 | void clear(); | 
|---|
| 597 |  | 
|---|
| 598 | private: | 
|---|
| 599 | int w; | 
|---|
| 600 | int pagesize; | 
|---|
| 601 |  | 
|---|
| 602 | #ifndef QT_NO_TEXTCUSTOMITEM | 
|---|
| 603 | QPtrList<QTextCustomItem> leftItems; | 
|---|
| 604 | QPtrList<QTextCustomItem> rightItems; | 
|---|
| 605 | #endif | 
|---|
| 606 | }; | 
|---|
| 607 |  | 
|---|
| 608 | inline int QTextFlow::width() const { return w; } | 
|---|
| 609 |  | 
|---|
| 610 | #ifndef QT_NO_TEXTCUSTOMITEM | 
|---|
| 611 | class QTextTable; | 
|---|
| 612 |  | 
|---|
| 613 | class Q_EXPORT QTextTableCell : public QLayoutItem | 
|---|
| 614 | { | 
|---|
| 615 | friend class QTextTable; | 
|---|
| 616 |  | 
|---|
| 617 | public: | 
|---|
| 618 | QTextTableCell( QTextTable* table, | 
|---|
| 619 | int row, int column, | 
|---|
| 620 | const QMap<QString, QString> &attr, | 
|---|
| 621 | const QStyleSheetItem* style, | 
|---|
| 622 | const QTextFormat& fmt, const QString& context, | 
|---|
| 623 | QMimeSourceFactory &factory, QStyleSheet *sheet, const QString& doc ); | 
|---|
| 624 | virtual ~QTextTableCell(); | 
|---|
| 625 |  | 
|---|
| 626 | QSize sizeHint() const ; | 
|---|
| 627 | QSize minimumSize() const ; | 
|---|
| 628 | QSize maximumSize() const ; | 
|---|
| 629 | QSizePolicy::ExpandData expanding() const; | 
|---|
| 630 | bool isEmpty() const; | 
|---|
| 631 | void setGeometry( const QRect& ) ; | 
|---|
| 632 | QRect geometry() const; | 
|---|
| 633 |  | 
|---|
| 634 | bool hasHeightForWidth() const; | 
|---|
| 635 | int heightForWidth( int ) const; | 
|---|
| 636 |  | 
|---|
| 637 | void adjustToPainter( QPainter* ); | 
|---|
| 638 |  | 
|---|
| 639 | int row() const { return row_; } | 
|---|
| 640 | int column() const { return col_; } | 
|---|
| 641 | int rowspan() const { return rowspan_; } | 
|---|
| 642 | int colspan() const { return colspan_; } | 
|---|
| 643 | int stretch() const { return stretch_; } | 
|---|
| 644 |  | 
|---|
| 645 | QTextDocument* richText()  const { return richtext; } | 
|---|
| 646 | QTextTable* table() const { return parent; } | 
|---|
| 647 |  | 
|---|
| 648 | void draw( QPainter* p, int x, int y, int cx, int cy, int cw, int ch, const QColorGroup& cg, bool selected ); | 
|---|
| 649 |  | 
|---|
| 650 | QBrush *backGround() const { return background; } | 
|---|
| 651 | virtual void invalidate(); | 
|---|
| 652 |  | 
|---|
| 653 | int verticalAlignmentOffset() const; | 
|---|
| 654 | int horizontalAlignmentOffset() const; | 
|---|
| 655 |  | 
|---|
| 656 | private: | 
|---|
| 657 | QRect geom; | 
|---|
| 658 | QTextTable* parent; | 
|---|
| 659 | QTextDocument* richtext; | 
|---|
| 660 | int row_; | 
|---|
| 661 | int col_; | 
|---|
| 662 | int rowspan_; | 
|---|
| 663 | int colspan_; | 
|---|
| 664 | int stretch_; | 
|---|
| 665 | int maxw; | 
|---|
| 666 | int minw; | 
|---|
| 667 | bool hasFixedWidth; | 
|---|
| 668 | QBrush *background; | 
|---|
| 669 | int cached_width; | 
|---|
| 670 | int cached_sizehint; | 
|---|
| 671 | QMap<QString, QString> attributes; | 
|---|
| 672 | int align; | 
|---|
| 673 | }; | 
|---|
| 674 | #endif | 
|---|
| 675 |  | 
|---|
| 676 | #if defined(Q_TEMPLATEDLL) | 
|---|
| 677 | // MOC_SKIP_BEGIN | 
|---|
| 678 | Q_TEMPLATE_EXTERN template class Q_EXPORT QPtrList<QTextTableCell>; | 
|---|
| 679 | Q_TEMPLATE_EXTERN template class Q_EXPORT QMap<QTextCursor*, int>; | 
|---|
| 680 | // MOC_SKIP_END | 
|---|
| 681 | #endif | 
|---|
| 682 |  | 
|---|
| 683 | #ifndef QT_NO_TEXTCUSTOMITEM | 
|---|
| 684 | class Q_EXPORT QTextTable: public QTextCustomItem | 
|---|
| 685 | { | 
|---|
| 686 | friend class QTextTableCell; | 
|---|
| 687 |  | 
|---|
| 688 | public: | 
|---|
| 689 | QTextTable( QTextDocument *p, const QMap<QString, QString> &attr ); | 
|---|
| 690 | virtual ~QTextTable(); | 
|---|
| 691 |  | 
|---|
| 692 | void adjustToPainter( QPainter *p ); | 
|---|
| 693 | void pageBreak( int  y, QTextFlow* flow ); | 
|---|
| 694 | void draw( QPainter* p, int x, int y, int cx, int cy, int cw, int ch, | 
|---|
| 695 | const QColorGroup& cg, bool selected ); | 
|---|
| 696 |  | 
|---|
| 697 | bool noErase() const { return TRUE; } | 
|---|
| 698 | bool ownLine() const { return TRUE; } | 
|---|
| 699 | Placement placement() const { return place; } | 
|---|
| 700 | bool isNested() const { return TRUE; } | 
|---|
| 701 | void resize( int nwidth ); | 
|---|
| 702 | virtual void invalidate(); | 
|---|
| 703 |  | 
|---|
| 704 | virtual bool enter( QTextCursor *c, QTextDocument *&doc, QTextParagraph *¶g, int &idx, int &ox, int &oy, bool atEnd = FALSE ); | 
|---|
| 705 | virtual bool enterAt( QTextCursor *c, QTextDocument *&doc, QTextParagraph *¶g, int &idx, int &ox, int &oy, const QPoint &pos ); | 
|---|
| 706 | virtual bool next( QTextCursor *c, QTextDocument *&doc, QTextParagraph *¶g, int &idx, int &ox, int &oy ); | 
|---|
| 707 | virtual bool prev( QTextCursor *c, QTextDocument *&doc, QTextParagraph *¶g, int &idx, int &ox, int &oy ); | 
|---|
| 708 | virtual bool down( QTextCursor *c, QTextDocument *&doc, QTextParagraph *¶g, int &idx, int &ox, int &oy ); | 
|---|
| 709 | virtual bool up( QTextCursor *c, QTextDocument *&doc, QTextParagraph *¶g, int &idx, int &ox, int &oy ); | 
|---|
| 710 |  | 
|---|
| 711 | QString richText() const; | 
|---|
| 712 |  | 
|---|
| 713 | int minimumWidth() const; | 
|---|
| 714 |  | 
|---|
| 715 | QPtrList<QTextTableCell> tableCells() const { return cells; } | 
|---|
| 716 |  | 
|---|
| 717 | bool isStretching() const { return stretch; } | 
|---|
| 718 |  | 
|---|
| 719 | private: | 
|---|
| 720 | void format( int w ); | 
|---|
| 721 | void addCell( QTextTableCell* cell ); | 
|---|
| 722 |  | 
|---|
| 723 | private: | 
|---|
| 724 | QGridLayout* layout; | 
|---|
| 725 | QPtrList<QTextTableCell> cells; | 
|---|
| 726 | int cachewidth; | 
|---|
| 727 | int fixwidth; | 
|---|
| 728 | int cellpadding; | 
|---|
| 729 | int cellspacing; | 
|---|
| 730 | int border; | 
|---|
| 731 | int outerborder; | 
|---|
| 732 | int stretch; | 
|---|
| 733 | int innerborder; | 
|---|
| 734 | int us_cp, us_ib, us_b, us_ob, us_cs; | 
|---|
| 735 | QMap<QString, QString> attributes; | 
|---|
| 736 | QMap<QTextCursor*, int> currCell; | 
|---|
| 737 | Placement place; | 
|---|
| 738 | void adjustCells( int y , int shift ); | 
|---|
| 739 | int pageBreakFor; | 
|---|
| 740 | }; | 
|---|
| 741 | #endif | 
|---|
| 742 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 
|---|
| 743 |  | 
|---|
| 744 | #ifndef QT_NO_TEXTCUSTOMITEM | 
|---|
| 745 | class QTextTableCell; | 
|---|
| 746 | class QTextParagraph; | 
|---|
| 747 | #endif | 
|---|
| 748 |  | 
|---|
| 749 | struct Q_EXPORT QTextDocumentSelection | 
|---|
| 750 | { | 
|---|
| 751 | QTextCursor startCursor, endCursor; | 
|---|
| 752 | bool swapped; | 
|---|
| 753 | Q_DUMMY_COMPARISON_OPERATOR(QTextDocumentSelection) | 
|---|
| 754 | }; | 
|---|
| 755 |  | 
|---|
| 756 | #if defined(Q_TEMPLATEDLL) | 
|---|
| 757 | // MOC_SKIP_BEGIN | 
|---|
| 758 | Q_TEMPLATE_EXTERN template class Q_EXPORT QMap<int, QColor>; | 
|---|
| 759 | //Q_TEMPLATE_EXTERN template class Q_EXPORT QMap<int, bool>; | 
|---|
| 760 | Q_TEMPLATE_EXTERN template class Q_EXPORT QMap<int, QTextDocumentSelection>; | 
|---|
| 761 | Q_TEMPLATE_EXTERN template class Q_EXPORT QPtrList<QTextDocument>; | 
|---|
| 762 | // MOC_SKIP_END | 
|---|
| 763 | #endif | 
|---|
| 764 |  | 
|---|
| 765 | class Q_EXPORT QTextDocument : public QObject | 
|---|
| 766 | { | 
|---|
| 767 | Q_OBJECT | 
|---|
| 768 |  | 
|---|
| 769 | #ifndef QT_NO_TEXTCUSTOMITEM | 
|---|
| 770 | friend class QTextTableCell; | 
|---|
| 771 | #endif | 
|---|
| 772 | friend class QTextCursor; | 
|---|
| 773 | friend class QTextEdit; | 
|---|
| 774 | friend class QTextParagraph; | 
|---|
| 775 |  | 
|---|
| 776 | public: | 
|---|
| 777 | enum SelectionIds { | 
|---|
| 778 | Standard = 0, | 
|---|
| 779 | IMSelectionText         = 31998, | 
|---|
| 780 | IMCompositionText       = 31999, // this must be higher! | 
|---|
| 781 | Temp = 32000 // This selection must not be drawn, it's used e.g. by undo/redo to | 
|---|
| 782 | // remove multiple lines with removeSelectedText() | 
|---|
| 783 | }; | 
|---|
| 784 |  | 
|---|
| 785 | QTextDocument( QTextDocument *p ); | 
|---|
| 786 | QTextDocument( QTextDocument *d, QTextFormatCollection *f ); | 
|---|
| 787 | virtual ~QTextDocument(); | 
|---|
| 788 |  | 
|---|
| 789 | QTextDocument *parent() const { return par; } | 
|---|
| 790 | QTextParagraph *parentParagraph() const { return parentPar; } | 
|---|
| 791 |  | 
|---|
| 792 | void setText( const QString &text, const QString &context ); | 
|---|
| 793 | QMap<QString, QString> attributes() const { return attribs; } | 
|---|
| 794 | void setAttributes( const QMap<QString, QString> &attr ) { attribs = attr; } | 
|---|
| 795 |  | 
|---|
| 796 | QString text() const; | 
|---|
| 797 | QString text( int parag ) const; | 
|---|
| 798 | QString originalText() const; | 
|---|
| 799 |  | 
|---|
| 800 | int x() const; | 
|---|
| 801 | int y() const; | 
|---|
| 802 | int width() const; | 
|---|
| 803 | int widthUsed() const; | 
|---|
| 804 | int visibleWidth() const; | 
|---|
| 805 | int height() const; | 
|---|
| 806 | void setWidth( int w ); | 
|---|
| 807 | int minimumWidth() const; | 
|---|
| 808 | bool setMinimumWidth( int needed, int used = -1, QTextParagraph *parag = 0 ); | 
|---|
| 809 |  | 
|---|
| 810 | void setY( int y ); | 
|---|
| 811 | int leftMargin() const; | 
|---|
| 812 | void setLeftMargin( int lm ); | 
|---|
| 813 | int rightMargin() const; | 
|---|
| 814 | void setRightMargin( int rm ); | 
|---|
| 815 |  | 
|---|
| 816 | QTextParagraph *firstParagraph() const; | 
|---|
| 817 | QTextParagraph *lastParagraph() const; | 
|---|
| 818 | void setFirstParagraph( QTextParagraph *p ); | 
|---|
| 819 | void setLastParagraph( QTextParagraph *p ); | 
|---|
| 820 |  | 
|---|
| 821 | void invalidate(); | 
|---|
| 822 |  | 
|---|
| 823 | void setPreProcessor( QTextPreProcessor *sh ); | 
|---|
| 824 | QTextPreProcessor *preProcessor() const; | 
|---|
| 825 |  | 
|---|
| 826 | void setFormatter( QTextFormatter *f ); | 
|---|
| 827 | QTextFormatter *formatter() const; | 
|---|
| 828 |  | 
|---|
| 829 | void setIndent( QTextIndent *i ); | 
|---|
| 830 | QTextIndent *indent() const; | 
|---|
| 831 |  | 
|---|
| 832 | QColor selectionColor( int id ) const; | 
|---|
| 833 | bool invertSelectionText( int id ) const; | 
|---|
| 834 | void setSelectionColor( int id, const QColor &c ); | 
|---|
| 835 | void setInvertSelectionText( int id, bool b ); | 
|---|
| 836 | bool hasSelection( int id, bool visible = FALSE ) const; | 
|---|
| 837 | void setSelectionStart( int id, const QTextCursor &cursor ); | 
|---|
| 838 | bool setSelectionEnd( int id, const QTextCursor &cursor ); | 
|---|
| 839 | void selectAll( int id ); | 
|---|
| 840 | bool removeSelection( int id ); | 
|---|
| 841 | void selectionStart( int id, int ¶gId, int &index ); | 
|---|
| 842 | QTextCursor selectionStartCursor( int id ); | 
|---|
| 843 | QTextCursor selectionEndCursor( int id ); | 
|---|
| 844 | void selectionEnd( int id, int ¶gId, int &index ); | 
|---|
| 845 | void setFormat( int id, QTextFormat *f, int flags ); | 
|---|
| 846 | int numSelections() const { return nSelections; } | 
|---|
| 847 | void addSelection( int id ); | 
|---|
| 848 |  | 
|---|
| 849 | QString selectedText( int id, bool asRichText = FALSE ) const; | 
|---|
| 850 | void removeSelectedText( int id, QTextCursor *cursor ); | 
|---|
| 851 | void indentSelection( int id ); | 
|---|
| 852 |  | 
|---|
| 853 | QTextParagraph *paragAt( int i ) const; | 
|---|
| 854 |  | 
|---|
| 855 | void addCommand( QTextCommand *cmd ); | 
|---|
| 856 | QTextCursor *undo( QTextCursor *c = 0 ); | 
|---|
| 857 | QTextCursor *redo( QTextCursor *c  = 0 ); | 
|---|
| 858 | QTextCommandHistory *commands() const { return commandHistory; } | 
|---|
| 859 |  | 
|---|
| 860 | QTextFormatCollection *formatCollection() const; | 
|---|
| 861 |  | 
|---|
| 862 | bool find( QTextCursor &cursor, const QString &expr, bool cs, bool wo, bool forward); | 
|---|
| 863 |  | 
|---|
| 864 | void setTextFormat( Qt::TextFormat f ); | 
|---|
| 865 | Qt::TextFormat textFormat() const; | 
|---|
| 866 |  | 
|---|
| 867 | bool inSelection( int selId, const QPoint &pos ) const; | 
|---|
| 868 |  | 
|---|
| 869 | QStyleSheet *styleSheet() const { return sheet_; } | 
|---|
| 870 | #ifndef QT_NO_MIME | 
|---|
| 871 | QMimeSourceFactory *mimeSourceFactory() const { return factory_; } | 
|---|
| 872 | #endif | 
|---|
| 873 | QString context() const { return contxt; } | 
|---|
| 874 |  | 
|---|
| 875 | void setStyleSheet( QStyleSheet *s ); | 
|---|
| 876 | void setDefaultFormat( const QFont &font, const QColor &color ); | 
|---|
| 877 | #ifndef QT_NO_MIME | 
|---|
| 878 | void setMimeSourceFactory( QMimeSourceFactory *f ) { if ( f ) factory_ = f; } | 
|---|
| 879 | #endif | 
|---|
| 880 | void setContext( const QString &c ) { if ( !c.isEmpty() ) contxt = c; } | 
|---|
| 881 |  | 
|---|
| 882 | void setUnderlineLinks( bool b ); | 
|---|
| 883 | bool underlineLinks() const { return underlLinks; } | 
|---|
| 884 |  | 
|---|
| 885 | void setPaper( QBrush *brush ) { if ( backBrush ) delete backBrush; backBrush = brush; } | 
|---|
| 886 | QBrush *paper() const { return backBrush; } | 
|---|
| 887 |  | 
|---|
| 888 | void doLayout( QPainter *p, int w ); | 
|---|
| 889 | void draw( QPainter *p, const QRect& rect, const QColorGroup &cg, const QBrush *paper = 0 ); | 
|---|
| 890 | bool useDoubleBuffer( QTextParagraph *parag, QPainter *p ); | 
|---|
| 891 |  | 
|---|
| 892 | void drawParagraph( QPainter *p, QTextParagraph *parag, int cx, int cy, int cw, int ch, | 
|---|
| 893 | QPixmap *&doubleBuffer, const QColorGroup &cg, | 
|---|
| 894 | bool drawCursor, QTextCursor *cursor, bool resetChanged = TRUE ); | 
|---|
| 895 | QTextParagraph *draw( QPainter *p, int cx, int cy, int cw, int ch, const QColorGroup &cg, | 
|---|
| 896 | bool onlyChanged = FALSE, bool drawCursor = FALSE, QTextCursor *cursor = 0, | 
|---|
| 897 | bool resetChanged = TRUE ); | 
|---|
| 898 |  | 
|---|
| 899 | #ifndef QT_NO_TEXTCUSTOMITEM | 
|---|
| 900 | void registerCustomItem( QTextCustomItem *i, QTextParagraph *p ); | 
|---|
| 901 | void unregisterCustomItem( QTextCustomItem *i, QTextParagraph *p ); | 
|---|
| 902 | #endif | 
|---|
| 903 |  | 
|---|
| 904 | void setFlow( QTextFlow *f ); | 
|---|
| 905 | void takeFlow(); | 
|---|
| 906 | QTextFlow *flow() const { return flow_; } | 
|---|
| 907 | bool isPageBreakEnabled() const { return pages; } | 
|---|
| 908 | void setPageBreakEnabled( bool b ) { pages = b; } | 
|---|
| 909 |  | 
|---|
| 910 | void setUseFormatCollection( bool b ) { useFC = b; } | 
|---|
| 911 | bool useFormatCollection() const { return useFC; } | 
|---|
| 912 |  | 
|---|
| 913 | #ifndef QT_NO_TEXTCUSTOMITEM | 
|---|
| 914 | QTextTableCell *tableCell() const { return tc; } | 
|---|
| 915 | void setTableCell( QTextTableCell *c ) { tc = c; } | 
|---|
| 916 | #endif | 
|---|
| 917 |  | 
|---|
| 918 | void setPlainText( const QString &text ); | 
|---|
| 919 | void setRichText( const QString &text, const QString &context ); | 
|---|
| 920 | QString richText() const; | 
|---|
| 921 | QString plainText() const; | 
|---|
| 922 |  | 
|---|
| 923 | bool focusNextPrevChild( bool next ); | 
|---|
| 924 |  | 
|---|
| 925 | int alignment() const; | 
|---|
| 926 | void setAlignment( int a ); | 
|---|
| 927 |  | 
|---|
| 928 | int *tabArray() const; | 
|---|
| 929 | int tabStopWidth() const; | 
|---|
| 930 | void setTabArray( int *a ); | 
|---|
| 931 | void setTabStops( int tw ); | 
|---|
| 932 |  | 
|---|
| 933 | void setUndoDepth( int d ) { commandHistory->setUndoDepth( d ); } | 
|---|
| 934 | int undoDepth() const { return commandHistory->undoDepth(); } | 
|---|
| 935 |  | 
|---|
| 936 | int length() const; | 
|---|
| 937 | void clear( bool createEmptyParag = FALSE ); | 
|---|
| 938 |  | 
|---|
| 939 | virtual QTextParagraph *createParagraph( QTextDocument *d, QTextParagraph *pr = 0, QTextParagraph *nx = 0, bool updateIds = TRUE ); | 
|---|
| 940 | void insertChild( QObject *o ) { QObject::insertChild( o ); } | 
|---|
| 941 | void removeChild( QObject *o ) { QObject::removeChild( o ); } | 
|---|
| 942 | void insertChild( QTextDocument *d ) { childList.append( d ); } | 
|---|
| 943 | void removeChild( QTextDocument *d ) { childList.removeRef( d ); } | 
|---|
| 944 | QPtrList<QTextDocument> children() const { return childList; } | 
|---|
| 945 |  | 
|---|
| 946 | bool hasFocusParagraph() const; | 
|---|
| 947 | QString focusHref() const; | 
|---|
| 948 | QString focusName() const; | 
|---|
| 949 |  | 
|---|
| 950 | void invalidateOriginalText() { oTextValid = FALSE; oText = ""; } | 
|---|
| 951 |  | 
|---|
| 952 | signals: | 
|---|
| 953 | void minimumWidthChanged( int ); | 
|---|
| 954 |  | 
|---|
| 955 | private: | 
|---|
| 956 | void init(); | 
|---|
| 957 | QPixmap *bufferPixmap( const QSize &s ); | 
|---|
| 958 | // HTML parser | 
|---|
| 959 | bool hasPrefix(const QChar* doc, int length, int pos, QChar c); | 
|---|
| 960 | bool hasPrefix(const QChar* doc, int length, int pos, const QString& s); | 
|---|
| 961 | #ifndef QT_NO_TEXTCUSTOMITEM | 
|---|
| 962 | QTextCustomItem* parseTable( const QMap<QString, QString> &attr, const QTextFormat &fmt, | 
|---|
| 963 | const QChar* doc, int length, int& pos, QTextParagraph *curpar ); | 
|---|
| 964 | #endif | 
|---|
| 965 | bool eatSpace(const QChar* doc, int length, int& pos, bool includeNbsp = FALSE ); | 
|---|
| 966 | bool eat(const QChar* doc, int length, int& pos, QChar c); | 
|---|
| 967 | QString parseOpenTag(const QChar* doc, int length, int& pos, QMap<QString, QString> &attr, bool& emptyTag); | 
|---|
| 968 | QString parseCloseTag( const QChar* doc, int length, int& pos ); | 
|---|
| 969 | QChar parseHTMLSpecialChar(const QChar* doc, int length, int& pos); | 
|---|
| 970 | QString parseWord(const QChar* doc, int length, int& pos, bool lower = TRUE); | 
|---|
| 971 | QChar parseChar(const QChar* doc, int length, int& pos, QStyleSheetItem::WhiteSpaceMode wsm ); | 
|---|
| 972 | void setRichTextInternal( const QString &text, QTextCursor* cursor = 0 ); | 
|---|
| 973 | void setRichTextMarginsInternal( QPtrList< QPtrVector<QStyleSheetItem> >& styles, QTextParagraph* stylesPar ); | 
|---|
| 974 |  | 
|---|
| 975 | private: | 
|---|
| 976 | struct Q_EXPORT Focus { | 
|---|
| 977 | QTextParagraph *parag; | 
|---|
| 978 | int start, len; | 
|---|
| 979 | QString href; | 
|---|
| 980 | QString name; | 
|---|
| 981 | }; | 
|---|
| 982 |  | 
|---|
| 983 | int cx, cy, cw, vw; | 
|---|
| 984 | QTextParagraph *fParag, *lParag; | 
|---|
| 985 | QTextPreProcessor *pProcessor; | 
|---|
| 986 | QMap<int, QColor> selectionColors; | 
|---|
| 987 | QMap<int, QTextDocumentSelection> selections; | 
|---|
| 988 | QMap<int, bool> selectionText; | 
|---|
| 989 | QTextCommandHistory *commandHistory; | 
|---|
| 990 | QTextFormatter *pFormatter; | 
|---|
| 991 | QTextIndent *indenter; | 
|---|
| 992 | QTextFormatCollection *fCollection; | 
|---|
| 993 | Qt::TextFormat txtFormat; | 
|---|
| 994 | uint preferRichText : 1; | 
|---|
| 995 | uint pages : 1; | 
|---|
| 996 | uint useFC : 1; | 
|---|
| 997 | uint withoutDoubleBuffer : 1; | 
|---|
| 998 | uint underlLinks : 1; | 
|---|
| 999 | uint nextDoubleBuffered : 1; | 
|---|
| 1000 | uint oTextValid : 1; | 
|---|
| 1001 | uint mightHaveCustomItems : 1; | 
|---|
| 1002 | int align; | 
|---|
| 1003 | int nSelections; | 
|---|
| 1004 | QTextFlow *flow_; | 
|---|
| 1005 | QTextDocument *par; | 
|---|
| 1006 | QTextParagraph *parentPar; | 
|---|
| 1007 | #ifndef QT_NO_TEXTCUSTOMITEM | 
|---|
| 1008 | QTextTableCell *tc; | 
|---|
| 1009 | #endif | 
|---|
| 1010 | QBrush *backBrush; | 
|---|
| 1011 | QPixmap *buf_pixmap; | 
|---|
| 1012 | Focus focusIndicator; | 
|---|
| 1013 | int minw; | 
|---|
| 1014 | int wused; | 
|---|
| 1015 | int leftmargin; | 
|---|
| 1016 | int rightmargin; | 
|---|
| 1017 | QTextParagraph *minwParag, *curParag; | 
|---|
| 1018 | QStyleSheet* sheet_; | 
|---|
| 1019 | #ifndef QT_NO_MIME | 
|---|
| 1020 | QMimeSourceFactory* factory_; | 
|---|
| 1021 | #endif | 
|---|
| 1022 | QString contxt; | 
|---|
| 1023 | QMap<QString, QString> attribs; | 
|---|
| 1024 | int *tArray; | 
|---|
| 1025 | int tStopWidth; | 
|---|
| 1026 | int uDepth; | 
|---|
| 1027 | QString oText; | 
|---|
| 1028 | QPtrList<QTextDocument> childList; | 
|---|
| 1029 | QColor linkColor, bodyText; | 
|---|
| 1030 | double scaleFontsFactor; | 
|---|
| 1031 |  | 
|---|
| 1032 | short list_tm,list_bm, list_lm, li_tm, li_bm, par_tm, par_bm; | 
|---|
| 1033 | #if defined(Q_DISABLE_COPY) // Disabled copy constructor and operator= | 
|---|
| 1034 | QTextDocument( const QTextDocument & ); | 
|---|
| 1035 | QTextDocument &operator=( const QTextDocument & ); | 
|---|
| 1036 | #endif | 
|---|
| 1037 | }; | 
|---|
| 1038 |  | 
|---|
| 1039 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 
|---|
| 1040 |  | 
|---|
| 1041 |  | 
|---|
| 1042 | class Q_EXPORT QTextDeleteCommand : public QTextCommand | 
|---|
| 1043 | { | 
|---|
| 1044 | public: | 
|---|
| 1045 | QTextDeleteCommand( QTextDocument *d, int i, int idx, const QMemArray<QTextStringChar> &str, | 
|---|
| 1046 | const QByteArray& oldStyle ); | 
|---|
| 1047 | QTextDeleteCommand( QTextParagraph *p, int idx, const QMemArray<QTextStringChar> &str ); | 
|---|
| 1048 | virtual ~QTextDeleteCommand(); | 
|---|
| 1049 |  | 
|---|
| 1050 | Commands type() const { return Delete; } | 
|---|
| 1051 | QTextCursor *execute( QTextCursor *c ); | 
|---|
| 1052 | QTextCursor *unexecute( QTextCursor *c ); | 
|---|
| 1053 |  | 
|---|
| 1054 | protected: | 
|---|
| 1055 | int id, index; | 
|---|
| 1056 | QTextParagraph *parag; | 
|---|
| 1057 | QMemArray<QTextStringChar> text; | 
|---|
| 1058 | QByteArray styleInformation; | 
|---|
| 1059 |  | 
|---|
| 1060 | }; | 
|---|
| 1061 |  | 
|---|
| 1062 | class Q_EXPORT QTextInsertCommand : public QTextDeleteCommand | 
|---|
| 1063 | { | 
|---|
| 1064 | public: | 
|---|
| 1065 | QTextInsertCommand( QTextDocument *d, int i, int idx, const QMemArray<QTextStringChar> &str, | 
|---|
| 1066 | const QByteArray& oldStyleInfo ) | 
|---|
| 1067 | : QTextDeleteCommand( d, i, idx, str, oldStyleInfo ) {} | 
|---|
| 1068 | QTextInsertCommand( QTextParagraph *p, int idx, const QMemArray<QTextStringChar> &str ) | 
|---|
| 1069 | : QTextDeleteCommand( p, idx, str ) {} | 
|---|
| 1070 | virtual ~QTextInsertCommand() {} | 
|---|
| 1071 |  | 
|---|
| 1072 | Commands type() const { return Insert; } | 
|---|
| 1073 | QTextCursor *execute( QTextCursor *c ) { return QTextDeleteCommand::unexecute( c ); } | 
|---|
| 1074 | QTextCursor *unexecute( QTextCursor *c ) { return QTextDeleteCommand::execute( c ); } | 
|---|
| 1075 |  | 
|---|
| 1076 | }; | 
|---|
| 1077 |  | 
|---|
| 1078 | class Q_EXPORT QTextFormatCommand : public QTextCommand | 
|---|
| 1079 | { | 
|---|
| 1080 | public: | 
|---|
| 1081 | QTextFormatCommand( QTextDocument *d, int sid, int sidx, int eid, int eidx, const QMemArray<QTextStringChar> &old, QTextFormat *f, int fl ); | 
|---|
| 1082 | virtual ~QTextFormatCommand(); | 
|---|
| 1083 |  | 
|---|
| 1084 | Commands type() const { return Format; } | 
|---|
| 1085 | QTextCursor *execute( QTextCursor *c ); | 
|---|
| 1086 | QTextCursor *unexecute( QTextCursor *c ); | 
|---|
| 1087 |  | 
|---|
| 1088 | protected: | 
|---|
| 1089 | int startId, startIndex, endId, endIndex; | 
|---|
| 1090 | QTextFormat *format; | 
|---|
| 1091 | QMemArray<QTextStringChar> oldFormats; | 
|---|
| 1092 | int flags; | 
|---|
| 1093 |  | 
|---|
| 1094 | }; | 
|---|
| 1095 |  | 
|---|
| 1096 | class Q_EXPORT QTextStyleCommand : public QTextCommand | 
|---|
| 1097 | { | 
|---|
| 1098 | public: | 
|---|
| 1099 | QTextStyleCommand( QTextDocument *d, int fParag, int lParag, const QByteArray& beforeChange  ); | 
|---|
| 1100 | virtual ~QTextStyleCommand() {} | 
|---|
| 1101 |  | 
|---|
| 1102 | Commands type() const { return Style; } | 
|---|
| 1103 | QTextCursor *execute( QTextCursor *c ); | 
|---|
| 1104 | QTextCursor *unexecute( QTextCursor *c ); | 
|---|
| 1105 |  | 
|---|
| 1106 | static QByteArray readStyleInformation(  QTextDocument* d, int fParag, int lParag ); | 
|---|
| 1107 | static void writeStyleInformation(  QTextDocument* d, int fParag, const QByteArray& style ); | 
|---|
| 1108 |  | 
|---|
| 1109 | private: | 
|---|
| 1110 | int firstParag, lastParag; | 
|---|
| 1111 | QByteArray before; | 
|---|
| 1112 | QByteArray after; | 
|---|
| 1113 | }; | 
|---|
| 1114 |  | 
|---|
| 1115 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 
|---|
| 1116 |  | 
|---|
| 1117 | struct Q_EXPORT QTextParagraphSelection | 
|---|
| 1118 | { | 
|---|
| 1119 | int start, end; | 
|---|
| 1120 | Q_DUMMY_COMPARISON_OPERATOR(QTextParagraphSelection) | 
|---|
| 1121 | }; | 
|---|
| 1122 |  | 
|---|
| 1123 | struct Q_EXPORT QTextLineStart | 
|---|
| 1124 | { | 
|---|
| 1125 | QTextLineStart() : y( 0 ), baseLine( 0 ), h( 0 ) | 
|---|
| 1126 | {  } | 
|---|
| 1127 | QTextLineStart( int y_, int bl, int h_ ) : y( y_ ), baseLine( bl ), h( h_ ), | 
|---|
| 1128 | w( 0 ) | 
|---|
| 1129 | {  } | 
|---|
| 1130 |  | 
|---|
| 1131 | public: | 
|---|
| 1132 | int y, baseLine, h; | 
|---|
| 1133 | int w; | 
|---|
| 1134 | }; | 
|---|
| 1135 |  | 
|---|
| 1136 | #if defined(Q_TEMPLATEDLL) | 
|---|
| 1137 | // MOC_SKIP_BEGIN | 
|---|
| 1138 | Q_TEMPLATE_EXTERN template class Q_EXPORT QMap<int, QTextParagraphSelection>; | 
|---|
| 1139 | Q_TEMPLATE_EXTERN template class Q_EXPORT QMap<int, QTextLineStart*>; | 
|---|
| 1140 | // MOC_SKIP_END | 
|---|
| 1141 | #endif | 
|---|
| 1142 |  | 
|---|
| 1143 | class Q_EXPORT QTextParagraphData | 
|---|
| 1144 | { | 
|---|
| 1145 | public: | 
|---|
| 1146 | QTextParagraphData() {} | 
|---|
| 1147 | virtual ~QTextParagraphData(); | 
|---|
| 1148 | virtual void join( QTextParagraphData * ); | 
|---|
| 1149 | }; | 
|---|
| 1150 |  | 
|---|
| 1151 | class QTextParagraphPseudoDocument; | 
|---|
| 1152 |  | 
|---|
| 1153 | class QSyntaxHighlighter; | 
|---|
| 1154 |  | 
|---|
| 1155 | class Q_EXPORT QTextParagraph | 
|---|
| 1156 | { | 
|---|
| 1157 | friend class QTextDocument; | 
|---|
| 1158 | friend class QTextCursor; | 
|---|
| 1159 | friend class QSyntaxHighlighter; | 
|---|
| 1160 |  | 
|---|
| 1161 | public: | 
|---|
| 1162 | QTextParagraph( QTextDocument *d, QTextParagraph *pr = 0, QTextParagraph *nx = 0, bool updateIds = TRUE ); | 
|---|
| 1163 | ~QTextParagraph(); | 
|---|
| 1164 |  | 
|---|
| 1165 | QTextString *string() const; | 
|---|
| 1166 | QTextStringChar *at( int i ) const; // maybe remove later | 
|---|
| 1167 | int leftGap() const; | 
|---|
| 1168 | int length() const; // maybe remove later | 
|---|
| 1169 |  | 
|---|
| 1170 | void setListStyle( QStyleSheetItem::ListStyle ls ) { lstyle = ls; changed = TRUE; } | 
|---|
| 1171 | QStyleSheetItem::ListStyle listStyle() const { return (QStyleSheetItem::ListStyle)lstyle; } | 
|---|
| 1172 | void setListItem( bool li ); | 
|---|
| 1173 | bool isListItem() const { return litem; } | 
|---|
| 1174 | void setListValue( int v ) { list_val = v; } | 
|---|
| 1175 | int listValue() const { return list_val > 0 ? list_val : -1; } | 
|---|
| 1176 |  | 
|---|
| 1177 | void setListDepth( int depth ); | 
|---|
| 1178 | int listDepth() const { return ldepth; } | 
|---|
| 1179 |  | 
|---|
| 1180 | //     void setFormat( QTextFormat *fm ); | 
|---|
| 1181 | //     QTextFormat *paragFormat() const; | 
|---|
| 1182 |  | 
|---|
| 1183 | inline QTextDocument *document() const { | 
|---|
| 1184 | if (hasdoc) return (QTextDocument*) docOrPseudo; | 
|---|
| 1185 | return 0; | 
|---|
| 1186 | } | 
|---|
| 1187 | QTextParagraphPseudoDocument *pseudoDocument() const; | 
|---|
| 1188 |  | 
|---|
| 1189 | QRect rect() const; | 
|---|
| 1190 | void setHeight( int h ) { r.setHeight( h ); } | 
|---|
| 1191 | void show(); | 
|---|
| 1192 | void hide(); | 
|---|
| 1193 | bool isVisible() const { return visible; } | 
|---|
| 1194 |  | 
|---|
| 1195 | QTextParagraph *prev() const; | 
|---|
| 1196 | QTextParagraph *next() const; | 
|---|
| 1197 | void setPrev( QTextParagraph *s ); | 
|---|
| 1198 | void setNext( QTextParagraph *s ); | 
|---|
| 1199 |  | 
|---|
| 1200 | void insert( int index, const QString &s ); | 
|---|
| 1201 | void insert( int index, const QChar *unicode, int len ); | 
|---|
| 1202 | void append( const QString &s, bool reallyAtEnd = FALSE ); | 
|---|
| 1203 | void truncate( int index ); | 
|---|
| 1204 | void remove( int index, int len ); | 
|---|
| 1205 | void join( QTextParagraph *s ); | 
|---|
| 1206 |  | 
|---|
| 1207 | void invalidate( int chr ); | 
|---|
| 1208 |  | 
|---|
| 1209 | void move( int &dy ); | 
|---|
| 1210 | void format( int start = -1, bool doMove = TRUE ); | 
|---|
| 1211 |  | 
|---|
| 1212 | bool isValid() const; | 
|---|
| 1213 | bool hasChanged() const; | 
|---|
| 1214 | void setChanged( bool b, bool recursive = FALSE ); | 
|---|
| 1215 |  | 
|---|
| 1216 | int lineHeightOfChar( int i, int *bl = 0, int *y = 0 ) const; | 
|---|
| 1217 | QTextStringChar *lineStartOfChar( int i, int *index = 0, int *line = 0 ) const; | 
|---|
| 1218 | int lines() const; | 
|---|
| 1219 | QTextStringChar *lineStartOfLine( int line, int *index = 0 ) const; | 
|---|
| 1220 | int lineY( int l ) const; | 
|---|
| 1221 | int lineBaseLine( int l ) const; | 
|---|
| 1222 | int lineHeight( int l ) const; | 
|---|
| 1223 | void lineInfo( int l, int &y, int &h, int &bl ) const; | 
|---|
| 1224 |  | 
|---|
| 1225 | void setSelection( int id, int start, int end ); | 
|---|
| 1226 | void removeSelection( int id ); | 
|---|
| 1227 | int selectionStart( int id ) const; | 
|---|
| 1228 | int selectionEnd( int id ) const; | 
|---|
| 1229 | bool hasSelection( int id ) const; | 
|---|
| 1230 | bool hasAnySelection() const; | 
|---|
| 1231 | bool fullSelected( int id ) const; | 
|---|
| 1232 |  | 
|---|
| 1233 | void setEndState( int s ); | 
|---|
| 1234 | int endState() const; | 
|---|
| 1235 |  | 
|---|
| 1236 | void setParagId( int i ); | 
|---|
| 1237 | int paragId() const; | 
|---|
| 1238 |  | 
|---|
| 1239 | bool firstPreProcess() const; | 
|---|
| 1240 | void setFirstPreProcess( bool b ); | 
|---|
| 1241 |  | 
|---|
| 1242 | void indent( int *oldIndent = 0, int *newIndent = 0 ); | 
|---|
| 1243 |  | 
|---|
| 1244 | void setExtraData( QTextParagraphData *data ); | 
|---|
| 1245 | QTextParagraphData *extraData() const; | 
|---|
| 1246 |  | 
|---|
| 1247 | QMap<int, QTextLineStart*> &lineStartList(); | 
|---|
| 1248 |  | 
|---|
| 1249 | void setFormat( int index, int len, QTextFormat *f, bool useCollection = TRUE, int flags = -1 ); | 
|---|
| 1250 |  | 
|---|
| 1251 | void setAlignment( int a ); | 
|---|
| 1252 | int alignment() const; | 
|---|
| 1253 |  | 
|---|
| 1254 | void paint( QPainter &painter, const QColorGroup &cg, QTextCursor *cursor = 0, bool drawSelections = FALSE, | 
|---|
| 1255 | int clipx = -1, int clipy = -1, int clipw = -1, int cliph = -1 ); | 
|---|
| 1256 |  | 
|---|
| 1257 | int topMargin() const; | 
|---|
| 1258 | int bottomMargin() const; | 
|---|
| 1259 | int leftMargin() const; | 
|---|
| 1260 | int firstLineMargin() const; | 
|---|
| 1261 | int rightMargin() const; | 
|---|
| 1262 | int lineSpacing() const; | 
|---|
| 1263 |  | 
|---|
| 1264 | #ifndef QT_NO_TEXTCUSTOMITEM | 
|---|
| 1265 | void registerFloatingItem( QTextCustomItem *i ); | 
|---|
| 1266 | void unregisterFloatingItem( QTextCustomItem *i ); | 
|---|
| 1267 | #endif | 
|---|
| 1268 |  | 
|---|
| 1269 | void setFullWidth( bool b ) { fullWidth = b; } | 
|---|
| 1270 | bool isFullWidth() const { return fullWidth; } | 
|---|
| 1271 |  | 
|---|
| 1272 | #ifndef QT_NO_TEXTCUSTOMITEM | 
|---|
| 1273 | QTextTableCell *tableCell() const; | 
|---|
| 1274 | #endif | 
|---|
| 1275 |  | 
|---|
| 1276 | QBrush *background() const; | 
|---|
| 1277 |  | 
|---|
| 1278 | int documentWidth() const; | 
|---|
| 1279 | int documentVisibleWidth() const; | 
|---|
| 1280 | int documentX() const; | 
|---|
| 1281 | int documentY() const; | 
|---|
| 1282 | QTextFormatCollection *formatCollection() const; | 
|---|
| 1283 | QTextFormatter *formatter() const; | 
|---|
| 1284 |  | 
|---|
| 1285 | int nextTab( int i, int x ); | 
|---|
| 1286 | int *tabArray() const; | 
|---|
| 1287 | void setTabArray( int *a ); | 
|---|
| 1288 | void setTabStops( int tw ); | 
|---|
| 1289 |  | 
|---|
| 1290 | void adjustToPainter( QPainter *p ); | 
|---|
| 1291 |  | 
|---|
| 1292 | void setNewLinesAllowed( bool b ); | 
|---|
| 1293 | bool isNewLinesAllowed() const; | 
|---|
| 1294 |  | 
|---|
| 1295 | QString richText() const; | 
|---|
| 1296 |  | 
|---|
| 1297 | void addCommand( QTextCommand *cmd ); | 
|---|
| 1298 | QTextCursor *undo( QTextCursor *c = 0 ); | 
|---|
| 1299 | QTextCursor *redo( QTextCursor *c  = 0 ); | 
|---|
| 1300 | QTextCommandHistory *commands() const; | 
|---|
| 1301 | void copyParagData( QTextParagraph *parag ); | 
|---|
| 1302 |  | 
|---|
| 1303 | void setBreakable( bool b ) { breakable = b; } | 
|---|
| 1304 | bool isBreakable() const { return breakable; } | 
|---|
| 1305 |  | 
|---|
| 1306 | void setBackgroundColor( const QColor &c ); | 
|---|
| 1307 | QColor *backgroundColor() const { return bgcol; } | 
|---|
| 1308 | void clearBackgroundColor(); | 
|---|
| 1309 |  | 
|---|
| 1310 | void setMovedDown( bool b ) { movedDown = b; } | 
|---|
| 1311 | bool wasMovedDown() const { return movedDown; } | 
|---|
| 1312 |  | 
|---|
| 1313 | void setDirection( QChar::Direction d ); | 
|---|
| 1314 | QChar::Direction direction() const; | 
|---|
| 1315 | void setPaintDevice( QPaintDevice *pd ) { paintdevice = pd; } | 
|---|
| 1316 |  | 
|---|
| 1317 | void readStyleInformation( QDataStream& stream ); | 
|---|
| 1318 | void writeStyleInformation( QDataStream& stream ) const; | 
|---|
| 1319 |  | 
|---|
| 1320 | protected: | 
|---|
| 1321 | void setColorForSelection( QColor &c, QPainter &p, const QColorGroup& cg, int selection ); | 
|---|
| 1322 | void drawLabel( QPainter* p, int x, int y, int w, int h, int base, const QColorGroup& cg ); | 
|---|
| 1323 | void drawString( QPainter &painter, const QString &str, int start, int len, int xstart, | 
|---|
| 1324 | int y, int baseLine, int w, int h, bool drawSelections, int fullSelectionWidth, | 
|---|
| 1325 | QTextStringChar *formatChar, const QColorGroup& cg, | 
|---|
| 1326 | bool rightToLeft ); | 
|---|
| 1327 |  | 
|---|
| 1328 | private: | 
|---|
| 1329 | QMap<int, QTextParagraphSelection> &selections() const; | 
|---|
| 1330 | #ifndef QT_NO_TEXTCUSTOMITEM | 
|---|
| 1331 | QPtrList<QTextCustomItem> &floatingItems() const; | 
|---|
| 1332 | #endif | 
|---|
| 1333 | QBrush backgroundBrush( const QColorGroup&cg ) { if ( bgcol ) return *bgcol; return cg.brush( QColorGroup::Base ); } | 
|---|
| 1334 | void invalidateStyleCache(); | 
|---|
| 1335 |  | 
|---|
| 1336 | QMap<int, QTextLineStart*> lineStarts; | 
|---|
| 1337 | QRect r; | 
|---|
| 1338 | QTextParagraph *p, *n; | 
|---|
| 1339 | void *docOrPseudo; | 
|---|
| 1340 | uint changed : 1; | 
|---|
| 1341 | uint firstFormat : 1; | 
|---|
| 1342 | uint firstPProcess : 1; | 
|---|
| 1343 | uint needPreProcess : 1; | 
|---|
| 1344 | uint fullWidth : 1; | 
|---|
| 1345 | uint lastInFrame : 1; | 
|---|
| 1346 | uint visible : 1; | 
|---|
| 1347 | uint breakable : 1; | 
|---|
| 1348 | uint movedDown : 1; | 
|---|
| 1349 | uint mightHaveCustomItems : 1; | 
|---|
| 1350 | uint hasdoc : 1; | 
|---|
| 1351 | uint litem : 1; // whether the paragraph is a list item | 
|---|
| 1352 | uint rtext : 1; // whether the paragraph needs rich text margin | 
|---|
| 1353 | int align : 4; | 
|---|
| 1354 | uint /*QStyleSheetItem::ListStyle*/ lstyle : 4; | 
|---|
| 1355 | int invalid; | 
|---|
| 1356 | int state, id; | 
|---|
| 1357 | QTextString *str; | 
|---|
| 1358 | QMap<int, QTextParagraphSelection> *mSelections; | 
|---|
| 1359 | #ifndef QT_NO_TEXTCUSTOMITEM | 
|---|
| 1360 | QPtrList<QTextCustomItem> *mFloatingItems; | 
|---|
| 1361 | #endif | 
|---|
| 1362 | short utm, ubm, ulm, urm, uflm, ulinespacing; | 
|---|
| 1363 | short tabStopWidth, minwidth; | 
|---|
| 1364 | int *tArray; | 
|---|
| 1365 | QTextParagraphData *eData; | 
|---|
| 1366 | short list_val; | 
|---|
| 1367 | ushort ldepth; | 
|---|
| 1368 | QColor *bgcol; | 
|---|
| 1369 | QPaintDevice *paintdevice; | 
|---|
| 1370 | }; | 
|---|
| 1371 |  | 
|---|
| 1372 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 
|---|
| 1373 |  | 
|---|
| 1374 | class Q_EXPORT QTextFormatter | 
|---|
| 1375 | { | 
|---|
| 1376 | public: | 
|---|
| 1377 | QTextFormatter(); | 
|---|
| 1378 | virtual ~QTextFormatter(); | 
|---|
| 1379 |  | 
|---|
| 1380 | virtual int format( QTextDocument *doc, QTextParagraph *parag, int start, const QMap<int, QTextLineStart*> &oldLineStarts ) = 0; | 
|---|
| 1381 | virtual int formatVertically( QTextDocument* doc, QTextParagraph* parag ); | 
|---|
| 1382 |  | 
|---|
| 1383 | bool isWrapEnabled( QTextParagraph *p ) const { if ( !wrapEnabled ) return FALSE; if ( p && !p->isBreakable() ) return FALSE; return TRUE;} | 
|---|
| 1384 | int wrapAtColumn() const { return wrapColumn;} | 
|---|
| 1385 | virtual void setWrapEnabled( bool b ); | 
|---|
| 1386 | virtual void setWrapAtColumn( int c ); | 
|---|
| 1387 | virtual void setAllowBreakInWords( bool b ) { biw = b; } | 
|---|
| 1388 | bool allowBreakInWords() const { return biw; } | 
|---|
| 1389 |  | 
|---|
| 1390 | int minimumWidth() const { return thisminw; } | 
|---|
| 1391 | int widthUsed() const { return thiswused; } | 
|---|
| 1392 |  | 
|---|
| 1393 | protected: | 
|---|
| 1394 | virtual QTextLineStart *formatLine( QTextParagraph *parag, QTextString *string, QTextLineStart *line, QTextStringChar *start, | 
|---|
| 1395 | QTextStringChar *last, int align = Qt::AlignAuto, int space = 0 ); | 
|---|
| 1396 | #ifndef QT_NO_COMPLEXTEXT | 
|---|
| 1397 | virtual QTextLineStart *bidiReorderLine( QTextParagraph *parag, QTextString *string, QTextLineStart *line, QTextStringChar *start, | 
|---|
| 1398 | QTextStringChar *last, int align, int space ); | 
|---|
| 1399 | #endif | 
|---|
| 1400 | void insertLineStart( QTextParagraph *parag, int index, QTextLineStart *ls ); | 
|---|
| 1401 |  | 
|---|
| 1402 | int thisminw; | 
|---|
| 1403 | int thiswused; | 
|---|
| 1404 |  | 
|---|
| 1405 | private: | 
|---|
| 1406 | bool wrapEnabled; | 
|---|
| 1407 | int wrapColumn; | 
|---|
| 1408 | bool biw; | 
|---|
| 1409 |  | 
|---|
| 1410 | #ifdef HAVE_THAI_BREAKS | 
|---|
| 1411 | static QCString *thaiCache; | 
|---|
| 1412 | static QTextString *cachedString; | 
|---|
| 1413 | static ThBreakIterator *thaiIt; | 
|---|
| 1414 | #endif | 
|---|
| 1415 | }; | 
|---|
| 1416 |  | 
|---|
| 1417 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 
|---|
| 1418 |  | 
|---|
| 1419 | class Q_EXPORT QTextFormatterBreakInWords : public QTextFormatter | 
|---|
| 1420 | { | 
|---|
| 1421 | public: | 
|---|
| 1422 | QTextFormatterBreakInWords(); | 
|---|
| 1423 | virtual ~QTextFormatterBreakInWords() {} | 
|---|
| 1424 |  | 
|---|
| 1425 | int format( QTextDocument *doc, QTextParagraph *parag, int start, const QMap<int, QTextLineStart*> &oldLineStarts ); | 
|---|
| 1426 |  | 
|---|
| 1427 | }; | 
|---|
| 1428 |  | 
|---|
| 1429 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 
|---|
| 1430 |  | 
|---|
| 1431 | class Q_EXPORT QTextFormatterBreakWords : public QTextFormatter | 
|---|
| 1432 | { | 
|---|
| 1433 | public: | 
|---|
| 1434 | QTextFormatterBreakWords(); | 
|---|
| 1435 | virtual ~QTextFormatterBreakWords() {} | 
|---|
| 1436 |  | 
|---|
| 1437 | int format( QTextDocument *doc, QTextParagraph *parag, int start, const QMap<int, QTextLineStart*> &oldLineStarts ); | 
|---|
| 1438 |  | 
|---|
| 1439 | }; | 
|---|
| 1440 |  | 
|---|
| 1441 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 
|---|
| 1442 |  | 
|---|
| 1443 | class Q_EXPORT QTextIndent | 
|---|
| 1444 | { | 
|---|
| 1445 | public: | 
|---|
| 1446 | QTextIndent(); | 
|---|
| 1447 | virtual ~QTextIndent() {} | 
|---|
| 1448 |  | 
|---|
| 1449 | virtual void indent( QTextDocument *doc, QTextParagraph *parag, int *oldIndent = 0, int *newIndent = 0 ) = 0; | 
|---|
| 1450 |  | 
|---|
| 1451 | }; | 
|---|
| 1452 |  | 
|---|
| 1453 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 
|---|
| 1454 |  | 
|---|
| 1455 | class Q_EXPORT QTextPreProcessor | 
|---|
| 1456 | { | 
|---|
| 1457 | public: | 
|---|
| 1458 | enum Ids { | 
|---|
| 1459 | Standard = 0 | 
|---|
| 1460 | }; | 
|---|
| 1461 |  | 
|---|
| 1462 | QTextPreProcessor(); | 
|---|
| 1463 | virtual ~QTextPreProcessor() {} | 
|---|
| 1464 |  | 
|---|
| 1465 | virtual void process( QTextDocument *doc, QTextParagraph *, int, bool = TRUE ) = 0; | 
|---|
| 1466 | virtual QTextFormat *format( int id ) = 0; | 
|---|
| 1467 |  | 
|---|
| 1468 | }; | 
|---|
| 1469 |  | 
|---|
| 1470 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 
|---|
| 1471 |  | 
|---|
| 1472 | class Q_EXPORT QTextFormat | 
|---|
| 1473 | { | 
|---|
| 1474 | friend class QTextFormatCollection; | 
|---|
| 1475 | friend class QTextDocument; | 
|---|
| 1476 |  | 
|---|
| 1477 | public: | 
|---|
| 1478 | enum Flags { | 
|---|
| 1479 | NoFlags, | 
|---|
| 1480 | Bold = 1, | 
|---|
| 1481 | Italic = 2, | 
|---|
| 1482 | Underline = 4, | 
|---|
| 1483 | Family = 8, | 
|---|
| 1484 | Size = 16, | 
|---|
| 1485 | Color = 32, | 
|---|
| 1486 | Misspelled = 64, | 
|---|
| 1487 | VAlign = 128, | 
|---|
| 1488 | StrikeOut= 256, | 
|---|
| 1489 | Font = Bold | Italic | Underline | Family | Size | StrikeOut, | 
|---|
| 1490 | Format = Font | Color | Misspelled | VAlign | 
|---|
| 1491 | }; | 
|---|
| 1492 |  | 
|---|
| 1493 | enum VerticalAlignment { AlignNormal, AlignSuperScript, AlignSubScript }; | 
|---|
| 1494 |  | 
|---|
| 1495 | QTextFormat(); | 
|---|
| 1496 | virtual ~QTextFormat(); | 
|---|
| 1497 |  | 
|---|
| 1498 | QTextFormat( const QStyleSheetItem *s ); | 
|---|
| 1499 | QTextFormat( const QFont &f, const QColor &c, QTextFormatCollection *parent = 0 ); | 
|---|
| 1500 | QTextFormat( const QTextFormat &fm ); | 
|---|
| 1501 | QTextFormat makeTextFormat( const QStyleSheetItem *style, const QMap<QString,QString>& attr, double scaleFontsFactor ) const; | 
|---|
| 1502 | QTextFormat& operator=( const QTextFormat &fm ); | 
|---|
| 1503 | QColor color() const; | 
|---|
| 1504 | QFont font() const; | 
|---|
| 1505 | QFontMetrics fontMetrics() const { return fm; } | 
|---|
| 1506 | bool isMisspelled() const; | 
|---|
| 1507 | VerticalAlignment vAlign() const; | 
|---|
| 1508 | int minLeftBearing() const; | 
|---|
| 1509 | int minRightBearing() const; | 
|---|
| 1510 | int width( const QChar &c ) const; | 
|---|
| 1511 | int width( const QString &str, int pos ) const; | 
|---|
| 1512 | int height() const; | 
|---|
| 1513 | int ascent() const; | 
|---|
| 1514 | int descent() const; | 
|---|
| 1515 | int leading() const; | 
|---|
| 1516 | bool useLinkColor() const; | 
|---|
| 1517 |  | 
|---|
| 1518 | void setBold( bool b ); | 
|---|
| 1519 | void setItalic( bool b ); | 
|---|
| 1520 | void setUnderline( bool b ); | 
|---|
| 1521 | void setStrikeOut( bool b ); | 
|---|
| 1522 | void setFamily( const QString &f ); | 
|---|
| 1523 | void setPointSize( int s ); | 
|---|
| 1524 | void setFont( const QFont &f ); | 
|---|
| 1525 | void setColor( const QColor &c ); | 
|---|
| 1526 | void setMisspelled( bool b ); | 
|---|
| 1527 | void setVAlign( VerticalAlignment a ); | 
|---|
| 1528 |  | 
|---|
| 1529 | bool operator==( const QTextFormat &f ) const; | 
|---|
| 1530 | QTextFormatCollection *parent() const; | 
|---|
| 1531 | const QString &key() const; | 
|---|
| 1532 |  | 
|---|
| 1533 | static QString getKey( const QFont &f, const QColor &c, bool misspelled, VerticalAlignment vAlign ); | 
|---|
| 1534 |  | 
|---|
| 1535 | void addRef(); | 
|---|
| 1536 | void removeRef(); | 
|---|
| 1537 |  | 
|---|
| 1538 | QString makeFormatChangeTags( QTextFormat* defaultFormat, QTextFormat *f, const QString& oldAnchorHref, const QString& anchorHref ) const; | 
|---|
| 1539 | QString makeFormatEndTags( QTextFormat* defaultFormat, const QString& anchorHref ) const; | 
|---|
| 1540 |  | 
|---|
| 1541 | static void setPainter( QPainter *p ); | 
|---|
| 1542 | static QPainter* painter(); | 
|---|
| 1543 |  | 
|---|
| 1544 | bool fontSizesInPixels() { return usePixelSizes; } | 
|---|
| 1545 |  | 
|---|
| 1546 | protected: | 
|---|
| 1547 | virtual void generateKey(); | 
|---|
| 1548 |  | 
|---|
| 1549 | private: | 
|---|
| 1550 | void update(); | 
|---|
| 1551 | static void applyFont( const QFont &f ); | 
|---|
| 1552 |  | 
|---|
| 1553 | private: | 
|---|
| 1554 | QFont fn; | 
|---|
| 1555 | QColor col; | 
|---|
| 1556 | QFontMetrics fm; | 
|---|
| 1557 | uint missp : 1; | 
|---|
| 1558 | uint linkColor : 1; | 
|---|
| 1559 | uint usePixelSizes : 1; | 
|---|
| 1560 | int leftBearing, rightBearing; | 
|---|
| 1561 | VerticalAlignment ha; | 
|---|
| 1562 | uchar widths[ 256 ]; | 
|---|
| 1563 | int hei, asc, dsc; | 
|---|
| 1564 | QTextFormatCollection *collection; | 
|---|
| 1565 | int ref; | 
|---|
| 1566 | QString k; | 
|---|
| 1567 | int logicalFontSize; | 
|---|
| 1568 | int stdSize; | 
|---|
| 1569 | static QPainter *pntr; | 
|---|
| 1570 | static QFontMetrics *pntr_fm; | 
|---|
| 1571 | static int pntr_asc; | 
|---|
| 1572 | static int pntr_hei; | 
|---|
| 1573 | static int pntr_ldg; | 
|---|
| 1574 | static int pntr_dsc; | 
|---|
| 1575 |  | 
|---|
| 1576 | }; | 
|---|
| 1577 |  | 
|---|
| 1578 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 
|---|
| 1579 |  | 
|---|
| 1580 | #if defined(Q_TEMPLATEDLL) | 
|---|
| 1581 | // MOC_SKIP_BEGIN | 
|---|
| 1582 | Q_TEMPLATE_EXTERN template class Q_EXPORT QDict<QTextFormat>; | 
|---|
| 1583 | // MOC_SKIP_END | 
|---|
| 1584 | #endif | 
|---|
| 1585 |  | 
|---|
| 1586 | class Q_EXPORT QTextFormatCollection | 
|---|
| 1587 | { | 
|---|
| 1588 | friend class QTextDocument; | 
|---|
| 1589 | friend class QTextFormat; | 
|---|
| 1590 |  | 
|---|
| 1591 | public: | 
|---|
| 1592 | QTextFormatCollection(); | 
|---|
| 1593 | virtual ~QTextFormatCollection(); | 
|---|
| 1594 |  | 
|---|
| 1595 | void setDefaultFormat( QTextFormat *f ); | 
|---|
| 1596 | QTextFormat *defaultFormat() const; | 
|---|
| 1597 | virtual QTextFormat *format( QTextFormat *f ); | 
|---|
| 1598 | virtual QTextFormat *format( QTextFormat *of, QTextFormat *nf, int flags ); | 
|---|
| 1599 | virtual QTextFormat *format( const QFont &f, const QColor &c ); | 
|---|
| 1600 | virtual void remove( QTextFormat *f ); | 
|---|
| 1601 | virtual QTextFormat *createFormat( const QTextFormat &f ) { return new QTextFormat( f ); } | 
|---|
| 1602 | virtual QTextFormat *createFormat( const QFont &f, const QColor &c ) { return new QTextFormat( f, c, this ); } | 
|---|
| 1603 |  | 
|---|
| 1604 | void updateDefaultFormat( const QFont &font, const QColor &c, QStyleSheet *sheet ); | 
|---|
| 1605 |  | 
|---|
| 1606 | QPaintDevice *paintDevice() const { return paintdevice; } | 
|---|
| 1607 | void setPaintDevice( QPaintDevice * ); | 
|---|
| 1608 |  | 
|---|
| 1609 | private: | 
|---|
| 1610 | void updateKeys(); | 
|---|
| 1611 |  | 
|---|
| 1612 | private: | 
|---|
| 1613 | QTextFormat *defFormat, *lastFormat, *cachedFormat; | 
|---|
| 1614 | QDict<QTextFormat> cKey; | 
|---|
| 1615 | QTextFormat *cres; | 
|---|
| 1616 | QFont cfont; | 
|---|
| 1617 | QColor ccol; | 
|---|
| 1618 | QString kof, knf; | 
|---|
| 1619 | int cflags; | 
|---|
| 1620 |  | 
|---|
| 1621 | QPaintDevice *paintdevice; | 
|---|
| 1622 | }; | 
|---|
| 1623 |  | 
|---|
| 1624 | class Q_EXPORT QTextParagraphPseudoDocument | 
|---|
| 1625 | { | 
|---|
| 1626 | public: | 
|---|
| 1627 | QTextParagraphPseudoDocument(); | 
|---|
| 1628 | ~QTextParagraphPseudoDocument(); | 
|---|
| 1629 | QRect docRect; | 
|---|
| 1630 | QTextFormatter *pFormatter; | 
|---|
| 1631 | QTextCommandHistory *commandHistory; | 
|---|
| 1632 | int minw; | 
|---|
| 1633 | int wused; | 
|---|
| 1634 | QTextFormatCollection collection; | 
|---|
| 1635 | }; | 
|---|
| 1636 |  | 
|---|
| 1637 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 
|---|
| 1638 |  | 
|---|
| 1639 | inline int QTextParagraph::length() const | 
|---|
| 1640 | { | 
|---|
| 1641 | return str->length(); | 
|---|
| 1642 | } | 
|---|
| 1643 |  | 
|---|
| 1644 | inline QRect QTextParagraph::rect() const | 
|---|
| 1645 | { | 
|---|
| 1646 | return r; | 
|---|
| 1647 | } | 
|---|
| 1648 |  | 
|---|
| 1649 | inline int QTextCursor::index() const | 
|---|
| 1650 | { | 
|---|
| 1651 | return idx; | 
|---|
| 1652 | } | 
|---|
| 1653 |  | 
|---|
| 1654 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 
|---|
| 1655 |  | 
|---|
| 1656 | inline int QTextDocument::x() const | 
|---|
| 1657 | { | 
|---|
| 1658 | return cx; | 
|---|
| 1659 | } | 
|---|
| 1660 |  | 
|---|
| 1661 | inline int QTextDocument::y() const | 
|---|
| 1662 | { | 
|---|
| 1663 | return cy; | 
|---|
| 1664 | } | 
|---|
| 1665 |  | 
|---|
| 1666 | inline int QTextDocument::width() const | 
|---|
| 1667 | { | 
|---|
| 1668 | return QMAX( cw, flow_->width() ); | 
|---|
| 1669 | } | 
|---|
| 1670 |  | 
|---|
| 1671 | inline int QTextDocument::visibleWidth() const | 
|---|
| 1672 | { | 
|---|
| 1673 | return vw; | 
|---|
| 1674 | } | 
|---|
| 1675 |  | 
|---|
| 1676 | inline QTextParagraph *QTextDocument::firstParagraph() const | 
|---|
| 1677 | { | 
|---|
| 1678 | return fParag; | 
|---|
| 1679 | } | 
|---|
| 1680 |  | 
|---|
| 1681 | inline QTextParagraph *QTextDocument::lastParagraph() const | 
|---|
| 1682 | { | 
|---|
| 1683 | return lParag; | 
|---|
| 1684 | } | 
|---|
| 1685 |  | 
|---|
| 1686 | inline void QTextDocument::setFirstParagraph( QTextParagraph *p ) | 
|---|
| 1687 | { | 
|---|
| 1688 | fParag = p; | 
|---|
| 1689 | } | 
|---|
| 1690 |  | 
|---|
| 1691 | inline void QTextDocument::setLastParagraph( QTextParagraph *p ) | 
|---|
| 1692 | { | 
|---|
| 1693 | lParag = p; | 
|---|
| 1694 | } | 
|---|
| 1695 |  | 
|---|
| 1696 | inline void QTextDocument::setWidth( int w ) | 
|---|
| 1697 | { | 
|---|
| 1698 | cw = QMAX( w, minw ); | 
|---|
| 1699 | flow_->setWidth( cw ); | 
|---|
| 1700 | vw = w; | 
|---|
| 1701 | } | 
|---|
| 1702 |  | 
|---|
| 1703 | inline int QTextDocument::minimumWidth() const | 
|---|
| 1704 | { | 
|---|
| 1705 | return minw; | 
|---|
| 1706 | } | 
|---|
| 1707 |  | 
|---|
| 1708 | inline void QTextDocument::setY( int y ) | 
|---|
| 1709 | { | 
|---|
| 1710 | cy = y; | 
|---|
| 1711 | } | 
|---|
| 1712 |  | 
|---|
| 1713 | inline int QTextDocument::leftMargin() const | 
|---|
| 1714 | { | 
|---|
| 1715 | return leftmargin; | 
|---|
| 1716 | } | 
|---|
| 1717 |  | 
|---|
| 1718 | inline void QTextDocument::setLeftMargin( int lm ) | 
|---|
| 1719 | { | 
|---|
| 1720 | leftmargin = lm; | 
|---|
| 1721 | } | 
|---|
| 1722 |  | 
|---|
| 1723 | inline int QTextDocument::rightMargin() const | 
|---|
| 1724 | { | 
|---|
| 1725 | return rightmargin; | 
|---|
| 1726 | } | 
|---|
| 1727 |  | 
|---|
| 1728 | inline void QTextDocument::setRightMargin( int rm ) | 
|---|
| 1729 | { | 
|---|
| 1730 | rightmargin = rm; | 
|---|
| 1731 | } | 
|---|
| 1732 |  | 
|---|
| 1733 | inline QTextPreProcessor *QTextDocument::preProcessor() const | 
|---|
| 1734 | { | 
|---|
| 1735 | return pProcessor; | 
|---|
| 1736 | } | 
|---|
| 1737 |  | 
|---|
| 1738 | inline void QTextDocument::setPreProcessor( QTextPreProcessor * sh ) | 
|---|
| 1739 | { | 
|---|
| 1740 | pProcessor = sh; | 
|---|
| 1741 | } | 
|---|
| 1742 |  | 
|---|
| 1743 | inline void QTextDocument::setFormatter( QTextFormatter *f ) | 
|---|
| 1744 | { | 
|---|
| 1745 | delete pFormatter; | 
|---|
| 1746 | pFormatter = f; | 
|---|
| 1747 | } | 
|---|
| 1748 |  | 
|---|
| 1749 | inline QTextFormatter *QTextDocument::formatter() const | 
|---|
| 1750 | { | 
|---|
| 1751 | return pFormatter; | 
|---|
| 1752 | } | 
|---|
| 1753 |  | 
|---|
| 1754 | inline void QTextDocument::setIndent( QTextIndent *i ) | 
|---|
| 1755 | { | 
|---|
| 1756 | indenter = i; | 
|---|
| 1757 | } | 
|---|
| 1758 |  | 
|---|
| 1759 | inline QTextIndent *QTextDocument::indent() const | 
|---|
| 1760 | { | 
|---|
| 1761 | return indenter; | 
|---|
| 1762 | } | 
|---|
| 1763 |  | 
|---|
| 1764 | inline QColor QTextDocument::selectionColor( int id ) const | 
|---|
| 1765 | { | 
|---|
| 1766 | return selectionColors[ id ]; | 
|---|
| 1767 | } | 
|---|
| 1768 |  | 
|---|
| 1769 | inline bool QTextDocument::invertSelectionText( int id ) const | 
|---|
| 1770 | { | 
|---|
| 1771 | return selectionText[ id ]; | 
|---|
| 1772 | } | 
|---|
| 1773 |  | 
|---|
| 1774 | inline void QTextDocument::setSelectionColor( int id, const QColor &c ) | 
|---|
| 1775 | { | 
|---|
| 1776 | selectionColors[ id ] = c; | 
|---|
| 1777 | } | 
|---|
| 1778 |  | 
|---|
| 1779 | inline void QTextDocument::setInvertSelectionText( int id, bool b ) | 
|---|
| 1780 | { | 
|---|
| 1781 | selectionText[ id ] = b; | 
|---|
| 1782 | } | 
|---|
| 1783 |  | 
|---|
| 1784 | inline QTextFormatCollection *QTextDocument::formatCollection() const | 
|---|
| 1785 | { | 
|---|
| 1786 | return fCollection; | 
|---|
| 1787 | } | 
|---|
| 1788 |  | 
|---|
| 1789 | inline int QTextDocument::alignment() const | 
|---|
| 1790 | { | 
|---|
| 1791 | return align; | 
|---|
| 1792 | } | 
|---|
| 1793 |  | 
|---|
| 1794 | inline void QTextDocument::setAlignment( int a ) | 
|---|
| 1795 | { | 
|---|
| 1796 | align = a; | 
|---|
| 1797 | } | 
|---|
| 1798 |  | 
|---|
| 1799 | inline int *QTextDocument::tabArray() const | 
|---|
| 1800 | { | 
|---|
| 1801 | return tArray; | 
|---|
| 1802 | } | 
|---|
| 1803 |  | 
|---|
| 1804 | inline int QTextDocument::tabStopWidth() const | 
|---|
| 1805 | { | 
|---|
| 1806 | return tStopWidth; | 
|---|
| 1807 | } | 
|---|
| 1808 |  | 
|---|
| 1809 | inline void QTextDocument::setTabArray( int *a ) | 
|---|
| 1810 | { | 
|---|
| 1811 | tArray = a; | 
|---|
| 1812 | } | 
|---|
| 1813 |  | 
|---|
| 1814 | inline void QTextDocument::setTabStops( int tw ) | 
|---|
| 1815 | { | 
|---|
| 1816 | tStopWidth = tw; | 
|---|
| 1817 | } | 
|---|
| 1818 |  | 
|---|
| 1819 | inline QString QTextDocument::originalText() const | 
|---|
| 1820 | { | 
|---|
| 1821 | if ( oTextValid ) | 
|---|
| 1822 | return oText; | 
|---|
| 1823 | return text(); | 
|---|
| 1824 | } | 
|---|
| 1825 |  | 
|---|
| 1826 | inline void QTextDocument::setFlow( QTextFlow *f ) | 
|---|
| 1827 | { | 
|---|
| 1828 | if ( flow_ ) | 
|---|
| 1829 | delete flow_; | 
|---|
| 1830 | flow_ = f; | 
|---|
| 1831 | } | 
|---|
| 1832 |  | 
|---|
| 1833 | inline void QTextDocument::takeFlow() | 
|---|
| 1834 | { | 
|---|
| 1835 | flow_ = 0; | 
|---|
| 1836 | } | 
|---|
| 1837 |  | 
|---|
| 1838 | inline bool QTextDocument::useDoubleBuffer( QTextParagraph *parag, QPainter *p ) | 
|---|
| 1839 | { | 
|---|
| 1840 | return ( !parag->document()->parent() || parag->document()->nextDoubleBuffered ) && | 
|---|
| 1841 | ( !p || !p->device() || p->device()->devType() != QInternal::Printer ); | 
|---|
| 1842 | } | 
|---|
| 1843 |  | 
|---|
| 1844 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 
|---|
| 1845 |  | 
|---|
| 1846 | inline QColor QTextFormat::color() const | 
|---|
| 1847 | { | 
|---|
| 1848 | return col; | 
|---|
| 1849 | } | 
|---|
| 1850 |  | 
|---|
| 1851 | inline QFont QTextFormat::font() const | 
|---|
| 1852 | { | 
|---|
| 1853 | return fn; | 
|---|
| 1854 | } | 
|---|
| 1855 |  | 
|---|
| 1856 | inline bool QTextFormat::isMisspelled() const | 
|---|
| 1857 | { | 
|---|
| 1858 | return missp; | 
|---|
| 1859 | } | 
|---|
| 1860 |  | 
|---|
| 1861 | inline QTextFormat::VerticalAlignment QTextFormat::vAlign() const | 
|---|
| 1862 | { | 
|---|
| 1863 | return ha; | 
|---|
| 1864 | } | 
|---|
| 1865 |  | 
|---|
| 1866 | inline bool QTextFormat::operator==( const QTextFormat &f ) const | 
|---|
| 1867 | { | 
|---|
| 1868 | return k == f.k; | 
|---|
| 1869 | } | 
|---|
| 1870 |  | 
|---|
| 1871 | inline QTextFormatCollection *QTextFormat::parent() const | 
|---|
| 1872 | { | 
|---|
| 1873 | return collection; | 
|---|
| 1874 | } | 
|---|
| 1875 |  | 
|---|
| 1876 | inline void QTextFormat::addRef() | 
|---|
| 1877 | { | 
|---|
| 1878 | ref++; | 
|---|
| 1879 | } | 
|---|
| 1880 |  | 
|---|
| 1881 | inline void QTextFormat::removeRef() | 
|---|
| 1882 | { | 
|---|
| 1883 | ref--; | 
|---|
| 1884 | if ( !collection ) | 
|---|
| 1885 | return; | 
|---|
| 1886 | if ( this == collection->defFormat ) | 
|---|
| 1887 | return; | 
|---|
| 1888 | if ( ref == 0 ) | 
|---|
| 1889 | collection->remove( this ); | 
|---|
| 1890 | } | 
|---|
| 1891 |  | 
|---|
| 1892 | inline const QString &QTextFormat::key() const | 
|---|
| 1893 | { | 
|---|
| 1894 | return k; | 
|---|
| 1895 | } | 
|---|
| 1896 |  | 
|---|
| 1897 | inline bool QTextFormat::useLinkColor() const | 
|---|
| 1898 | { | 
|---|
| 1899 | return linkColor; | 
|---|
| 1900 | } | 
|---|
| 1901 |  | 
|---|
| 1902 | inline QTextStringChar *QTextParagraph::at( int i ) const | 
|---|
| 1903 | { | 
|---|
| 1904 | return &str->at( i ); | 
|---|
| 1905 | } | 
|---|
| 1906 |  | 
|---|
| 1907 | inline bool QTextParagraph::isValid() const | 
|---|
| 1908 | { | 
|---|
| 1909 | return invalid == -1; | 
|---|
| 1910 | } | 
|---|
| 1911 |  | 
|---|
| 1912 | inline bool QTextParagraph::hasChanged() const | 
|---|
| 1913 | { | 
|---|
| 1914 | return changed; | 
|---|
| 1915 | } | 
|---|
| 1916 |  | 
|---|
| 1917 | inline void QTextParagraph::setBackgroundColor( const QColor & c ) | 
|---|
| 1918 | { | 
|---|
| 1919 | delete bgcol; | 
|---|
| 1920 | bgcol = new QColor( c ); | 
|---|
| 1921 | setChanged( TRUE ); | 
|---|
| 1922 | } | 
|---|
| 1923 |  | 
|---|
| 1924 | inline void QTextParagraph::clearBackgroundColor() | 
|---|
| 1925 | { | 
|---|
| 1926 | delete bgcol; bgcol = 0; setChanged( TRUE ); | 
|---|
| 1927 | } | 
|---|
| 1928 |  | 
|---|
| 1929 | inline void QTextParagraph::append( const QString &s, bool reallyAtEnd ) | 
|---|
| 1930 | { | 
|---|
| 1931 | if ( reallyAtEnd ) | 
|---|
| 1932 | insert( str->length(), s ); | 
|---|
| 1933 | else | 
|---|
| 1934 | insert( QMAX( str->length() - 1, 0 ), s ); | 
|---|
| 1935 | } | 
|---|
| 1936 |  | 
|---|
| 1937 | inline QTextParagraph *QTextParagraph::prev() const | 
|---|
| 1938 | { | 
|---|
| 1939 | return p; | 
|---|
| 1940 | } | 
|---|
| 1941 |  | 
|---|
| 1942 | inline QTextParagraph *QTextParagraph::next() const | 
|---|
| 1943 | { | 
|---|
| 1944 | return n; | 
|---|
| 1945 | } | 
|---|
| 1946 |  | 
|---|
| 1947 | inline bool QTextParagraph::hasAnySelection() const | 
|---|
| 1948 | { | 
|---|
| 1949 | return mSelections ? !selections().isEmpty() : FALSE; | 
|---|
| 1950 | } | 
|---|
| 1951 |  | 
|---|
| 1952 | inline void QTextParagraph::setEndState( int s ) | 
|---|
| 1953 | { | 
|---|
| 1954 | if ( s == state ) | 
|---|
| 1955 | return; | 
|---|
| 1956 | state = s; | 
|---|
| 1957 | } | 
|---|
| 1958 |  | 
|---|
| 1959 | inline int QTextParagraph::endState() const | 
|---|
| 1960 | { | 
|---|
| 1961 | return state; | 
|---|
| 1962 | } | 
|---|
| 1963 |  | 
|---|
| 1964 | inline void QTextParagraph::setParagId( int i ) | 
|---|
| 1965 | { | 
|---|
| 1966 | id = i; | 
|---|
| 1967 | } | 
|---|
| 1968 |  | 
|---|
| 1969 | inline int QTextParagraph::paragId() const | 
|---|
| 1970 | { | 
|---|
| 1971 | if ( id == -1 ) | 
|---|
| 1972 | qWarning( "invalid parag id!!!!!!!! (%p)", (void*)this ); | 
|---|
| 1973 | return id; | 
|---|
| 1974 | } | 
|---|
| 1975 |  | 
|---|
| 1976 | inline bool QTextParagraph::firstPreProcess() const | 
|---|
| 1977 | { | 
|---|
| 1978 | return firstPProcess; | 
|---|
| 1979 | } | 
|---|
| 1980 |  | 
|---|
| 1981 | inline void QTextParagraph::setFirstPreProcess( bool b ) | 
|---|
| 1982 | { | 
|---|
| 1983 | firstPProcess = b; | 
|---|
| 1984 | } | 
|---|
| 1985 |  | 
|---|
| 1986 | inline QMap<int, QTextLineStart*> &QTextParagraph::lineStartList() | 
|---|
| 1987 | { | 
|---|
| 1988 | return lineStarts; | 
|---|
| 1989 | } | 
|---|
| 1990 |  | 
|---|
| 1991 | inline QTextString *QTextParagraph::string() const | 
|---|
| 1992 | { | 
|---|
| 1993 | return str; | 
|---|
| 1994 | } | 
|---|
| 1995 |  | 
|---|
| 1996 | inline QTextParagraphPseudoDocument *QTextParagraph::pseudoDocument() const | 
|---|
| 1997 | { | 
|---|
| 1998 | if ( hasdoc ) | 
|---|
| 1999 | return 0; | 
|---|
| 2000 | return (QTextParagraphPseudoDocument*) docOrPseudo; | 
|---|
| 2001 | } | 
|---|
| 2002 |  | 
|---|
| 2003 |  | 
|---|
| 2004 | #ifndef QT_NO_TEXTCUSTOMITEM | 
|---|
| 2005 | inline QTextTableCell *QTextParagraph::tableCell() const | 
|---|
| 2006 | { | 
|---|
| 2007 | return hasdoc ? document()->tableCell () : 0; | 
|---|
| 2008 | } | 
|---|
| 2009 | #endif | 
|---|
| 2010 |  | 
|---|
| 2011 | inline QTextCommandHistory *QTextParagraph::commands() const | 
|---|
| 2012 | { | 
|---|
| 2013 | return hasdoc ? document()->commands() : pseudoDocument()->commandHistory; | 
|---|
| 2014 | } | 
|---|
| 2015 |  | 
|---|
| 2016 |  | 
|---|
| 2017 | inline int QTextParagraph::alignment() const | 
|---|
| 2018 | { | 
|---|
| 2019 | return align; | 
|---|
| 2020 | } | 
|---|
| 2021 |  | 
|---|
| 2022 | #ifndef QT_NO_TEXTCUSTOMITEM | 
|---|
| 2023 | inline void QTextParagraph::registerFloatingItem( QTextCustomItem *i ) | 
|---|
| 2024 | { | 
|---|
| 2025 | floatingItems().append( i ); | 
|---|
| 2026 | } | 
|---|
| 2027 |  | 
|---|
| 2028 | inline void QTextParagraph::unregisterFloatingItem( QTextCustomItem *i ) | 
|---|
| 2029 | { | 
|---|
| 2030 | floatingItems().removeRef( i ); | 
|---|
| 2031 | } | 
|---|
| 2032 | #endif | 
|---|
| 2033 |  | 
|---|
| 2034 | inline QBrush *QTextParagraph::background() const | 
|---|
| 2035 | { | 
|---|
| 2036 | #ifndef QT_NO_TEXTCUSTOMITEM | 
|---|
| 2037 | return tableCell() ? tableCell()->backGround() : 0; | 
|---|
| 2038 | #else | 
|---|
| 2039 | return 0; | 
|---|
| 2040 | #endif | 
|---|
| 2041 | } | 
|---|
| 2042 |  | 
|---|
| 2043 | inline int QTextParagraph::documentWidth() const | 
|---|
| 2044 | { | 
|---|
| 2045 | return hasdoc ? document()->width() : pseudoDocument()->docRect.width(); | 
|---|
| 2046 | } | 
|---|
| 2047 |  | 
|---|
| 2048 | inline int QTextParagraph::documentVisibleWidth() const | 
|---|
| 2049 | { | 
|---|
| 2050 | return hasdoc ? document()->visibleWidth() : pseudoDocument()->docRect.width(); | 
|---|
| 2051 | } | 
|---|
| 2052 |  | 
|---|
| 2053 | inline int QTextParagraph::documentX() const | 
|---|
| 2054 | { | 
|---|
| 2055 | return hasdoc ? document()->x() : pseudoDocument()->docRect.x(); | 
|---|
| 2056 | } | 
|---|
| 2057 |  | 
|---|
| 2058 | inline int QTextParagraph::documentY() const | 
|---|
| 2059 | { | 
|---|
| 2060 | return hasdoc ? document()->y() : pseudoDocument()->docRect.y(); | 
|---|
| 2061 | } | 
|---|
| 2062 |  | 
|---|
| 2063 | inline void QTextParagraph::setExtraData( QTextParagraphData *data ) | 
|---|
| 2064 | { | 
|---|
| 2065 | eData = data; | 
|---|
| 2066 | } | 
|---|
| 2067 |  | 
|---|
| 2068 | inline QTextParagraphData *QTextParagraph::extraData() const | 
|---|
| 2069 | { | 
|---|
| 2070 | return eData; | 
|---|
| 2071 | } | 
|---|
| 2072 |  | 
|---|
| 2073 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 
|---|
| 2074 |  | 
|---|
| 2075 | inline void QTextFormatCollection::setDefaultFormat( QTextFormat *f ) | 
|---|
| 2076 | { | 
|---|
| 2077 | defFormat = f; | 
|---|
| 2078 | } | 
|---|
| 2079 |  | 
|---|
| 2080 | inline QTextFormat *QTextFormatCollection::defaultFormat() const | 
|---|
| 2081 | { | 
|---|
| 2082 | return defFormat; | 
|---|
| 2083 | } | 
|---|
| 2084 |  | 
|---|
| 2085 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 
|---|
| 2086 |  | 
|---|
| 2087 | inline QTextFormat *QTextStringChar::format() const | 
|---|
| 2088 | { | 
|---|
| 2089 | return (type == Regular) ? d.format : d.custom->format; | 
|---|
| 2090 | } | 
|---|
| 2091 |  | 
|---|
| 2092 |  | 
|---|
| 2093 | #ifndef QT_NO_TEXTCUSTOMITEM | 
|---|
| 2094 | inline QTextCustomItem *QTextStringChar::customItem() const | 
|---|
| 2095 | { | 
|---|
| 2096 | return isCustom() ? d.custom->custom : 0; | 
|---|
| 2097 | } | 
|---|
| 2098 | #endif | 
|---|
| 2099 |  | 
|---|
| 2100 | inline int QTextStringChar::height() const | 
|---|
| 2101 | { | 
|---|
| 2102 | #ifndef QT_NO_TEXTCUSTOMITEM | 
|---|
| 2103 | return !isCustom() ? format()->height() : ( customItem()->placement() == QTextCustomItem::PlaceInline ? customItem()->height : 0 ); | 
|---|
| 2104 | #else | 
|---|
| 2105 | return format()->height(); | 
|---|
| 2106 | #endif | 
|---|
| 2107 | } | 
|---|
| 2108 |  | 
|---|
| 2109 | inline int QTextStringChar::ascent() const | 
|---|
| 2110 | { | 
|---|
| 2111 | #ifndef QT_NO_TEXTCUSTOMITEM | 
|---|
| 2112 | return !isCustom() ? format()->ascent() : ( customItem()->placement() == QTextCustomItem::PlaceInline ? customItem()->ascent() : 0 ); | 
|---|
| 2113 | #else | 
|---|
| 2114 | return format()->ascent(); | 
|---|
| 2115 | #endif | 
|---|
| 2116 | } | 
|---|
| 2117 |  | 
|---|
| 2118 | inline int QTextStringChar::descent() const | 
|---|
| 2119 | { | 
|---|
| 2120 | #ifndef QT_NO_TEXTCUSTOMITEM | 
|---|
| 2121 | return !isCustom() ? format()->descent() : 0; | 
|---|
| 2122 | #else | 
|---|
| 2123 | return format()->descent(); | 
|---|
| 2124 | #endif | 
|---|
| 2125 | } | 
|---|
| 2126 |  | 
|---|
| 2127 | #endif //QT_NO_RICHTEXT | 
|---|
| 2128 |  | 
|---|
| 2129 | #endif | 
|---|