author | ar <ar> | 2004-05-31 15:26:50 (UTC) |
---|---|---|
committer | ar <ar> | 2004-05-31 15:26:50 (UTC) |
commit | 27dfc34d411dee76f09f5e516c60b0a64eb35948 (patch) (unidiff) | |
tree | b7f7259497630390e352a1257cac5dc59f5399a6 /noncore/apps/opie-write/qrichtext_p.h | |
parent | 27b09fe4f930b96e82cea9fb0eb1a9b87f7ec062 (diff) | |
download | opie-27dfc34d411dee76f09f5e516c60b0a64eb35948.zip opie-27dfc34d411dee76f09f5e516c60b0a64eb35948.tar.gz opie-27dfc34d411dee76f09f5e516c60b0a64eb35948.tar.bz2 |
- convert qWarning to owarn
Diffstat (limited to 'noncore/apps/opie-write/qrichtext_p.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-write/qrichtext_p.h | 157 |
1 files changed, 80 insertions, 77 deletions
diff --git a/noncore/apps/opie-write/qrichtext_p.h b/noncore/apps/opie-write/qrichtext_p.h index e368edb..3778feb 100644 --- a/noncore/apps/opie-write/qrichtext_p.h +++ b/noncore/apps/opie-write/qrichtext_p.h | |||
@@ -41,24 +41,27 @@ | |||
41 | // | 41 | // |
42 | // W A R N I N G | 42 | // W A R N I N G |
43 | // ------------- | 43 | // ------------- |
44 | // | 44 | // |
45 | // This file is not part of the Qt API. It exists for the convenience | 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 | 46 | // of a number of Qt sources files. This header file may change from |
47 | // version to version without notice, or even be removed. | 47 | // version to version without notice, or even be removed. |
48 | // | 48 | // |
49 | // We mean it. | 49 | // We mean it. |
50 | // | 50 | // |
51 | // | 51 | // |
52 | 52 | ||
53 | #include <opie2/odebug.h> | ||
54 | using namespace Opie::Core; | ||
55 | |||
53 | #ifndef QT_H | 56 | #ifndef QT_H |
54 | #include "qstring.h" | 57 | #include "qstring.h" |
55 | #include "qlist.h" | 58 | #include "qlist.h" |
56 | #include "qrect.h" | 59 | #include "qrect.h" |
57 | #include "qfontmetrics.h" | 60 | #include "qfontmetrics.h" |
58 | #include "qintdict.h" | 61 | #include "qintdict.h" |
59 | #include "qmap.h" | 62 | #include "qmap.h" |
60 | #include "qstringlist.h" | 63 | #include "qstringlist.h" |
61 | #include "qfont.h" | 64 | #include "qfont.h" |
62 | #include "qcolor.h" | 65 | #include "qcolor.h" |
63 | #include "qsize.h" | 66 | #include "qsize.h" |
64 | #include "qvaluelist.h" | 67 | #include "qvaluelist.h" |
@@ -115,46 +118,46 @@ public: | |||
115 | 118 | ||
116 | int x; | 119 | int x; |
117 | int height() const; | 120 | int height() const; |
118 | int ascent() const; | 121 | int ascent() const; |
119 | int descent() const; | 122 | int descent() const; |
120 | bool isCustom() const { return (type & Custom) != 0; } | 123 | bool isCustom() const { return (type & Custom) != 0; } |
121 | QTextFormat *format() const; | 124 | QTextFormat *format() const; |
122 | QTextCustomItem *customItem() const; | 125 | QTextCustomItem *customItem() const; |
123 | void setFormat( QTextFormat *f ); | 126 | void setFormat( QTextFormat *f ); |
124 | void setCustomItem( QTextCustomItem *i ); | 127 | void setCustomItem( QTextCustomItem *i ); |
125 | struct CustomData | 128 | struct CustomData |
126 | { | 129 | { |
127 | QTextFormat *format; | 130 | QTextFormat *format; |
128 | QTextCustomItem *custom; | 131 | QTextCustomItem *custom; |
129 | QString anchorName; | 132 | QString anchorName; |
130 | QString anchorHref; | 133 | QString anchorHref; |
131 | }; | 134 | }; |
132 | 135 | ||
133 | void loseCustomItem(); | 136 | void loseCustomItem(); |
134 | 137 | ||
135 | union { | 138 | union { |
136 | QTextFormat* format; | 139 | QTextFormat* format; |
137 | CustomData* custom; | 140 | CustomData* custom; |
138 | } d; | 141 | } d; |
139 | 142 | ||
140 | bool isAnchor() const { return ( type & Anchor) != 0; } | 143 | bool isAnchor() const { return ( type & Anchor) != 0; } |
141 | QString anchorName() const; | 144 | QString anchorName() const; |
142 | QString anchorHref() const; | 145 | QString anchorHref() const; |
143 | void setAnchor( const QString& name, const QString& href ); | 146 | void setAnchor( const QString& name, const QString& href ); |
144 | 147 | ||
145 | private: | 148 | private: |
146 | QTextStringChar &operator=( const QTextStringChar & ) { | 149 | QTextStringChar &operator=( const QTextStringChar & ) { |
147 | //abort(); | 150 | //abort(); |
148 | return *this; | 151 | return *this; |
149 | } | 152 | } |
150 | friend class QComplexText; | 153 | friend class QComplexText; |
151 | friend class QTextParagraph; | 154 | friend class QTextParagraph; |
152 | }; | 155 | }; |
153 | 156 | ||
154 | #if defined(Q_TEMPLATEDLL) | 157 | #if defined(Q_TEMPLATEDLL) |
155 | // MOC_SKIP_BEGIN | 158 | // MOC_SKIP_BEGIN |
156 | Q_TEMPLATE_EXTERN template class Q_EXPORT QMemArray<QTextStringChar>; | 159 | Q_TEMPLATE_EXTERN template class Q_EXPORT QMemArray<QTextStringChar>; |
157 | // MOC_SKIP_END | 160 | // MOC_SKIP_END |
158 | #endif | 161 | #endif |
159 | 162 | ||
160 | class Q_EXPORT QTextString | 163 | class Q_EXPORT QTextString |
@@ -199,32 +202,32 @@ private: | |||
199 | void checkBidi() const; | 202 | void checkBidi() const; |
200 | 203 | ||
201 | QMemArray<QTextStringChar> data; | 204 | QMemArray<QTextStringChar> data; |
202 | uint bidiDirty : 1; | 205 | uint bidiDirty : 1; |
203 | uint bidi : 1; // true when the paragraph has right to left characters | 206 | uint bidi : 1; // true when the paragraph has right to left characters |
204 | uint rightToLeft : 1; | 207 | uint rightToLeft : 1; |
205 | uint dir : 5; | 208 | uint dir : 5; |
206 | }; | 209 | }; |
207 | 210 | ||
208 | inline bool QTextString::isBidi() const | 211 | inline bool QTextString::isBidi() const |
209 | { | 212 | { |
210 | if ( bidiDirty ) | 213 | if ( bidiDirty ) |
211 | checkBidi(); | 214 | checkBidi(); |
212 | return bidi; | 215 | return bidi; |
213 | } | 216 | } |
214 | 217 | ||
215 | inline bool QTextString::isRightToLeft() const | 218 | inline bool QTextString::isRightToLeft() const |
216 | { | 219 | { |
217 | if ( bidiDirty ) | 220 | if ( bidiDirty ) |
218 | checkBidi(); | 221 | checkBidi(); |
219 | return rightToLeft; | 222 | return rightToLeft; |
220 | } | 223 | } |
221 | 224 | ||
222 | inline QChar::Direction QTextString::direction() const | 225 | inline QChar::Direction QTextString::direction() const |
223 | { | 226 | { |
224 | return (QChar::Direction) dir; | 227 | return (QChar::Direction) dir; |
225 | } | 228 | } |
226 | 229 | ||
227 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 230 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
228 | 231 | ||
229 | #if defined(Q_TEMPLATEDLL) | 232 | #if defined(Q_TEMPLATEDLL) |
230 | // MOC_SKIP_BEGIN | 233 | // MOC_SKIP_BEGIN |
@@ -375,25 +378,25 @@ private: | |||
375 | 378 | ||
376 | inline QTextCommandHistory::~QTextCommandHistory() | 379 | inline QTextCommandHistory::~QTextCommandHistory() |
377 | { | 380 | { |
378 | clear(); | 381 | clear(); |
379 | } | 382 | } |
380 | 383 | ||
381 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 384 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
382 | 385 | ||
383 | class Q_EXPORT QTextCustomItem | 386 | class Q_EXPORT QTextCustomItem |
384 | { | 387 | { |
385 | public: | 388 | public: |
386 | QTextCustomItem( QTextDocument *p ) | 389 | QTextCustomItem( QTextDocument *p ) |
387 | : xpos(0), ypos(-1), width(-1), height(0), parent( p ) | 390 | : xpos(0), ypos(-1), width(-1), height(0), parent( p ) |
388 | {} | 391 | {} |
389 | virtual ~QTextCustomItem(); | 392 | virtual ~QTextCustomItem(); |
390 | virtual void draw(QPainter* p, int x, int y, int cx, int cy, int cw, int ch, const QColorGroup& cg, bool selected ) = 0; | 393 | virtual void draw(QPainter* p, int x, int y, int cx, int cy, int cw, int ch, const QColorGroup& cg, bool selected ) = 0; |
391 | 394 | ||
392 | virtual void adjustToPainter( QPainter* ); | 395 | virtual void adjustToPainter( QPainter* ); |
393 | 396 | ||
394 | enum Placement { PlaceInline = 0, PlaceLeft, PlaceRight }; | 397 | enum Placement { PlaceInline = 0, PlaceLeft, PlaceRight }; |
395 | virtual Placement placement() const; | 398 | virtual Placement placement() const; |
396 | bool placeInline() { return placement() == PlaceInline; } | 399 | bool placeInline() { return placement() == PlaceInline; } |
397 | 400 | ||
398 | virtual bool ownLine() const; | 401 | virtual bool ownLine() const; |
399 | virtual void resize( int nwidth ); | 402 | virtual void resize( int nwidth ); |
@@ -429,50 +432,50 @@ public: | |||
429 | }; | 432 | }; |
430 | 433 | ||
431 | #if defined(Q_TEMPLATEDLL) | 434 | #if defined(Q_TEMPLATEDLL) |
432 | // MOC_SKIP_BEGIN | 435 | // MOC_SKIP_BEGIN |
433 | Q_TEMPLATE_EXTERN template class Q_EXPORT QMap<QString, QString>; | 436 | Q_TEMPLATE_EXTERN template class Q_EXPORT QMap<QString, QString>; |
434 | // MOC_SKIP_END | 437 | // MOC_SKIP_END |
435 | #endif | 438 | #endif |
436 | 439 | ||
437 | class Q_EXPORT QTextImage : public QTextCustomItem | 440 | class Q_EXPORT QTextImage : public QTextCustomItem |
438 | { | 441 | { |
439 | public: | 442 | public: |
440 | QTextImage( QTextDocument *p, const QMap<QString, QString> &attr, const QString& context, | 443 | QTextImage( QTextDocument *p, const QMap<QString, QString> &attr, const QString& context, |
441 | QMimeSourceFactory &factory ); | 444 | QMimeSourceFactory &factory ); |
442 | virtual ~QTextImage(); | 445 | virtual ~QTextImage(); |
443 | 446 | ||
444 | Placement placement() const { return place; } | 447 | Placement placement() const { return place; } |
445 | void adjustToPainter( QPainter* ); | 448 | void adjustToPainter( QPainter* ); |
446 | int minimumWidth() const { return width; } | 449 | int minimumWidth() const { return width; } |
447 | 450 | ||
448 | QString richText() const; | 451 | QString richText() const; |
449 | 452 | ||
450 | void draw( QPainter* p, int x, int y, int cx, int cy, int cw, int ch, const QColorGroup& cg, bool selected ); | 453 | void draw( QPainter* p, int x, int y, int cx, int cy, int cw, int ch, const QColorGroup& cg, bool selected ); |
451 | 454 | ||
452 | private: | 455 | private: |
453 | QRegion* reg; | 456 | QRegion* reg; |
454 | QPixmap pm; | 457 | QPixmap pm; |
455 | Placement place; | 458 | Placement place; |
456 | int tmpwidth, tmpheight; | 459 | int tmpwidth, tmpheight; |
457 | QMap<QString, QString> attributes; | 460 | QMap<QString, QString> attributes; |
458 | QString imgId; | 461 | QString imgId; |
459 | 462 | ||
460 | }; | 463 | }; |
461 | 464 | ||
462 | class Q_EXPORT QTextHorizontalLine : public QTextCustomItem | 465 | class Q_EXPORT QTextHorizontalLine : public QTextCustomItem |
463 | { | 466 | { |
464 | public: | 467 | public: |
465 | QTextHorizontalLine( QTextDocument *p, const QMap<QString, QString> &attr, const QString& context, | 468 | QTextHorizontalLine( QTextDocument *p, const QMap<QString, QString> &attr, const QString& context, |
466 | QMimeSourceFactory &factory ); | 469 | QMimeSourceFactory &factory ); |
467 | virtual ~QTextHorizontalLine(); | 470 | virtual ~QTextHorizontalLine(); |
468 | 471 | ||
469 | void adjustToPainter( QPainter* ); | 472 | void adjustToPainter( QPainter* ); |
470 | void draw(QPainter* p, int x, int y, int cx, int cy, int cw, int ch, const QColorGroup& cg, bool selected ); | 473 | void draw(QPainter* p, int x, int y, int cx, int cy, int cw, int ch, const QColorGroup& cg, bool selected ); |
471 | QString richText() const; | 474 | QString richText() const; |
472 | 475 | ||
473 | bool ownLine() const { return TRUE; } | 476 | bool ownLine() const { return TRUE; } |
474 | 477 | ||
475 | private: | 478 | private: |
476 | int tmpheight; | 479 | int tmpheight; |
477 | QColor color; | 480 | QColor color; |
478 | 481 | ||
@@ -523,29 +526,29 @@ private: | |||
523 | }; | 526 | }; |
524 | 527 | ||
525 | inline int QTextFlow::width() const { return w; } | 528 | inline int QTextFlow::width() const { return w; } |
526 | 529 | ||
527 | class QTextTable; | 530 | class QTextTable; |
528 | 531 | ||
529 | class Q_EXPORT QTextTableCell : public QLayoutItem | 532 | class Q_EXPORT QTextTableCell : public QLayoutItem |
530 | { | 533 | { |
531 | friend class QTextTable; | 534 | friend class QTextTable; |
532 | 535 | ||
533 | public: | 536 | public: |
534 | QTextTableCell( QTextTable* table, | 537 | QTextTableCell( QTextTable* table, |
535 | int row, int column, | 538 | int row, int column, |
536 | const QMap<QString, QString> &attr, | 539 | const QMap<QString, QString> &attr, |
537 | const QStyleSheetItem* style, | 540 | const QStyleSheetItem* style, |
538 | const QTextFormat& fmt, const QString& context, | 541 | const QTextFormat& fmt, const QString& context, |
539 | QMimeSourceFactory &factory, QStyleSheet *sheet, const QString& doc ); | 542 | QMimeSourceFactory &factory, QStyleSheet *sheet, const QString& doc ); |
540 | virtual ~QTextTableCell(); | 543 | virtual ~QTextTableCell(); |
541 | 544 | ||
542 | QSize sizeHint() const ; | 545 | QSize sizeHint() const ; |
543 | QSize minimumSize() const ; | 546 | QSize minimumSize() const ; |
544 | QSize maximumSize() const ; | 547 | QSize maximumSize() const ; |
545 | QSizePolicy::ExpandData expanding() const; | 548 | QSizePolicy::ExpandData expanding() const; |
546 | bool isEmpty() const; | 549 | bool isEmpty() const; |
547 | void setGeometry( const QRect& ) ; | 550 | void setGeometry( const QRect& ) ; |
548 | QRect geometry() const; | 551 | QRect geometry() const; |
549 | 552 | ||
550 | bool hasHeightForWidth() const; | 553 | bool hasHeightForWidth() const; |
551 | int heightForWidth( int ) const; | 554 | int heightForWidth( int ) const; |
@@ -597,25 +600,25 @@ Q_TEMPLATE_EXTERN template class Q_EXPORT QMap<QTextCursor*, int>; | |||
597 | 600 | ||
598 | class Q_EXPORT QTextTable: public QTextCustomItem | 601 | class Q_EXPORT QTextTable: public QTextCustomItem |
599 | { | 602 | { |
600 | friend class QTextTableCell; | 603 | friend class QTextTableCell; |
601 | 604 | ||
602 | public: | 605 | public: |
603 | QTextTable( QTextDocument *p, const QMap<QString, QString> &attr ); | 606 | QTextTable( QTextDocument *p, const QMap<QString, QString> &attr ); |
604 | virtual ~QTextTable(); | 607 | virtual ~QTextTable(); |
605 | 608 | ||
606 | void adjustToPainter( QPainter *p ); | 609 | void adjustToPainter( QPainter *p ); |
607 | void pageBreak( int y, QTextFlow* flow ); | 610 | void pageBreak( int y, QTextFlow* flow ); |
608 | void draw( QPainter* p, int x, int y, int cx, int cy, int cw, int ch, | 611 | void draw( QPainter* p, int x, int y, int cx, int cy, int cw, int ch, |
609 | const QColorGroup& cg, bool selected ); | 612 | const QColorGroup& cg, bool selected ); |
610 | 613 | ||
611 | bool noErase() const { return TRUE; } | 614 | bool noErase() const { return TRUE; } |
612 | bool ownLine() const { return TRUE; } | 615 | bool ownLine() const { return TRUE; } |
613 | Placement placement() const { return place; } | 616 | Placement placement() const { return place; } |
614 | bool isNested() const { return TRUE; } | 617 | bool isNested() const { return TRUE; } |
615 | void resize( int nwidth ); | 618 | void resize( int nwidth ); |
616 | virtual void invalidate(); | 619 | virtual void invalidate(); |
617 | 620 | ||
618 | virtual bool enter( QTextCursor *c, QTextDocument *&doc, QTextParagraph *¶g, int &idx, int &ox, int &oy, bool atEnd = FALSE ); | 621 | virtual bool enter( QTextCursor *c, QTextDocument *&doc, QTextParagraph *¶g, int &idx, int &ox, int &oy, bool atEnd = FALSE ); |
619 | virtual bool enterAt( QTextCursor *c, QTextDocument *&doc, QTextParagraph *¶g, int &idx, int &ox, int &oy, const QPoint &pos ); | 622 | virtual bool enterAt( QTextCursor *c, QTextDocument *&doc, QTextParagraph *¶g, int &idx, int &ox, int &oy, const QPoint &pos ); |
620 | virtual bool next( QTextCursor *c, QTextDocument *&doc, QTextParagraph *¶g, int &idx, int &ox, int &oy ); | 623 | virtual bool next( QTextCursor *c, QTextDocument *&doc, QTextParagraph *¶g, int &idx, int &ox, int &oy ); |
621 | virtual bool prev( QTextCursor *c, QTextDocument *&doc, QTextParagraph *¶g, int &idx, int &ox, int &oy ); | 624 | virtual bool prev( QTextCursor *c, QTextDocument *&doc, QTextParagraph *¶g, int &idx, int &ox, int &oy ); |
@@ -675,27 +678,27 @@ Q_TEMPLATE_EXTERN template class Q_EXPORT QPtrList<QTextDocument>; | |||
675 | 678 | ||
676 | class Q_EXPORT QTextDocument : public QObject | 679 | class Q_EXPORT QTextDocument : public QObject |
677 | { | 680 | { |
678 | Q_OBJECT | 681 | Q_OBJECT |
679 | 682 | ||
680 | friend class QTextTableCell; | 683 | friend class QTextTableCell; |
681 | friend class QTextCursor; | 684 | friend class QTextCursor; |
682 | friend class QTextEdit; | 685 | friend class QTextEdit; |
683 | friend class QTextParagraph; | 686 | friend class QTextParagraph; |
684 | 687 | ||
685 | public: | 688 | public: |
686 | enum SelectionIds { | 689 | enum SelectionIds { |
687 | Standard = 0, | 690 | Standard = 0, |
688 | Temp = 32000 // This selection must not be drawn, it's used e.g. by undo/redo to | 691 | Temp = 32000 // This selection must not be drawn, it's used e.g. by undo/redo to |
689 | // remove multiple lines with removeSelectedText() | 692 | // remove multiple lines with removeSelectedText() |
690 | }; | 693 | }; |
691 | 694 | ||
692 | QTextDocument( QTextDocument *p ); | 695 | QTextDocument( QTextDocument *p ); |
693 | QTextDocument( QTextDocument *d, QTextFormatCollection *f ); | 696 | QTextDocument( QTextDocument *d, QTextFormatCollection *f ); |
694 | virtual ~QTextDocument(); | 697 | virtual ~QTextDocument(); |
695 | 698 | ||
696 | QTextDocument *parent() const { return par; } | 699 | QTextDocument *parent() const { return par; } |
697 | QTextParagraph *parentParagraph() const { return parentPar; } | 700 | QTextParagraph *parentParagraph() const { return parentPar; } |
698 | 701 | ||
699 | void setText( const QString &text, const QString &context ); | 702 | void setText( const QString &text, const QString &context ); |
700 | QMap<QString, QString> attributes() const { return attribs; } | 703 | QMap<QString, QString> attributes() const { return attribs; } |
701 | void setAttributes( const QMap<QString, QString> &attr ) { attribs = attr; } | 704 | void setAttributes( const QMap<QString, QString> &attr ) { attribs = attr; } |
@@ -782,29 +785,29 @@ public: | |||
782 | void setMimeSourceFactory( QMimeSourceFactory *f ) { if ( f ) factory_ = f; } | 785 | void setMimeSourceFactory( QMimeSourceFactory *f ) { if ( f ) factory_ = f; } |
783 | void setContext( const QString &c ) { if ( !c.isEmpty() ) contxt = c; } | 786 | void setContext( const QString &c ) { if ( !c.isEmpty() ) contxt = c; } |
784 | 787 | ||
785 | void setUnderlineLinks( bool b ); | 788 | void setUnderlineLinks( bool b ); |
786 | bool underlineLinks() const { return underlLinks; } | 789 | bool underlineLinks() const { return underlLinks; } |
787 | 790 | ||
788 | void setPaper( QBrush *brush ) { if ( backBrush ) delete backBrush; backBrush = brush; } | 791 | void setPaper( QBrush *brush ) { if ( backBrush ) delete backBrush; backBrush = brush; } |
789 | QBrush *paper() const { return backBrush; } | 792 | QBrush *paper() const { return backBrush; } |
790 | 793 | ||
791 | void doLayout( QPainter *p, int w ); | 794 | void doLayout( QPainter *p, int w ); |
792 | void draw( QPainter *p, const QRect& rect, const QColorGroup &cg, const QBrush *paper = 0 ); | 795 | void draw( QPainter *p, const QRect& rect, const QColorGroup &cg, const QBrush *paper = 0 ); |
793 | void drawParagraph( QPainter *p, QTextParagraph *parag, int cx, int cy, int cw, int ch, | 796 | void drawParagraph( QPainter *p, QTextParagraph *parag, int cx, int cy, int cw, int ch, |
794 | QPixmap *&doubleBuffer, const QColorGroup &cg, | 797 | QPixmap *&doubleBuffer, const QColorGroup &cg, |
795 | bool drawCursor, QTextCursor *cursor, bool resetChanged = TRUE ); | 798 | bool drawCursor, QTextCursor *cursor, bool resetChanged = TRUE ); |
796 | QTextParagraph *draw( QPainter *p, int cx, int cy, int cw, int ch, const QColorGroup &cg, | 799 | QTextParagraph *draw( QPainter *p, int cx, int cy, int cw, int ch, const QColorGroup &cg, |
797 | bool onlyChanged = FALSE, bool drawCursor = FALSE, QTextCursor *cursor = 0, | 800 | bool onlyChanged = FALSE, bool drawCursor = FALSE, QTextCursor *cursor = 0, |
798 | bool resetChanged = TRUE ); | 801 | bool resetChanged = TRUE ); |
799 | 802 | ||
800 | void registerCustomItem( QTextCustomItem *i, QTextParagraph *p ); | 803 | void registerCustomItem( QTextCustomItem *i, QTextParagraph *p ); |
801 | void unregisterCustomItem( QTextCustomItem *i, QTextParagraph *p ); | 804 | void unregisterCustomItem( QTextCustomItem *i, QTextParagraph *p ); |
802 | 805 | ||
803 | void setFlow( QTextFlow *f ); | 806 | void setFlow( QTextFlow *f ); |
804 | void takeFlow(); | 807 | void takeFlow(); |
805 | QTextFlow *flow() const { return flow_; } | 808 | QTextFlow *flow() const { return flow_; } |
806 | bool isPageBreakEnabled() const { return pages; } | 809 | bool isPageBreakEnabled() const { return pages; } |
807 | void setPageBreakEnabled( bool b ) { pages = b; } | 810 | void setPageBreakEnabled( bool b ) { pages = b; } |
808 | 811 | ||
809 | void setUseFormatCollection( bool b ) { useFC = b; } | 812 | void setUseFormatCollection( bool b ) { useFC = b; } |
810 | bool useFormatCollection() const { return useFC; } | 813 | bool useFormatCollection() const { return useFC; } |
@@ -849,40 +852,40 @@ public: | |||
849 | static bool endsWith( QString str, const QString &s); | 852 | static bool endsWith( QString str, const QString &s); |
850 | 853 | ||
851 | signals: | 854 | signals: |
852 | void minimumWidthChanged( int ); | 855 | void minimumWidthChanged( int ); |
853 | 856 | ||
854 | private: | 857 | private: |
855 | void init(); | 858 | void init(); |
856 | QPixmap *bufferPixmap( const QSize &s ); | 859 | QPixmap *bufferPixmap( const QSize &s ); |
857 | // HTML parser | 860 | // HTML parser |
858 | bool hasPrefix(const QChar* doc, int length, int pos, QChar c); | 861 | bool hasPrefix(const QChar* doc, int length, int pos, QChar c); |
859 | bool hasPrefix(const QChar* doc, int length, int pos, const QString& s); | 862 | bool hasPrefix(const QChar* doc, int length, int pos, const QString& s); |
860 | QTextCustomItem* parseTable( const QMap<QString, QString> &attr, const QTextFormat &fmt, | 863 | QTextCustomItem* parseTable( const QMap<QString, QString> &attr, const QTextFormat &fmt, |
861 | const QChar* doc, int length, int& pos, QTextParagraph *curpar ); | 864 | const QChar* doc, int length, int& pos, QTextParagraph *curpar ); |
862 | bool eatSpace(const QChar* doc, int length, int& pos, bool includeNbsp = FALSE ); | 865 | bool eatSpace(const QChar* doc, int length, int& pos, bool includeNbsp = FALSE ); |
863 | bool eat(const QChar* doc, int length, int& pos, QChar c); | 866 | bool eat(const QChar* doc, int length, int& pos, QChar c); |
864 | QString parseOpenTag(const QChar* doc, int length, int& pos, QMap<QString, QString> &attr, bool& emptyTag); | 867 | QString parseOpenTag(const QChar* doc, int length, int& pos, QMap<QString, QString> &attr, bool& emptyTag); |
865 | QString parseCloseTag( const QChar* doc, int length, int& pos ); | 868 | QString parseCloseTag( const QChar* doc, int length, int& pos ); |
866 | QChar parseHTMLSpecialChar(const QChar* doc, int length, int& pos); | 869 | QChar parseHTMLSpecialChar(const QChar* doc, int length, int& pos); |
867 | QString parseWord(const QChar* doc, int length, int& pos, bool lower = TRUE); | 870 | QString parseWord(const QChar* doc, int length, int& pos, bool lower = TRUE); |
868 | QChar parseChar(const QChar* doc, int length, int& pos, QStyleSheetItem::WhiteSpaceMode wsm ); | 871 | QChar parseChar(const QChar* doc, int length, int& pos, QStyleSheetItem::WhiteSpaceMode wsm ); |
869 | void setRichTextInternal( const QString &text, QTextCursor* cursor = 0 ); | 872 | void setRichTextInternal( const QString &text, QTextCursor* cursor = 0 ); |
870 | void setRichTextMarginsInternal( QPtrList< QPtrVector<QStyleSheetItem> >& styles, QTextParagraph* stylesPar ); | 873 | void setRichTextMarginsInternal( QPtrList< QPtrVector<QStyleSheetItem> >& styles, QTextParagraph* stylesPar ); |
871 | 874 | ||
872 | private: | 875 | private: |
873 | struct Q_EXPORT Focus { | 876 | struct Q_EXPORT Focus { |
874 | QTextParagraph *parag; | 877 | QTextParagraph *parag; |
875 | int start, len; | 878 | int start, len; |
876 | QString href; | 879 | QString href; |
877 | }; | 880 | }; |
878 | 881 | ||
879 | int cx, cy, cw, vw; | 882 | int cx, cy, cw, vw; |
880 | QTextParagraph *fParag, *lParag; | 883 | QTextParagraph *fParag, *lParag; |
881 | QTextPreProcessor *pProcessor; | 884 | QTextPreProcessor *pProcessor; |
882 | QMap<int, QColor> selectionColors; | 885 | QMap<int, QColor> selectionColors; |
883 | QMap<int, QTextDocumentSelection> selections; | 886 | QMap<int, QTextDocumentSelection> selections; |
884 | QMap<int, bool> selectionText; | 887 | QMap<int, bool> selectionText; |
885 | QTextCommandHistory *commandHistory; | 888 | QTextCommandHistory *commandHistory; |
886 | QTextFormatter *pFormatter; | 889 | QTextFormatter *pFormatter; |
887 | QTextIndent *indenter; | 890 | QTextIndent *indenter; |
888 | QTextFormatCollection *fCollection; | 891 | QTextFormatCollection *fCollection; |
@@ -922,48 +925,48 @@ private: | |||
922 | double scaleFontsFactor; | 925 | double scaleFontsFactor; |
923 | 926 | ||
924 | short list_tm,list_bm, list_lm, li_tm, li_bm, par_tm, par_bm; | 927 | short list_tm,list_bm, list_lm, li_tm, li_bm, par_tm, par_bm; |
925 | }; | 928 | }; |
926 | 929 | ||
927 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 930 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
928 | 931 | ||
929 | 932 | ||
930 | class Q_EXPORT QTextDeleteCommand : public QTextCommand | 933 | class Q_EXPORT QTextDeleteCommand : public QTextCommand |
931 | { | 934 | { |
932 | public: | 935 | public: |
933 | QTextDeleteCommand( QTextDocument *d, int i, int idx, const QMemArray<QTextStringChar> &str, | 936 | QTextDeleteCommand( QTextDocument *d, int i, int idx, const QMemArray<QTextStringChar> &str, |
934 | const QByteArray& oldStyle ); | 937 | const QByteArray& oldStyle ); |
935 | QTextDeleteCommand( QTextParagraph *p, int idx, const QMemArray<QTextStringChar> &str ); | 938 | QTextDeleteCommand( QTextParagraph *p, int idx, const QMemArray<QTextStringChar> &str ); |
936 | virtual ~QTextDeleteCommand(); | 939 | virtual ~QTextDeleteCommand(); |
937 | 940 | ||
938 | Commands type() const { return Delete; } | 941 | Commands type() const { return Delete; } |
939 | QTextCursor *execute( QTextCursor *c ); | 942 | QTextCursor *execute( QTextCursor *c ); |
940 | QTextCursor *unexecute( QTextCursor *c ); | 943 | QTextCursor *unexecute( QTextCursor *c ); |
941 | 944 | ||
942 | protected: | 945 | protected: |
943 | int id, index; | 946 | int id, index; |
944 | QTextParagraph *parag; | 947 | QTextParagraph *parag; |
945 | QMemArray<QTextStringChar> text; | 948 | QMemArray<QTextStringChar> text; |
946 | QByteArray styleInformation; | 949 | QByteArray styleInformation; |
947 | 950 | ||
948 | }; | 951 | }; |
949 | 952 | ||
950 | class Q_EXPORT QTextInsertCommand : public QTextDeleteCommand | 953 | class Q_EXPORT QTextInsertCommand : public QTextDeleteCommand |
951 | { | 954 | { |
952 | public: | 955 | public: |
953 | QTextInsertCommand( QTextDocument *d, int i, int idx, const QMemArray<QTextStringChar> &str, | 956 | QTextInsertCommand( QTextDocument *d, int i, int idx, const QMemArray<QTextStringChar> &str, |
954 | const QByteArray& oldStyleInfo ) | 957 | const QByteArray& oldStyleInfo ) |
955 | : QTextDeleteCommand( d, i, idx, str, oldStyleInfo ) {} | 958 | : QTextDeleteCommand( d, i, idx, str, oldStyleInfo ) {} |
956 | QTextInsertCommand( QTextParagraph *p, int idx, const QMemArray<QTextStringChar> &str ) | 959 | QTextInsertCommand( QTextParagraph *p, int idx, const QMemArray<QTextStringChar> &str ) |
957 | : QTextDeleteCommand( p, idx, str ) {} | 960 | : QTextDeleteCommand( p, idx, str ) {} |
958 | virtual ~QTextInsertCommand() {} | 961 | virtual ~QTextInsertCommand() {} |
959 | 962 | ||
960 | Commands type() const { return Insert; } | 963 | Commands type() const { return Insert; } |
961 | QTextCursor *execute( QTextCursor *c ) { return QTextDeleteCommand::unexecute( c ); } | 964 | QTextCursor *execute( QTextCursor *c ) { return QTextDeleteCommand::unexecute( c ); } |
962 | QTextCursor *unexecute( QTextCursor *c ) { return QTextDeleteCommand::execute( c ); } | 965 | QTextCursor *unexecute( QTextCursor *c ) { return QTextDeleteCommand::execute( c ); } |
963 | 966 | ||
964 | }; | 967 | }; |
965 | 968 | ||
966 | class Q_EXPORT QTextFormatCommand : public QTextCommand | 969 | class Q_EXPORT QTextFormatCommand : public QTextCommand |
967 | { | 970 | { |
968 | public: | 971 | public: |
969 | QTextFormatCommand( QTextDocument *d, int sid, int sidx, int eid, int eidx, const QMemArray<QTextStringChar> &old, QTextFormat *f, int fl ); | 972 | QTextFormatCommand( QTextDocument *d, int sid, int sidx, int eid, int eidx, const QMemArray<QTextStringChar> &old, QTextFormat *f, int fl ); |
@@ -1002,55 +1005,55 @@ private: | |||
1002 | 1005 | ||
1003 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 1006 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1004 | 1007 | ||
1005 | struct Q_EXPORT QTextParagraphSelection | 1008 | struct Q_EXPORT QTextParagraphSelection |
1006 | { | 1009 | { |
1007 | int start, end; | 1010 | int start, end; |
1008 | }; | 1011 | }; |
1009 | 1012 | ||
1010 | struct Q_EXPORT QTextLineStart | 1013 | struct Q_EXPORT QTextLineStart |
1011 | { | 1014 | { |
1012 | QTextLineStart() : y( 0 ), baseLine( 0 ), h( 0 ) | 1015 | QTextLineStart() : y( 0 ), baseLine( 0 ), h( 0 ) |
1013 | #ifndef QT_NO_COMPLEXTEXT | 1016 | #ifndef QT_NO_COMPLEXTEXT |
1014 | , bidicontext( 0 ) | 1017 | , bidicontext( 0 ) |
1015 | #endif | 1018 | #endif |
1016 | { } | 1019 | { } |
1017 | QTextLineStart( ushort y_, ushort bl, ushort h_ ) : y( y_ ), baseLine( bl ), h( h_ ), | 1020 | QTextLineStart( ushort y_, ushort bl, ushort h_ ) : y( y_ ), baseLine( bl ), h( h_ ), |
1018 | w( 0 ) | 1021 | w( 0 ) |
1019 | #ifndef QT_NO_COMPLEXTEXT | 1022 | #ifndef QT_NO_COMPLEXTEXT |
1020 | , bidicontext( 0 ) | 1023 | , bidicontext( 0 ) |
1021 | #endif | 1024 | #endif |
1022 | { } | 1025 | { } |
1023 | #ifndef QT_NO_COMPLEXTEXT | 1026 | #ifndef QT_NO_COMPLEXTEXT |
1024 | QTextLineStart( QBidiContext *c, QBidiStatus s ) : y(0), baseLine(0), h(0), | 1027 | QTextLineStart( QBidiContext *c, QBidiStatus s ) : y(0), baseLine(0), h(0), |
1025 | status( s ), bidicontext( c ) { if ( bidicontext ) bidicontext->ref(); } | 1028 | status( s ), bidicontext( c ) { if ( bidicontext ) bidicontext->ref(); } |
1026 | #endif | 1029 | #endif |
1027 | 1030 | ||
1028 | virtual ~QTextLineStart() | 1031 | virtual ~QTextLineStart() |
1029 | { | 1032 | { |
1030 | #ifndef QT_NO_COMPLEXTEXT | 1033 | #ifndef QT_NO_COMPLEXTEXT |
1031 | if ( bidicontext && bidicontext->deref() ) | 1034 | if ( bidicontext && bidicontext->deref() ) |
1032 | delete bidicontext; | 1035 | delete bidicontext; |
1033 | #endif | 1036 | #endif |
1034 | } | 1037 | } |
1035 | 1038 | ||
1036 | #ifndef QT_NO_COMPLEXTEXT | 1039 | #ifndef QT_NO_COMPLEXTEXT |
1037 | void setContext( QBidiContext *c ) { | 1040 | void setContext( QBidiContext *c ) { |
1038 | if ( c == bidicontext ) | 1041 | if ( c == bidicontext ) |
1039 | return; | 1042 | return; |
1040 | if ( bidicontext && bidicontext->deref() ) | 1043 | if ( bidicontext && bidicontext->deref() ) |
1041 | delete bidicontext; | 1044 | delete bidicontext; |
1042 | bidicontext = c; | 1045 | bidicontext = c; |
1043 | if ( bidicontext ) | 1046 | if ( bidicontext ) |
1044 | bidicontext->ref(); | 1047 | bidicontext->ref(); |
1045 | } | 1048 | } |
1046 | QBidiContext *context() const { return bidicontext; } | 1049 | QBidiContext *context() const { return bidicontext; } |
1047 | #endif | 1050 | #endif |
1048 | 1051 | ||
1049 | public: | 1052 | public: |
1050 | ushort y, baseLine, h; | 1053 | ushort y, baseLine, h; |
1051 | #ifndef QT_NO_COMPLEXTEXT | 1054 | #ifndef QT_NO_COMPLEXTEXT |
1052 | QBidiStatus status; | 1055 | QBidiStatus status; |
1053 | #endif | 1056 | #endif |
1054 | int w; | 1057 | int w; |
1055 | 1058 | ||
1056 | private: | 1059 | private: |
@@ -1174,25 +1177,25 @@ public: | |||
1174 | 1177 | ||
1175 | void setExtraData( QTextParagraphData *data ); | 1178 | void setExtraData( QTextParagraphData *data ); |
1176 | QTextParagraphData *extraData() const; | 1179 | QTextParagraphData *extraData() const; |
1177 | 1180 | ||
1178 | QMap<int, QTextLineStart*> &lineStartList(); | 1181 | QMap<int, QTextLineStart*> &lineStartList(); |
1179 | 1182 | ||
1180 | void setFormat( int index, int len, QTextFormat *f, bool useCollection = TRUE, int flags = -1 ); | 1183 | void setFormat( int index, int len, QTextFormat *f, bool useCollection = TRUE, int flags = -1 ); |
1181 | 1184 | ||
1182 | void setAlignment( int a ); | 1185 | void setAlignment( int a ); |
1183 | int alignment() const; | 1186 | int alignment() const; |
1184 | 1187 | ||
1185 | virtual void paint( QPainter &painter, const QColorGroup &cg, QTextCursor *cursor = 0, bool drawSelections = FALSE, | 1188 | virtual void paint( QPainter &painter, const QColorGroup &cg, QTextCursor *cursor = 0, bool drawSelections = FALSE, |
1186 | int clipx = -1, int clipy = -1, int clipw = -1, int cliph = -1 ); | 1189 | int clipx = -1, int clipy = -1, int clipw = -1, int cliph = -1 ); |
1187 | 1190 | ||
1188 | virtual int topMargin() const; | 1191 | virtual int topMargin() const; |
1189 | virtual int bottomMargin() const; | 1192 | virtual int bottomMargin() const; |
1190 | virtual int leftMargin() const; | 1193 | virtual int leftMargin() const; |
1191 | virtual int firstLineMargin() const; | 1194 | virtual int firstLineMargin() const; |
1192 | virtual int rightMargin() const; | 1195 | virtual int rightMargin() const; |
1193 | virtual int lineSpacing() const; | 1196 | virtual int lineSpacing() const; |
1194 | 1197 | ||
1195 | void registerFloatingItem( QTextCustomItem *i ); | 1198 | void registerFloatingItem( QTextCustomItem *i ); |
1196 | void unregisterFloatingItem( QTextCustomItem *i ); | 1199 | void unregisterFloatingItem( QTextCustomItem *i ); |
1197 | 1200 | ||
1198 | void setFullWidth( bool b ) { fullWidth = b; } | 1201 | void setFullWidth( bool b ) { fullWidth = b; } |
@@ -1237,27 +1240,27 @@ public: | |||
1237 | void setMovedDown( bool b ) { movedDown = b; } | 1240 | void setMovedDown( bool b ) { movedDown = b; } |
1238 | bool wasMovedDown() const { return movedDown; } | 1241 | bool wasMovedDown() const { return movedDown; } |
1239 | 1242 | ||
1240 | void setDirection( QChar::Direction d ); | 1243 | void setDirection( QChar::Direction d ); |
1241 | QChar::Direction direction() const; | 1244 | QChar::Direction direction() const; |
1242 | 1245 | ||
1243 | void readStyleInformation( QDataStream& stream ); | 1246 | void readStyleInformation( QDataStream& stream ); |
1244 | void writeStyleInformation( QDataStream& stream ) const; | 1247 | void writeStyleInformation( QDataStream& stream ) const; |
1245 | 1248 | ||
1246 | protected: | 1249 | protected: |
1247 | virtual void drawLabel( QPainter* p, int x, int y, int w, int h, int base, const QColorGroup& cg ); | 1250 | virtual void drawLabel( QPainter* p, int x, int y, int w, int h, int base, const QColorGroup& cg ); |
1248 | virtual void drawString( QPainter &painter, const QString &str, int start, int len, int xstart, | 1251 | virtual void drawString( QPainter &painter, const QString &str, int start, int len, int xstart, |
1249 | int y, int baseLine, int w, int h, int selection, | 1252 | int y, int baseLine, int w, int h, int selection, |
1250 | QTextStringChar *formatChar, const QColorGroup& cg, | 1253 | QTextStringChar *formatChar, const QColorGroup& cg, |
1251 | bool rightToLeft ); | 1254 | bool rightToLeft ); |
1252 | 1255 | ||
1253 | private: | 1256 | private: |
1254 | QMap<int, QTextParagraphSelection> &selections() const; | 1257 | QMap<int, QTextParagraphSelection> &selections() const; |
1255 | QPtrList<QTextCustomItem> &floatingItems() const; | 1258 | QPtrList<QTextCustomItem> &floatingItems() const; |
1256 | QBrush backgroundBrush( const QColorGroup&cg ) { if ( bgcol ) return *bgcol; return cg.brush( QColorGroup::Base ); } | 1259 | QBrush backgroundBrush( const QColorGroup&cg ) { if ( bgcol ) return *bgcol; return cg.brush( QColorGroup::Base ); } |
1257 | void invalidateStyleCache(); | 1260 | void invalidateStyleCache(); |
1258 | 1261 | ||
1259 | QMap<int, QTextLineStart*> lineStarts; | 1262 | QMap<int, QTextLineStart*> lineStarts; |
1260 | int invalid; | 1263 | int invalid; |
1261 | QRect r; | 1264 | QRect r; |
1262 | QTextParagraph *p, *n; | 1265 | QTextParagraph *p, *n; |
1263 | void *docOrPseudo; | 1266 | void *docOrPseudo; |
@@ -1306,28 +1309,28 @@ public: | |||
1306 | virtual void setWrapEnabled( bool b ); | 1309 | virtual void setWrapEnabled( bool b ); |
1307 | virtual void setWrapAtColumn( int c ); | 1310 | virtual void setWrapAtColumn( int c ); |
1308 | virtual void setAllowBreakInWords( bool b ) { biw = b; } | 1311 | virtual void setAllowBreakInWords( bool b ) { biw = b; } |
1309 | bool allowBreakInWords() const { return biw; } | 1312 | bool allowBreakInWords() const { return biw; } |
1310 | 1313 | ||
1311 | int minimumWidth() const { return thisminw; } | 1314 | int minimumWidth() const { return thisminw; } |
1312 | int widthUsed() const { return thiswused; } | 1315 | int widthUsed() const { return thiswused; } |
1313 | 1316 | ||
1314 | static bool isBreakable( QTextString *string, int pos ); | 1317 | static bool isBreakable( QTextString *string, int pos ); |
1315 | 1318 | ||
1316 | protected: | 1319 | protected: |
1317 | virtual QTextLineStart *formatLine( QTextParagraph *parag, QTextString *string, QTextLineStart *line, QTextStringChar *start, | 1320 | virtual QTextLineStart *formatLine( QTextParagraph *parag, QTextString *string, QTextLineStart *line, QTextStringChar *start, |
1318 | QTextStringChar *last, int align = Qt3::AlignAuto, int space = 0 ); | 1321 | QTextStringChar *last, int align = Qt3::AlignAuto, int space = 0 ); |
1319 | #ifndef QT_NO_COMPLEXTEXT | 1322 | #ifndef QT_NO_COMPLEXTEXT |
1320 | virtual QTextLineStart *bidiReorderLine( QTextParagraph *parag, QTextString *string, QTextLineStart *line, QTextStringChar *start, | 1323 | virtual QTextLineStart *bidiReorderLine( QTextParagraph *parag, QTextString *string, QTextLineStart *line, QTextStringChar *start, |
1321 | QTextStringChar *last, int align, int space ); | 1324 | QTextStringChar *last, int align, int space ); |
1322 | #endif | 1325 | #endif |
1323 | void insertLineStart( QTextParagraph *parag, int index, QTextLineStart *ls ); | 1326 | void insertLineStart( QTextParagraph *parag, int index, QTextLineStart *ls ); |
1324 | 1327 | ||
1325 | int thisminw; | 1328 | int thisminw; |
1326 | int thiswused; | 1329 | int thiswused; |
1327 | 1330 | ||
1328 | private: | 1331 | private: |
1329 | bool wrapEnabled; | 1332 | bool wrapEnabled; |
1330 | int wrapColumn; | 1333 | int wrapColumn; |
1331 | bool biw; | 1334 | bool biw; |
1332 | 1335 | ||
1333 | #ifdef HAVE_THAI_BREAKS | 1336 | #ifdef HAVE_THAI_BREAKS |
@@ -1370,56 +1373,56 @@ public: | |||
1370 | virtual ~QTextIndent() {} | 1373 | virtual ~QTextIndent() {} |
1371 | 1374 | ||
1372 | virtual void indent( QTextDocument *doc, QTextParagraph *parag, int *oldIndent = 0, int *newIndent = 0 ) = 0; | 1375 | virtual void indent( QTextDocument *doc, QTextParagraph *parag, int *oldIndent = 0, int *newIndent = 0 ) = 0; |
1373 | 1376 | ||
1374 | }; | 1377 | }; |
1375 | 1378 | ||
1376 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 1379 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1377 | 1380 | ||
1378 | class Q_EXPORT QTextPreProcessor | 1381 | class Q_EXPORT QTextPreProcessor |
1379 | { | 1382 | { |
1380 | public: | 1383 | public: |
1381 | enum Ids { | 1384 | enum Ids { |
1382 | Standard = 0 | 1385 | Standard = 0 |
1383 | }; | 1386 | }; |
1384 | 1387 | ||
1385 | QTextPreProcessor(); | 1388 | QTextPreProcessor(); |
1386 | virtual ~QTextPreProcessor() {} | 1389 | virtual ~QTextPreProcessor() {} |
1387 | 1390 | ||
1388 | virtual void process( QTextDocument *doc, QTextParagraph *, int, bool = TRUE ) = 0; | 1391 | virtual void process( QTextDocument *doc, QTextParagraph *, int, bool = TRUE ) = 0; |
1389 | virtual QTextFormat *format( int id ) = 0; | 1392 | virtual QTextFormat *format( int id ) = 0; |
1390 | 1393 | ||
1391 | }; | 1394 | }; |
1392 | 1395 | ||
1393 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 1396 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1394 | 1397 | ||
1395 | class Q_EXPORT QTextFormat | 1398 | class Q_EXPORT QTextFormat |
1396 | { | 1399 | { |
1397 | friend class QTextFormatCollection; | 1400 | friend class QTextFormatCollection; |
1398 | friend class QTextDocument; | 1401 | friend class QTextDocument; |
1399 | 1402 | ||
1400 | public: | 1403 | public: |
1401 | enum Flags { | 1404 | enum Flags { |
1402 | NoFlags, | 1405 | NoFlags, |
1403 | Bold = 1, | 1406 | Bold = 1, |
1404 | Italic = 2, | 1407 | Italic = 2, |
1405 | Underline = 4, | 1408 | Underline = 4, |
1406 | Family = 8, | 1409 | Family = 8, |
1407 | Size = 16, | 1410 | Size = 16, |
1408 | Color = 32, | 1411 | Color = 32, |
1409 | Misspelled = 64, | 1412 | Misspelled = 64, |
1410 | VAlign = 128, | 1413 | VAlign = 128, |
1411 | StrikeOut= 256, | 1414 | StrikeOut= 256, |
1412 | Font = Bold | Italic | Underline | Family | Size | StrikeOut, | 1415 | Font = Bold | Italic | Underline | Family | Size | StrikeOut, |
1413 | Format = Font | Color | Misspelled | VAlign | 1416 | Format = Font | Color | Misspelled | VAlign |
1414 | }; | 1417 | }; |
1415 | 1418 | ||
1416 | enum VerticalAlignment { AlignNormal, AlignSuperScript, AlignSubScript }; | 1419 | enum VerticalAlignment { AlignNormal, AlignSuperScript, AlignSubScript }; |
1417 | 1420 | ||
1418 | QTextFormat(); | 1421 | QTextFormat(); |
1419 | virtual ~QTextFormat(); | 1422 | virtual ~QTextFormat(); |
1420 | 1423 | ||
1421 | QTextFormat( const QStyleSheetItem *s ); | 1424 | QTextFormat( const QStyleSheetItem *s ); |
1422 | QTextFormat( const QFont &f, const QColor &c, QTextFormatCollection *parent = 0 ); | 1425 | QTextFormat( const QFont &f, const QColor &c, QTextFormatCollection *parent = 0 ); |
1423 | QTextFormat( const QTextFormat &fm ); | 1426 | QTextFormat( const QTextFormat &fm ); |
1424 | QTextFormat makeTextFormat( const QStyleSheetItem *style, const QMap<QString,QString>& attr, double scaleFontsFactor ) const; | 1427 | QTextFormat makeTextFormat( const QStyleSheetItem *style, const QMap<QString,QString>& attr, double scaleFontsFactor ) const; |
1425 | QTextFormat& operator=( const QTextFormat &fm ); | 1428 | QTextFormat& operator=( const QTextFormat &fm ); |
@@ -1720,32 +1723,32 @@ inline void QTextDocument::setTabArray( int *a ) | |||
1720 | { | 1723 | { |
1721 | tArray = a; | 1724 | tArray = a; |
1722 | } | 1725 | } |
1723 | 1726 | ||
1724 | inline void QTextDocument::setTabStops( int tw ) | 1727 | inline void QTextDocument::setTabStops( int tw ) |
1725 | { | 1728 | { |
1726 | tStopWidth = tw; | 1729 | tStopWidth = tw; |
1727 | } | 1730 | } |
1728 | 1731 | ||
1729 | inline QString QTextDocument::originalText() const | 1732 | inline QString QTextDocument::originalText() const |
1730 | { | 1733 | { |
1731 | if ( oTextValid ) | 1734 | if ( oTextValid ) |
1732 | return oText; | 1735 | return oText; |
1733 | return text(); | 1736 | return text(); |
1734 | } | 1737 | } |
1735 | 1738 | ||
1736 | inline void QTextDocument::setFlow( QTextFlow *f ) | 1739 | inline void QTextDocument::setFlow( QTextFlow *f ) |
1737 | { | 1740 | { |
1738 | if ( flow_ ) | 1741 | if ( flow_ ) |
1739 | delete flow_; | 1742 | delete flow_; |
1740 | flow_ = f; | 1743 | flow_ = f; |
1741 | } | 1744 | } |
1742 | 1745 | ||
1743 | inline void QTextDocument::takeFlow() | 1746 | inline void QTextDocument::takeFlow() |
1744 | { | 1747 | { |
1745 | flow_ = 0; | 1748 | flow_ = 0; |
1746 | } | 1749 | } |
1747 | 1750 | ||
1748 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 1751 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1749 | 1752 | ||
1750 | inline QColor QTextFormat::color() const | 1753 | inline QColor QTextFormat::color() const |
1751 | { | 1754 | { |
@@ -1777,29 +1780,29 @@ inline QTextFormatCollection *QTextFormat::parent() const | |||
1777 | return collection; | 1780 | return collection; |
1778 | } | 1781 | } |
1779 | 1782 | ||
1780 | inline void QTextFormat::addRef() | 1783 | inline void QTextFormat::addRef() |
1781 | { | 1784 | { |
1782 | ref++; | 1785 | ref++; |
1783 | } | 1786 | } |
1784 | 1787 | ||
1785 | inline void QTextFormat::removeRef() | 1788 | inline void QTextFormat::removeRef() |
1786 | { | 1789 | { |
1787 | ref--; | 1790 | ref--; |
1788 | if ( !collection ) | 1791 | if ( !collection ) |
1789 | return; | 1792 | return; |
1790 | if ( this == collection->defFormat ) | 1793 | if ( this == collection->defFormat ) |
1791 | return; | 1794 | return; |
1792 | if ( ref == 0 ) | 1795 | if ( ref == 0 ) |
1793 | collection->remove( this ); | 1796 | collection->remove( this ); |
1794 | } | 1797 | } |
1795 | 1798 | ||
1796 | inline QString QTextFormat::key() const | 1799 | inline QString QTextFormat::key() const |
1797 | { | 1800 | { |
1798 | return k; | 1801 | return k; |
1799 | } | 1802 | } |
1800 | 1803 | ||
1801 | inline bool QTextFormat::useLinkColor() const | 1804 | inline bool QTextFormat::useLinkColor() const |
1802 | { | 1805 | { |
1803 | return linkColor; | 1806 | return linkColor; |
1804 | } | 1807 | } |
1805 | 1808 | ||
@@ -1834,65 +1837,65 @@ inline void QTextParagraph::setBackgroundColor( const QColor & c ) | |||
1834 | bgcol = new QColor( c ); | 1837 | bgcol = new QColor( c ); |
1835 | setChanged( TRUE ); | 1838 | setChanged( TRUE ); |
1836 | } | 1839 | } |
1837 | 1840 | ||
1838 | inline void QTextParagraph::clearBackgroundColor() | 1841 | inline void QTextParagraph::clearBackgroundColor() |
1839 | { | 1842 | { |
1840 | delete bgcol; bgcol = 0; setChanged( TRUE ); | 1843 | delete bgcol; bgcol = 0; setChanged( TRUE ); |
1841 | } | 1844 | } |
1842 | 1845 | ||
1843 | inline void QTextParagraph::append( const QString &s, bool reallyAtEnd ) | 1846 | inline void QTextParagraph::append( const QString &s, bool reallyAtEnd ) |
1844 | { | 1847 | { |
1845 | if ( reallyAtEnd ) | 1848 | if ( reallyAtEnd ) |
1846 | insert( str->length(), s ); | 1849 | insert( str->length(), s ); |
1847 | else | 1850 | else |
1848 | insert( QMAX( str->length() - 1, 0 ), s ); | 1851 | insert( QMAX( str->length() - 1, 0 ), s ); |
1849 | } | 1852 | } |
1850 | 1853 | ||
1851 | inline QTextParagraph *QTextParagraph::prev() const | 1854 | inline QTextParagraph *QTextParagraph::prev() const |
1852 | { | 1855 | { |
1853 | return p; | 1856 | return p; |
1854 | } | 1857 | } |
1855 | 1858 | ||
1856 | inline QTextParagraph *QTextParagraph::next() const | 1859 | inline QTextParagraph *QTextParagraph::next() const |
1857 | { | 1860 | { |
1858 | return n; | 1861 | return n; |
1859 | } | 1862 | } |
1860 | 1863 | ||
1861 | inline bool QTextParagraph::hasAnySelection() const | 1864 | inline bool QTextParagraph::hasAnySelection() const |
1862 | { | 1865 | { |
1863 | return mSelections ? !selections().isEmpty() : FALSE; | 1866 | return mSelections ? !selections().isEmpty() : FALSE; |
1864 | } | 1867 | } |
1865 | 1868 | ||
1866 | inline void QTextParagraph::setEndState( int s ) | 1869 | inline void QTextParagraph::setEndState( int s ) |
1867 | { | 1870 | { |
1868 | if ( s == state ) | 1871 | if ( s == state ) |
1869 | return; | 1872 | return; |
1870 | state = s; | 1873 | state = s; |
1871 | } | 1874 | } |
1872 | 1875 | ||
1873 | inline int QTextParagraph::endState() const | 1876 | inline int QTextParagraph::endState() const |
1874 | { | 1877 | { |
1875 | return state; | 1878 | return state; |
1876 | } | 1879 | } |
1877 | 1880 | ||
1878 | inline void QTextParagraph::setParagId( int i ) | 1881 | inline void QTextParagraph::setParagId( int i ) |
1879 | { | 1882 | { |
1880 | id = i; | 1883 | id = i; |
1881 | } | 1884 | } |
1882 | 1885 | ||
1883 | inline int QTextParagraph::paragId() const | 1886 | inline int QTextParagraph::paragId() const |
1884 | { | 1887 | { |
1885 | if ( id == -1 ) | 1888 | if ( id == -1 ) |
1886 | qWarning( "invalid parag id!!!!!!!! (%p)", (void*)this ); | 1889 | owarn << "invalid parag id!!!!!!!! (" << (void*)this << ")" << oendl; |
1887 | return id; | 1890 | return id; |
1888 | } | 1891 | } |
1889 | 1892 | ||
1890 | inline bool QTextParagraph::firstPreProcess() const | 1893 | inline bool QTextParagraph::firstPreProcess() const |
1891 | { | 1894 | { |
1892 | return firstPProcess; | 1895 | return firstPProcess; |
1893 | } | 1896 | } |
1894 | 1897 | ||
1895 | inline void QTextParagraph::setFirstPreProcess( bool b ) | 1898 | inline void QTextParagraph::setFirstPreProcess( bool b ) |
1896 | { | 1899 | { |
1897 | firstPProcess = b; | 1900 | firstPProcess = b; |
1898 | } | 1901 | } |
@@ -1901,32 +1904,32 @@ inline QMap<int, QTextLineStart*> &QTextParagraph::lineStartList() | |||
1901 | { | 1904 | { |
1902 | return lineStarts; | 1905 | return lineStarts; |
1903 | } | 1906 | } |
1904 | 1907 | ||
1905 | inline QTextString *QTextParagraph::string() const | 1908 | inline QTextString *QTextParagraph::string() const |
1906 | { | 1909 | { |
1907 | return str; | 1910 | return str; |
1908 | } | 1911 | } |
1909 | 1912 | ||
1910 | inline QTextDocument *QTextParagraph::document() const | 1913 | inline QTextDocument *QTextParagraph::document() const |
1911 | { | 1914 | { |
1912 | if ( hasdoc ) | 1915 | if ( hasdoc ) |
1913 | return (QTextDocument*) docOrPseudo; | 1916 | return (QTextDocument*) docOrPseudo; |
1914 | return 0; | 1917 | return 0; |
1915 | } | 1918 | } |
1916 | 1919 | ||
1917 | inline QTextParagraphPseudoDocument *QTextParagraph::pseudoDocument() const | 1920 | inline QTextParagraphPseudoDocument *QTextParagraph::pseudoDocument() const |
1918 | { | 1921 | { |
1919 | if ( hasdoc ) | 1922 | if ( hasdoc ) |
1920 | return 0; | 1923 | return 0; |
1921 | return (QTextParagraphPseudoDocument*) docOrPseudo; | 1924 | return (QTextParagraphPseudoDocument*) docOrPseudo; |
1922 | } | 1925 | } |
1923 | 1926 | ||
1924 | 1927 | ||
1925 | inline QTextTableCell *QTextParagraph::tableCell() const | 1928 | inline QTextTableCell *QTextParagraph::tableCell() const |
1926 | { | 1929 | { |
1927 | return hasdoc ? document()->tableCell () : 0; | 1930 | return hasdoc ? document()->tableCell () : 0; |
1928 | } | 1931 | } |
1929 | 1932 | ||
1930 | inline QTextCommandHistory *QTextParagraph::commands() const | 1933 | inline QTextCommandHistory *QTextParagraph::commands() const |
1931 | { | 1934 | { |
1932 | return hasdoc ? document()->commands() : pseudoDocument()->commandHistory; | 1935 | return hasdoc ? document()->commands() : pseudoDocument()->commandHistory; |