summaryrefslogtreecommitdiff
path: root/qmake/include/private/qrichtext_p.h
Unidiff
Diffstat (limited to 'qmake/include/private/qrichtext_p.h') (more/less context) (show whitespace changes)
-rw-r--r--qmake/include/private/qrichtext_p.h59
1 files changed, 41 insertions, 18 deletions
diff --git a/qmake/include/private/qrichtext_p.h b/qmake/include/private/qrichtext_p.h
index 8e29804..9ed87cf 100644
--- a/qmake/include/private/qrichtext_p.h
+++ b/qmake/include/private/qrichtext_p.h
@@ -135,68 +135,70 @@ public:
135 QString anchorName; 135 QString anchorName;
136 QString anchorHref; 136 QString anchorHref;
137 }; 137 };
138 138
139#ifndef QT_NO_TEXTCUSTOMITEM 139#ifndef QT_NO_TEXTCUSTOMITEM
140 void loseCustomItem(); 140 void loseCustomItem();
141#endif 141#endif
142 142
143 union { 143 union {
144 QTextFormat* format; 144 QTextFormat* format;
145 CustomData* custom; 145 CustomData* custom;
146 } d; 146 } d;
147 147
148 bool isAnchor() const { return ( type & Anchor) != 0; } 148 bool isAnchor() const { return ( type & Anchor) != 0; }
149 bool isLink() const { return isAnchor() && !!d.custom->anchorHref; } 149 bool isLink() const { return isAnchor() && !!d.custom->anchorHref; }
150 QString anchorName() const; 150 QString anchorName() const;
151 QString anchorHref() const; 151 QString anchorHref() const;
152 void setAnchor( const QString& name, const QString& href ); 152 void setAnchor( const QString& name, const QString& href );
153 153
154private: 154private:
155 QTextStringChar &operator=( const QTextStringChar & ) { 155 QTextStringChar &operator=( const QTextStringChar & ) {
156 //abort(); 156 //abort();
157 return *this; 157 return *this;
158 } 158 }
159 QTextStringChar( const QTextStringChar & ) {
160 }
159 friend class QComplexText; 161 friend class QComplexText;
160 friend class QTextParagraph; 162 friend class QTextParagraph;
161}; 163};
162 164
163#if defined(Q_TEMPLATEDLL) 165#if defined(Q_TEMPLATEDLL)
164// MOC_SKIP_BEGIN 166// MOC_SKIP_BEGIN
165Q_TEMPLATE_EXTERN template class Q_EXPORT QMemArray<QTextStringChar>; 167Q_TEMPLATE_EXTERN template class Q_EXPORT QMemArray<QTextStringChar>;
166// MOC_SKIP_END 168// MOC_SKIP_END
167#endif 169#endif
168 170
169class Q_EXPORT QTextString 171class Q_EXPORT QTextString
170{ 172{
171public: 173public:
172 174
173 QTextString(); 175 QTextString();
174 QTextString( const QTextString &s ); 176 QTextString( const QTextString &s );
175 virtual ~QTextString(); 177 virtual ~QTextString();
176 178
177 static QString toString( const QMemArray<QTextStringChar> &data ); 179 static QString toString( const QMemArray<QTextStringChar> &data, bool fixspaces = TRUE );
178 QString toString() const; 180 QString toString( bool fixspaces = TRUE ) const;
179 181
180 QTextStringChar &at( int i ) const; 182 QTextStringChar &at( int i ) const;
181#if defined(Q_STRICT_INLINING_RULES) 183#if defined(Q_STRICT_INLINING_RULES)
182 // This is for the IRIX MIPSpro o32 ABI - it fails, claiming the 184 // This is for the IRIX MIPSpro o32 ABI - it fails, claiming the
183 // implementation to be a redefinition. 185 // implementation to be a redefinition.
184 inline int length() const; 186 inline int length() const;
185#else 187#else
186 int length() const; 188 int length() const;
187#endif 189#endif
188 190
189 int width( int idx ) const; 191 int width( int idx ) const;
190 192
191 void insert( int index, const QString &s, QTextFormat *f ); 193 void insert( int index, const QString &s, QTextFormat *f );
192 void insert( int index, const QChar *unicode, int len, QTextFormat *f ); 194 void insert( int index, const QChar *unicode, int len, QTextFormat *f );
193 void insert( int index, QTextStringChar *c, bool doAddRefFormat = FALSE ); 195 void insert( int index, QTextStringChar *c, bool doAddRefFormat = FALSE );
194 void truncate( int index ); 196 void truncate( int index );
195 void remove( int index, int len ); 197 void remove( int index, int len );
196 void clear(); 198 void clear();
197 199
198 void setFormat( int index, QTextFormat *f, bool useCollection ); 200 void setFormat( int index, QTextFormat *f, bool useCollection );
199 201
200 void setBidi( bool b ) { bidi = b; } 202 void setBidi( bool b ) { bidi = b; }
201 bool isBidi() const; 203 bool isBidi() const;
202 bool isRightToLeft() const; 204 bool isRightToLeft() const;
@@ -265,89 +267,89 @@ public:
265 // implementation to be a redefinition. 267 // implementation to be a redefinition.
266 inline QTextParagraph *paragraph() const; 268 inline QTextParagraph *paragraph() const;
267#else 269#else
268 QTextParagraph *paragraph() const; 270 QTextParagraph *paragraph() const;
269#endif 271#endif
270 272
271 void setParagraph( QTextParagraph*p ) { gotoPosition(p, 0 ); } 273 void setParagraph( QTextParagraph*p ) { gotoPosition(p, 0 ); }
272 QTextDocument *document() const; 274 QTextDocument *document() const;
273 int index() const; 275 int index() const;
274 void setIndex( int index ) { gotoPosition(paragraph(), index ); } 276 void setIndex( int index ) { gotoPosition(paragraph(), index ); }
275 277
276 void gotoPosition( QTextParagraph* p, int index = 0); 278 void gotoPosition( QTextParagraph* p, int index = 0);
277 void gotoLeft(); 279 void gotoLeft();
278 void gotoRight(); 280 void gotoRight();
279 void gotoNextLetter(); 281 void gotoNextLetter();
280 void gotoPreviousLetter(); 282 void gotoPreviousLetter();
281 void gotoUp(); 283 void gotoUp();
282 void gotoDown(); 284 void gotoDown();
283 void gotoLineEnd(); 285 void gotoLineEnd();
284 void gotoLineStart(); 286 void gotoLineStart();
285 void gotoHome(); 287 void gotoHome();
286 void gotoEnd(); 288 void gotoEnd();
287 void gotoPageUp( int visibleHeight ); 289 void gotoPageUp( int visibleHeight );
288 void gotoPageDown( int visibleHeight ); 290 void gotoPageDown( int visibleHeight );
289 void gotoNextWord(); 291 void gotoNextWord( bool onlySpace = FALSE );
290 void gotoPreviousWord(); 292 void gotoPreviousWord( bool onlySpace = FALSE );
291 void gotoWordLeft(); 293 void gotoWordLeft();
292 void gotoWordRight(); 294 void gotoWordRight();
293 295
294 void insert( const QString &s, bool checkNewLine, QMemArray<QTextStringChar> *formatting = 0 ); 296 void insert( const QString &s, bool checkNewLine, QMemArray<QTextStringChar> *formatting = 0 );
295 void splitAndInsertEmptyParagraph( bool ind = TRUE, bool updateIds = TRUE ); 297 void splitAndInsertEmptyParagraph( bool ind = TRUE, bool updateIds = TRUE );
296 bool remove(); 298 bool remove();
297 void indent(); 299 void indent();
298 300
299 bool atParagStart(); 301 bool atParagStart();
300 bool atParagEnd(); 302 bool atParagEnd();
301 303
302 int x() const; // x in current paragraph 304 int x() const; // x in current paragraph
303 int y() const; // y in current paragraph 305 int y() const; // y in current paragraph
304 306
305 int globalX() const; 307 int globalX() const;
306 int globalY() const; 308 int globalY() const;
307 309
308 QTextParagraph *topParagraph() const { return paras.isEmpty() ? para : paras.first(); } 310 QTextParagraph *topParagraph() const { return paras.isEmpty() ? para : paras.first(); }
309 int offsetX() const { return ox; } // inner document offset 311 int offsetX() const { return ox; } // inner document offset
310 int offsetY() const { return oy; } // inner document offset 312 int offsetY() const { return oy; } // inner document offset
311 int totalOffsetX() const; // total document offset 313 int totalOffsetX() const; // total document offset
312 int totalOffsetY() const; // total document offset 314 int totalOffsetY() const; // total document offset
313 315
314 bool place( const QPoint &pos, QTextParagraph *s ) { return place( pos, s, FALSE ); } 316 bool place( const QPoint &pos, QTextParagraph *s ) { return place( pos, s, FALSE ); }
315 bool place( const QPoint &pos, QTextParagraph *s, bool link ); 317 bool place( const QPoint &pos, QTextParagraph *s, bool link );
316 void restoreState(); 318 void restoreState();
317 319
318 320
319 int nestedDepth() const { return (int)indices.count(); } //### size_t/int cast 321 int nestedDepth() const { return (int)indices.count(); } //### size_t/int cast
320 void oneUp() { if ( !indices.isEmpty() ) pop(); } 322 void oneUp() { if ( !indices.isEmpty() ) pop(); }
321 void setValid( bool b ) { valid = b; } 323 void setValid( bool b ) { valid = b; }
322 bool isValid() const { return valid; } 324 bool isValid() const { return valid; }
323 325
324private: 326private:
325 enum Operation { EnterBegin, EnterEnd, Next, Prev, Up, Down }; 327 enum Operation { EnterBegin, EnterEnd, Next, Prev, Up, Down };
326 328
327 void push(); 329 void push();
328 void pop(); 330 void pop();
329 void processNesting( Operation op ); 331 bool processNesting( Operation op );
330 void invalidateNested(); 332 void invalidateNested();
331 void gotoIntoNested( const QPoint &globalPos ); 333 void gotoIntoNested( const QPoint &globalPos );
332 334
333 QTextParagraph *para; 335 QTextParagraph *para;
334 int idx, tmpIndex; 336 int idx, tmpIndex;
335 int ox, oy; 337 int ox, oy;
336 QValueStack<int> indices; 338 QValueStack<int> indices;
337 QValueStack<QTextParagraph*> paras; 339 QValueStack<QTextParagraph*> paras;
338 QValueStack<int> xOffsets; 340 QValueStack<int> xOffsets;
339 QValueStack<int> yOffsets; 341 QValueStack<int> yOffsets;
340 uint valid : 1; 342 uint valid : 1;
341 343
342}; 344};
343 345
344// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 346// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
345 347
346class Q_EXPORT QTextCommand 348class Q_EXPORT QTextCommand
347{ 349{
348public: 350public:
349 enum Commands { Invalid, Insert, Delete, Format, Style }; 351 enum Commands { Invalid, Insert, Delete, Format, Style };
350 352
351 QTextCommand( QTextDocument *d ) : doc( d ), cursor( d ) {} 353 QTextCommand( QTextDocument *d ) : doc( d ), cursor( d ) {}
352 virtual ~QTextCommand(); 354 virtual ~QTextCommand();
353 355
@@ -682,48 +684,49 @@ private:
682 int cellspacing; 684 int cellspacing;
683 int border; 685 int border;
684 int outerborder; 686 int outerborder;
685 int stretch; 687 int stretch;
686 int innerborder; 688 int innerborder;
687 int us_cp, us_ib, us_b, us_ob, us_cs; 689 int us_cp, us_ib, us_b, us_ob, us_cs;
688 QMap<QString, QString> attributes; 690 QMap<QString, QString> attributes;
689 QMap<QTextCursor*, int> currCell; 691 QMap<QTextCursor*, int> currCell;
690 Placement place; 692 Placement place;
691 void adjustCells( int y , int shift ); 693 void adjustCells( int y , int shift );
692 int pageBreakFor; 694 int pageBreakFor;
693}; 695};
694#endif 696#endif
695// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 697// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
696 698
697#ifndef QT_NO_TEXTCUSTOMITEM 699#ifndef QT_NO_TEXTCUSTOMITEM
698class QTextTableCell; 700class QTextTableCell;
699class QTextParagraph; 701class QTextParagraph;
700#endif 702#endif
701 703
702struct Q_EXPORT QTextDocumentSelection 704struct Q_EXPORT QTextDocumentSelection
703{ 705{
704 QTextCursor startCursor, endCursor; 706 QTextCursor startCursor, endCursor;
705 bool swapped; 707 bool swapped;
708 Q_DUMMY_COMPARISON_OPERATOR(QTextDocumentSelection)
706}; 709};
707 710
708#if defined(Q_TEMPLATEDLL) 711#if defined(Q_TEMPLATEDLL)
709// MOC_SKIP_BEGIN 712// MOC_SKIP_BEGIN
710Q_TEMPLATE_EXTERN template class Q_EXPORT QMap<int, QColor>; 713Q_TEMPLATE_EXTERN template class Q_EXPORT QMap<int, QColor>;
711Q_TEMPLATE_EXTERN template class Q_EXPORT QMap<int, bool>; 714Q_TEMPLATE_EXTERN template class Q_EXPORT QMap<int, bool>;
712Q_TEMPLATE_EXTERN template class Q_EXPORT QMap<int, QTextDocumentSelection>; 715Q_TEMPLATE_EXTERN template class Q_EXPORT QMap<int, QTextDocumentSelection>;
713Q_TEMPLATE_EXTERN template class Q_EXPORT QPtrList<QTextDocument>; 716Q_TEMPLATE_EXTERN template class Q_EXPORT QPtrList<QTextDocument>;
714// MOC_SKIP_END 717// MOC_SKIP_END
715#endif 718#endif
716 719
717class Q_EXPORT QTextDocument : public QObject 720class Q_EXPORT QTextDocument : public QObject
718{ 721{
719 Q_OBJECT 722 Q_OBJECT
720 723
721#ifndef QT_NO_TEXTCUSTOMITEM 724#ifndef QT_NO_TEXTCUSTOMITEM
722 friend class QTextTableCell; 725 friend class QTextTableCell;
723#endif 726#endif
724 friend class QTextCursor; 727 friend class QTextCursor;
725 friend class QTextEdit; 728 friend class QTextEdit;
726 friend class QTextParagraph; 729 friend class QTextParagraph;
727 730
728public: 731public:
729 enum SelectionIds { 732 enum SelectionIds {
@@ -818,48 +821,51 @@ public:
818 821
819 bool inSelection( int selId, const QPoint &pos ) const; 822 bool inSelection( int selId, const QPoint &pos ) const;
820 823
821 QStyleSheet *styleSheet() const { return sheet_; } 824 QStyleSheet *styleSheet() const { return sheet_; }
822#ifndef QT_NO_MIME 825#ifndef QT_NO_MIME
823 QMimeSourceFactory *mimeSourceFactory() const { return factory_; } 826 QMimeSourceFactory *mimeSourceFactory() const { return factory_; }
824#endif 827#endif
825 QString context() const { return contxt; } 828 QString context() const { return contxt; }
826 829
827 void setStyleSheet( QStyleSheet *s ); 830 void setStyleSheet( QStyleSheet *s );
828 void setDefaultFormat( const QFont &font, const QColor &color ); 831 void setDefaultFormat( const QFont &font, const QColor &color );
829#ifndef QT_NO_MIME 832#ifndef QT_NO_MIME
830 void setMimeSourceFactory( QMimeSourceFactory *f ) { if ( f ) factory_ = f; } 833 void setMimeSourceFactory( QMimeSourceFactory *f ) { if ( f ) factory_ = f; }
831#endif 834#endif
832 void setContext( const QString &c ) { if ( !c.isEmpty() ) contxt = c; } 835 void setContext( const QString &c ) { if ( !c.isEmpty() ) contxt = c; }
833 836
834 void setUnderlineLinks( bool b ); 837 void setUnderlineLinks( bool b );
835 bool underlineLinks() const { return underlLinks; } 838 bool underlineLinks() const { return underlLinks; }
836 839
837 void setPaper( QBrush *brush ) { if ( backBrush ) delete backBrush; backBrush = brush; } 840 void setPaper( QBrush *brush ) { if ( backBrush ) delete backBrush; backBrush = brush; }
838 QBrush *paper() const { return backBrush; } 841 QBrush *paper() const { return backBrush; }
839 842
840 void doLayout( QPainter *p, int w ); 843 void doLayout( QPainter *p, int w );
841 void draw( QPainter *p, const QRect& rect, const QColorGroup &cg, const QBrush *paper = 0 ); 844 void draw( QPainter *p, const QRect& rect, const QColorGroup &cg, const QBrush *paper = 0 );
845 void eraseParagraphEmptyArea( QTextParagraph *parag, QPainter *p, const QColorGroup &cg );
846 bool useDoubleBuffer( QTextParagraph *parag, QPainter *p );
847
842 void drawParagraph( QPainter *p, QTextParagraph *parag, int cx, int cy, int cw, int ch, 848 void drawParagraph( QPainter *p, QTextParagraph *parag, int cx, int cy, int cw, int ch,
843 QPixmap *&doubleBuffer, const QColorGroup &cg, 849 QPixmap *&doubleBuffer, const QColorGroup &cg,
844 bool drawCursor, QTextCursor *cursor, bool resetChanged = TRUE ); 850 bool drawCursor, QTextCursor *cursor, bool resetChanged = TRUE );
845 QTextParagraph *draw( QPainter *p, int cx, int cy, int cw, int ch, const QColorGroup &cg, 851 QTextParagraph *draw( QPainter *p, int cx, int cy, int cw, int ch, const QColorGroup &cg,
846 bool onlyChanged = FALSE, bool drawCursor = FALSE, QTextCursor *cursor = 0, 852 bool onlyChanged = FALSE, bool drawCursor = FALSE, QTextCursor *cursor = 0,
847 bool resetChanged = TRUE ); 853 bool resetChanged = TRUE );
848 854
849#ifndef QT_NO_TEXTCUSTOMITEM 855#ifndef QT_NO_TEXTCUSTOMITEM
850 void registerCustomItem( QTextCustomItem *i, QTextParagraph *p ); 856 void registerCustomItem( QTextCustomItem *i, QTextParagraph *p );
851 void unregisterCustomItem( QTextCustomItem *i, QTextParagraph *p ); 857 void unregisterCustomItem( QTextCustomItem *i, QTextParagraph *p );
852#endif 858#endif
853 859
854 void setFlow( QTextFlow *f ); 860 void setFlow( QTextFlow *f );
855 void takeFlow(); 861 void takeFlow();
856 QTextFlow *flow() const { return flow_; } 862 QTextFlow *flow() const { return flow_; }
857 bool isPageBreakEnabled() const { return pages; } 863 bool isPageBreakEnabled() const { return pages; }
858 void setPageBreakEnabled( bool b ) { pages = b; } 864 void setPageBreakEnabled( bool b ) { pages = b; }
859 865
860 void setUseFormatCollection( bool b ) { useFC = b; } 866 void setUseFormatCollection( bool b ) { useFC = b; }
861 bool useFormatCollection() const { return useFC; } 867 bool useFormatCollection() const { return useFC; }
862 868
863#ifndef QT_NO_TEXTCUSTOMITEM 869#ifndef QT_NO_TEXTCUSTOMITEM
864 QTextTableCell *tableCell() const { return tc; } 870 QTextTableCell *tableCell() const { return tc; }
865 void setTableCell( QTextTableCell *c ) { tc = c; } 871 void setTableCell( QTextTableCell *c ) { tc = c; }
@@ -1046,48 +1052,49 @@ protected:
1046class Q_EXPORT QTextStyleCommand : public QTextCommand 1052class Q_EXPORT QTextStyleCommand : public QTextCommand
1047{ 1053{
1048public: 1054public:
1049 QTextStyleCommand( QTextDocument *d, int fParag, int lParag, const QByteArray& beforeChange ); 1055 QTextStyleCommand( QTextDocument *d, int fParag, int lParag, const QByteArray& beforeChange );
1050 virtual ~QTextStyleCommand() {} 1056 virtual ~QTextStyleCommand() {}
1051 1057
1052 Commands type() const { return Style; } 1058 Commands type() const { return Style; }
1053 QTextCursor *execute( QTextCursor *c ); 1059 QTextCursor *execute( QTextCursor *c );
1054 QTextCursor *unexecute( QTextCursor *c ); 1060 QTextCursor *unexecute( QTextCursor *c );
1055 1061
1056 static QByteArray readStyleInformation( QTextDocument* d, int fParag, int lParag ); 1062 static QByteArray readStyleInformation( QTextDocument* d, int fParag, int lParag );
1057 static void writeStyleInformation( QTextDocument* d, int fParag, const QByteArray& style ); 1063 static void writeStyleInformation( QTextDocument* d, int fParag, const QByteArray& style );
1058 1064
1059private: 1065private:
1060 int firstParag, lastParag; 1066 int firstParag, lastParag;
1061 QByteArray before; 1067 QByteArray before;
1062 QByteArray after; 1068 QByteArray after;
1063}; 1069};
1064 1070
1065// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1071// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1066 1072
1067struct Q_EXPORT QTextParagraphSelection 1073struct Q_EXPORT QTextParagraphSelection
1068{ 1074{
1069 int start, end; 1075 int start, end;
1076 Q_DUMMY_COMPARISON_OPERATOR(QTextParagraphSelection)
1070}; 1077};
1071 1078
1072struct Q_EXPORT QTextLineStart 1079struct Q_EXPORT QTextLineStart
1073{ 1080{
1074 QTextLineStart() : y( 0 ), baseLine( 0 ), h( 0 ) 1081 QTextLineStart() : y( 0 ), baseLine( 0 ), h( 0 )
1075#ifndef QT_NO_COMPLEXTEXT 1082#ifndef QT_NO_COMPLEXTEXT
1076 , bidicontext( 0 ) 1083 , bidicontext( 0 )
1077#endif 1084#endif
1078 { } 1085 { }
1079 QTextLineStart( ushort y_, ushort bl, ushort h_ ) : y( y_ ), baseLine( bl ), h( h_ ), 1086 QTextLineStart( ushort y_, ushort bl, ushort h_ ) : y( y_ ), baseLine( bl ), h( h_ ),
1080 w( 0 ) 1087 w( 0 )
1081#ifndef QT_NO_COMPLEXTEXT 1088#ifndef QT_NO_COMPLEXTEXT
1082 , bidicontext( 0 ) 1089 , bidicontext( 0 )
1083#endif 1090#endif
1084 { } 1091 { }
1085#ifndef QT_NO_COMPLEXTEXT 1092#ifndef QT_NO_COMPLEXTEXT
1086 QTextLineStart( QBidiContext *c, QBidiStatus s ) : y(0), baseLine(0), h(0), 1093 QTextLineStart( QBidiContext *c, QBidiStatus s ) : y(0), baseLine(0), h(0),
1087 status( s ), bidicontext( c ) { if ( bidicontext ) bidicontext->ref(); } 1094 status( s ), bidicontext( c ) { if ( bidicontext ) bidicontext->ref(); }
1088#endif 1095#endif
1089 1096
1090 virtual ~QTextLineStart() 1097 virtual ~QTextLineStart()
1091 { 1098 {
1092#ifndef QT_NO_COMPLEXTEXT 1099#ifndef QT_NO_COMPLEXTEXT
1093 if ( bidicontext && bidicontext->deref() ) 1100 if ( bidicontext && bidicontext->deref() )
@@ -1115,89 +1122,87 @@ public:
1115#endif 1122#endif
1116 int w; 1123 int w;
1117 1124
1118private: 1125private:
1119#ifndef QT_NO_COMPLEXTEXT 1126#ifndef QT_NO_COMPLEXTEXT
1120 QBidiContext *bidicontext; 1127 QBidiContext *bidicontext;
1121#endif 1128#endif
1122}; 1129};
1123 1130
1124#if defined(Q_TEMPLATEDLL) 1131#if defined(Q_TEMPLATEDLL)
1125// MOC_SKIP_BEGIN 1132// MOC_SKIP_BEGIN
1126Q_TEMPLATE_EXTERN template class Q_EXPORT QMap<int, QTextParagraphSelection>; 1133Q_TEMPLATE_EXTERN template class Q_EXPORT QMap<int, QTextParagraphSelection>;
1127Q_TEMPLATE_EXTERN template class Q_EXPORT QMap<int, QTextLineStart*>; 1134Q_TEMPLATE_EXTERN template class Q_EXPORT QMap<int, QTextLineStart*>;
1128// MOC_SKIP_END 1135// MOC_SKIP_END
1129#endif 1136#endif
1130 1137
1131class Q_EXPORT QTextParagraphData 1138class Q_EXPORT QTextParagraphData
1132{ 1139{
1133public: 1140public:
1134 QTextParagraphData() {} 1141 QTextParagraphData() {}
1135 virtual ~QTextParagraphData(); 1142 virtual ~QTextParagraphData();
1136 virtual void join( QTextParagraphData * ); 1143 virtual void join( QTextParagraphData * );
1137}; 1144};
1138 1145
1139class Q_EXPORT QTextParagraphPseudoDocument 1146class QTextParagraphPseudoDocument;
1140{ 1147
1141public: 1148class QSyntaxHighlighter;
1142 QTextParagraphPseudoDocument();
1143 ~QTextParagraphPseudoDocument();
1144 QRect docRect;
1145 QTextFormatter *pFormatter;
1146 QTextCommandHistory *commandHistory;
1147 int minw;
1148 int wused;
1149};
1150 1149
1151//nase
1152class Q_EXPORT QTextParagraph 1150class Q_EXPORT QTextParagraph
1153{ 1151{
1154 friend class QTextDocument; 1152 friend class QTextDocument;
1155 friend class QTextCursor; 1153 friend class QTextCursor;
1154 friend class QSyntaxHighlighter;
1156 1155
1157public: 1156public:
1158 QTextParagraph( QTextDocument *d, QTextParagraph *pr = 0, QTextParagraph *nx = 0, bool updateIds = TRUE ); 1157 QTextParagraph( QTextDocument *d, QTextParagraph *pr = 0, QTextParagraph *nx = 0, bool updateIds = TRUE );
1159 virtual ~QTextParagraph(); 1158 virtual ~QTextParagraph();
1160 1159
1161 QTextString *string() const; 1160 QTextString *string() const;
1162 QTextStringChar *at( int i ) const; // maybe remove later 1161 QTextStringChar *at( int i ) const; // maybe remove later
1163 int leftGap() const; 1162 int leftGap() const;
1164 int length() const; // maybe remove later 1163 int length() const; // maybe remove later
1165 1164
1166 void setListStyle( QStyleSheetItem::ListStyle ls ) { lstyle = ls; changed = TRUE; } 1165 void setListStyle( QStyleSheetItem::ListStyle ls ) { lstyle = ls; changed = TRUE; }
1167 QStyleSheetItem::ListStyle listStyle() const { return lstyle; } 1166 QStyleSheetItem::ListStyle listStyle() const { return lstyle; }
1168 void setListItem( bool li ); 1167 void setListItem( bool li );
1169 bool isListItem() const { return litem; } 1168 bool isListItem() const { return litem; }
1170 void setListValue( int v ) { list_val = v; } 1169 void setListValue( int v ) { list_val = v; }
1171 int listValue() const { return list_val > 0 ? list_val : -1; } 1170 int listValue() const { return list_val > 0 ? list_val : -1; }
1172 1171
1173 void setListDepth( int depth ); 1172 void setListDepth( int depth );
1174 int listDepth() const { return ldepth; } 1173 int listDepth() const { return ldepth; }
1175 1174
1176// void setFormat( QTextFormat *fm ); 1175// void setFormat( QTextFormat *fm );
1177// QTextFormat *paragFormat() const; 1176// QTextFormat *paragFormat() const;
1178 1177
1178#if defined(Q_STRICT_INLINING_RULES)
1179 // This is for the IRIX MIPSpro o32 ABI - it fails, claiming the
1180 // implementation to be a redefinition.
1181 inline QTextDocument *document() const;
1182#else
1179 QTextDocument *document() const; 1183 QTextDocument *document() const;
1184#endif
1180 QTextParagraphPseudoDocument *pseudoDocument() const; 1185 QTextParagraphPseudoDocument *pseudoDocument() const;
1181 1186
1182 QRect rect() const; 1187 QRect rect() const;
1183 void setHeight( int h ) { r.setHeight( h ); } 1188 void setHeight( int h ) { r.setHeight( h ); }
1184 void show(); 1189 void show();
1185 void hide(); 1190 void hide();
1186 bool isVisible() const { return visible; } 1191 bool isVisible() const { return visible; }
1187 1192
1188 QTextParagraph *prev() const; 1193 QTextParagraph *prev() const;
1189 QTextParagraph *next() const; 1194 QTextParagraph *next() const;
1190 void setPrev( QTextParagraph *s ); 1195 void setPrev( QTextParagraph *s );
1191 void setNext( QTextParagraph *s ); 1196 void setNext( QTextParagraph *s );
1192 1197
1193 void insert( int index, const QString &s ); 1198 void insert( int index, const QString &s );
1194 void insert( int index, const QChar *unicode, int len ); 1199 void insert( int index, const QChar *unicode, int len );
1195 void append( const QString &s, bool reallyAtEnd = FALSE ); 1200 void append( const QString &s, bool reallyAtEnd = FALSE );
1196 void truncate( int index ); 1201 void truncate( int index );
1197 void remove( int index, int len ); 1202 void remove( int index, int len );
1198 void join( QTextParagraph *s ); 1203 void join( QTextParagraph *s );
1199 1204
1200 void invalidate( int chr ); 1205 void invalidate( int chr );
1201 1206
1202 void move( int &dy ); 1207 void move( int &dy );
1203 void format( int start = -1, bool doMove = TRUE ); 1208 void format( int start = -1, bool doMove = TRUE );
@@ -1575,68 +1580,80 @@ private:
1575// MOC_SKIP_BEGIN 1580// MOC_SKIP_BEGIN
1576Q_TEMPLATE_EXTERN template class Q_EXPORT QDict<QTextFormat>; 1581Q_TEMPLATE_EXTERN template class Q_EXPORT QDict<QTextFormat>;
1577// MOC_SKIP_END 1582// MOC_SKIP_END
1578#endif 1583#endif
1579 1584
1580class Q_EXPORT QTextFormatCollection 1585class Q_EXPORT QTextFormatCollection
1581{ 1586{
1582 friend class QTextDocument; 1587 friend class QTextDocument;
1583 friend class QTextFormat; 1588 friend class QTextFormat;
1584 1589
1585public: 1590public:
1586 QTextFormatCollection(); 1591 QTextFormatCollection();
1587 virtual ~QTextFormatCollection(); 1592 virtual ~QTextFormatCollection();
1588 1593
1589 void setDefaultFormat( QTextFormat *f ); 1594 void setDefaultFormat( QTextFormat *f );
1590 QTextFormat *defaultFormat() const; 1595 QTextFormat *defaultFormat() const;
1591 virtual QTextFormat *format( QTextFormat *f ); 1596 virtual QTextFormat *format( QTextFormat *f );
1592 virtual QTextFormat *format( QTextFormat *of, QTextFormat *nf, int flags ); 1597 virtual QTextFormat *format( QTextFormat *of, QTextFormat *nf, int flags );
1593 virtual QTextFormat *format( const QFont &f, const QColor &c ); 1598 virtual QTextFormat *format( const QFont &f, const QColor &c );
1594 virtual void remove( QTextFormat *f ); 1599 virtual void remove( QTextFormat *f );
1595 virtual QTextFormat *createFormat( const QTextFormat &f ) { return new QTextFormat( f ); } 1600 virtual QTextFormat *createFormat( const QTextFormat &f ) { return new QTextFormat( f ); }
1596 virtual QTextFormat *createFormat( const QFont &f, const QColor &c ) { return new QTextFormat( f, c, this ); } 1601 virtual QTextFormat *createFormat( const QFont &f, const QColor &c ) { return new QTextFormat( f, c, this ); }
1597 1602
1598 void updateDefaultFormat( const QFont &font, const QColor &c, QStyleSheet *sheet ); 1603 void updateDefaultFormat( const QFont &font, const QColor &c, QStyleSheet *sheet );
1599 QDict<QTextFormat> dict() const { return cKey; }
1600 1604
1601 QPaintDevice *paintDevice() const { return paintdevice; } 1605 QPaintDevice *paintDevice() const { return paintdevice; }
1602 void setPaintDevice( QPaintDevice * ); 1606 void setPaintDevice( QPaintDevice * );
1603 1607
1604private: 1608private:
1605 void updateKeys(); 1609 void updateKeys();
1606 1610
1607private: 1611private:
1608 QTextFormat *defFormat, *lastFormat, *cachedFormat; 1612 QTextFormat *defFormat, *lastFormat, *cachedFormat;
1609 QDict<QTextFormat> cKey; 1613 QDict<QTextFormat> cKey;
1610 QTextFormat *cres; 1614 QTextFormat *cres;
1611 QFont cfont; 1615 QFont cfont;
1612 QColor ccol; 1616 QColor ccol;
1613 QString kof, knf; 1617 QString kof, knf;
1614 int cflags; 1618 int cflags;
1615 1619
1616 QPaintDevice *paintdevice; 1620 QPaintDevice *paintdevice;
1617}; 1621};
1618 1622
1623class Q_EXPORT QTextParagraphPseudoDocument
1624{
1625public:
1626 QTextParagraphPseudoDocument();
1627 ~QTextParagraphPseudoDocument();
1628 QRect docRect;
1629 QTextFormatter *pFormatter;
1630 QTextCommandHistory *commandHistory;
1631 int minw;
1632 int wused;
1633 QTextFormatCollection collection;
1634};
1635
1619// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1636// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1620 1637
1621inline int QTextString::length() const 1638inline int QTextString::length() const
1622{ 1639{
1623 return data.size(); 1640 return data.size();
1624} 1641}
1625 1642
1626inline int QTextParagraph::length() const 1643inline int QTextParagraph::length() const
1627{ 1644{
1628 return str->length(); 1645 return str->length();
1629} 1646}
1630 1647
1631inline QRect QTextParagraph::rect() const 1648inline QRect QTextParagraph::rect() const
1632{ 1649{
1633 return r; 1650 return r;
1634} 1651}
1635 1652
1636inline QTextParagraph *QTextCursor::paragraph() const 1653inline QTextParagraph *QTextCursor::paragraph() const
1637{ 1654{
1638 return para; 1655 return para;
1639} 1656}
1640 1657
1641inline int QTextCursor::index() const 1658inline int QTextCursor::index() const
1642{ 1659{
@@ -1807,48 +1824,54 @@ inline void QTextDocument::setTabArray( int *a )
1807inline void QTextDocument::setTabStops( int tw ) 1824inline void QTextDocument::setTabStops( int tw )
1808{ 1825{
1809 tStopWidth = tw; 1826 tStopWidth = tw;
1810} 1827}
1811 1828
1812inline QString QTextDocument::originalText() const 1829inline QString QTextDocument::originalText() const
1813{ 1830{
1814 if ( oTextValid ) 1831 if ( oTextValid )
1815 return oText; 1832 return oText;
1816 return text(); 1833 return text();
1817} 1834}
1818 1835
1819inline void QTextDocument::setFlow( QTextFlow *f ) 1836inline void QTextDocument::setFlow( QTextFlow *f )
1820{ 1837{
1821 if ( flow_ ) 1838 if ( flow_ )
1822 delete flow_; 1839 delete flow_;
1823 flow_ = f; 1840 flow_ = f;
1824} 1841}
1825 1842
1826inline void QTextDocument::takeFlow() 1843inline void QTextDocument::takeFlow()
1827{ 1844{
1828 flow_ = 0; 1845 flow_ = 0;
1829} 1846}
1830 1847
1848inline bool QTextDocument::useDoubleBuffer( QTextParagraph *parag, QPainter *p )
1849{
1850 return ( !parag->document()->parent() || parag->document()->nextDoubleBuffered ) &&
1851 ( !p || !p->device() || p->device()->devType() != QInternal::Printer );
1852}
1853
1831// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1854// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1832 1855
1833inline QColor QTextFormat::color() const 1856inline QColor QTextFormat::color() const
1834{ 1857{
1835 return col; 1858 return col;
1836} 1859}
1837 1860
1838inline QFont QTextFormat::font() const 1861inline QFont QTextFormat::font() const
1839{ 1862{
1840 return fn; 1863 return fn;
1841} 1864}
1842 1865
1843inline bool QTextFormat::isMisspelled() const 1866inline bool QTextFormat::isMisspelled() const
1844{ 1867{
1845 return missp; 1868 return missp;
1846} 1869}
1847 1870
1848inline QTextFormat::VerticalAlignment QTextFormat::vAlign() const 1871inline QTextFormat::VerticalAlignment QTextFormat::vAlign() const
1849{ 1872{
1850 return ha; 1873 return ha;
1851} 1874}
1852 1875
1853inline bool QTextFormat::operator==( const QTextFormat &f ) const 1876inline bool QTextFormat::operator==( const QTextFormat &f ) const
1854{ 1877{