102
102
virtual void saxx(SaxHandler& handler, const Xml_string& elemtag) const;
103
103
virtual void saxx(SaxHandler& handler) const { saxx(handler, saxxDefaultElem); }
105
int cursorPosition() const;
106
void setCursorPosition(int pos, bool relative = false);
107
void normalizeCursorPosition();
108
int normalizedCursorPosition();
106
111
StoryText copy() const;
112
// Insert chars from another StoryText object at current cursor position
113
void insert(const StoryText& other, bool onlySelection = false);
114
// Insert chars from another StoryText object at specific position
107
115
void insert(int pos, const StoryText& other, bool onlySelection = false);
116
// Append chars from another StoryText object
108
117
void append(const StoryText& other) { insert(length(), other, false); }
118
// Remove len chars at specific position
109
119
void removeChars(int pos, uint len);
120
// Insert chars at current cursor position
121
void insertChars(QString txt, bool applyNeighbourStyle = false);
122
// Insert chars ar specific position
110
123
void insertChars(int pos, QString txt, bool applyNeighbourStyle = false);
124
// Insert inline object at current cursor position
125
void insertObject(PageItem* obj);
126
// Insert object at specific position
111
127
void insertObject(int pos, PageItem* obj);
112
128
void replaceChar(int pos, QChar ch);
114
130
void hyphenateWord(int pos, uint len, char* hyphens);
116
132
int length() const;
117
QChar text(int pos) const;
133
// Get char at current cursor position
135
// Get char at specific position
136
QChar text(int pos) const;
137
// Get text with len chars at specific position
118
138
QString text(int pos, uint len) const;
140
bool hasObject(int pos) const;
119
141
PageItem* object(int pos) const;
121
143
int nextCharPos(int c);
127
149
int nextFramePos(int c);
128
150
int prevFramePos(int c);
152
// Get charstyle at current cursor position
153
const CharStyle& charStyle() const;
154
// Get charstyle at specific position
130
155
const CharStyle& charStyle(int pos) const;
156
// Get paragraph style at current cursor position
157
const ParagraphStyle& paragraphStyle() const;
158
// Get paragraph style at specific position
131
159
const ParagraphStyle& paragraphStyle(int pos) const;
132
160
const ParagraphStyle& defaultStyle() const;
133
161
void setDefaultStyle(const ParagraphStyle& style);
139
167
void eraseStyle(int pos, const ParagraphStyle& style);
140
168
void replaceStyles(QMap<QString,QString> newNameForOld);
141
169
void replaceCharStyles(QMap<QString,QString> newNameForOld);
171
// Cleanup legacy formatting for whole story, ie remove direct
172
// formatting for parameters already set at paragraph level
173
void fixLegacyFormatting();
175
// Cleanup legacy formatting for paragraph at position pos
176
void fixLegacyFormatting(int pos);
143
178
void getNamedResources(ResourceCollection& lists) const;
144
179
void replaceNamedResources(ResourceCollection& newNames);
146
181
uint nrOfParagraphs() const;
147
int startOfParagraph(uint index) const;
148
int endOfParagraph(uint index) const;
182
int startOfParagraph() const;
183
int startOfParagraph(uint index) const;
184
int endOfParagraph() const;
185
int endOfParagraph(uint index) const;
186
uint nrOfParagraph() const;
149
187
uint nrOfParagraph(int pos) const;
151
189
uint nrOfRuns() const;