~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to src/qt3support/text/q3textedit.h

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
**
 
3
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
 
4
**
 
5
** This file is part of the Qt 3 compatibility classes of the Qt Toolkit.
 
6
**
 
7
** This file may be distributed under the terms of the Q Public License
 
8
** as defined by Trolltech AS of Norway and appearing in the file
 
9
** LICENSE.QPL included in the packaging of this file.
 
10
**
 
11
** This file may be distributed and/or modified under the terms of the
 
12
** GNU General Public License version 2 as published by the Free Software
 
13
** Foundation and appearing in the file LICENSE.GPL included in the
 
14
** packaging of this file.
 
15
**
 
16
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
 
17
**   information about Qt Commercial License Agreements.
 
18
** See http://www.trolltech.com/qpl/ for QPL licensing information.
 
19
** See http://www.trolltech.com/gpl/ for GPL licensing information.
 
20
**
 
21
** Contact info@trolltech.com if any conditions of this licensing are
 
22
** not clear to you.
 
23
**
 
24
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 
25
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 
26
**
 
27
****************************************************************************/
 
28
 
 
29
#ifndef Q3TEXTEDIT_H
 
30
#define Q3TEXTEDIT_H
 
31
 
 
32
#include "Qt3Support/q3scrollview.h"
 
33
#include "Qt3Support/q3stylesheet.h"
 
34
#include "Qt3Support/q3mimefactory.h"
 
35
#include "QtCore/qmap.h"
 
36
 
 
37
#ifndef QT_NO_TEXTEDIT
 
38
// uncomment below to enable optimization mode - also uncomment the
 
39
// optimDoAutoScroll() private slot since moc ignores #ifdefs..
 
40
#define QT_TEXTEDIT_OPTIMIZATION
 
41
 
 
42
class QPainter;
 
43
class Q3TextDocument;
 
44
class Q3TextCursor;
 
45
class QKeyEvent;
 
46
class QResizeEvent;
 
47
class QMouseEvent;
 
48
class QTimer;
 
49
class Q3TextString;
 
50
class QTextCommand;
 
51
class Q3TextParagraph;
 
52
class Q3TextFormat;
 
53
class QFont;
 
54
class QColor;
 
55
class Q3TextEdit;
 
56
class QTextBrowser;
 
57
class Q3TextString;
 
58
struct QUndoRedoInfoPrivate;
 
59
class Q3PopupMenu;
 
60
class Q3TextEditPrivate;
 
61
class Q3SyntaxHighlighter;
 
62
class Q3TextDrag;
 
63
 
 
64
#ifdef QT_TEXTEDIT_OPTIMIZATION
 
65
class Q3TextEditOptimPrivate
 
66
{
 
67
public:
 
68
    // Note: no left-tag has any value for leftTag or parent, and
 
69
    // no right-tag has any formatting flags set.
 
70
    enum TagType { Color = 0, Format = 1 };
 
71
    struct Tag {
 
72
        TagType type:2;
 
73
        bool bold:1;
 
74
        bool italic:1;
 
75
        bool underline:1;
 
76
        int line;
 
77
        int index;
 
78
        Tag * leftTag; // ptr to left-tag in a left-right tag pair
 
79
        Tag * parent;  // ptr to parent left-tag in a nested tag
 
80
        Tag * prev;
 
81
        Tag * next;
 
82
        QString tag;
 
83
    };
 
84
    Q3TextEditOptimPrivate()
 
85
    {
 
86
        len = numLines = maxLineWidth = 0;
 
87
        selStart.line = selStart.index = -1;
 
88
        selEnd.line = selEnd.index = -1;
 
89
        search.line = search.index = 0;
 
90
        tags = lastTag = 0;
 
91
    }
 
92
    void clearTags()
 
93
    {
 
94
        Tag * itr = tags;
 
95
        while (tags) {
 
96
            itr  = tags;
 
97
            tags = tags->next;
 
98
            delete itr;
 
99
        }
 
100
        tags = lastTag = 0;
 
101
        tagIndex.clear();
 
102
    }
 
103
    ~Q3TextEditOptimPrivate()
 
104
    {
 
105
        clearTags();
 
106
    }
 
107
    int len;
 
108
    int numLines;
 
109
    int maxLineWidth;
 
110
    struct Selection {
 
111
        int line;
 
112
        int index;
 
113
    };
 
114
    Selection selStart, selEnd, search;
 
115
    Tag * tags, * lastTag;
 
116
    QMap<int, QString> lines;
 
117
    QMap<int, Tag *> tagIndex;
 
118
};
 
119
#endif
 
120
 
 
121
class Q_COMPAT_EXPORT Q3TextEdit : public Q3ScrollView
 
122
{
 
123
    friend class Q3TextBrowser;
 
124
    friend class Q3SyntaxHighlighter;
 
125
 
 
126
    Q_OBJECT
 
127
    Q_ENUMS(WordWrap WrapPolicy)
 
128
    Q_FLAGS(AutoFormattingFlag)
 
129
    Q_PROPERTY(Qt::TextFormat textFormat READ textFormat WRITE setTextFormat)
 
130
    Q_PROPERTY(QString text READ text WRITE setText)
 
131
    Q_PROPERTY(QBrush paper READ paper WRITE setPaper)
 
132
    Q_PROPERTY(bool linkUnderline READ linkUnderline WRITE setLinkUnderline)
 
133
    Q_PROPERTY(QString documentTitle READ documentTitle)
 
134
    Q_PROPERTY(int length READ length)
 
135
    Q_PROPERTY(WordWrap wordWrap READ wordWrap WRITE setWordWrap)
 
136
    Q_PROPERTY(int wrapColumnOrWidth READ wrapColumnOrWidth WRITE setWrapColumnOrWidth)
 
137
    Q_PROPERTY(WrapPolicy wrapPolicy READ wrapPolicy WRITE setWrapPolicy)
 
138
    Q_PROPERTY(bool hasSelectedText READ hasSelectedText)
 
139
    Q_PROPERTY(QString selectedText READ selectedText)
 
140
    Q_PROPERTY(int undoDepth READ undoDepth WRITE setUndoDepth)
 
141
    Q_PROPERTY(bool overwriteMode READ isOverwriteMode WRITE setOverwriteMode)
 
142
    Q_PROPERTY(bool modified READ isModified WRITE setModified DESIGNABLE false)
 
143
    Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly)
 
144
    Q_PROPERTY(bool undoRedoEnabled READ isUndoRedoEnabled WRITE setUndoRedoEnabled)
 
145
    Q_PROPERTY(int tabStopWidth READ tabStopWidth WRITE setTabStopWidth)
 
146
    Q_PROPERTY(bool tabChangesFocus READ tabChangesFocus WRITE setTabChangesFocus)
 
147
    Q_PROPERTY(AutoFormattingFlag autoFormatting READ autoFormatting WRITE setAutoFormatting)
 
148
 
 
149
public:
 
150
    enum WordWrap {
 
151
        NoWrap,
 
152
        WidgetWidth,
 
153
        FixedPixelWidth,
 
154
        FixedColumnWidth
 
155
    };
 
156
 
 
157
    enum WrapPolicy {
 
158
        AtWordBoundary,
 
159
        AtWhiteSpace = AtWordBoundary, // AtWhiteSpace is deprecated
 
160
        Anywhere,
 
161
        AtWordOrDocumentBoundary
 
162
    };
 
163
 
 
164
    enum AutoFormattingFlag {
 
165
        AutoNone = 0,
 
166
        AutoBulletList = 0x00000001,
 
167
        AutoAll = 0xffffffff
 
168
    };
 
169
 
 
170
    Q_DECLARE_FLAGS(AutoFormatting, AutoFormattingFlag)
 
171
 
 
172
    enum KeyboardAction {
 
173
        ActionBackspace,
 
174
        ActionDelete,
 
175
        ActionReturn,
 
176
        ActionKill,
 
177
        ActionWordBackspace,
 
178
        ActionWordDelete
 
179
    };
 
180
 
 
181
    enum CursorAction {
 
182
        MoveBackward,
 
183
        MoveForward,
 
184
        MoveWordBackward,
 
185
        MoveWordForward,
 
186
        MoveUp,
 
187
        MoveDown,
 
188
        MoveLineStart,
 
189
        MoveLineEnd,
 
190
        MoveHome,
 
191
        MoveEnd,
 
192
        MovePgUp,
 
193
        MovePgDown
 
194
    };
 
195
 
 
196
    enum VerticalAlignment {
 
197
        AlignNormal,
 
198
        AlignSuperScript,
 
199
        AlignSubScript
 
200
    };
 
201
 
 
202
    enum TextInsertionFlags {
 
203
        RedoIndentation = 0x0001,
 
204
        CheckNewLines = 0x0002,
 
205
        RemoveSelected = 0x0004
 
206
    };
 
207
 
 
208
    Q3TextEdit(const QString& text, const QString& context = QString(),
 
209
               QWidget* parent=0, const char* name=0);
 
210
    Q3TextEdit(QWidget* parent=0, const char* name=0);
 
211
    virtual ~Q3TextEdit();
 
212
 
 
213
    QString text() const;
 
214
    QString text(int para) const;
 
215
    Qt::TextFormat textFormat() const;
 
216
    QString context() const;
 
217
    QString documentTitle() const;
 
218
 
 
219
    void getSelection(int *paraFrom, int *indexFrom,
 
220
                    int *paraTo, int *indexTo, int selNum = 0) const;
 
221
    virtual bool find(const QString &expr, bool cs, bool wo, bool forward = true,
 
222
                       int *para = 0, int *index = 0);
 
223
 
 
224
    int paragraphs() const;
 
225
    int lines() const;
 
226
    int linesOfParagraph(int para) const;
 
227
    int lineOfChar(int para, int chr);
 
228
    int length() const;
 
229
    QRect paragraphRect(int para) const;
 
230
    int paragraphAt(const QPoint &pos) const;
 
231
    int charAt(const QPoint &pos, int *para) const;
 
232
    int paragraphLength(int para) const;
 
233
 
 
234
    Q3StyleSheet* styleSheet() const;
 
235
#ifndef QT_NO_MIME
 
236
    Q3MimeSourceFactory* mimeSourceFactory() const;
 
237
#endif
 
238
    QBrush paper() const;
 
239
    bool linkUnderline() const;
 
240
 
 
241
    int heightForWidth(int w) const;
 
242
 
 
243
    bool hasSelectedText() const;
 
244
    QString selectedText() const;
 
245
    bool isUndoAvailable() const;
 
246
    bool isRedoAvailable() const;
 
247
 
 
248
    WordWrap wordWrap() const;
 
249
    int wrapColumnOrWidth() const;
 
250
    WrapPolicy wrapPolicy() const;
 
251
 
 
252
    int tabStopWidth() const;
 
253
 
 
254
    QString anchorAt(const QPoint& pos, Qt::AnchorAttribute a = Qt::AnchorHref);
 
255
 
 
256
    QSize sizeHint() const;
 
257
 
 
258
    bool isReadOnly() const { return readonly; }
 
259
 
 
260
    void getCursorPosition(int *parag, int *index) const;
 
261
 
 
262
    bool isModified() const;
 
263
    bool italic() const;
 
264
    bool bold() const;
 
265
    bool underline() const;
 
266
    QString family() const;
 
267
    int pointSize() const;
 
268
    QColor color() const;
 
269
    QFont font() const;
 
270
    QFont currentFont() const;
 
271
    int alignment() const;
 
272
    VerticalAlignment verticalAlignment() const;
 
273
    int undoDepth() const;
 
274
 
 
275
    // do not use, will go away
 
276
    virtual bool getFormat(int para, int index, QFont *font, QColor *color, VerticalAlignment *verticalAlignment);
 
277
    // do not use, will go away
 
278
    virtual bool getParagraphFormat(int para, QFont *font, QColor *color,
 
279
                                     VerticalAlignment *verticalAlignment, int *alignment,
 
280
                                     Q3StyleSheetItem::DisplayMode *displayMode,
 
281
                                     Q3StyleSheetItem::ListStyle *listStyle,
 
282
                                     int *listDepth);
 
283
 
 
284
 
 
285
    bool isOverwriteMode() const { return overWrite; }
 
286
    QColor paragraphBackgroundColor(int para) const;
 
287
 
 
288
    bool isUndoRedoEnabled() const;
 
289
    bool eventFilter(QObject *o, QEvent *e);
 
290
    bool tabChangesFocus() const;
 
291
 
 
292
    void setAutoFormatting(AutoFormatting);
 
293
    AutoFormatting autoFormatting() const;
 
294
    Q3SyntaxHighlighter *syntaxHighlighter() const;
 
295
 
 
296
public slots:
 
297
#ifndef QT_NO_MIME
 
298
    virtual void setMimeSourceFactory(Q3MimeSourceFactory* factory);
 
299
#endif
 
300
    virtual void setStyleSheet(Q3StyleSheet* styleSheet);
 
301
    virtual void scrollToAnchor(const QString& name);
 
302
    virtual void setPaper(const QBrush& pap);
 
303
    virtual void setLinkUnderline(bool);
 
304
 
 
305
    virtual void setWordWrap(WordWrap mode);
 
306
    virtual void setWrapColumnOrWidth(int);
 
307
    virtual void setWrapPolicy(WrapPolicy policy);
 
308
 
 
309
    virtual void copy();
 
310
    virtual void append(const QString& text);
 
311
 
 
312
    void setText(const QString &txt) { setText(txt, QString()); }
 
313
    virtual void setText(const QString &txt, const QString &context);
 
314
    virtual void setTextFormat(Qt::TextFormat f);
 
315
 
 
316
    virtual void selectAll(bool select = true);
 
317
    virtual void setTabStopWidth(int ts);
 
318
    virtual void zoomIn(int range);
 
319
    virtual void zoomIn() { zoomIn(1); }
 
320
    virtual void zoomOut(int range);
 
321
    virtual void zoomOut() { zoomOut(1); }
 
322
    virtual void zoomTo(int size);
 
323
 
 
324
    virtual void sync();
 
325
    virtual void setReadOnly(bool b);
 
326
 
 
327
    virtual void undo();
 
328
    virtual void redo();
 
329
    virtual void cut();
 
330
    virtual void paste();
 
331
#ifndef QT_NO_CLIPBOARD
 
332
    virtual void pasteSubType(const QByteArray &subtype);
 
333
#endif
 
334
    virtual void clear();
 
335
    virtual void del();
 
336
    virtual void indent();
 
337
    virtual void setItalic(bool b);
 
338
    virtual void setBold(bool b);
 
339
    virtual void setUnderline(bool b);
 
340
    virtual void setFamily(const QString &f);
 
341
    virtual void setPointSize(int s);
 
342
    virtual void setColor(const QColor &c);
 
343
    virtual void setVerticalAlignment(VerticalAlignment a);
 
344
    virtual void setAlignment(int a);
 
345
 
 
346
    // do not use, will go away
 
347
    virtual void setParagType(Q3StyleSheetItem::DisplayMode dm, Q3StyleSheetItem::ListStyle listStyle);
 
348
 
 
349
    virtual void setCursorPosition(int parag, int index);
 
350
    virtual void setSelection(int parag_from, int index_from, int parag_to, int index_to, int selNum = 0);
 
351
    virtual void setSelectionAttributes(int selNum, const QColor &back, bool invertText);
 
352
    virtual void setModified(bool m);
 
353
    virtual void resetFormat();
 
354
    virtual void setUndoDepth(int d);
 
355
    virtual void setFormat(Q3TextFormat *f, int flags);
 
356
    virtual void ensureCursorVisible();
 
357
    virtual void placeCursor(const QPoint &pos, Q3TextCursor *c = 0);
 
358
    virtual void moveCursor(CursorAction action, bool select);
 
359
    virtual void doKeyboardAction(KeyboardAction action);
 
360
    virtual void removeSelectedText(int selNum = 0);
 
361
    virtual void removeSelection(int selNum = 0);
 
362
    virtual void setCurrentFont(const QFont &f);
 
363
    virtual void setOverwriteMode(bool b) { overWrite = b; }
 
364
 
 
365
    virtual void scrollToBottom();
 
366
 
 
367
    virtual void insert(const QString &text, uint insertionFlags = CheckNewLines | RemoveSelected);
 
368
 
 
369
    // obsolete
 
370
    virtual void insert(const QString &text, bool, bool = true, bool = true);
 
371
 
 
372
    virtual void insertAt(const QString &text, int para, int index);
 
373
    virtual void removeParagraph(int para);
 
374
    virtual void insertParagraph(const QString &text, int para);
 
375
 
 
376
    virtual void setParagraphBackgroundColor(int para, const QColor &bg);
 
377
    virtual void clearParagraphBackground(int para);
 
378
 
 
379
    virtual void setUndoRedoEnabled(bool b);
 
380
    virtual void setTabChangesFocus(bool b);
 
381
 
 
382
#ifdef QT_TEXTEDIT_OPTIMIZATION
 
383
    void polishEvent(QEvent*);
 
384
    void setMaxLogLines(int numLines);
 
385
    int maxLogLines() const;
 
386
#endif
 
387
 
 
388
signals:
 
389
    void textChanged();
 
390
    void selectionChanged();
 
391
    void copyAvailable(bool);
 
392
    void undoAvailable(bool yes);
 
393
    void redoAvailable(bool yes);
 
394
    void currentFontChanged(const QFont &f);
 
395
    void currentColorChanged(const QColor &c);
 
396
    void currentAlignmentChanged(int a);
 
397
    void currentVerticalAlignmentChanged(VerticalAlignment a);
 
398
    void cursorPositionChanged(Q3TextCursor *c);
 
399
    void cursorPositionChanged(int para, int pos);
 
400
    void returnPressed();
 
401
    void modificationChanged(bool m);
 
402
    void clicked(int parag, int index);
 
403
    void doubleClicked(int parag, int index);
 
404
 
 
405
protected:
 
406
    void repaintChanged();
 
407
    void updateStyles();
 
408
    void drawContents(QPainter *p, int cx, int cy, int cw, int ch);
 
409
    bool event(QEvent *e);
 
410
    void changeEvent(QEvent *);
 
411
    void keyPressEvent(QKeyEvent *e);
 
412
    void resizeEvent(QResizeEvent *e);
 
413
    void viewportResizeEvent(QResizeEvent*);
 
414
    void contentsMousePressEvent(QMouseEvent *e);
 
415
    void contentsMouseMoveEvent(QMouseEvent *e);
 
416
    void contentsMouseReleaseEvent(QMouseEvent *e);
 
417
    void contentsMouseDoubleClickEvent(QMouseEvent *e);
 
418
#ifndef QT_NO_WHEELEVENT
 
419
    void contentsWheelEvent(QWheelEvent *e);
 
420
#endif
 
421
    void inputMethodEvent(QInputMethodEvent *);
 
422
#ifndef QT_NO_DRAGANDDROP
 
423
    void contentsDragEnterEvent(QDragEnterEvent *e);
 
424
    void contentsDragMoveEvent(QDragMoveEvent *e);
 
425
    void contentsDragLeaveEvent(QDragLeaveEvent *e);
 
426
    void contentsDropEvent(QDropEvent *e);
 
427
#endif
 
428
    void contentsContextMenuEvent(QContextMenuEvent *e);
 
429
    bool focusNextPrevChild(bool next);
 
430
    Q3TextDocument *document() const;
 
431
    Q3TextCursor *textCursor() const;
 
432
    void setDocument(Q3TextDocument *doc);
 
433
    virtual Q3PopupMenu *createPopupMenu(const QPoint& pos);
 
434
    virtual Q3PopupMenu *createPopupMenu();
 
435
    void drawCursor(bool visible);
 
436
 
 
437
protected slots:
 
438
    virtual void doChangeInterval();
 
439
    virtual void sliderReleased();
 
440
 
 
441
private slots:
 
442
    void formatMore();
 
443
    void doResize();
 
444
    void autoScrollTimerDone();
 
445
    void blinkCursor();
 
446
    void setModified();
 
447
    void startDrag();
 
448
    void documentWidthChanged(int w);
 
449
    void clipboardChanged();
 
450
 
 
451
private:
 
452
    struct Q_COMPAT_EXPORT UndoRedoInfo {
 
453
        enum Type { Invalid, Insert, Delete, Backspace, Return, RemoveSelected, Format, Style };
 
454
 
 
455
        UndoRedoInfo(Q3TextDocument *dc);
 
456
        ~UndoRedoInfo();
 
457
        void clear();
 
458
        bool valid() const;
 
459
 
 
460
        QUndoRedoInfoPrivate *d;
 
461
        int id;
 
462
        int index;
 
463
        int eid;
 
464
        int eindex;
 
465
        Q3TextFormat *format;
 
466
        int flags;
 
467
        Type type;
 
468
        Q3TextDocument *doc;
 
469
        QByteArray styleInformation;
 
470
    };
 
471
 
 
472
private:
 
473
    void updateCursor(const QPoint & pos);
 
474
    void handleMouseMove(const QPoint& pos);
 
475
    void drawContents(QPainter *);
 
476
    virtual bool linksEnabled() const { return false; }
 
477
    void init();
 
478
    void checkUndoRedoInfo(UndoRedoInfo::Type t);
 
479
    void updateCurrentFormat();
 
480
    bool handleReadOnlyKeyEvent(QKeyEvent *e);
 
481
    void makeParagVisible(Q3TextParagraph *p);
 
482
    void normalCopy();
 
483
    void copyToClipboard();
 
484
#ifndef QT_NO_MIME
 
485
    QByteArray pickSpecial(QMimeSource* ms, bool always_ask, const QPoint&);
 
486
    Q3TextDrag *dragObject(QWidget *parent = 0) const;
 
487
#endif
 
488
#ifndef QT_NO_MIMECLIPBOARD
 
489
    void pasteSpecial(const QPoint&);
 
490
#endif
 
491
    void setFontInternal(const QFont &f);
 
492
 
 
493
    virtual void emitHighlighted(const QString &) {}
 
494
    virtual void emitLinkClicked(const QString &) {}
 
495
 
 
496
    void readFormats(Q3TextCursor &c1, Q3TextCursor &c2, Q3TextString &text, bool fillStyles = false);
 
497
    void clearUndoRedo();
 
498
    void paintDocument(bool drawAll, QPainter *p, int cx = -1, int cy = -1, int cw = -1, int ch = -1);
 
499
    void moveCursor(CursorAction action);
 
500
    void ensureFormatted(Q3TextParagraph *p);
 
501
    void placeCursor(const QPoint &pos, Q3TextCursor *c, bool link);
 
502
    QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
 
503
 
 
504
#ifdef QT_TEXTEDIT_OPTIMIZATION
 
505
    bool checkOptimMode();
 
506
    QString optimText() const;
 
507
    void optimSetText(const QString &str);
 
508
    void optimAppend(const QString &str);
 
509
    void optimInsert(const QString &str, int line, int index);
 
510
    void optimDrawContents(QPainter * p, int cx, int cy, int cw, int ch);
 
511
    void optimMousePressEvent(QMouseEvent * e);
 
512
    void optimMouseReleaseEvent(QMouseEvent * e);
 
513
    void optimMouseMoveEvent(QMouseEvent * e);
 
514
    int  optimCharIndex(const QString &str, int mx) const;
 
515
    void optimSelectAll();
 
516
    void optimRemoveSelection();
 
517
    void optimSetSelection(int startLine, int startIdx, int endLine,
 
518
                            int endIdx);
 
519
    bool optimHasSelection() const;
 
520
    QString optimSelectedText() const;
 
521
    bool optimFind(const QString & str, bool, bool, bool, int *, int *);
 
522
    void optimParseTags(QString * str, int lineNo = -1, int indexOffset = 0);
 
523
    Q3TextEditOptimPrivate::Tag * optimPreviousLeftTag(int line);
 
524
    void optimSetTextFormat(Q3TextDocument *, Q3TextCursor *, Q3TextFormat * f,
 
525
                             int, int, Q3TextEditOptimPrivate::Tag * t);
 
526
    Q3TextEditOptimPrivate::Tag * optimAppendTag(int index, const QString & tag);
 
527
    Q3TextEditOptimPrivate::Tag * optimInsertTag(int line, int index, const QString & tag);
 
528
    void optimCheckLimit(const QString& str);
 
529
    bool optimHasBoldMetrics(int line);
 
530
 
 
531
private slots:
 
532
    void optimDoAutoScroll();
 
533
#endif // QT_TEXTEDIT_OPTIMIZATION
 
534
 
 
535
private:
 
536
#ifndef QT_NO_CLIPBOARD
 
537
    void pasteSubType(const QByteArray &subtype, QMimeSource *m);
 
538
#endif
 
539
 
 
540
private:
 
541
    Q_DISABLE_COPY(Q3TextEdit)
 
542
 
 
543
    Q3TextDocument *doc;
 
544
    Q3TextCursor *cursor;
 
545
    QTimer *formatTimer, *scrollTimer, *changeIntervalTimer, *blinkTimer, *dragStartTimer;
 
546
    Q3TextParagraph *lastFormatted;
 
547
    int interval;
 
548
    UndoRedoInfo undoRedoInfo;
 
549
    Q3TextFormat *currentFormat;
 
550
    int currentAlignment;
 
551
    QPoint oldMousePos, mousePos;
 
552
    QPoint dragStartPos;
 
553
    QString onLink;
 
554
    WordWrap wrapMode;
 
555
    WrapPolicy wPolicy;
 
556
    int wrapWidth;
 
557
    QString pressedLink;
 
558
    Q3TextEditPrivate *d;
 
559
    bool inDoubleClick : 1;
 
560
    bool mousePressed : 1;
 
561
    bool cursorVisible : 1;
 
562
    bool blinkCursorVisible : 1;
 
563
    bool modified : 1;
 
564
    bool mightStartDrag : 1;
 
565
    bool inDnD : 1;
 
566
    bool readonly : 1;
 
567
    bool undoEnabled : 1;
 
568
    bool overWrite : 1;
 
569
};
 
570
 
 
571
Q_DECLARE_OPERATORS_FOR_FLAGS(Q3TextEdit::AutoFormatting)
 
572
 
 
573
inline Q3TextDocument *Q3TextEdit::document() const
 
574
{
 
575
    return doc;
 
576
}
 
577
 
 
578
inline Q3TextCursor *Q3TextEdit::textCursor() const
 
579
{
 
580
    return cursor;
 
581
}
 
582
 
 
583
inline void Q3TextEdit::setCurrentFont(const QFont &f)
 
584
{
 
585
    Q3TextEdit::setFontInternal(f);
 
586
}
 
587
 
 
588
#endif // QT_NO_TEXTEDIT
 
589
 
 
590
#endif // Q3TEXTEDIT_H