Diffstat (limited to 'noncore/apps/opie-write/qtextedit.h') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-write/qtextedit.h | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/noncore/apps/opie-write/qtextedit.h b/noncore/apps/opie-write/qtextedit.h index b4e5701..64e8f45 100644 --- a/noncore/apps/opie-write/qtextedit.h +++ b/noncore/apps/opie-write/qtextedit.h | |||
@@ -52,27 +52,29 @@ class QMouseEvent; | |||
52 | class QTimer; | 52 | class QTimer; |
53 | class QFont; | 53 | class QFont; |
54 | class QColor; | 54 | class QColor; |
55 | struct QUndoRedoInfoPrivate; | 55 | struct QUndoRedoInfoPrivate; |
56 | class QPopupMenu; | 56 | class QPopupMenu; |
57 | 57 | ||
58 | namespace Qt3 { | 58 | namespace Qt3 { |
59 | 59 | ||
60 | class QTextString; | 60 | class QTextString; |
61 | class QTextDocument; | 61 | class QTextDocument; |
62 | class QTextCursor; | 62 | class QTextCursor; |
63 | class QTextCommand; | 63 | class QTextCommand; |
64 | class QTextParag; | 64 | class QTextParagraph; |
65 | class QTextFormat; | 65 | class QTextFormat; |
66 | class QTextEdit; | ||
66 | class QTextBrowser; | 67 | class QTextBrowser; |
68 | class QTextString; | ||
67 | class QTextEditPrivate; | 69 | class QTextEditPrivate; |
68 | 70 | ||
69 | class Q_EXPORT QTextEdit : public QScrollView | 71 | class Q_EXPORT QTextEdit : public QScrollView |
70 | { | 72 | { |
71 | friend class QTextBrowser; | 73 | friend class QTextBrowser; |
72 | 74 | ||
73 | Q_OBJECT | 75 | Q_OBJECT |
74 | Q_ENUMS( WordWrap WrapPolicy ) | 76 | Q_ENUMS( WordWrap WrapPolicy ) |
75 | Q_PROPERTY( TextFormat textFormat READ textFormat WRITE setTextFormat ) | 77 | Q_PROPERTY( TextFormat textFormat READ textFormat WRITE setTextFormat ) |
76 | Q_PROPERTY( QString text READ text WRITE setText ) | 78 | Q_PROPERTY( QString text READ text WRITE setText ) |
77 | Q_PROPERTY( QBrush paper READ paper WRITE setPaper ) | 79 | Q_PROPERTY( QBrush paper READ paper WRITE setPaper ) |
78 | Q_PROPERTY( bool linkUnderline READ linkUnderline WRITE setLinkUnderline ) | 80 | Q_PROPERTY( bool linkUnderline READ linkUnderline WRITE setLinkUnderline ) |
@@ -187,30 +189,35 @@ public: | |||
187 | void getCursorPosition( int *parag, int *index ) const; | 189 | void getCursorPosition( int *parag, int *index ) const; |
188 | 190 | ||
189 | bool isModified() const; | 191 | bool isModified() const; |
190 | bool italic() const; | 192 | bool italic() const; |
191 | bool bold() const; | 193 | bool bold() const; |
192 | bool underline() const; | 194 | bool underline() const; |
193 | QString family() const; | 195 | QString family() const; |
194 | int pointSize() const; | 196 | int pointSize() const; |
195 | QColor color() const; | 197 | QColor color() const; |
196 | QFont font() const; | 198 | QFont font() const; |
197 | int alignment() const; | 199 | int alignment() const; |
198 | int undoDepth() const; | 200 | int undoDepth() const; |
201 | |||
202 | // do not use, will go away | ||
199 | virtual bool getFormat( int para, int index, QFont *font, QColor *color, VerticalAlignment *verticalAlignment ); | 203 | virtual bool getFormat( int para, int index, QFont *font, QColor *color, VerticalAlignment *verticalAlignment ); |
204 | // do not use, will go away | ||
200 | virtual bool getParagraphFormat( int para, QFont *font, QColor *color, | 205 | virtual bool getParagraphFormat( int para, QFont *font, QColor *color, |
201 | VerticalAlignment *verticalAlignment, int *alignment, | 206 | VerticalAlignment *verticalAlignment, int *alignment, |
202 | QStyleSheetItem::DisplayMode *displayMode, | 207 | QStyleSheetItem::DisplayMode *displayMode, |
203 | QStyleSheetItem::ListStyle *listStyle, | 208 | QStyleSheetItem::ListStyle *listStyle, |
204 | int *listDepth ); | 209 | int *listDepth ); |
210 | |||
211 | |||
205 | bool isOverwriteMode() const { return overWrite; } | 212 | bool isOverwriteMode() const { return overWrite; } |
206 | QColor paragraphBackgroundColor( int para ) const; | 213 | QColor paragraphBackgroundColor( int para ) const; |
207 | 214 | ||
208 | bool isUndoRedoEnabled() const; | 215 | bool isUndoRedoEnabled() const; |
209 | bool eventFilter( QObject *o, QEvent *e ); | 216 | bool eventFilter( QObject *o, QEvent *e ); |
210 | 217 | ||
211 | public slots: | 218 | public slots: |
212 | void setEnabled( bool ); | 219 | void setEnabled( bool ); |
213 | virtual void setMimeSourceFactory( QMimeSourceFactory* factory ); | 220 | virtual void setMimeSourceFactory( QMimeSourceFactory* factory ); |
214 | virtual void setStyleSheet( QStyleSheet* styleSheet ); | 221 | virtual void setStyleSheet( QStyleSheet* styleSheet ); |
215 | virtual void scrollToAnchor( const QString& name ); | 222 | virtual void scrollToAnchor( const QString& name ); |
216 | virtual void setPaper( const QBrush& pap ); | 223 | virtual void setPaper( const QBrush& pap ); |
@@ -248,25 +255,28 @@ public slots: | |||
248 | virtual void clear(); | 255 | virtual void clear(); |
249 | virtual void del(); | 256 | virtual void del(); |
250 | virtual void indent(); | 257 | virtual void indent(); |
251 | virtual void setItalic( bool b ); | 258 | virtual void setItalic( bool b ); |
252 | virtual void setBold( bool b ); | 259 | virtual void setBold( bool b ); |
253 | virtual void setUnderline( bool b ); | 260 | virtual void setUnderline( bool b ); |
254 | virtual void setFamily( const QString &f ); | 261 | virtual void setFamily( const QString &f ); |
255 | virtual void setPointSize( int s ); | 262 | virtual void setPointSize( int s ); |
256 | virtual void setColor( const QColor &c ); | 263 | virtual void setColor( const QColor &c ); |
257 | virtual void setFont( const QFont &f ); | 264 | virtual void setFont( const QFont &f ); |
258 | virtual void setVerticalAlignment( VerticalAlignment a ); | 265 | virtual void setVerticalAlignment( VerticalAlignment a ); |
259 | virtual void setAlignment( int a ); | 266 | virtual void setAlignment( int a ); |
267 | |||
268 | // do not use, will go away | ||
260 | virtual void setParagType( QStyleSheetItem::DisplayMode dm, QStyleSheetItem::ListStyle listStyle ); | 269 | virtual void setParagType( QStyleSheetItem::DisplayMode dm, QStyleSheetItem::ListStyle listStyle ); |
270 | |||
261 | virtual void setCursorPosition( int parag, int index ); | 271 | virtual void setCursorPosition( int parag, int index ); |
262 | virtual void setSelection( int parag_from, int index_from, int parag_to, int index_to, int selNum = 0 ); | 272 | virtual void setSelection( int parag_from, int index_from, int parag_to, int index_to, int selNum = 0 ); |
263 | virtual void setSelectionAttributes( int selNum, const QColor &back, bool invertText ); | 273 | virtual void setSelectionAttributes( int selNum, const QColor &back, bool invertText ); |
264 | virtual void setModified( bool m ); | 274 | virtual void setModified( bool m ); |
265 | virtual void resetFormat(); | 275 | virtual void resetFormat(); |
266 | virtual void setUndoDepth( int d ); | 276 | virtual void setUndoDepth( int d ); |
267 | virtual void setFormat( QTextFormat *f, int flags ); | 277 | virtual void setFormat( QTextFormat *f, int flags ); |
268 | virtual void ensureCursorVisible(); | 278 | virtual void ensureCursorVisible(); |
269 | virtual void placeCursor( const QPoint &pos, QTextCursor *c = 0 ); | 279 | virtual void placeCursor( const QPoint &pos, QTextCursor *c = 0 ); |
270 | virtual void moveCursor( CursorAction action, bool select ); | 280 | virtual void moveCursor( CursorAction action, bool select ); |
271 | virtual void doKeyboardAction( KeyboardAction action ); | 281 | virtual void doKeyboardAction( KeyboardAction action ); |
272 | virtual void removeSelectedText( int selNum = 0 ); | 282 | virtual void removeSelectedText( int selNum = 0 ); |
@@ -337,81 +347,77 @@ protected slots: | |||
337 | 347 | ||
338 | private slots: | 348 | private slots: |
339 | void formatMore(); | 349 | void formatMore(); |
340 | void doResize(); | 350 | void doResize(); |
341 | void autoScrollTimerDone(); | 351 | void autoScrollTimerDone(); |
342 | void blinkCursor(); | 352 | void blinkCursor(); |
343 | void setModified(); | 353 | void setModified(); |
344 | void startDrag(); | 354 | void startDrag(); |
345 | void documentWidthChanged( int w ); | 355 | void documentWidthChanged( int w ); |
346 | 356 | ||
347 | private: | 357 | private: |
348 | struct Q_EXPORT UndoRedoInfo { | 358 | struct Q_EXPORT UndoRedoInfo { |
349 | enum Type { Invalid, Insert, Delete, Backspace, Return, RemoveSelected, Format, Alignment, ParagType }; | 359 | enum Type { Invalid, Insert, Delete, Backspace, Return, RemoveSelected, Format, Style }; |
350 | 360 | ||
351 | UndoRedoInfo( QTextDocument *dc ); | 361 | UndoRedoInfo( QTextDocument *dc ); |
352 | ~UndoRedoInfo(); | 362 | ~UndoRedoInfo(); |
353 | void clear(); | 363 | void clear(); |
354 | bool valid() const; | 364 | bool valid() const; |
355 | 365 | ||
356 | QUndoRedoInfoPrivate *d; | 366 | QUndoRedoInfoPrivate *d; |
357 | int id; | 367 | int id; |
358 | int index; | 368 | int index; |
359 | int eid; | 369 | int eid; |
360 | int eindex; | 370 | int eindex; |
361 | QTextFormat *format; | 371 | QTextFormat *format; |
362 | int flags; | 372 | int flags; |
363 | Type type; | 373 | Type type; |
364 | QTextDocument *doc; | 374 | QTextDocument *doc; |
365 | QMemArray<int> oldAligns; | 375 | QByteArray styleInformation; |
366 | int newAlign; | ||
367 | bool list; | ||
368 | QStyleSheetItem::ListStyle listStyle; | ||
369 | QValueList< QPtrVector<QStyleSheetItem> > oldStyles; | ||
370 | QValueList<QStyleSheetItem::ListStyle> oldListStyles; | ||
371 | }; | 376 | }; |
372 | 377 | ||
373 | private: | 378 | private: |
374 | void updateCursor( const QPoint & pos ); | 379 | void updateCursor( const QPoint & pos ); |
375 | void handleMouseMove( const QPoint& pos ); | 380 | void handleMouseMove( const QPoint& pos ); |
376 | void drawContents( QPainter * ); | 381 | void drawContents( QPainter * ); |
377 | virtual bool linksEnabled() const { return FALSE; } | 382 | virtual bool linksEnabled() const { return FALSE; } |
378 | void init(); | 383 | void init(); |
379 | void checkUndoRedoInfo( UndoRedoInfo::Type t ); | 384 | void checkUndoRedoInfo( UndoRedoInfo::Type t ); |
380 | void updateCurrentFormat(); | 385 | void updateCurrentFormat(); |
381 | bool handleReadOnlyKeyEvent( QKeyEvent *e ); | 386 | bool handleReadOnlyKeyEvent( QKeyEvent *e ); |
382 | void makeParagVisible( QTextParag *p ); | 387 | void makeParagVisible( QTextParagraph *p ); |
383 | #ifndef QT_NO_MIME | 388 | #ifndef QT_NO_MIME |
384 | QCString pickSpecial(QMimeSource* ms, bool always_ask, const QPoint&); | 389 | QCString pickSpecial(QMimeSource* ms, bool always_ask, const QPoint&); |
385 | #endif | 390 | #endif |
386 | #ifndef QT_NO_MIMECLIPBOARD | 391 | #ifndef QT_NO_MIMECLIPBOARD |
387 | void pasteSpecial(const QPoint&); | 392 | void pasteSpecial(const QPoint&); |
388 | #endif | 393 | #endif |
389 | void setFontInternal( const QFont &f ); | 394 | void setFontInternal( const QFont &f ); |
390 | 395 | ||
391 | virtual void emitHighlighted( const QString & ) {} | 396 | virtual void emitHighlighted( const QString & ) {} |
392 | virtual void emitLinkClicked( const QString & ) {} | 397 | virtual void emitLinkClicked( const QString & ) {} |
393 | 398 | ||
394 | void readFormats( QTextCursor &c1, QTextCursor &c2, int oldLen, QTextString &text, bool fillStyles = FALSE ); | 399 | void readFormats( QTextCursor &c1, QTextCursor &c2, QTextString &text, bool fillStyles = FALSE ); |
395 | void clearUndoRedo(); | 400 | void clearUndoRedo(); |
396 | void paintDocument( bool drawAll, QPainter *p, int cx = -1, int cy = -1, int cw = -1, int ch = -1 ); | 401 | void paintDocument( bool drawAll, QPainter *p, int cx = -1, int cy = -1, int cw = -1, int ch = -1 ); |
397 | void moveCursor( CursorAction action ); | 402 | void moveCursor( CursorAction action ); |
398 | void ensureFormatted( QTextParag *p ); | 403 | void ensureFormatted( QTextParagraph *p ); |
399 | void placeCursor( const QPoint &pos, QTextCursor *c, bool link ); | 404 | void placeCursor( const QPoint &pos, QTextCursor *c, bool link ); |
405 | void updateMicroFocusHint(); | ||
400 | 406 | ||
401 | private: | 407 | private: |
402 | QTextDocument *doc; | 408 | QTextDocument *doc; |
403 | QTextCursor *cursor; | 409 | QTextCursor *cursor; |
404 | QTimer *formatTimer, *scrollTimer, *changeIntervalTimer, *blinkTimer, *dragStartTimer; | 410 | QTimer *formatTimer, *scrollTimer, *changeIntervalTimer, *blinkTimer, *dragStartTimer; |
405 | QTextParag *lastFormatted; | 411 | QTextParagraph *lastFormatted; |
406 | int interval; | 412 | int interval; |
407 | UndoRedoInfo undoRedoInfo; | 413 | UndoRedoInfo undoRedoInfo; |
408 | QTextFormat *currentFormat; | 414 | QTextFormat *currentFormat; |
409 | int currentAlignment; | 415 | int currentAlignment; |
410 | QPoint oldMousePos, mousePos; | 416 | QPoint oldMousePos, mousePos; |
411 | QPoint dragStartPos; | 417 | QPoint dragStartPos; |
412 | QString onLink; | 418 | QString onLink; |
413 | WordWrap wrapMode; | 419 | WordWrap wrapMode; |
414 | WrapPolicy wPolicy; | 420 | WrapPolicy wPolicy; |
415 | int wrapWidth; | 421 | int wrapWidth; |
416 | QString pressedLink; | 422 | QString pressedLink; |
417 | QTextEditPrivate *d; | 423 | QTextEditPrivate *d; |