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 | |||
@@ -47,12 +47,15 @@ | |||
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" |
@@ -121,34 +124,34 @@ public: | |||
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) |
@@ -205,20 +208,20 @@ private: | |||
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; |
@@ -381,13 +384,13 @@ inline QTextCommandHistory::~QTextCommandHistory() | |||
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 | ||
@@ -435,13 +438,13 @@ Q_TEMPLATE_EXTERN template class Q_EXPORT QMap<QString, QString>; | |||
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 | ||
@@ -460,13 +463,13 @@ private: | |||
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 | ||
@@ -529,17 +532,17 @@ class QTextTable; | |||
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; |
@@ -603,13 +606,13 @@ 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 ); |
@@ -681,15 +684,15 @@ class Q_EXPORT QTextDocument : public QObject | |||
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 | ||
@@ -788,17 +791,17 @@ public: | |||
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(); |
@@ -855,28 +858,28 @@ 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; |
@@ -928,13 +931,13 @@ private: | |||
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 ); |
@@ -948,16 +951,16 @@ protected: | |||
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 | ||
@@ -1008,43 +1011,43 @@ struct Q_EXPORT QTextParagraphSelection | |||
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; |
@@ -1180,13 +1183,13 @@ public: | |||
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; |
@@ -1243,15 +1246,15 @@ public: | |||
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(); |
@@ -1312,16 +1315,16 @@ public: | |||
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 | ||
@@ -1376,13 +1379,13 @@ public: | |||
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; |
@@ -1396,24 +1399,24 @@ 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(); |
@@ -1726,20 +1729,20 @@ inline void QTextDocument::setTabStops( int tw ) | |||
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; |
@@ -1783,17 +1786,17 @@ inline void QTextFormat::addRef() | |||
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 | } |
@@ -1840,15 +1843,15 @@ inline void QTextParagraph::clearBackgroundColor() | |||
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 | } |
@@ -1863,13 +1866,13 @@ inline bool QTextParagraph::hasAnySelection() const | |||
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; |
@@ -1880,13 +1883,13 @@ inline void QTextParagraph::setParagId( int i ) | |||
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; |
@@ -1907,20 +1910,20 @@ inline QTextString *QTextParagraph::string() const | |||
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 | { |