author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Mon, 04 Oct 2010 01:19:32 +0300 | |
changeset 37 | 758a864f9613 |
parent 33 | 3e2da88830cd |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the QtGui module of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#ifndef QTEXTCURSOR_H |
|
43 |
#define QTEXTCURSOR_H |
|
44 |
||
45 |
#include <QtCore/qstring.h> |
|
46 |
#include <QtCore/qshareddata.h> |
|
47 |
#include <QtGui/qtextformat.h> |
|
48 |
||
49 |
QT_BEGIN_HEADER |
|
50 |
||
51 |
QT_BEGIN_NAMESPACE |
|
52 |
||
53 |
QT_MODULE(Gui) |
|
54 |
||
55 |
class QTextDocument; |
|
56 |
class QTextCursorPrivate; |
|
57 |
class QTextDocumentFragment; |
|
58 |
class QTextCharFormat; |
|
59 |
class QTextBlockFormat; |
|
60 |
class QTextListFormat; |
|
61 |
class QTextTableFormat; |
|
62 |
class QTextFrameFormat; |
|
63 |
class QTextImageFormat; |
|
64 |
class QTextDocumentPrivate; |
|
65 |
class QTextList; |
|
66 |
class QTextTable; |
|
67 |
class QTextFrame; |
|
68 |
class QTextBlock; |
|
69 |
||
70 |
class Q_GUI_EXPORT QTextCursor |
|
71 |
{ |
|
72 |
public: |
|
73 |
QTextCursor(); |
|
74 |
explicit QTextCursor(QTextDocument *document); |
|
75 |
QTextCursor(QTextDocumentPrivate *p, int pos); |
|
76 |
explicit QTextCursor(QTextFrame *frame); |
|
77 |
explicit QTextCursor(const QTextBlock &block); |
|
78 |
explicit QTextCursor(QTextCursorPrivate *d); |
|
79 |
QTextCursor(const QTextCursor &cursor); |
|
80 |
QTextCursor &operator=(const QTextCursor &other); |
|
81 |
~QTextCursor(); |
|
82 |
||
83 |
bool isNull() const; |
|
84 |
||
85 |
enum MoveMode { |
|
86 |
MoveAnchor, |
|
87 |
KeepAnchor |
|
88 |
}; |
|
89 |
||
90 |
void setPosition(int pos, MoveMode mode = MoveAnchor); |
|
91 |
int position() const; |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
92 |
int positionInBlock() const; |
0 | 93 |
|
94 |
int anchor() const; |
|
95 |
||
96 |
void insertText(const QString &text); |
|
97 |
void insertText(const QString &text, const QTextCharFormat &format); |
|
98 |
||
99 |
enum MoveOperation { |
|
100 |
NoMove, |
|
101 |
||
102 |
Start, |
|
103 |
Up, |
|
104 |
StartOfLine, |
|
105 |
StartOfBlock, |
|
106 |
StartOfWord, |
|
107 |
PreviousBlock, |
|
108 |
PreviousCharacter, |
|
109 |
PreviousWord, |
|
110 |
Left, |
|
111 |
WordLeft, |
|
112 |
||
113 |
End, |
|
114 |
Down, |
|
115 |
EndOfLine, |
|
116 |
EndOfWord, |
|
117 |
EndOfBlock, |
|
118 |
NextBlock, |
|
119 |
NextCharacter, |
|
120 |
NextWord, |
|
121 |
Right, |
|
122 |
WordRight, |
|
123 |
||
124 |
NextCell, |
|
125 |
PreviousCell, |
|
126 |
NextRow, |
|
127 |
PreviousRow |
|
128 |
}; |
|
129 |
||
130 |
bool movePosition(MoveOperation op, MoveMode = MoveAnchor, int n = 1); |
|
131 |
||
132 |
bool visualNavigation() const; |
|
133 |
void setVisualNavigation(bool b); |
|
134 |
||
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
135 |
void setVerticalMovementX(int x); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
136 |
int verticalMovementX() const; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
137 |
|
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
138 |
void setKeepPositionOnInsert(bool b); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
139 |
bool keepPositionOnInsert() const; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
140 |
|
0 | 141 |
void deleteChar(); |
142 |
void deletePreviousChar(); |
|
143 |
||
144 |
enum SelectionType { |
|
145 |
WordUnderCursor, |
|
146 |
LineUnderCursor, |
|
147 |
BlockUnderCursor, |
|
148 |
Document |
|
149 |
}; |
|
150 |
void select(SelectionType selection); |
|
151 |
||
152 |
bool hasSelection() const; |
|
153 |
bool hasComplexSelection() const; |
|
154 |
void removeSelectedText(); |
|
155 |
void clearSelection(); |
|
156 |
int selectionStart() const; |
|
157 |
int selectionEnd() const; |
|
158 |
||
159 |
QString selectedText() const; |
|
160 |
QTextDocumentFragment selection() const; |
|
161 |
void selectedTableCells(int *firstRow, int *numRows, int *firstColumn, int *numColumns) const; |
|
162 |
||
163 |
QTextBlock block() const; |
|
164 |
||
165 |
QTextCharFormat charFormat() const; |
|
166 |
void setCharFormat(const QTextCharFormat &format); |
|
167 |
void mergeCharFormat(const QTextCharFormat &modifier); |
|
168 |
||
169 |
QTextBlockFormat blockFormat() const; |
|
170 |
void setBlockFormat(const QTextBlockFormat &format); |
|
171 |
void mergeBlockFormat(const QTextBlockFormat &modifier); |
|
172 |
||
173 |
QTextCharFormat blockCharFormat() const; |
|
174 |
void setBlockCharFormat(const QTextCharFormat &format); |
|
175 |
void mergeBlockCharFormat(const QTextCharFormat &modifier); |
|
176 |
||
177 |
bool atBlockStart() const; |
|
178 |
bool atBlockEnd() const; |
|
179 |
bool atStart() const; |
|
180 |
bool atEnd() const; |
|
181 |
||
182 |
void insertBlock(); |
|
183 |
void insertBlock(const QTextBlockFormat &format); |
|
184 |
void insertBlock(const QTextBlockFormat &format, const QTextCharFormat &charFormat); |
|
185 |
||
186 |
QTextList *insertList(const QTextListFormat &format); |
|
187 |
QTextList *insertList(QTextListFormat::Style style); |
|
188 |
||
189 |
QTextList *createList(const QTextListFormat &format); |
|
190 |
QTextList *createList(QTextListFormat::Style style); |
|
191 |
QTextList *currentList() const; |
|
192 |
||
193 |
QTextTable *insertTable(int rows, int cols, const QTextTableFormat &format); |
|
194 |
QTextTable *insertTable(int rows, int cols); |
|
195 |
QTextTable *currentTable() const; |
|
196 |
||
197 |
QTextFrame *insertFrame(const QTextFrameFormat &format); |
|
198 |
QTextFrame *currentFrame() const; |
|
199 |
||
200 |
void insertFragment(const QTextDocumentFragment &fragment); |
|
201 |
||
202 |
#ifndef QT_NO_TEXTHTMLPARSER |
|
203 |
void insertHtml(const QString &html); |
|
204 |
#endif // QT_NO_TEXTHTMLPARSER |
|
205 |
||
206 |
void insertImage(const QTextImageFormat &format, QTextFrameFormat::Position alignment); |
|
207 |
void insertImage(const QTextImageFormat &format); |
|
208 |
void insertImage(const QString &name); |
|
209 |
void insertImage(const QImage &image, const QString &name = QString()); |
|
210 |
||
211 |
void beginEditBlock(); |
|
212 |
void joinPreviousEditBlock(); |
|
213 |
void endEditBlock(); |
|
214 |
||
215 |
bool operator!=(const QTextCursor &rhs) const; |
|
216 |
bool operator<(const QTextCursor &rhs) const; |
|
217 |
bool operator<=(const QTextCursor &rhs) const; |
|
218 |
bool operator==(const QTextCursor &rhs) const; |
|
219 |
bool operator>=(const QTextCursor &rhs) const; |
|
220 |
bool operator>(const QTextCursor &rhs) const; |
|
221 |
||
222 |
bool isCopyOf(const QTextCursor &other) const; |
|
223 |
||
224 |
int blockNumber() const; |
|
225 |
int columnNumber() const; |
|
226 |
||
227 |
QTextDocument *document() const; |
|
228 |
||
229 |
private: |
|
230 |
QSharedDataPointer<QTextCursorPrivate> d; |
|
231 |
friend class QTextDocumentFragmentPrivate; |
|
232 |
friend class QTextCopyHelper; |
|
233 |
}; |
|
234 |
||
235 |
QT_END_NAMESPACE |
|
236 |
||
237 |
QT_END_HEADER |
|
238 |
||
239 |
#endif // QTEXTCURSOR_H |