Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | __attribute__((visibility("default"))) unsigned int qt_int_sqrt(unsigned int n); | - |
8 | bool Qt::mightBeRichText(const QString& text) | - |
9 | { | - |
10 | if (text.isEmpty()) partially evaluated: text.isEmpty() no Evaluation Count:0 | yes Evaluation Count:1051 |
| 0-1051 |
11 | return false; never executed: return false; | 0 |
12 | int start = 0; | - |
13 | | - |
14 | while (start < text.length() && text.at(start).isSpace()) evaluated: start < text.length() yes Evaluation Count:1051 | yes Evaluation Count:1 |
evaluated: text.at(start).isSpace() yes Evaluation Count:1 | yes Evaluation Count:1050 |
| 1-1051 |
15 | ++start; executed: ++start; Execution Count:1 | 1 |
16 | | - |
17 | | - |
18 | if (text.mid(start, 5) == QLatin1String("<?xml")) { evaluated: text.mid(start, 5) == QLatin1String("<?xml") yes Evaluation Count:2 | yes Evaluation Count:1049 |
| 2-1049 |
19 | while (start < text.length()) { partially evaluated: start < text.length() yes Evaluation Count:84 | no Evaluation Count:0 |
| 0-84 |
20 | if (text.at(start) == QLatin1Char('?') evaluated: text.at(start) == QLatin1Char('?') yes Evaluation Count:4 | yes Evaluation Count:80 |
| 4-80 |
21 | && start + 2 < text.length() partially evaluated: start + 2 < text.length() yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
22 | && text.at(start + 1) == QLatin1Char('>')) { evaluated: text.at(start + 1) == QLatin1Char('>') yes Evaluation Count:2 | yes Evaluation Count:2 |
| 2 |
23 | start += 2; | - |
24 | break; executed: break; Execution Count:2 | 2 |
25 | } | - |
26 | ++start; | - |
27 | } executed: } Execution Count:82 | 82 |
28 | | - |
29 | while (start < text.length() && text.at(start).isSpace()) partially evaluated: start < text.length() yes Evaluation Count:4 | no Evaluation Count:0 |
evaluated: text.at(start).isSpace() yes Evaluation Count:2 | yes Evaluation Count:2 |
| 0-4 |
30 | ++start; executed: ++start; Execution Count:2 | 2 |
31 | } executed: } Execution Count:2 | 2 |
32 | | - |
33 | if (text.mid(start, 5).toLower() == QLatin1String("<!doc")) evaluated: text.mid(start, 5).toLower() == QLatin1String("<!doc") yes Evaluation Count:2 | yes Evaluation Count:1049 |
| 2-1049 |
34 | return true; executed: return true; Execution Count:2 | 2 |
35 | int open = start; | - |
36 | while (open < text.length() && text.at(open) != QLatin1Char('<') evaluated: open < text.length() yes Evaluation Count:13196 | yes Evaluation Count:1002 |
evaluated: text.at(open) != QLatin1Char('<') yes Evaluation Count:13181 | yes Evaluation Count:15 |
| 15-13196 |
37 | && text.at(open) != QLatin1Char('\n')) { evaluated: text.at(open) != QLatin1Char('\n') yes Evaluation Count:13149 | yes Evaluation Count:32 |
| 32-13149 |
38 | if (text.at(open) == QLatin1Char('&') && text.mid(open+1,3) == QLatin1String("lt;")) evaluated: text.at(open) == QLatin1Char('&') yes Evaluation Count:271 | yes Evaluation Count:12878 |
partially evaluated: text.mid(open+1,3) == QLatin1String("lt;") no Evaluation Count:0 | yes Evaluation Count:271 |
| 0-12878 |
39 | return true; never executed: return true; | 0 |
40 | ++open; | - |
41 | } executed: } Execution Count:13149 | 13149 |
42 | if (open < text.length() && text.at(open) == QLatin1Char('<')) { evaluated: open < text.length() yes Evaluation Count:47 | yes Evaluation Count:1002 |
evaluated: text.at(open) == QLatin1Char('<') yes Evaluation Count:15 | yes Evaluation Count:32 |
| 15-1002 |
43 | const int close = text.indexOf(QLatin1Char('>'), open); | - |
44 | if (close > -1) { evaluated: close > -1 yes Evaluation Count:14 | yes Evaluation Count:1 |
| 1-14 |
45 | QString tag; | - |
46 | for (int i = open+1; i < close; ++i) { evaluated: i < close yes Evaluation Count:29 | yes Evaluation Count:11 |
| 11-29 |
47 | if (text[i].isDigit() || text[i].isLetter()) evaluated: text[i].isDigit() yes Evaluation Count:2 | yes Evaluation Count:27 |
evaluated: text[i].isLetter() yes Evaluation Count:24 | yes Evaluation Count:3 |
| 2-27 |
48 | tag += text[i]; executed: tag += text[i]; Execution Count:26 | 26 |
49 | else if (!tag.isEmpty() && text[i].isSpace()) partially evaluated: !tag.isEmpty() yes Evaluation Count:3 | no Evaluation Count:0 |
evaluated: text[i].isSpace() yes Evaluation Count:1 | yes Evaluation Count:2 |
| 0-3 |
50 | break; executed: break; Execution Count:1 | 1 |
51 | else if (!tag.isEmpty() && text[i] == QLatin1Char('/') && i + 1 == close) partially evaluated: !tag.isEmpty() yes Evaluation Count:2 | no Evaluation Count:0 |
partially evaluated: text[i] == QLatin1Char('/') yes Evaluation Count:2 | no Evaluation Count:0 |
evaluated: i + 1 == close yes Evaluation Count:1 | yes Evaluation Count:1 |
| 0-2 |
52 | break; executed: break; Execution Count:1 | 1 |
53 | else if (!text[i].isSpace() && (!tag.isEmpty() || text[i] != QLatin1Char('!'))) partially evaluated: !text[i].isSpace() yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: !tag.isEmpty() yes Evaluation Count:1 | no Evaluation Count:0 |
never evaluated: text[i] != QLatin1Char('!') | 0-1 |
54 | return false; executed: return false; Execution Count:1 | 1 |
55 | } | - |
56 | | - |
57 | return QTextHtmlParser::lookupElement(tag.toLower()) != -1; executed: return QTextHtmlParser::lookupElement(tag.toLower()) != -1; Execution Count:13 | 13 |
58 | | - |
59 | | - |
60 | | - |
61 | } | - |
62 | } executed: } Execution Count:1 | 1 |
63 | return false; executed: return false; Execution Count:1035 | 1035 |
64 | } | - |
65 | QString Qt::convertFromPlainText(const QString &plain, Qt::WhiteSpaceMode mode) | - |
66 | { | - |
67 | int col = 0; | - |
68 | QString rich; | - |
69 | rich += QLatin1String("<p>"); | - |
70 | for (int i = 0; i < plain.length(); ++i) { never evaluated: i < plain.length() | 0 |
71 | if (plain[i] == QLatin1Char('\n')){ never evaluated: plain[i] == QLatin1Char('\n') | 0 |
72 | int c = 1; | - |
73 | while (i+1 < plain.length() && plain[i+1] == QLatin1Char('\n')) { never evaluated: i+1 < plain.length() never evaluated: plain[i+1] == QLatin1Char('\n') | 0 |
74 | i++; | - |
75 | c++; | - |
76 | } | 0 |
77 | if (c == 1) | 0 |
78 | rich += QLatin1String("<br>\n"); never executed: rich += QLatin1String("<br>\n"); | 0 |
79 | else { | - |
80 | rich += QLatin1String("</p>\n"); | - |
81 | while (--c > 1) | 0 |
82 | rich += QLatin1String("<br>\n"); never executed: rich += QLatin1String("<br>\n"); | 0 |
83 | rich += QLatin1String("<p>"); | - |
84 | } | 0 |
85 | col = 0; | - |
86 | } else { | 0 |
87 | if (mode == Qt::WhiteSpacePre && plain[i] == QLatin1Char('\t')){ never evaluated: mode == Qt::WhiteSpacePre never evaluated: plain[i] == QLatin1Char('\t') | 0 |
88 | rich += QChar(0x00a0U); | - |
89 | ++col; | - |
90 | while (col % 8) { | 0 |
91 | rich += QChar(0x00a0U); | - |
92 | ++col; | - |
93 | } | 0 |
94 | } | 0 |
95 | else if (mode == Qt::WhiteSpacePre && plain[i].isSpace()) never evaluated: mode == Qt::WhiteSpacePre never evaluated: plain[i].isSpace() | 0 |
96 | rich += QChar(0x00a0U); never executed: rich += QChar(0x00a0U); | 0 |
97 | else if (plain[i] == QLatin1Char('<')) never evaluated: plain[i] == QLatin1Char('<') | 0 |
98 | rich += QLatin1String("<"); never executed: rich += QLatin1String("<"); | 0 |
99 | else if (plain[i] == QLatin1Char('>')) never evaluated: plain[i] == QLatin1Char('>') | 0 |
100 | rich += QLatin1String(">"); never executed: rich += QLatin1String(">"); | 0 |
101 | else if (plain[i] == QLatin1Char('&')) never evaluated: plain[i] == QLatin1Char('&') | 0 |
102 | rich += QLatin1String("&"); never executed: rich += QLatin1String("&"); | 0 |
103 | else | - |
104 | rich += plain[i]; never executed: rich += plain[i]; | 0 |
105 | ++col; | - |
106 | } | 0 |
107 | } | - |
108 | if (col != 0) never evaluated: col != 0 | 0 |
109 | rich += QLatin1String("</p>"); never executed: rich += QLatin1String("</p>"); | 0 |
110 | return rich; never executed: return rich; | 0 |
111 | } | - |
112 | | - |
113 | | - |
114 | | - |
115 | | - |
116 | | - |
117 | | - |
118 | | - |
119 | QTextCodec *Qt::codecForHtml(const QByteArray &ba) | - |
120 | { | - |
121 | return QTextCodec::codecForHtml(ba); executed: return QTextCodec::codecForHtml(ba); Execution Count:47 | 47 |
122 | } | - |
123 | QTextDocument::QTextDocument(QObject *parent) | - |
124 | : QObject(*new QTextDocumentPrivate, parent) | - |
125 | { | - |
126 | QTextDocumentPrivate * const d = d_func(); | - |
127 | d->init(); | - |
128 | } executed: } Execution Count:1941 | 1941 |
129 | | - |
130 | | - |
131 | | - |
132 | | - |
133 | | - |
134 | QTextDocument::QTextDocument(const QString &text, QObject *parent) | - |
135 | : QObject(*new QTextDocumentPrivate, parent) | - |
136 | { | - |
137 | QTextDocumentPrivate * const d = d_func(); | - |
138 | d->init(); | - |
139 | QTextCursor(this).insertText(text); | - |
140 | } | 0 |
141 | | - |
142 | | - |
143 | | - |
144 | | - |
145 | QTextDocument::QTextDocument(QTextDocumentPrivate &dd, QObject *parent) | - |
146 | : QObject(dd, parent) | - |
147 | { | - |
148 | QTextDocumentPrivate * const d = d_func(); | - |
149 | d->init(); | - |
150 | } | 0 |
151 | | - |
152 | | - |
153 | | - |
154 | | - |
155 | QTextDocument::~QTextDocument() | - |
156 | { | - |
157 | } | - |
158 | | - |
159 | | - |
160 | | - |
161 | | - |
162 | | - |
163 | | - |
164 | QTextDocument *QTextDocument::clone(QObject *parent) const | - |
165 | { | - |
166 | const QTextDocumentPrivate * const d = d_func(); | - |
167 | QTextDocument *doc = new QTextDocument(parent); | - |
168 | QTextCursor(doc).insertFragment(QTextDocumentFragment(this)); | - |
169 | doc->rootFrame()->setFrameFormat(rootFrame()->frameFormat()); | - |
170 | QTextDocumentPrivate *priv = doc->d_func(); | - |
171 | priv->title = d->title; | - |
172 | priv->url = d->url; | - |
173 | priv->pageSize = d->pageSize; | - |
174 | priv->indentWidth = d->indentWidth; | - |
175 | priv->defaultTextOption = d->defaultTextOption; | - |
176 | priv->setDefaultFont(d->defaultFont()); | - |
177 | priv->resources = d->resources; | - |
178 | priv->cachedResources.clear(); | - |
179 | | - |
180 | priv->defaultStyleSheet = d->defaultStyleSheet; | - |
181 | priv->parsedDefaultStyleSheet = d->parsedDefaultStyleSheet; | - |
182 | | - |
183 | return doc; executed: return doc; Execution Count:10 | 10 |
184 | } | - |
185 | | - |
186 | | - |
187 | | - |
188 | | - |
189 | bool QTextDocument::isEmpty() const | - |
190 | { | - |
191 | const QTextDocumentPrivate * const d = d_func(); | - |
192 | | - |
193 | | - |
194 | return d->length() <= 1; executed: return d->length() <= 1; Execution Count:23 | 23 |
195 | } | - |
196 | | - |
197 | | - |
198 | | - |
199 | | - |
200 | void QTextDocument::clear() | - |
201 | { | - |
202 | QTextDocumentPrivate * const d = d_func(); | - |
203 | d->clear(); | - |
204 | d->resources.clear(); | - |
205 | } executed: } Execution Count:754 | 754 |
206 | void QTextDocument::undo(QTextCursor *cursor) | - |
207 | { | - |
208 | QTextDocumentPrivate * const d = d_func(); | - |
209 | const int pos = d->undoRedo(true); | - |
210 | if (cursor && pos >= 0) { partially evaluated: cursor yes Evaluation Count:9 | no Evaluation Count:0 |
partially evaluated: pos >= 0 yes Evaluation Count:9 | no Evaluation Count:0 |
| 0-9 |
211 | *cursor = QTextCursor(this); | - |
212 | cursor->setPosition(pos); | - |
213 | } executed: } Execution Count:9 | 9 |
214 | } executed: } Execution Count:9 | 9 |
215 | void QTextDocument::redo(QTextCursor *cursor) | - |
216 | { | - |
217 | QTextDocumentPrivate * const d = d_func(); | - |
218 | const int pos = d->undoRedo(false); | - |
219 | if (cursor && pos >= 0) { partially evaluated: cursor yes Evaluation Count:6 | no Evaluation Count:0 |
partially evaluated: pos >= 0 yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
220 | *cursor = QTextCursor(this); | - |
221 | cursor->setPosition(pos); | - |
222 | } executed: } Execution Count:6 | 6 |
223 | } executed: } Execution Count:6 | 6 |
224 | void QTextDocument::clearUndoRedoStacks(Stacks stacksToClear) | - |
225 | { | - |
226 | QTextDocumentPrivate * const d = d_func(); | - |
227 | d->clearUndoRedoStacks(stacksToClear, true); | - |
228 | } | 0 |
229 | | - |
230 | | - |
231 | | - |
232 | | - |
233 | | - |
234 | void QTextDocument::undo() | - |
235 | { | - |
236 | QTextDocumentPrivate * const d = d_func(); | - |
237 | d->undoRedo(true); | - |
238 | } executed: } Execution Count:52 | 52 |
239 | | - |
240 | | - |
241 | | - |
242 | | - |
243 | | - |
244 | void QTextDocument::redo() | - |
245 | { | - |
246 | QTextDocumentPrivate * const d = d_func(); | - |
247 | d->undoRedo(false); | - |
248 | } executed: } Execution Count:9 | 9 |
249 | | - |
250 | | - |
251 | | - |
252 | | - |
253 | | - |
254 | | - |
255 | void QTextDocument::appendUndoItem(QAbstractUndoItem *item) | - |
256 | { | - |
257 | QTextDocumentPrivate * const d = d_func(); | - |
258 | d->appendUndoItem(item); | - |
259 | } | 0 |
260 | void QTextDocument::setUndoRedoEnabled(bool enable) | - |
261 | { | - |
262 | QTextDocumentPrivate * const d = d_func(); | - |
263 | d->enableUndoRedo(enable); | - |
264 | } executed: } Execution Count:2468 | 2468 |
265 | | - |
266 | bool QTextDocument::isUndoRedoEnabled() const | - |
267 | { | - |
268 | const QTextDocumentPrivate * const d = d_func(); | - |
269 | return d->isUndoRedoEnabled(); executed: return d->isUndoRedoEnabled(); Execution Count:666 | 666 |
270 | } | - |
271 | int QTextDocument::maximumBlockCount() const | - |
272 | { | - |
273 | const QTextDocumentPrivate * const d = d_func(); | - |
274 | return d->maximumBlockCount; executed: return d->maximumBlockCount; Execution Count:14 | 14 |
275 | } | - |
276 | | - |
277 | void QTextDocument::setMaximumBlockCount(int maximum) | - |
278 | { | - |
279 | QTextDocumentPrivate * const d = d_func(); | - |
280 | d->maximumBlockCount = maximum; | - |
281 | d->ensureMaximumBlockCount(); | - |
282 | setUndoRedoEnabled(false); | - |
283 | } executed: } Execution Count:5 | 5 |
284 | QTextOption QTextDocument::defaultTextOption() const | - |
285 | { | - |
286 | const QTextDocumentPrivate * const d = d_func(); | - |
287 | return d->defaultTextOption; executed: return d->defaultTextOption; Execution Count:1053 | 1053 |
288 | } | - |
289 | | - |
290 | | - |
291 | | - |
292 | | - |
293 | | - |
294 | | - |
295 | void QTextDocument::setDefaultTextOption(const QTextOption &option) | - |
296 | { | - |
297 | QTextDocumentPrivate * const d = d_func(); | - |
298 | d->defaultTextOption = option; | - |
299 | if (d->lout) partially evaluated: d->lout yes Evaluation Count:50 | no Evaluation Count:0 |
| 0-50 |
300 | d->lout->documentChanged(0, 0, d->length()); executed: d->lout->documentChanged(0, 0, d->length()); Execution Count:50 | 50 |
301 | } executed: } Execution Count:50 | 50 |
302 | | - |
303 | | - |
304 | | - |
305 | | - |
306 | | - |
307 | | - |
308 | | - |
309 | Qt::CursorMoveStyle QTextDocument::defaultCursorMoveStyle() const | - |
310 | { | - |
311 | const QTextDocumentPrivate * const d = d_func(); | - |
312 | return d->defaultCursorMoveStyle; never executed: return d->defaultCursorMoveStyle; | 0 |
313 | } | - |
314 | | - |
315 | | - |
316 | | - |
317 | | - |
318 | | - |
319 | | - |
320 | void QTextDocument::setDefaultCursorMoveStyle(Qt::CursorMoveStyle style) | - |
321 | { | - |
322 | QTextDocumentPrivate * const d = d_func(); | - |
323 | d->defaultCursorMoveStyle = style; | - |
324 | } | 0 |
325 | void QTextDocument::markContentsDirty(int from, int length) | - |
326 | { | - |
327 | QTextDocumentPrivate * const d = d_func(); | - |
328 | d->documentChange(from, length); | - |
329 | if (!d->inContentsChange) { evaluated: !d->inContentsChange yes Evaluation Count:1 | yes Evaluation Count:7 |
| 1-7 |
330 | if (d->lout) { partially evaluated: d->lout yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
331 | d->lout->documentChanged(d->docChangeFrom, d->docChangeOldLength, d->docChangeLength); | - |
332 | d->docChangeFrom = -1; | - |
333 | } executed: } Execution Count:1 | 1 |
334 | } executed: } Execution Count:1 | 1 |
335 | } executed: } Execution Count:8 | 8 |
336 | void QTextDocument::setUseDesignMetrics(bool b) | - |
337 | { | - |
338 | QTextDocumentPrivate * const d = d_func(); | - |
339 | if (b == d->defaultTextOption.useDesignMetrics()) evaluated: b == d->defaultTextOption.useDesignMetrics() yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
340 | return; executed: return; Execution Count:1 | 1 |
341 | d->defaultTextOption.setUseDesignMetrics(b); | - |
342 | if (d->lout) partially evaluated: d->lout yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
343 | d->lout->documentChanged(0, 0, d->length()); executed: d->lout->documentChanged(0, 0, d->length()); Execution Count:1 | 1 |
344 | } executed: } Execution Count:1 | 1 |
345 | | - |
346 | bool QTextDocument::useDesignMetrics() const | - |
347 | { | - |
348 | const QTextDocumentPrivate * const d = d_func(); | - |
349 | return d->defaultTextOption.useDesignMetrics(); executed: return d->defaultTextOption.useDesignMetrics(); Execution Count:2 | 2 |
350 | } | - |
351 | | - |
352 | | - |
353 | | - |
354 | | - |
355 | | - |
356 | | - |
357 | | - |
358 | void QTextDocument::drawContents(QPainter *p, const QRectF &rect) | - |
359 | { | - |
360 | p->save(); | - |
361 | QAbstractTextDocumentLayout::PaintContext ctx; | - |
362 | if (rect.isValid()) { evaluated: rect.isValid() yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
363 | p->setClipRect(rect); | - |
364 | ctx.clip = rect; | - |
365 | } executed: } Execution Count:2 | 2 |
366 | documentLayout()->draw(p, ctx); | - |
367 | p->restore(); | - |
368 | } executed: } Execution Count:3 | 3 |
369 | void QTextDocument::setTextWidth(qreal width) | - |
370 | { | - |
371 | QTextDocumentPrivate * const d = d_func(); | - |
372 | QSizeF sz = d->pageSize; | - |
373 | sz.setWidth(width); | - |
374 | sz.setHeight(-1); | - |
375 | setPageSize(sz); | - |
376 | } executed: } Execution Count:354 | 354 |
377 | | - |
378 | qreal QTextDocument::textWidth() const | - |
379 | { | - |
380 | const QTextDocumentPrivate * const d = d_func(); | - |
381 | return d->pageSize.width(); executed: return d->pageSize.width(); Execution Count:108 | 108 |
382 | } | - |
383 | qreal QTextDocument::idealWidth() const | - |
384 | { | - |
385 | if (QTextDocumentLayout *lout = qobject_cast<QTextDocumentLayout *>(documentLayout())) partially evaluated: QTextDocumentLayout *lout = qobject_cast<QTextDocumentLayout *>(documentLayout()) yes Evaluation Count:13 | no Evaluation Count:0 |
| 0-13 |
386 | return lout->idealWidth(); executed: return lout->idealWidth(); Execution Count:13 | 13 |
387 | return textWidth(); never executed: return textWidth(); | 0 |
388 | } | - |
389 | | - |
390 | | - |
391 | | - |
392 | | - |
393 | | - |
394 | | - |
395 | | - |
396 | qreal QTextDocument::documentMargin() const | - |
397 | { | - |
398 | const QTextDocumentPrivate * const d = d_func(); | - |
399 | return d->documentMargin; executed: return d->documentMargin; Execution Count:5760 | 5760 |
400 | } | - |
401 | | - |
402 | void QTextDocument::setDocumentMargin(qreal margin) | - |
403 | { | - |
404 | QTextDocumentPrivate * const d = d_func(); | - |
405 | if (d->documentMargin != margin) { never evaluated: d->documentMargin != margin | 0 |
406 | d->documentMargin = margin; | - |
407 | | - |
408 | QTextFrame* root = rootFrame(); | - |
409 | QTextFrameFormat format = root->frameFormat(); | - |
410 | format.setMargin(margin); | - |
411 | root->setFrameFormat(format); | - |
412 | | - |
413 | if (d->lout) | 0 |
414 | d->lout->documentChanged(0, 0, d->length()); never executed: d->lout->documentChanged(0, 0, d->length()); | 0 |
415 | } | 0 |
416 | } | 0 |
417 | qreal QTextDocument::indentWidth() const | - |
418 | { | - |
419 | const QTextDocumentPrivate * const d = d_func(); | - |
420 | return d->indentWidth; executed: return d->indentWidth; Execution Count:1 | 1 |
421 | } | - |
422 | void QTextDocument::setIndentWidth(qreal width) | - |
423 | { | - |
424 | QTextDocumentPrivate * const d = d_func(); | - |
425 | if (d->indentWidth != width) { partially evaluated: d->indentWidth != width yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
426 | d->indentWidth = width; | - |
427 | if (d->lout) partially evaluated: d->lout no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
428 | d->lout->documentChanged(0, 0, d->length()); never executed: d->lout->documentChanged(0, 0, d->length()); | 0 |
429 | } executed: } Execution Count:1 | 1 |
430 | } executed: } Execution Count:1 | 1 |
431 | void QTextDocument::adjustSize() | - |
432 | { | - |
433 | | - |
434 | QFont f = defaultFont(); | - |
435 | QFontMetrics fm(f); | - |
436 | int mw = fm.width(QLatin1Char('x')) * 80; | - |
437 | int w = mw; | - |
438 | setTextWidth(w); | - |
439 | QSizeF size = documentLayout()->documentSize(); | - |
440 | if (size.width() != 0) { partially evaluated: size.width() != 0 yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
441 | w = qt_int_sqrt((uint)(5 * size.height() * size.width() / 3)); | - |
442 | setTextWidth(qMin(w, mw)); | - |
443 | | - |
444 | size = documentLayout()->documentSize(); | - |
445 | if (w*3 < 5*size.height()) { evaluated: w*3 < 5*size.height() yes Evaluation Count:5 | yes Evaluation Count:3 |
| 3-5 |
446 | w = qt_int_sqrt((uint)(2 * size.height() * size.width())); | - |
447 | setTextWidth(qMin(w, mw)); | - |
448 | } executed: } Execution Count:5 | 5 |
449 | } executed: } Execution Count:8 | 8 |
450 | setTextWidth(idealWidth()); | - |
451 | } executed: } Execution Count:8 | 8 |
452 | QSizeF QTextDocument::size() const | - |
453 | { | - |
454 | return documentLayout()->documentSize(); executed: return documentLayout()->documentSize(); Execution Count:212 | 212 |
455 | } | - |
456 | int QTextDocument::blockCount() const | - |
457 | { | - |
458 | const QTextDocumentPrivate * const d = d_func(); | - |
459 | return d->blockMap().numNodes(); executed: return d->blockMap().numNodes(); Execution Count:1869 | 1869 |
460 | } | - |
461 | int QTextDocument::lineCount() const | - |
462 | { | - |
463 | const QTextDocumentPrivate * const d = d_func(); | - |
464 | return d->blockMap().length(2); executed: return d->blockMap().length(2); Execution Count:2324 | 2324 |
465 | } | - |
466 | int QTextDocument::characterCount() const | - |
467 | { | - |
468 | const QTextDocumentPrivate * const d = d_func(); | - |
469 | return d->length(); executed: return d->length(); Execution Count:1 | 1 |
470 | } | - |
471 | QChar QTextDocument::characterAt(int pos) const | - |
472 | { | - |
473 | const QTextDocumentPrivate * const d = d_func(); | - |
474 | if (pos < 0 || pos >= d->length()) evaluated: pos < 0 yes Evaluation Count:1 | yes Evaluation Count:22 |
evaluated: pos >= d->length() yes Evaluation Count:2 | yes Evaluation Count:20 |
| 1-22 |
475 | return QChar(); executed: return QChar(); Execution Count:3 | 3 |
476 | QTextDocumentPrivate::FragmentIterator fragIt = d->find(pos); | - |
477 | const QTextFragmentData * const frag = fragIt.value(); | - |
478 | const int offsetInFragment = qMax(0, pos - fragIt.position()); | - |
479 | return d->text.at(frag->stringPosition + offsetInFragment); executed: return d->text.at(frag->stringPosition + offsetInFragment); Execution Count:20 | 20 |
480 | } | - |
481 | void QTextDocument::setDefaultStyleSheet(const QString &sheet) | - |
482 | { | - |
483 | QTextDocumentPrivate * const d = d_func(); | - |
484 | d->defaultStyleSheet = sheet; | - |
485 | QCss::Parser parser(sheet); | - |
486 | d->parsedDefaultStyleSheet = QCss::StyleSheet(); | - |
487 | d->parsedDefaultStyleSheet.origin = QCss::StyleSheetOrigin_UserAgent; | - |
488 | parser.parse(&d->parsedDefaultStyleSheet); | - |
489 | } executed: } Execution Count:2 | 2 |
490 | | - |
491 | QString QTextDocument::defaultStyleSheet() const | - |
492 | { | - |
493 | const QTextDocumentPrivate * const d = d_func(); | - |
494 | return d->defaultStyleSheet; executed: return d->defaultStyleSheet; Execution Count:3 | 3 |
495 | } | - |
496 | bool QTextDocument::isUndoAvailable() const | - |
497 | { | - |
498 | const QTextDocumentPrivate * const d = d_func(); | - |
499 | return d->isUndoAvailable(); executed: return d->isUndoAvailable(); Execution Count:7 | 7 |
500 | } | - |
501 | | - |
502 | | - |
503 | | - |
504 | | - |
505 | | - |
506 | | - |
507 | bool QTextDocument::isRedoAvailable() const | - |
508 | { | - |
509 | const QTextDocumentPrivate * const d = d_func(); | - |
510 | return d->isRedoAvailable(); executed: return d->isRedoAvailable(); Execution Count:7 | 7 |
511 | } | - |
512 | | - |
513 | | - |
514 | | - |
515 | | - |
516 | | - |
517 | | - |
518 | | - |
519 | int QTextDocument::availableUndoSteps() const | - |
520 | { | - |
521 | const QTextDocumentPrivate * const d = d_func(); | - |
522 | return d->availableUndoSteps(); never executed: return d->availableUndoSteps(); | 0 |
523 | } | - |
524 | | - |
525 | | - |
526 | | - |
527 | | - |
528 | | - |
529 | | - |
530 | | - |
531 | int QTextDocument::availableRedoSteps() const | - |
532 | { | - |
533 | const QTextDocumentPrivate * const d = d_func(); | - |
534 | return d->availableRedoSteps(); never executed: return d->availableRedoSteps(); | 0 |
535 | } | - |
536 | int QTextDocument::revision() const | - |
537 | { | - |
538 | const QTextDocumentPrivate * const d = d_func(); | - |
539 | return d->revision; executed: return d->revision; Execution Count:9 | 9 |
540 | } | - |
541 | void QTextDocument::setDocumentLayout(QAbstractTextDocumentLayout *layout) | - |
542 | { | - |
543 | QTextDocumentPrivate * const d = d_func(); | - |
544 | d->setLayout(layout); | - |
545 | } executed: } Execution Count:139 | 139 |
546 | | - |
547 | | - |
548 | | - |
549 | | - |
550 | QAbstractTextDocumentLayout *QTextDocument::documentLayout() const | - |
551 | { | - |
552 | const QTextDocumentPrivate * const d = d_func(); | - |
553 | if (!d->lout) { evaluated: !d->lout yes Evaluation Count:314 | yes Evaluation Count:7233 |
| 314-7233 |
554 | QTextDocument *that = const_cast<QTextDocument *>(this); | - |
555 | that->d_func()->setLayout(new QTextDocumentLayout(that)); | - |
556 | } executed: } Execution Count:314 | 314 |
557 | return d->lout; executed: return d->lout; Execution Count:7547 | 7547 |
558 | } | - |
559 | QString QTextDocument::metaInformation(MetaInformation info) const | - |
560 | { | - |
561 | const QTextDocumentPrivate * const d = d_func(); | - |
562 | switch (info) { | - |
563 | case DocumentTitle: | - |
564 | return d->title; executed: return d->title; Execution Count:198 | 198 |
565 | case DocumentUrl: | - |
566 | return d->url; executed: return d->url; Execution Count:2 | 2 |
567 | } | - |
568 | return QString(); never executed: return QString(); | 0 |
569 | } | - |
570 | | - |
571 | | - |
572 | | - |
573 | | - |
574 | | - |
575 | | - |
576 | | - |
577 | void QTextDocument::setMetaInformation(MetaInformation info, const QString &string) | - |
578 | { | - |
579 | QTextDocumentPrivate * const d = d_func(); | - |
580 | switch (info) { | - |
581 | case DocumentTitle: | - |
582 | d->title = string; | - |
583 | break; executed: break; Execution Count:20 | 20 |
584 | case DocumentUrl: | - |
585 | d->url = string; | - |
586 | break; executed: break; Execution Count:49 | 49 |
587 | } | - |
588 | } executed: } Execution Count:69 | 69 |
589 | | - |
590 | | - |
591 | | - |
592 | | - |
593 | | - |
594 | | - |
595 | | - |
596 | QString QTextDocument::toPlainText() const | - |
597 | { | - |
598 | const QTextDocumentPrivate * const d = d_func(); | - |
599 | QString txt = d->plainText(); | - |
600 | | - |
601 | QChar *uc = txt.data(); | - |
602 | QChar *e = uc + txt.size(); | - |
603 | | - |
604 | for (; uc != e; ++uc) { evaluated: uc != e yes Evaluation Count:1941 | yes Evaluation Count:210 |
| 210-1941 |
605 | switch (uc->unicode()) { | - |
606 | case 0xfdd0: | - |
607 | case 0xfdd1: | - |
608 | case QChar::ParagraphSeparator: | - |
609 | case QChar::LineSeparator: | - |
610 | *uc = QLatin1Char('\n'); | - |
611 | break; executed: break; Execution Count:180 | 180 |
612 | case QChar::Nbsp: | - |
613 | *uc = QLatin1Char(' '); | - |
614 | break; executed: break; Execution Count:3 | 3 |
615 | default: | - |
616 | ; | - |
617 | } executed: } Execution Count:1758 | 1758 |
618 | } executed: } Execution Count:1941 | 1941 |
619 | return txt; executed: return txt; Execution Count:210 | 210 |
620 | } | - |
621 | | - |
622 | | - |
623 | | - |
624 | | - |
625 | | - |
626 | | - |
627 | | - |
628 | void QTextDocument::setPlainText(const QString &text) | - |
629 | { | - |
630 | QTextDocumentPrivate * const d = d_func(); | - |
631 | bool previousState = d->isUndoRedoEnabled(); | - |
632 | d->enableUndoRedo(false); | - |
633 | d->beginEditBlock(); | - |
634 | d->clear(); | - |
635 | QTextCursor(this).insertText(text); | - |
636 | d->endEditBlock(); | - |
637 | d->enableUndoRedo(previousState); | - |
638 | } executed: } Execution Count:211 | 211 |
639 | void QTextDocument::setHtml(const QString &html) | - |
640 | { | - |
641 | QTextDocumentPrivate * const d = d_func(); | - |
642 | bool previousState = d->isUndoRedoEnabled(); | - |
643 | d->enableUndoRedo(false); | - |
644 | d->beginEditBlock(); | - |
645 | d->clear(); | - |
646 | QTextHtmlImporter(this, html, QTextHtmlImporter::ImportToDocument).import(); | - |
647 | d->endEditBlock(); | - |
648 | d->enableUndoRedo(previousState); | - |
649 | } executed: } Execution Count:234 | 234 |
650 | QTextCursor QTextDocument::find(const QString &subString, int from, FindFlags options) const | - |
651 | { | - |
652 | QRegExp expr(subString); | - |
653 | expr.setPatternSyntax(QRegExp::FixedString); | - |
654 | expr.setCaseSensitivity((options & QTextDocument::FindCaseSensitively) ? Qt::CaseSensitive : Qt::CaseInsensitive); | - |
655 | | - |
656 | return find(expr, from, options); executed: return find(expr, from, options); Execution Count:25 | 25 |
657 | } | - |
658 | QTextCursor QTextDocument::find(const QString &subString, const QTextCursor &from, FindFlags options) const | - |
659 | { | - |
660 | int pos = 0; | - |
661 | if (!from.isNull()) { partially evaluated: !from.isNull() yes Evaluation Count:5 | no Evaluation Count:0 |
| 0-5 |
662 | if (options & QTextDocument::FindBackward) evaluated: options & QTextDocument::FindBackward yes Evaluation Count:2 | yes Evaluation Count:3 |
| 2-3 |
663 | pos = from.selectionStart(); executed: pos = from.selectionStart(); Execution Count:2 | 2 |
664 | else | - |
665 | pos = from.selectionEnd(); executed: pos = from.selectionEnd(); Execution Count:3 | 3 |
666 | } | - |
667 | QRegExp expr(subString); | - |
668 | expr.setPatternSyntax(QRegExp::FixedString); | - |
669 | expr.setCaseSensitivity((options & QTextDocument::FindCaseSensitively) ? Qt::CaseSensitive : Qt::CaseInsensitive); | - |
670 | | - |
671 | return find(expr, pos, options); executed: return find(expr, pos, options); Execution Count:5 | 5 |
672 | } | - |
673 | | - |
674 | | - |
675 | static bool findInBlock(const QTextBlock &block, const QRegExp &expression, int offset, | - |
676 | QTextDocument::FindFlags options, QTextCursor &cursor) | - |
677 | { | - |
678 | QRegExp expr(expression); | - |
679 | QString text = block.text(); | - |
680 | text.replace(QChar::Nbsp, QLatin1Char(' ')); | - |
681 | | - |
682 | int idx = -1; | - |
683 | while (offset >=0 && offset <= text.length()) { partially evaluated: offset >=0 yes Evaluation Count:61 | no Evaluation Count:0 |
evaluated: offset <= text.length() yes Evaluation Count:59 | yes Evaluation Count:2 |
| 0-61 |
684 | idx = (options & QTextDocument::FindBackward) ? evaluated: (options & QTextDocument::FindBackward) yes Evaluation Count:15 | yes Evaluation Count:44 |
| 15-44 |
685 | expr.lastIndexIn(text, offset) : expr.indexIn(text, offset); | - |
686 | if (idx == -1) evaluated: idx == -1 yes Evaluation Count:16 | yes Evaluation Count:43 |
| 16-43 |
687 | return false; executed: return false; Execution Count:16 | 16 |
688 | | - |
689 | if (options & QTextDocument::FindWholeWords) { evaluated: options & QTextDocument::FindWholeWords yes Evaluation Count:12 | yes Evaluation Count:31 |
| 12-31 |
690 | const int start = idx; | - |
691 | const int end = start + expr.matchedLength(); | - |
692 | if ((start != 0 && text.at(start - 1).isLetterOrNumber()) partially evaluated: start != 0 yes Evaluation Count:12 | no Evaluation Count:0 |
evaluated: text.at(start - 1).isLetterOrNumber() yes Evaluation Count:6 | yes Evaluation Count:6 |
| 0-12 |
693 | || (end != text.length() && text.at(end).isLetterOrNumber())) { partially evaluated: end != text.length() yes Evaluation Count:6 | no Evaluation Count:0 |
partially evaluated: text.at(end).isLetterOrNumber() no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-6 |
694 | | - |
695 | offset = (options & QTextDocument::FindBackward) ? idx-1 : end+1; partially evaluated: (options & QTextDocument::FindBackward) no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-6 |
696 | idx = -1; | - |
697 | continue; executed: continue; Execution Count:6 | 6 |
698 | } | - |
699 | } executed: } Execution Count:6 | 6 |
700 | | - |
701 | break; executed: break; Execution Count:37 | 37 |
702 | } | - |
703 | if (idx == -1) evaluated: idx == -1 yes Evaluation Count:2 | yes Evaluation Count:37 |
| 2-37 |
704 | return false; executed: return false; Execution Count:2 | 2 |
705 | cursor = QTextCursor(block.docHandle(), block.position() + idx); | - |
706 | cursor.setPosition(cursor.position() + expr.matchedLength(), QTextCursor::KeepAnchor); | - |
707 | return true; executed: return true; Execution Count:37 | 37 |
708 | } | - |
709 | QTextCursor QTextDocument::find(const QRegExp & expr, int from, FindFlags options) const | - |
710 | { | - |
711 | const QTextDocumentPrivate * const d = d_func(); | - |
712 | | - |
713 | if (expr.isEmpty()) partially evaluated: expr.isEmpty() no Evaluation Count:0 | yes Evaluation Count:47 |
| 0-47 |
714 | return QTextCursor(); never executed: return QTextCursor(); | 0 |
715 | | - |
716 | int pos = from; | - |
717 | | - |
718 | | - |
719 | if (options & FindBackward) { evaluated: options & FindBackward yes Evaluation Count:11 | yes Evaluation Count:36 |
| 11-36 |
720 | --pos ; | - |
721 | if(pos < 0) partially evaluated: pos < 0 no Evaluation Count:0 | yes Evaluation Count:11 |
| 0-11 |
722 | return QTextCursor(); never executed: return QTextCursor(); | 0 |
723 | } executed: } Execution Count:11 | 11 |
724 | | - |
725 | QTextCursor cursor; | - |
726 | QTextBlock block = d->blocksFind(pos); | - |
727 | | - |
728 | if (!(options & FindBackward)) { evaluated: !(options & FindBackward) yes Evaluation Count:36 | yes Evaluation Count:11 |
| 11-36 |
729 | int blockOffset = qMax(0, pos - block.position()); | - |
730 | while (block.isValid()) { evaluated: block.isValid() yes Evaluation Count:40 | yes Evaluation Count:10 |
| 10-40 |
731 | if (findInBlock(block, expr, blockOffset, options, cursor)) evaluated: findInBlock(block, expr, blockOffset, options, cursor) yes Evaluation Count:26 | yes Evaluation Count:14 |
| 14-26 |
732 | return cursor; executed: return cursor; Execution Count:26 | 26 |
733 | blockOffset = 0; | - |
734 | block = block.next(); | - |
735 | } executed: } Execution Count:14 | 14 |
736 | } else { executed: } Execution Count:10 | 10 |
737 | int blockOffset = pos - block.position(); | - |
738 | while (block.isValid()) { partially evaluated: block.isValid() yes Evaluation Count:15 | no Evaluation Count:0 |
| 0-15 |
739 | if (findInBlock(block, expr, blockOffset, options, cursor)) evaluated: findInBlock(block, expr, blockOffset, options, cursor) yes Evaluation Count:11 | yes Evaluation Count:4 |
| 4-11 |
740 | return cursor; executed: return cursor; Execution Count:11 | 11 |
741 | block = block.previous(); | - |
742 | blockOffset = block.length() - 1; | - |
743 | } executed: } Execution Count:4 | 4 |
744 | } | 0 |
745 | | - |
746 | return QTextCursor(); executed: return QTextCursor(); Execution Count:10 | 10 |
747 | } | - |
748 | QTextCursor QTextDocument::find(const QRegExp &expr, const QTextCursor &from, FindFlags options) const | - |
749 | { | - |
750 | int pos = 0; | - |
751 | if (!from.isNull()) { partially evaluated: !from.isNull() yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
752 | if (options & QTextDocument::FindBackward) evaluated: options & QTextDocument::FindBackward yes Evaluation Count:2 | yes Evaluation Count:2 |
| 2 |
753 | pos = from.selectionStart(); executed: pos = from.selectionStart(); Execution Count:2 | 2 |
754 | else | - |
755 | pos = from.selectionEnd(); executed: pos = from.selectionEnd(); Execution Count:2 | 2 |
756 | } | - |
757 | return find(expr, pos, options); executed: return find(expr, pos, options); Execution Count:4 | 4 |
758 | } | - |
759 | QTextObject *QTextDocument::createObject(const QTextFormat &f) | - |
760 | { | - |
761 | QTextObject *obj = 0; | - |
762 | if (f.isListFormat()) evaluated: f.isListFormat() yes Evaluation Count:105 | yes Evaluation Count:2111 |
| 105-2111 |
763 | obj = new QTextList(this); executed: obj = new QTextList(this); Execution Count:105 | 105 |
764 | else if (f.isTableFormat()) evaluated: f.isTableFormat() yes Evaluation Count:240 | yes Evaluation Count:1871 |
| 240-1871 |
765 | obj = new QTextTable(this); executed: obj = new QTextTable(this); Execution Count:240 | 240 |
766 | else if (f.isFrameFormat()) partially evaluated: f.isFrameFormat() yes Evaluation Count:1871 | no Evaluation Count:0 |
| 0-1871 |
767 | obj = new QTextFrame(this); executed: obj = new QTextFrame(this); Execution Count:1871 | 1871 |
768 | | - |
769 | return obj; executed: return obj; Execution Count:2216 | 2216 |
770 | } | - |
771 | | - |
772 | | - |
773 | | - |
774 | | - |
775 | | - |
776 | | - |
777 | QTextFrame *QTextDocument::frameAt(int pos) const | - |
778 | { | - |
779 | const QTextDocumentPrivate * const d = d_func(); | - |
780 | return d->frameAt(pos); executed: return d->frameAt(pos); Execution Count:1286 | 1286 |
781 | } | - |
782 | | - |
783 | | - |
784 | | - |
785 | | - |
786 | QTextFrame *QTextDocument::rootFrame() const | - |
787 | { | - |
788 | const QTextDocumentPrivate * const d = d_func(); | - |
789 | return d->rootFrame(); executed: return d->rootFrame(); Execution Count:4008 | 4008 |
790 | } | - |
791 | | - |
792 | | - |
793 | | - |
794 | | - |
795 | QTextObject *QTextDocument::object(int objectIndex) const | - |
796 | { | - |
797 | const QTextDocumentPrivate * const d = d_func(); | - |
798 | return d->objectForIndex(objectIndex); never executed: return d->objectForIndex(objectIndex); | 0 |
799 | } | - |
800 | | - |
801 | | - |
802 | | - |
803 | | - |
804 | QTextObject *QTextDocument::objectForFormat(const QTextFormat &f) const | - |
805 | { | - |
806 | const QTextDocumentPrivate * const d = d_func(); | - |
807 | return d->objectForFormat(f); executed: return d->objectForFormat(f); Execution Count:5063 | 5063 |
808 | } | - |
809 | | - |
810 | | - |
811 | | - |
812 | | - |
813 | | - |
814 | QTextBlock QTextDocument::findBlock(int pos) const | - |
815 | { | - |
816 | const QTextDocumentPrivate * const d = d_func(); | - |
817 | return QTextBlock(docHandle(), d->blockMap().findNode(pos)); executed: return QTextBlock(docHandle(), d->blockMap().findNode(pos)); Execution Count:7758 | 7758 |
818 | } | - |
819 | | - |
820 | | - |
821 | | - |
822 | | - |
823 | | - |
824 | | - |
825 | | - |
826 | QTextBlock QTextDocument::findBlockByNumber(int blockNumber) const | - |
827 | { | - |
828 | const QTextDocumentPrivate * const d = d_func(); | - |
829 | return QTextBlock(docHandle(), d->blockMap().findNode(blockNumber, 1)); executed: return QTextBlock(docHandle(), d->blockMap().findNode(blockNumber, 1)); Execution Count:1770 | 1770 |
830 | } | - |
831 | | - |
832 | | - |
833 | | - |
834 | | - |
835 | | - |
836 | | - |
837 | | - |
838 | QTextBlock QTextDocument::findBlockByLineNumber(int lineNumber) const | - |
839 | { | - |
840 | const QTextDocumentPrivate * const d = d_func(); | - |
841 | return QTextBlock(docHandle(), d->blockMap().findNode(lineNumber, 2)); executed: return QTextBlock(docHandle(), d->blockMap().findNode(lineNumber, 2)); Execution Count:239 | 239 |
842 | } | - |
843 | | - |
844 | | - |
845 | | - |
846 | | - |
847 | | - |
848 | | - |
849 | QTextBlock QTextDocument::begin() const | - |
850 | { | - |
851 | const QTextDocumentPrivate * const d = d_func(); | - |
852 | return QTextBlock(docHandle(), d->blockMap().begin().n); executed: return QTextBlock(docHandle(), d->blockMap().begin().n); Execution Count:431 | 431 |
853 | } | - |
854 | QTextBlock QTextDocument::end() const | - |
855 | { | - |
856 | return QTextBlock(docHandle(), 0); executed: return QTextBlock(docHandle(), 0); Execution Count:17 | 17 |
857 | } | - |
858 | | - |
859 | | - |
860 | | - |
861 | | - |
862 | | - |
863 | QTextBlock QTextDocument::firstBlock() const | - |
864 | { | - |
865 | const QTextDocumentPrivate * const d = d_func(); | - |
866 | return QTextBlock(docHandle(), d->blockMap().begin().n); executed: return QTextBlock(docHandle(), d->blockMap().begin().n); Execution Count:96 | 96 |
867 | } | - |
868 | | - |
869 | | - |
870 | | - |
871 | | - |
872 | | - |
873 | QTextBlock QTextDocument::lastBlock() const | - |
874 | { | - |
875 | const QTextDocumentPrivate * const d = d_func(); | - |
876 | return QTextBlock(docHandle(), d->blockMap().last().n); executed: return QTextBlock(docHandle(), d->blockMap().last().n); Execution Count:74 | 74 |
877 | } | - |
878 | void QTextDocument::setPageSize(const QSizeF &size) | - |
879 | { | - |
880 | QTextDocumentPrivate * const d = d_func(); | - |
881 | d->pageSize = size; | - |
882 | if (d->lout) evaluated: d->lout yes Evaluation Count:579 | yes Evaluation Count:7 |
| 7-579 |
883 | d->lout->documentChanged(0, 0, d->length()); executed: d->lout->documentChanged(0, 0, d->length()); Execution Count:579 | 579 |
884 | } executed: } Execution Count:586 | 586 |
885 | | - |
886 | QSizeF QTextDocument::pageSize() const | - |
887 | { | - |
888 | const QTextDocumentPrivate * const d = d_func(); | - |
889 | return d->pageSize; executed: return d->pageSize; Execution Count:9701 | 9701 |
890 | } | - |
891 | | - |
892 | | - |
893 | | - |
894 | | - |
895 | int QTextDocument::pageCount() const | - |
896 | { | - |
897 | return documentLayout()->pageCount(); executed: return documentLayout()->pageCount(); Execution Count:3 | 3 |
898 | } | - |
899 | | - |
900 | | - |
901 | | - |
902 | | - |
903 | void QTextDocument::setDefaultFont(const QFont &font) | - |
904 | { | - |
905 | QTextDocumentPrivate * const d = d_func(); | - |
906 | d->setDefaultFont(font); | - |
907 | if (d->lout) evaluated: d->lout yes Evaluation Count:292 | yes Evaluation Count:82 |
| 82-292 |
908 | d->lout->documentChanged(0, 0, d->length()); executed: d->lout->documentChanged(0, 0, d->length()); Execution Count:292 | 292 |
909 | } executed: } Execution Count:374 | 374 |
910 | | - |
911 | | - |
912 | | - |
913 | | - |
914 | QFont QTextDocument::defaultFont() const | - |
915 | { | - |
916 | const QTextDocumentPrivate * const d = d_func(); | - |
917 | return d->defaultFont(); executed: return d->defaultFont(); Execution Count:109 | 109 |
918 | } | - |
919 | bool QTextDocument::isModified() const | - |
920 | { | - |
921 | return docHandle()->isModified(); executed: return docHandle()->isModified(); Execution Count:40 | 40 |
922 | } | - |
923 | | - |
924 | void QTextDocument::setModified(bool m) | - |
925 | { | - |
926 | docHandle()->setModified(m); | - |
927 | } executed: } Execution Count:561 | 561 |
928 | | - |
929 | | - |
930 | static void printPage(int index, QPainter *painter, const QTextDocument *doc, const QRectF &body, const QPointF &pageNumberPos) | - |
931 | { | - |
932 | painter->save(); | - |
933 | painter->translate(body.left(), body.top() - (index - 1) * body.height()); | - |
934 | QRectF view(0, (index - 1) * body.height(), body.width(), body.height()); | - |
935 | | - |
936 | QAbstractTextDocumentLayout *layout = doc->documentLayout(); | - |
937 | QAbstractTextDocumentLayout::PaintContext ctx; | - |
938 | | - |
939 | painter->setClipRect(view); | - |
940 | ctx.clip = view; | - |
941 | | - |
942 | | - |
943 | | - |
944 | | - |
945 | ctx.palette.setColor(QPalette::Text, Qt::black); | - |
946 | | - |
947 | layout->draw(painter, ctx); | - |
948 | | - |
949 | if (!pageNumberPos.isNull()) { never evaluated: !pageNumberPos.isNull() | 0 |
950 | painter->setClipping(false); | - |
951 | painter->setFont(QFont(doc->defaultFont())); | - |
952 | const QString pageString = QString::number(index); | - |
953 | | - |
954 | painter->drawText(qRound(pageNumberPos.x() - painter->fontMetrics().width(pageString)), | - |
955 | qRound(pageNumberPos.y() + view.top()), | - |
956 | pageString); | - |
957 | } | 0 |
958 | | - |
959 | painter->restore(); | - |
960 | } | 0 |
961 | void QTextDocument::print(QPagedPaintDevice *printer) const | - |
962 | { | - |
963 | const QTextDocumentPrivate * const d = d_func(); | - |
964 | | - |
965 | if (!printer) never evaluated: !printer | 0 |
966 | return; | 0 |
967 | | - |
968 | bool documentPaginated = d->pageSize.isValid() && !d->pageSize.isNull() never evaluated: d->pageSize.isValid() never evaluated: !d->pageSize.isNull() | 0 |
969 | && d->pageSize.height() != 2147483647; never evaluated: d->pageSize.height() != 2147483647 | 0 |
970 | | - |
971 | QPagedPaintDevicePrivate *pd = QPagedPaintDevicePrivate::get(printer); | - |
972 | | - |
973 | | - |
974 | QPagedPaintDevice::Margins m = printer->margins(); | - |
975 | if (!documentPaginated && m.left == 0. && m.right == 0. && m.top == 0. && m.bottom == 0.) { never evaluated: !documentPaginated never evaluated: m.left == 0. never evaluated: m.right == 0. never evaluated: m.top == 0. never evaluated: m.bottom == 0. | 0 |
976 | m.left = m.right = m.top = m.bottom = 2.; | - |
977 | printer->setMargins(m); | - |
978 | } | 0 |
979 | | - |
980 | | - |
981 | QPainter p(printer); | - |
982 | | - |
983 | | - |
984 | if (!p.isActive()) never evaluated: !p.isActive() | 0 |
985 | return; | 0 |
986 | | - |
987 | const QTextDocument *doc = this; | - |
988 | QScopedPointer<QTextDocument> clonedDoc; | - |
989 | (void)doc->documentLayout(); | - |
990 | | - |
991 | QRectF body = QRectF(QPointF(0, 0), d->pageSize); | - |
992 | QPointF pageNumberPos; | - |
993 | | - |
994 | if (documentPaginated) { never evaluated: documentPaginated | 0 |
995 | qreal sourceDpiX = qt_defaultDpi(); | - |
996 | qreal sourceDpiY = sourceDpiX; | - |
997 | | - |
998 | QPaintDevice *dev = doc->documentLayout()->paintDevice(); | - |
999 | if (dev) { | 0 |
1000 | sourceDpiX = dev->logicalDpiX(); | - |
1001 | sourceDpiY = dev->logicalDpiY(); | - |
1002 | } | 0 |
1003 | | - |
1004 | const qreal dpiScaleX = qreal(printer->logicalDpiX()) / sourceDpiX; | - |
1005 | const qreal dpiScaleY = qreal(printer->logicalDpiY()) / sourceDpiY; | - |
1006 | | - |
1007 | | - |
1008 | p.scale(dpiScaleX, dpiScaleY); | - |
1009 | | - |
1010 | QSizeF scaledPageSize = d->pageSize; | - |
1011 | scaledPageSize.rwidth() *= dpiScaleX; | - |
1012 | scaledPageSize.rheight() *= dpiScaleY; | - |
1013 | | - |
1014 | const QSizeF printerPageSize(printer->width(), printer->height()); | - |
1015 | | - |
1016 | | - |
1017 | p.scale(printerPageSize.width() / scaledPageSize.width(), | - |
1018 | printerPageSize.height() / scaledPageSize.height()); | - |
1019 | } else { | 0 |
1020 | doc = clone(const_cast<QTextDocument *>(this)); | - |
1021 | clonedDoc.reset(const_cast<QTextDocument *>(doc)); | - |
1022 | | - |
1023 | for (QTextBlock srcBlock = firstBlock(), dstBlock = clonedDoc->firstBlock(); | - |
1024 | srcBlock.isValid() && dstBlock.isValid(); never evaluated: srcBlock.isValid() never evaluated: dstBlock.isValid() | 0 |
1025 | srcBlock = srcBlock.next(), dstBlock = dstBlock.next()) { | - |
1026 | dstBlock.layout()->setAdditionalFormats(srcBlock.layout()->additionalFormats()); | - |
1027 | } | 0 |
1028 | | - |
1029 | QAbstractTextDocumentLayout *layout = doc->documentLayout(); | - |
1030 | layout->setPaintDevice(p.device()); | - |
1031 | | - |
1032 | | - |
1033 | layout->d_func()->handlers = documentLayout()->d_func()->handlers; | - |
1034 | | - |
1035 | int dpiy = p.device()->logicalDpiY(); | - |
1036 | int margin = (int) ((2/2.54)*dpiy); | - |
1037 | QTextFrameFormat fmt = doc->rootFrame()->frameFormat(); | - |
1038 | fmt.setMargin(margin); | - |
1039 | doc->rootFrame()->setFrameFormat(fmt); | - |
1040 | | - |
1041 | body = QRectF(0, 0, printer->width(), printer->height()); | - |
1042 | pageNumberPos = QPointF(body.width() - margin, | - |
1043 | body.height() - margin | - |
1044 | + QFontMetrics(doc->defaultFont(), p.device()).ascent() | - |
1045 | + 5 * dpiy / 72.0); | - |
1046 | clonedDoc->setPageSize(body.size()); | - |
1047 | } | 0 |
1048 | | - |
1049 | int fromPage = pd->fromPage; | - |
1050 | int toPage = pd->toPage; | - |
1051 | bool ascending = true; | - |
1052 | | - |
1053 | if (fromPage == 0 && toPage == 0) { never evaluated: fromPage == 0 never evaluated: toPage == 0 | 0 |
1054 | fromPage = 1; | - |
1055 | toPage = doc->pageCount(); | - |
1056 | } | 0 |
1057 | | - |
1058 | fromPage = qMax(1, fromPage); | - |
1059 | toPage = qMin(doc->pageCount(), toPage); | - |
1060 | | - |
1061 | if (toPage < fromPage) { never evaluated: toPage < fromPage | 0 |
1062 | | - |
1063 | | - |
1064 | return; | 0 |
1065 | } | - |
1066 | int page = fromPage; | - |
1067 | while (true) { | 0 |
1068 | printPage(page, &p, doc, body, pageNumberPos); | - |
1069 | | - |
1070 | if (page == toPage) never evaluated: page == toPage | 0 |
1071 | break; | 0 |
1072 | | - |
1073 | if (ascending) never evaluated: ascending | 0 |
1074 | ++page; | 0 |
1075 | else | - |
1076 | --page; | 0 |
1077 | | - |
1078 | if (!printer->newPage()) never evaluated: !printer->newPage() | 0 |
1079 | return; | 0 |
1080 | } | 0 |
1081 | } | 0 |
1082 | QVariant QTextDocument::resource(int type, const QUrl &name) const | - |
1083 | { | - |
1084 | const QTextDocumentPrivate * const d = d_func(); | - |
1085 | QVariant r = d->resources.value(name); | - |
1086 | if (!r.isValid()) { evaluated: !r.isValid() yes Evaluation Count:22 | yes Evaluation Count:21 |
| 21-22 |
1087 | r = d->cachedResources.value(name); | - |
1088 | if (!r.isValid()) partially evaluated: !r.isValid() yes Evaluation Count:22 | no Evaluation Count:0 |
| 0-22 |
1089 | r = const_cast<QTextDocument *>(this)->loadResource(type, name); executed: r = const_cast<QTextDocument *>(this)->loadResource(type, name); Execution Count:22 | 22 |
1090 | } executed: } Execution Count:22 | 22 |
1091 | return r; executed: return r; Execution Count:43 | 43 |
1092 | } | - |
1093 | void QTextDocument::addResource(int type, const QUrl &name, const QVariant &resource) | - |
1094 | { | - |
1095 | (void)type;; | - |
1096 | QTextDocumentPrivate * const d = d_func(); | - |
1097 | d->resources.insert(name, resource); | - |
1098 | } executed: } Execution Count:10 | 10 |
1099 | QVariant QTextDocument::loadResource(int type, const QUrl &name) | - |
1100 | { | - |
1101 | QTextDocumentPrivate * const d = d_func(); | - |
1102 | QVariant r; | - |
1103 | | - |
1104 | QObject *p = parent(); | - |
1105 | if (p) { evaluated: p yes Evaluation Count:7 | yes Evaluation Count:10 |
| 7-10 |
1106 | const QMetaObject *me = p->metaObject(); | - |
1107 | int index = me->indexOfMethod("loadResource(int,QUrl)"); | - |
1108 | if (index >= 0) { partially evaluated: index >= 0 yes Evaluation Count:7 | no Evaluation Count:0 |
| 0-7 |
1109 | QMetaMethod loader = me->method(index); | - |
1110 | loader.invoke(p, QReturnArgument<QVariant >("QVariant", r), QArgument<int >("int", type), QArgument<QUrl >("QUrl", name)); | - |
1111 | } executed: } Execution Count:7 | 7 |
1112 | } executed: } Execution Count:7 | 7 |
1113 | | - |
1114 | | - |
1115 | if (r.isNull() && name.scheme().compare(QLatin1String("data"), Qt::CaseInsensitive) == 0) { partially evaluated: r.isNull() yes Evaluation Count:17 | no Evaluation Count:0 |
partially evaluated: name.scheme().compare(QLatin1String("data"), Qt::CaseInsensitive) == 0 no Evaluation Count:0 | yes Evaluation Count:17 |
| 0-17 |
1116 | QString mimetype; | - |
1117 | QByteArray payload; | - |
1118 | if (qDecodeDataUrl(name, mimetype, payload)) never evaluated: qDecodeDataUrl(name, mimetype, payload) | 0 |
1119 | r = payload; never executed: r = payload; | 0 |
1120 | } | 0 |
1121 | | - |
1122 | | - |
1123 | if (!qobject_cast<QTextDocument *>(p) && r.isNull() && name.isRelative()) { partially evaluated: !qobject_cast<QTextDocument *>(p) yes Evaluation Count:17 | no Evaluation Count:0 |
partially evaluated: r.isNull() yes Evaluation Count:17 | no Evaluation Count:0 |
evaluated: name.isRelative() yes Evaluation Count:14 | yes Evaluation Count:3 |
| 0-17 |
1124 | QUrl currentURL = d->url; | - |
1125 | QUrl resourceUrl = name; | - |
1126 | | - |
1127 | | - |
1128 | | - |
1129 | if (!(currentURL.isRelative() partially evaluated: currentURL.isRelative() yes Evaluation Count:14 | no Evaluation Count:0 |
| 0-14 |
1130 | || (currentURL.scheme() == QLatin1String("file") never evaluated: currentURL.scheme() == QLatin1String("file") | 0 |
1131 | && !QFileInfo(currentURL.toLocalFile()).isAbsolute())) never evaluated: !QFileInfo(currentURL.toLocalFile()).isAbsolute() | 0 |
1132 | || (name.hasFragment() && name.path().isEmpty())) { partially evaluated: name.hasFragment() no Evaluation Count:0 | yes Evaluation Count:14 |
never evaluated: name.path().isEmpty() | 0-14 |
1133 | resourceUrl = currentURL.resolved(name); | - |
1134 | } else { | 0 |
1135 | | - |
1136 | | - |
1137 | | - |
1138 | QFileInfo fi(currentURL.toLocalFile()); | - |
1139 | if (fi.exists()) { partially evaluated: fi.exists() no Evaluation Count:0 | yes Evaluation Count:14 |
| 0-14 |
1140 | resourceUrl = | - |
1141 | QUrl::fromLocalFile(fi.absolutePath() + QDir::separator()).resolved(name); | - |
1142 | } else if (currentURL.isEmpty()) { partially evaluated: currentURL.isEmpty() yes Evaluation Count:14 | no Evaluation Count:0 |
| 0-14 |
1143 | resourceUrl.setScheme(QLatin1String("file")); | - |
1144 | } executed: } Execution Count:14 | 14 |
1145 | } | - |
1146 | | - |
1147 | QString s = resourceUrl.toLocalFile(); | - |
1148 | QFile f(s); | - |
1149 | if (!s.isEmpty() && f.open(QFile::ReadOnly)) { evaluated: !s.isEmpty() yes Evaluation Count:13 | yes Evaluation Count:1 |
evaluated: f.open(QFile::ReadOnly) yes Evaluation Count:8 | yes Evaluation Count:5 |
| 1-13 |
1150 | r = f.readAll(); | - |
1151 | f.close(); | - |
1152 | } executed: } Execution Count:8 | 8 |
1153 | } executed: } Execution Count:14 | 14 |
1154 | | - |
1155 | if (!r.isNull()) { evaluated: !r.isNull() yes Evaluation Count:8 | yes Evaluation Count:9 |
| 8-9 |
1156 | if (type == ImageResource && r.type() == QVariant::ByteArray) { partially evaluated: type == ImageResource yes Evaluation Count:8 | no Evaluation Count:0 |
partially evaluated: r.type() == QVariant::ByteArray yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
1157 | if (QCoreApplication::instance()->thread() != QThread::currentThread()) { partially evaluated: QCoreApplication::instance()->thread() != QThread::currentThread() no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
1158 | | - |
1159 | QImage image; | - |
1160 | image.loadFromData(r.toByteArray()); | - |
1161 | if (!image.isNull()) never evaluated: !image.isNull() | 0 |
1162 | r = image; never executed: r = image; | 0 |
1163 | } else { | 0 |
1164 | QPixmap pm; | - |
1165 | pm.loadFromData(r.toByteArray()); | - |
1166 | if (!pm.isNull()) partially evaluated: !pm.isNull() yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
1167 | r = pm; executed: r = pm; Execution Count:8 | 8 |
1168 | } executed: } Execution Count:8 | 8 |
1169 | } | - |
1170 | d->cachedResources.insert(name, r); | - |
1171 | } executed: } Execution Count:8 | 8 |
1172 | return r; executed: return r; Execution Count:17 | 17 |
1173 | } | - |
1174 | | - |
1175 | static QTextFormat formatDifference(const QTextFormat &from, const QTextFormat &to) | - |
1176 | { | - |
1177 | QTextFormat diff = to; | - |
1178 | | - |
1179 | const QMap<int, QVariant> props = to.properties(); | - |
1180 | for (QMap<int, QVariant>::ConstIterator it = props.begin(), end = props.end(); | - |
1181 | it != end; ++it) evaluated: it != end yes Evaluation Count:1 | yes Evaluation Count:88 |
| 1-88 |
1182 | if (it.value() == from.property(it.key())) partially evaluated: it.value() == from.property(it.key()) no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
1183 | diff.clearProperty(it.key()); never executed: diff.clearProperty(it.key()); | 0 |
1184 | | - |
1185 | return diff; executed: return diff; Execution Count:88 | 88 |
1186 | } | - |
1187 | | - |
1188 | static QString colorValue(QColor color) | - |
1189 | { | - |
1190 | QString result; | - |
1191 | | - |
1192 | if (color.alpha() == 255) { evaluated: color.alpha() == 255 yes Evaluation Count:22 | yes Evaluation Count:8 |
| 8-22 |
1193 | result = color.name(); | - |
1194 | } else if (color.alpha()) { executed: } Execution Count:22 evaluated: color.alpha() yes Evaluation Count:4 | yes Evaluation Count:4 |
| 4-22 |
1195 | QString alphaValue = QString::number(color.alphaF(), 'f', 6).remove(QRegExp(QLatin1String("\\.?0*$"))); | - |
1196 | result = QString::fromLatin1("rgba(%1,%2,%3,%4)").arg(color.red()) | - |
1197 | .arg(color.green()) | - |
1198 | .arg(color.blue()) | - |
1199 | .arg(alphaValue); | - |
1200 | } else { executed: } Execution Count:4 | 4 |
1201 | result = QLatin1String("transparent"); | - |
1202 | } executed: } Execution Count:4 | 4 |
1203 | | - |
1204 | return result; executed: return result; Execution Count:30 | 30 |
1205 | } | - |
1206 | | - |
1207 | QTextHtmlExporter::QTextHtmlExporter(const QTextDocument *_doc) | - |
1208 | : doc(_doc), fragmentMarkers(false) | - |
1209 | { | - |
1210 | const QFont defaultFont = doc->defaultFont(); | - |
1211 | defaultCharFormat.setFont(defaultFont); | - |
1212 | | - |
1213 | defaultCharFormat.clearProperty(QTextFormat::FontUnderline); | - |
1214 | defaultCharFormat.clearProperty(QTextFormat::FontOverline); | - |
1215 | defaultCharFormat.clearProperty(QTextFormat::FontStrikeOut); | - |
1216 | defaultCharFormat.clearProperty(QTextFormat::TextUnderlineStyle); | - |
1217 | } executed: } Execution Count:98 | 98 |
1218 | | - |
1219 | | - |
1220 | | - |
1221 | | - |
1222 | | - |
1223 | | - |
1224 | QString QTextHtmlExporter::toHtml(const QByteArray &encoding, ExportMode mode) | - |
1225 | { | - |
1226 | html = QLatin1String("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" " | - |
1227 | "\"http://www.w3.org/TR/REC-html40/strict.dtd\">\n" | - |
1228 | "<html><head><meta name=\"qrichtext\" content=\"1\" />"); | - |
1229 | html.reserve(doc->docHandle()->length()); | - |
1230 | | - |
1231 | fragmentMarkers = (mode == ExportFragment); | - |
1232 | | - |
1233 | if (!encoding.isEmpty()) evaluated: !encoding.isEmpty() yes Evaluation Count:3 | yes Evaluation Count:95 |
| 3-95 |
1234 | html += QString::fromLatin1("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=%1\" />").arg(QString::fromLatin1(encoding)); executed: html += QString::fromLatin1("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=%1\" />").arg(QString::fromLatin1(encoding)); Execution Count:3 | 3 |
1235 | | - |
1236 | QString title = doc->metaInformation(QTextDocument::DocumentTitle); | - |
1237 | if (!title.isEmpty()) partially evaluated: !title.isEmpty() no Evaluation Count:0 | yes Evaluation Count:98 |
| 0-98 |
1238 | html += QString::fromLatin1("<title>") + title + QString::fromLatin1("</title>"); never executed: html += QString::fromLatin1("<title>") + title + QString::fromLatin1("</title>"); | 0 |
1239 | html += QLatin1String("<style type=\"text/css\">\n"); | - |
1240 | html += QLatin1String("p, li { white-space: pre-wrap; }\n"); | - |
1241 | html += QLatin1String("</style>"); | - |
1242 | html += QLatin1String("</head><body"); | - |
1243 | | - |
1244 | if (mode == ExportEntireDocument) { evaluated: mode == ExportEntireDocument yes Evaluation Count:89 | yes Evaluation Count:9 |
| 9-89 |
1245 | html += QLatin1String(" style=\""); | - |
1246 | | - |
1247 | emitFontFamily(defaultCharFormat.fontFamily()); | - |
1248 | | - |
1249 | if (defaultCharFormat.hasProperty(QTextFormat::FontPointSize)) { partially evaluated: defaultCharFormat.hasProperty(QTextFormat::FontPointSize) yes Evaluation Count:89 | no Evaluation Count:0 |
| 0-89 |
1250 | html += QLatin1String(" font-size:"); | - |
1251 | html += QString::number(defaultCharFormat.fontPointSize()); | - |
1252 | html += QLatin1String("pt;"); | - |
1253 | } else if (defaultCharFormat.hasProperty(QTextFormat::FontPixelSize)) { executed: } Execution Count:89 never evaluated: defaultCharFormat.hasProperty(QTextFormat::FontPixelSize) | 0-89 |
1254 | html += QLatin1String(" font-size:"); | - |
1255 | html += QString::number(defaultCharFormat.intProperty(QTextFormat::FontPixelSize)); | - |
1256 | html += QLatin1String("px;"); | - |
1257 | } | 0 |
1258 | | - |
1259 | html += QLatin1String(" font-weight:"); | - |
1260 | html += QString::number(defaultCharFormat.fontWeight() * 8); | - |
1261 | html += QLatin1Char(';'); | - |
1262 | | - |
1263 | html += QLatin1String(" font-style:"); | - |
1264 | html += (defaultCharFormat.fontItalic() ? QLatin1String("italic") : QLatin1String("normal")); evaluated: defaultCharFormat.fontItalic() yes Evaluation Count:2 | yes Evaluation Count:87 |
| 2-87 |
1265 | html += QLatin1Char(';'); | - |
1266 | | - |
1267 | | - |
1268 | | - |
1269 | | - |
1270 | html += QLatin1Char('\"'); | - |
1271 | | - |
1272 | const QTextFrameFormat fmt = doc->rootFrame()->frameFormat(); | - |
1273 | emitBackgroundAttribute(fmt); | - |
1274 | | - |
1275 | } else { executed: } Execution Count:89 | 89 |
1276 | defaultCharFormat = QTextCharFormat(); | - |
1277 | } executed: } Execution Count:9 | 9 |
1278 | html += QLatin1Char('>'); | - |
1279 | | - |
1280 | QTextFrameFormat rootFmt = doc->rootFrame()->frameFormat(); | - |
1281 | rootFmt.clearProperty(QTextFormat::BackgroundBrush); | - |
1282 | | - |
1283 | QTextFrameFormat defaultFmt; | - |
1284 | defaultFmt.setMargin(doc->documentMargin()); | - |
1285 | | - |
1286 | if (rootFmt == defaultFmt) evaluated: rootFmt == defaultFmt yes Evaluation Count:97 | yes Evaluation Count:1 |
| 1-97 |
1287 | emitFrame(doc->rootFrame()->begin()); executed: emitFrame(doc->rootFrame()->begin()); Execution Count:97 | 97 |
1288 | else | - |
1289 | emitTextFrame(doc->rootFrame()); executed: emitTextFrame(doc->rootFrame()); Execution Count:1 | 1 |
1290 | | - |
1291 | html += QLatin1String("</body></html>"); | - |
1292 | return html; executed: return html; Execution Count:98 | 98 |
1293 | } | - |
1294 | | - |
1295 | void QTextHtmlExporter::emitAttribute(const char *attribute, const QString &value) | - |
1296 | { | - |
1297 | html += QLatin1Char(' '); | - |
1298 | html += QLatin1String(attribute); | - |
1299 | html += QLatin1String("=\""); | - |
1300 | html += value.toHtmlEscaped(); | - |
1301 | html += QLatin1Char('"'); | - |
1302 | } executed: } Execution Count:69 | 69 |
1303 | | - |
1304 | bool QTextHtmlExporter::emitCharFormatStyle(const QTextCharFormat &format) | - |
1305 | { | - |
1306 | bool attributesEmitted = false; | - |
1307 | | - |
1308 | { | - |
1309 | const QString family = format.fontFamily(); | - |
1310 | if (!family.isEmpty() && family != defaultCharFormat.fontFamily()) { evaluated: !family.isEmpty() yes Evaluation Count:4 | yes Evaluation Count:92 |
partially evaluated: family != defaultCharFormat.fontFamily() yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-92 |
1311 | emitFontFamily(family); | - |
1312 | attributesEmitted = true; | - |
1313 | } executed: } Execution Count:4 | 4 |
1314 | } | - |
1315 | | - |
1316 | if (format.hasProperty(QTextFormat::FontPointSize) evaluated: format.hasProperty(QTextFormat::FontPointSize) yes Evaluation Count:1 | yes Evaluation Count:95 |
| 1-95 |
1317 | && format.fontPointSize() != defaultCharFormat.fontPointSize()) { partially evaluated: format.fontPointSize() != defaultCharFormat.fontPointSize() yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1318 | html += QLatin1String(" font-size:"); | - |
1319 | html += QString::number(format.fontPointSize()); | - |
1320 | html += QLatin1String("pt;"); | - |
1321 | attributesEmitted = true; | - |
1322 | } else if (format.hasProperty(QTextFormat::FontSizeAdjustment)) { executed: } Execution Count:1 evaluated: format.hasProperty(QTextFormat::FontSizeAdjustment) yes Evaluation Count:2 | yes Evaluation Count:93 |
| 1-93 |
1323 | static const char * const sizeNames[] = { | - |
1324 | "small", "medium", "large", "x-large", "xx-large" | - |
1325 | }; | - |
1326 | const char *name = 0; | - |
1327 | const int idx = format.intProperty(QTextFormat::FontSizeAdjustment) + 1; | - |
1328 | if (idx >= 0 && idx <= 4) { partially evaluated: idx >= 0 yes Evaluation Count:2 | no Evaluation Count:0 |
partially evaluated: idx <= 4 yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
1329 | name = sizeNames[idx]; | - |
1330 | } executed: } Execution Count:2 | 2 |
1331 | if (name) { partially evaluated: name yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
1332 | html += QLatin1String(" font-size:"); | - |
1333 | html += QLatin1String(name); | - |
1334 | html += QLatin1Char(';'); | - |
1335 | attributesEmitted = true; | - |
1336 | } executed: } Execution Count:2 | 2 |
1337 | } else if (format.hasProperty(QTextFormat::FontPixelSize)) { executed: } Execution Count:2 evaluated: format.hasProperty(QTextFormat::FontPixelSize) yes Evaluation Count:2 | yes Evaluation Count:91 |
| 2-91 |
1338 | html += QLatin1String(" font-size:"); | - |
1339 | html += QString::number(format.intProperty(QTextFormat::FontPixelSize)); | - |
1340 | html += QLatin1String("px;"); | - |
1341 | attributesEmitted = true; | - |
1342 | } executed: } Execution Count:2 | 2 |
1343 | | - |
1344 | if (format.hasProperty(QTextFormat::FontWeight) evaluated: format.hasProperty(QTextFormat::FontWeight) yes Evaluation Count:2 | yes Evaluation Count:94 |
| 2-94 |
1345 | && format.fontWeight() != defaultCharFormat.fontWeight()) { evaluated: format.fontWeight() != defaultCharFormat.fontWeight() yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
1346 | html += QLatin1String(" font-weight:"); | - |
1347 | html += QString::number(format.fontWeight() * 8); | - |
1348 | html += QLatin1Char(';'); | - |
1349 | attributesEmitted = true; | - |
1350 | } executed: } Execution Count:1 | 1 |
1351 | | - |
1352 | if (format.hasProperty(QTextFormat::FontItalic) evaluated: format.hasProperty(QTextFormat::FontItalic) yes Evaluation Count:2 | yes Evaluation Count:94 |
| 2-94 |
1353 | && format.fontItalic() != defaultCharFormat.fontItalic()) { evaluated: format.fontItalic() != defaultCharFormat.fontItalic() yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
1354 | html += QLatin1String(" font-style:"); | - |
1355 | html += (format.fontItalic() ? QLatin1String("italic") : QLatin1String("normal")); partially evaluated: format.fontItalic() yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1356 | html += QLatin1Char(';'); | - |
1357 | attributesEmitted = true; | - |
1358 | } executed: } Execution Count:1 | 1 |
1359 | | - |
1360 | QLatin1String decorationTag(" text-decoration:"); | - |
1361 | html += decorationTag; | - |
1362 | bool hasDecoration = false; | - |
1363 | bool atLeastOneDecorationSet = false; | - |
1364 | | - |
1365 | if ((format.hasProperty(QTextFormat::FontUnderline) || format.hasProperty(QTextFormat::TextUnderlineStyle)) evaluated: format.hasProperty(QTextFormat::FontUnderline) yes Evaluation Count:1 | yes Evaluation Count:95 |
evaluated: format.hasProperty(QTextFormat::TextUnderlineStyle) yes Evaluation Count:1 | yes Evaluation Count:94 |
| 1-95 |
1366 | && format.fontUnderline() != defaultCharFormat.fontUnderline()) { evaluated: format.fontUnderline() != defaultCharFormat.fontUnderline() yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
1367 | hasDecoration = true; | - |
1368 | if (format.fontUnderline()) { partially evaluated: format.fontUnderline() yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1369 | html += QLatin1String(" underline"); | - |
1370 | atLeastOneDecorationSet = true; | - |
1371 | } executed: } Execution Count:1 | 1 |
1372 | } executed: } Execution Count:1 | 1 |
1373 | | - |
1374 | if (format.hasProperty(QTextFormat::FontOverline) evaluated: format.hasProperty(QTextFormat::FontOverline) yes Evaluation Count:2 | yes Evaluation Count:94 |
| 2-94 |
1375 | && format.fontOverline() != defaultCharFormat.fontOverline()) { partially evaluated: format.fontOverline() != defaultCharFormat.fontOverline() no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
1376 | hasDecoration = true; | - |
1377 | if (format.fontOverline()) { never evaluated: format.fontOverline() | 0 |
1378 | html += QLatin1String(" overline"); | - |
1379 | atLeastOneDecorationSet = true; | - |
1380 | } | 0 |
1381 | } | 0 |
1382 | | - |
1383 | if (format.hasProperty(QTextFormat::FontStrikeOut) evaluated: format.hasProperty(QTextFormat::FontStrikeOut) yes Evaluation Count:1 | yes Evaluation Count:95 |
| 1-95 |
1384 | && format.fontStrikeOut() != defaultCharFormat.fontStrikeOut()) { partially evaluated: format.fontStrikeOut() != defaultCharFormat.fontStrikeOut() no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
1385 | hasDecoration = true; | - |
1386 | if (format.fontStrikeOut()) { never evaluated: format.fontStrikeOut() | 0 |
1387 | html += QLatin1String(" line-through"); | - |
1388 | atLeastOneDecorationSet = true; | - |
1389 | } | 0 |
1390 | } | 0 |
1391 | | - |
1392 | if (hasDecoration) { evaluated: hasDecoration yes Evaluation Count:1 | yes Evaluation Count:95 |
| 1-95 |
1393 | if (!atLeastOneDecorationSet) partially evaluated: !atLeastOneDecorationSet no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
1394 | html += QLatin1String("none"); never executed: html += QLatin1String("none"); | 0 |
1395 | html += QLatin1Char(';'); | - |
1396 | attributesEmitted = true; | - |
1397 | } else { executed: } Execution Count:1 | 1 |
1398 | html.chop(qstrlen(decorationTag.latin1())); | - |
1399 | } executed: } Execution Count:95 | 95 |
1400 | | - |
1401 | if (format.foreground() != defaultCharFormat.foreground() evaluated: format.foreground() != defaultCharFormat.foreground() yes Evaluation Count:8 | yes Evaluation Count:88 |
| 8-88 |
1402 | && format.foreground().style() != Qt::NoBrush) { partially evaluated: format.foreground().style() != Qt::NoBrush yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
1403 | html += QLatin1String(" color:"); | - |
1404 | html += colorValue(format.foreground().color()); | - |
1405 | html += QLatin1Char(';'); | - |
1406 | attributesEmitted = true; | - |
1407 | } executed: } Execution Count:8 | 8 |
1408 | | - |
1409 | if (format.background() != defaultCharFormat.background() evaluated: format.background() != defaultCharFormat.background() yes Evaluation Count:16 | yes Evaluation Count:80 |
| 16-80 |
1410 | && format.background().style() == Qt::SolidPattern) { evaluated: format.background().style() == Qt::SolidPattern yes Evaluation Count:12 | yes Evaluation Count:4 |
| 4-12 |
1411 | html += QLatin1String(" background-color:"); | - |
1412 | html += colorValue(format.background().color()); | - |
1413 | html += QLatin1Char(';'); | - |
1414 | attributesEmitted = true; | - |
1415 | } executed: } Execution Count:12 | 12 |
1416 | | - |
1417 | if (format.verticalAlignment() != defaultCharFormat.verticalAlignment() evaluated: format.verticalAlignment() != defaultCharFormat.verticalAlignment() yes Evaluation Count:2 | yes Evaluation Count:94 |
| 2-94 |
1418 | && format.verticalAlignment() != QTextCharFormat::AlignNormal) partially evaluated: format.verticalAlignment() != QTextCharFormat::AlignNormal yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
1419 | { | - |
1420 | html += QLatin1String(" vertical-align:"); | - |
1421 | | - |
1422 | QTextCharFormat::VerticalAlignment valign = format.verticalAlignment(); | - |
1423 | if (valign == QTextCharFormat::AlignSubScript) evaluated: valign == QTextCharFormat::AlignSubScript yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
1424 | html += QLatin1String("sub"); executed: html += QLatin1String("sub"); Execution Count:1 | 1 |
1425 | else if (valign == QTextCharFormat::AlignSuperScript) partially evaluated: valign == QTextCharFormat::AlignSuperScript yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1426 | html += QLatin1String("super"); executed: html += QLatin1String("super"); Execution Count:1 | 1 |
1427 | else if (valign == QTextCharFormat::AlignMiddle) never evaluated: valign == QTextCharFormat::AlignMiddle | 0 |
1428 | html += QLatin1String("middle"); never executed: html += QLatin1String("middle"); | 0 |
1429 | else if (valign == QTextCharFormat::AlignTop) never evaluated: valign == QTextCharFormat::AlignTop | 0 |
1430 | html += QLatin1String("top"); never executed: html += QLatin1String("top"); | 0 |
1431 | else if (valign == QTextCharFormat::AlignBottom) never evaluated: valign == QTextCharFormat::AlignBottom | 0 |
1432 | html += QLatin1String("bottom"); never executed: html += QLatin1String("bottom"); | 0 |
1433 | | - |
1434 | html += QLatin1Char(';'); | - |
1435 | attributesEmitted = true; | - |
1436 | } executed: } Execution Count:2 | 2 |
1437 | | - |
1438 | if (format.fontCapitalization() != QFont::MixedCase) { evaluated: format.fontCapitalization() != QFont::MixedCase yes Evaluation Count:6 | yes Evaluation Count:90 |
| 6-90 |
1439 | const QFont::Capitalization caps = format.fontCapitalization(); | - |
1440 | if (caps == QFont::AllUppercase) evaluated: caps == QFont::AllUppercase yes Evaluation Count:2 | yes Evaluation Count:4 |
| 2-4 |
1441 | html += QLatin1String(" text-transform:uppercase;"); executed: html += QLatin1String(" text-transform:uppercase;"); Execution Count:2 | 2 |
1442 | else if (caps == QFont::AllLowercase) evaluated: caps == QFont::AllLowercase yes Evaluation Count:2 | yes Evaluation Count:2 |
| 2 |
1443 | html += QLatin1String(" text-transform:lowercase;"); executed: html += QLatin1String(" text-transform:lowercase;"); Execution Count:2 | 2 |
1444 | else if (caps == QFont::SmallCaps) partially evaluated: caps == QFont::SmallCaps yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
1445 | html += QLatin1String(" font-variant:small-caps;"); executed: html += QLatin1String(" font-variant:small-caps;"); Execution Count:2 | 2 |
1446 | attributesEmitted = true; | - |
1447 | } executed: } Execution Count:6 | 6 |
1448 | | - |
1449 | if (format.fontWordSpacing() != 0.0) { evaluated: format.fontWordSpacing() != 0.0 yes Evaluation Count:2 | yes Evaluation Count:94 |
| 2-94 |
1450 | html += QLatin1String(" word-spacing:"); | - |
1451 | html += QString::number(format.fontWordSpacing()); | - |
1452 | html += QLatin1String("px;"); | - |
1453 | attributesEmitted = true; | - |
1454 | } executed: } Execution Count:2 | 2 |
1455 | | - |
1456 | return attributesEmitted; executed: return attributesEmitted; Execution Count:96 | 96 |
1457 | } | - |
1458 | | - |
1459 | void QTextHtmlExporter::emitTextLength(const char *attribute, const QTextLength &length) | - |
1460 | { | - |
1461 | if (length.type() == QTextLength::VariableLength) evaluated: length.type() == QTextLength::VariableLength yes Evaluation Count:42 | yes Evaluation Count:13 |
| 13-42 |
1462 | return; executed: return; Execution Count:42 | 42 |
1463 | | - |
1464 | html += QLatin1Char(' '); | - |
1465 | html += QLatin1String(attribute); | - |
1466 | html += QLatin1String("=\""); | - |
1467 | html += QString::number(length.rawValue()); | - |
1468 | | - |
1469 | if (length.type() == QTextLength::PercentageLength) evaluated: length.type() == QTextLength::PercentageLength yes Evaluation Count:4 | yes Evaluation Count:9 |
| 4-9 |
1470 | html += QLatin1String("%\""); executed: html += QLatin1String("%\""); Execution Count:4 | 4 |
1471 | else | - |
1472 | html += QLatin1Char('\"'); executed: html += QLatin1Char('\"'); Execution Count:9 | 9 |
1473 | } | - |
1474 | | - |
1475 | void QTextHtmlExporter::emitAlignment(Qt::Alignment align) | - |
1476 | { | - |
1477 | if (align & Qt::AlignLeft) evaluated: align & Qt::AlignLeft yes Evaluation Count:141 | yes Evaluation Count:21 |
| 21-141 |
1478 | return; executed: return; Execution Count:141 | 141 |
1479 | else if (align & Qt::AlignRight) evaluated: align & Qt::AlignRight yes Evaluation Count:1 | yes Evaluation Count:20 |
| 1-20 |
1480 | html += QLatin1String(" align=\"right\""); executed: html += QLatin1String(" align=\"right\""); Execution Count:1 | 1 |
1481 | else if (align & Qt::AlignHCenter) evaluated: align & Qt::AlignHCenter yes Evaluation Count:3 | yes Evaluation Count:17 |
| 3-17 |
1482 | html += QLatin1String(" align=\"center\""); executed: html += QLatin1String(" align=\"center\""); Execution Count:3 | 3 |
1483 | else if (align & Qt::AlignJustify) evaluated: align & Qt::AlignJustify yes Evaluation Count:1 | yes Evaluation Count:16 |
| 1-16 |
1484 | html += QLatin1String(" align=\"justify\""); executed: html += QLatin1String(" align=\"justify\""); Execution Count:1 | 1 |
1485 | } | - |
1486 | | - |
1487 | void QTextHtmlExporter::emitFloatStyle(QTextFrameFormat::Position pos, StyleMode mode) | - |
1488 | { | - |
1489 | if (pos == QTextFrameFormat::InFlow) evaluated: pos == QTextFrameFormat::InFlow yes Evaluation Count:17 | yes Evaluation Count:6 |
| 6-17 |
1490 | return; executed: return; Execution Count:17 | 17 |
1491 | | - |
1492 | if (mode == EmitStyleTag) evaluated: mode == EmitStyleTag yes Evaluation Count:1 | yes Evaluation Count:5 |
| 1-5 |
1493 | html += QLatin1String(" style=\"float:"); executed: html += QLatin1String(" style=\"float:"); Execution Count:1 | 1 |
1494 | else | - |
1495 | html += QLatin1String(" float:"); executed: html += QLatin1String(" float:"); Execution Count:5 | 5 |
1496 | | - |
1497 | if (pos == QTextFrameFormat::FloatLeft) partially evaluated: pos == QTextFrameFormat::FloatLeft no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-6 |
1498 | html += QLatin1String(" left;"); never executed: html += QLatin1String(" left;"); | 0 |
1499 | else if (pos == QTextFrameFormat::FloatRight) partially evaluated: pos == QTextFrameFormat::FloatRight yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
1500 | html += QLatin1String(" right;"); executed: html += QLatin1String(" right;"); Execution Count:6 | 6 |
1501 | else | - |
1502 | qt_noop(); never executed: qt_noop(); | 0 |
1503 | | - |
1504 | if (mode == EmitStyleTag) evaluated: mode == EmitStyleTag yes Evaluation Count:1 | yes Evaluation Count:5 |
| 1-5 |
1505 | html += QLatin1Char('\"'); executed: html += QLatin1Char('\"'); Execution Count:1 | 1 |
1506 | } executed: } Execution Count:6 | 6 |
1507 | | - |
1508 | void QTextHtmlExporter::emitBorderStyle(QTextFrameFormat::BorderStyle style) | - |
1509 | { | - |
1510 | qt_noop(); | - |
1511 | | - |
1512 | html += QLatin1String(" border-style:"); | - |
1513 | | - |
1514 | switch (style) { | - |
1515 | case QTextFrameFormat::BorderStyle_None: | - |
1516 | html += QLatin1String("none"); | - |
1517 | break; | 0 |
1518 | case QTextFrameFormat::BorderStyle_Dotted: | - |
1519 | html += QLatin1String("dotted"); | - |
1520 | break; | 0 |
1521 | case QTextFrameFormat::BorderStyle_Dashed: | - |
1522 | html += QLatin1String("dashed"); | - |
1523 | break; | 0 |
1524 | case QTextFrameFormat::BorderStyle_Solid: | - |
1525 | html += QLatin1String("solid"); | - |
1526 | break; executed: break; Execution Count:1 | 1 |
1527 | case QTextFrameFormat::BorderStyle_Double: | - |
1528 | html += QLatin1String("double"); | - |
1529 | break; | 0 |
1530 | case QTextFrameFormat::BorderStyle_DotDash: | - |
1531 | html += QLatin1String("dot-dash"); | - |
1532 | break; | 0 |
1533 | case QTextFrameFormat::BorderStyle_DotDotDash: | - |
1534 | html += QLatin1String("dot-dot-dash"); | - |
1535 | break; | 0 |
1536 | case QTextFrameFormat::BorderStyle_Groove: | - |
1537 | html += QLatin1String("groove"); | - |
1538 | break; | 0 |
1539 | case QTextFrameFormat::BorderStyle_Ridge: | - |
1540 | html += QLatin1String("ridge"); | - |
1541 | break; | 0 |
1542 | case QTextFrameFormat::BorderStyle_Inset: | - |
1543 | html += QLatin1String("inset"); | - |
1544 | break; | 0 |
1545 | case QTextFrameFormat::BorderStyle_Outset: | - |
1546 | html += QLatin1String("outset"); | - |
1547 | break; | 0 |
1548 | default: | - |
1549 | qt_noop(); | - |
1550 | break; | 0 |
1551 | }; | - |
1552 | | - |
1553 | html += QLatin1Char(';'); | - |
1554 | } executed: } Execution Count:1 | 1 |
1555 | | - |
1556 | void QTextHtmlExporter::emitPageBreakPolicy(QTextFormat::PageBreakFlags policy) | - |
1557 | { | - |
1558 | if (policy & QTextFormat::PageBreak_AlwaysBefore) evaluated: policy & QTextFormat::PageBreak_AlwaysBefore yes Evaluation Count:2 | yes Evaluation Count:164 |
| 2-164 |
1559 | html += QLatin1String(" page-break-before:always;"); executed: html += QLatin1String(" page-break-before:always;"); Execution Count:2 | 2 |
1560 | | - |
1561 | if (policy & QTextFormat::PageBreak_AlwaysAfter) evaluated: policy & QTextFormat::PageBreak_AlwaysAfter yes Evaluation Count:2 | yes Evaluation Count:164 |
| 2-164 |
1562 | html += QLatin1String(" page-break-after:always;"); executed: html += QLatin1String(" page-break-after:always;"); Execution Count:2 | 2 |
1563 | } executed: } Execution Count:166 | 166 |
1564 | | - |
1565 | void QTextHtmlExporter::emitFontFamily(const QString &family) | - |
1566 | { | - |
1567 | html += QLatin1String(" font-family:"); | - |
1568 | | - |
1569 | QLatin1String quote("\'"); | - |
1570 | if (family.contains(QLatin1Char('\''))) evaluated: family.contains(QLatin1Char('\'')) yes Evaluation Count:1 | yes Evaluation Count:92 |
| 1-92 |
1571 | quote = QLatin1String("""); executed: quote = QLatin1String("""); Execution Count:1 | 1 |
1572 | | - |
1573 | html += quote; | - |
1574 | html += family.toHtmlEscaped(); | - |
1575 | html += quote; | - |
1576 | html += QLatin1Char(';'); | - |
1577 | } executed: } Execution Count:93 | 93 |
1578 | | - |
1579 | void QTextHtmlExporter::emitMargins(const QString &top, const QString &bottom, const QString &left, const QString &right) | - |
1580 | { | - |
1581 | html += QLatin1String(" margin-top:"); | - |
1582 | html += top; | - |
1583 | html += QLatin1String("px;"); | - |
1584 | | - |
1585 | html += QLatin1String(" margin-bottom:"); | - |
1586 | html += bottom; | - |
1587 | html += QLatin1String("px;"); | - |
1588 | | - |
1589 | html += QLatin1String(" margin-left:"); | - |
1590 | html += left; | - |
1591 | html += QLatin1String("px;"); | - |
1592 | | - |
1593 | html += QLatin1String(" margin-right:"); | - |
1594 | html += right; | - |
1595 | html += QLatin1String("px;"); | - |
1596 | } executed: } Execution Count:153 | 153 |
1597 | | - |
1598 | void QTextHtmlExporter::emitFragment(const QTextFragment &fragment) | - |
1599 | { | - |
1600 | const QTextCharFormat format = fragment.charFormat(); | - |
1601 | | - |
1602 | bool closeAnchor = false; | - |
1603 | | - |
1604 | if (format.isAnchor()) { evaluated: format.isAnchor() yes Evaluation Count:4 | yes Evaluation Count:91 |
| 4-91 |
1605 | const QString name = format.anchorName(); | - |
1606 | if (!name.isEmpty()) { evaluated: !name.isEmpty() yes Evaluation Count:1 | yes Evaluation Count:3 |
| 1-3 |
1607 | html += QLatin1String("<a name=\""); | - |
1608 | html += name.toHtmlEscaped(); | - |
1609 | html += QLatin1String("\"></a>"); | - |
1610 | } executed: } Execution Count:1 | 1 |
1611 | const QString href = format.anchorHref(); | - |
1612 | if (!href.isEmpty()) { evaluated: !href.isEmpty() yes Evaluation Count:3 | yes Evaluation Count:1 |
| 1-3 |
1613 | html += QLatin1String("<a href=\""); | - |
1614 | html += href.toHtmlEscaped(); | - |
1615 | html += QLatin1String("\">"); | - |
1616 | closeAnchor = true; | - |
1617 | } executed: } Execution Count:3 | 3 |
1618 | } executed: } Execution Count:4 | 4 |
1619 | | - |
1620 | QString txt = fragment.text(); | - |
1621 | const bool isObject = txt.contains(QChar::ObjectReplacementCharacter); | - |
1622 | const bool isImage = isObject && format.isImageFormat(); evaluated: isObject yes Evaluation Count:4 | yes Evaluation Count:91 |
partially evaluated: format.isImageFormat() yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-91 |
1623 | | - |
1624 | QLatin1String styleTag("<span style=\""); | - |
1625 | html += styleTag; | - |
1626 | | - |
1627 | bool attributesEmitted = false; | - |
1628 | if (!isImage) evaluated: !isImage yes Evaluation Count:91 | yes Evaluation Count:4 |
| 4-91 |
1629 | attributesEmitted = emitCharFormatStyle(format); executed: attributesEmitted = emitCharFormatStyle(format); Execution Count:91 | 91 |
1630 | if (attributesEmitted) evaluated: attributesEmitted yes Evaluation Count:35 | yes Evaluation Count:60 |
| 35-60 |
1631 | html += QLatin1String("\">"); executed: html += QLatin1String("\">"); Execution Count:35 | 35 |
1632 | else | - |
1633 | html.chop(qstrlen(styleTag.latin1())); executed: html.chop(qstrlen(styleTag.latin1())); Execution Count:60 | 60 |
1634 | | - |
1635 | if (isObject) { evaluated: isObject yes Evaluation Count:4 | yes Evaluation Count:91 |
| 4-91 |
1636 | for (int i = 0; isImage && i < txt.length(); ++i) { partially evaluated: isImage yes Evaluation Count:9 | no Evaluation Count:0 |
evaluated: i < txt.length() yes Evaluation Count:5 | yes Evaluation Count:4 |
| 0-9 |
1637 | QTextImageFormat imgFmt = format.toImageFormat(); | - |
1638 | | - |
1639 | html += QLatin1String("<img"); | - |
1640 | | - |
1641 | if (imgFmt.hasProperty(QTextFormat::ImageName)) partially evaluated: imgFmt.hasProperty(QTextFormat::ImageName) yes Evaluation Count:5 | no Evaluation Count:0 |
| 0-5 |
1642 | emitAttribute("src", imgFmt.name()); executed: emitAttribute("src", imgFmt.name()); Execution Count:5 | 5 |
1643 | | - |
1644 | if (imgFmt.hasProperty(QTextFormat::ImageWidth)) evaluated: imgFmt.hasProperty(QTextFormat::ImageWidth) yes Evaluation Count:1 | yes Evaluation Count:4 |
| 1-4 |
1645 | emitAttribute("width", QString::number(imgFmt.width())); executed: emitAttribute("width", QString::number(imgFmt.width())); Execution Count:1 | 1 |
1646 | | - |
1647 | if (imgFmt.hasProperty(QTextFormat::ImageHeight)) evaluated: imgFmt.hasProperty(QTextFormat::ImageHeight) yes Evaluation Count:1 | yes Evaluation Count:4 |
| 1-4 |
1648 | emitAttribute("height", QString::number(imgFmt.height())); executed: emitAttribute("height", QString::number(imgFmt.height())); Execution Count:1 | 1 |
1649 | | - |
1650 | if (imgFmt.verticalAlignment() == QTextCharFormat::AlignMiddle) evaluated: imgFmt.verticalAlignment() == QTextCharFormat::AlignMiddle yes Evaluation Count:1 | yes Evaluation Count:4 |
| 1-4 |
1651 | html += QLatin1String(" style=\"vertical-align: middle;\""); executed: html += QLatin1String(" style=\"vertical-align: middle;\""); Execution Count:1 | 1 |
1652 | else if (imgFmt.verticalAlignment() == QTextCharFormat::AlignTop) evaluated: imgFmt.verticalAlignment() == QTextCharFormat::AlignTop yes Evaluation Count:1 | yes Evaluation Count:3 |
| 1-3 |
1653 | html += QLatin1String(" style=\"vertical-align: top;\""); executed: html += QLatin1String(" style=\"vertical-align: top;\""); Execution Count:1 | 1 |
1654 | | - |
1655 | if (QTextFrame *imageFrame = qobject_cast<QTextFrame *>(doc->objectForFormat(imgFmt))) evaluated: QTextFrame *imageFrame = qobject_cast<QTextFrame *>(doc->objectForFormat(imgFmt)) yes Evaluation Count:1 | yes Evaluation Count:4 |
| 1-4 |
1656 | emitFloatStyle(imageFrame->frameFormat().position()); executed: emitFloatStyle(imageFrame->frameFormat().position()); Execution Count:1 | 1 |
1657 | | - |
1658 | html += QLatin1String(" />"); | - |
1659 | } executed: } Execution Count:5 | 5 |
1660 | } else { executed: } Execution Count:4 | 4 |
1661 | qt_noop(); | - |
1662 | | - |
1663 | txt = txt.toHtmlEscaped(); | - |
1664 | | - |
1665 | | - |
1666 | QString forcedLineBreakRegExp = QString::fromLatin1("[\\na]"); | - |
1667 | forcedLineBreakRegExp[3] = QChar::LineSeparator; | - |
1668 | | - |
1669 | const QStringList lines = txt.split(QRegExp(forcedLineBreakRegExp)); | - |
1670 | for (int i = 0; i < lines.count(); ++i) { evaluated: i < lines.count() yes Evaluation Count:92 | yes Evaluation Count:91 |
| 91-92 |
1671 | if (i > 0) evaluated: i > 0 yes Evaluation Count:1 | yes Evaluation Count:91 |
| 1-91 |
1672 | html += QLatin1String("<br />"); executed: html += QLatin1String("<br />"); Execution Count:1 | 1 |
1673 | html += lines.at(i); | - |
1674 | } executed: } Execution Count:92 | 92 |
1675 | } executed: } Execution Count:91 | 91 |
1676 | | - |
1677 | if (attributesEmitted) evaluated: attributesEmitted yes Evaluation Count:35 | yes Evaluation Count:60 |
| 35-60 |
1678 | html += QLatin1String("</span>"); executed: html += QLatin1String("</span>"); Execution Count:35 | 35 |
1679 | | - |
1680 | if (closeAnchor) evaluated: closeAnchor yes Evaluation Count:3 | yes Evaluation Count:92 |
| 3-92 |
1681 | html += QLatin1String("</a>"); executed: html += QLatin1String("</a>"); Execution Count:3 | 3 |
1682 | } executed: } Execution Count:95 | 95 |
1683 | | - |
1684 | static bool isOrderedList(int style) | - |
1685 | { | - |
1686 | return style == QTextListFormat::ListDecimal || style == QTextListFormat::ListLowerAlpha | 5 |
1687 | || style == QTextListFormat::ListUpperAlpha | 5 |
1688 | || style == QTextListFormat::ListUpperRoman | 5 |
1689 | || style == QTextListFormat::ListLowerRoman | 5 |
1690 | ; executed: return style == QTextListFormat::ListDecimal || style == QTextListFormat::ListLowerAlpha || style == QTextListFormat::ListUpperAlpha || style == QTextListFormat::ListUpperRoman || style == QTextListFormat::ListLowerRoman ; Execution Count:5 | 5 |
1691 | } | - |
1692 | | - |
1693 | void QTextHtmlExporter::emitBlockAttributes(const QTextBlock &block) | - |
1694 | { | - |
1695 | QTextBlockFormat format = block.blockFormat(); | - |
1696 | emitAlignment(format.alignment()); | - |
1697 | | - |
1698 | | - |
1699 | | - |
1700 | if (block.textDirection() == Qt::RightToLeft) evaluated: block.textDirection() == Qt::RightToLeft yes Evaluation Count:1 | yes Evaluation Count:143 |
| 1-143 |
1701 | html += QLatin1String(" dir='rtl'"); executed: html += QLatin1String(" dir='rtl'"); Execution Count:1 | 1 |
1702 | | - |
1703 | QLatin1String style(" style=\""); | - |
1704 | html += style; | - |
1705 | | - |
1706 | const bool emptyBlock = block.begin().atEnd(); | - |
1707 | if (emptyBlock) { evaluated: emptyBlock yes Evaluation Count:54 | yes Evaluation Count:90 |
| 54-90 |
1708 | html += QLatin1String("-qt-paragraph-type:empty;"); | - |
1709 | } executed: } Execution Count:54 | 54 |
1710 | | - |
1711 | emitMargins(QString::number(format.topMargin()), | - |
1712 | QString::number(format.bottomMargin()), | - |
1713 | QString::number(format.leftMargin()), | - |
1714 | QString::number(format.rightMargin())); | - |
1715 | | - |
1716 | html += QLatin1String(" -qt-block-indent:"); | - |
1717 | html += QString::number(format.indent()); | - |
1718 | html += QLatin1Char(';'); | - |
1719 | | - |
1720 | html += QLatin1String(" text-indent:"); | - |
1721 | html += QString::number(format.textIndent()); | - |
1722 | html += QLatin1String("px;"); | - |
1723 | | - |
1724 | if (block.userState() != -1) { evaluated: block.userState() != -1 yes Evaluation Count:1 | yes Evaluation Count:143 |
| 1-143 |
1725 | html += QLatin1String(" -qt-user-state:"); | - |
1726 | html += QString::number(block.userState()); | - |
1727 | html += QLatin1Char(';'); | - |
1728 | } executed: } Execution Count:1 | 1 |
1729 | | - |
1730 | emitPageBreakPolicy(format.pageBreakPolicy()); | - |
1731 | | - |
1732 | QTextCharFormat diff; | - |
1733 | if (emptyBlock) { evaluated: emptyBlock yes Evaluation Count:54 | yes Evaluation Count:90 |
| 54-90 |
1734 | const QTextCharFormat blockCharFmt = block.charFormat(); | - |
1735 | diff = formatDifference(defaultCharFormat, blockCharFmt).toCharFormat(); | - |
1736 | } executed: } Execution Count:54 | 54 |
1737 | | - |
1738 | diff.clearProperty(QTextFormat::BackgroundBrush); | - |
1739 | if (format.hasProperty(QTextFormat::BackgroundBrush)) { evaluated: format.hasProperty(QTextFormat::BackgroundBrush) yes Evaluation Count:4 | yes Evaluation Count:140 |
| 4-140 |
1740 | QBrush bg = format.background(); | - |
1741 | if (bg.style() != Qt::NoBrush) partially evaluated: bg.style() != Qt::NoBrush yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
1742 | diff.setProperty(QTextFormat::BackgroundBrush, format.property(QTextFormat::BackgroundBrush)); executed: diff.setProperty(QTextFormat::BackgroundBrush, format.property(QTextFormat::BackgroundBrush)); Execution Count:4 | 4 |
1743 | } executed: } Execution Count:4 | 4 |
1744 | | - |
1745 | if (!diff.properties().isEmpty()) evaluated: !diff.properties().isEmpty() yes Evaluation Count:4 | yes Evaluation Count:140 |
| 4-140 |
1746 | emitCharFormatStyle(diff); executed: emitCharFormatStyle(diff); Execution Count:4 | 4 |
1747 | | - |
1748 | html += QLatin1Char('"'); | - |
1749 | | - |
1750 | } executed: } Execution Count:144 | 144 |
1751 | | - |
1752 | void QTextHtmlExporter::emitBlock(const QTextBlock &block) | - |
1753 | { | - |
1754 | if (block.begin().atEnd()) { evaluated: block.begin().atEnd() yes Evaluation Count:97 | yes Evaluation Count:90 |
| 90-97 |
1755 | | - |
1756 | int p = block.position(); | - |
1757 | if (p > 0) evaluated: p > 0 yes Evaluation Count:55 | yes Evaluation Count:42 |
| 42-55 |
1758 | --p; executed: --p; Execution Count:55 | 55 |
1759 | QTextDocumentPrivate::FragmentIterator frag = doc->docHandle()->find(p); | - |
1760 | QChar ch = doc->docHandle()->buffer().at(frag->stringPosition); | - |
1761 | if (ch == QChar(0xfdd0) evaluated: ch == QChar(0xfdd0) yes Evaluation Count:20 | yes Evaluation Count:77 |
| 20-77 |
1762 | || ch == QChar(0xfdd1)) evaluated: ch == QChar(0xfdd1) yes Evaluation Count:21 | yes Evaluation Count:56 |
| 21-56 |
1763 | return; executed: return; Execution Count:41 | 41 |
1764 | } executed: } Execution Count:56 | 56 |
1765 | | - |
1766 | html += QLatin1Char('\n'); | - |
1767 | | - |
1768 | | - |
1769 | | - |
1770 | QTextCharFormat oldDefaultCharFormat = defaultCharFormat; | - |
1771 | | - |
1772 | QTextList *list = block.textList(); | - |
1773 | if (list) { evaluated: list yes Evaluation Count:34 | yes Evaluation Count:112 |
| 34-112 |
1774 | if (list->itemNumber(block) == 0) { evaluated: list->itemNumber(block) == 0 yes Evaluation Count:5 | yes Evaluation Count:29 |
| 5-29 |
1775 | const QTextListFormat format = list->format(); | - |
1776 | const int style = format.style(); | - |
1777 | switch (style) { | - |
1778 | case QTextListFormat::ListDecimal: html += QLatin1String("<ol"); break; | 0 |
1779 | case QTextListFormat::ListDisc: html += QLatin1String("<ul"); break; executed: break; Execution Count:4 | 4 |
1780 | case QTextListFormat::ListCircle: html += QLatin1String("<ul type=\"circle\""); break; | 0 |
1781 | case QTextListFormat::ListSquare: html += QLatin1String("<ul type=\"square\""); break; | 0 |
1782 | case QTextListFormat::ListLowerAlpha: html += QLatin1String("<ol type=\"a\""); break; executed: break; Execution Count:1 | 1 |
1783 | case QTextListFormat::ListUpperAlpha: html += QLatin1String("<ol type=\"A\""); break; | 0 |
1784 | case QTextListFormat::ListLowerRoman: html += QLatin1String("<ol type=\"i\""); break; | 0 |
1785 | case QTextListFormat::ListUpperRoman: html += QLatin1String("<ol type=\"I\""); break; | 0 |
1786 | default: html += QLatin1String("<ul"); | - |
1787 | } | 0 |
1788 | | - |
1789 | QString styleString = QString::fromLatin1("margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px;"); | - |
1790 | | - |
1791 | if (format.hasProperty(QTextFormat::ListIndent)) { partially evaluated: format.hasProperty(QTextFormat::ListIndent) yes Evaluation Count:5 | no Evaluation Count:0 |
| 0-5 |
1792 | styleString += QLatin1String(" -qt-list-indent: "); | - |
1793 | styleString += QString::number(format.indent()); | - |
1794 | styleString += QLatin1Char(';'); | - |
1795 | } executed: } Execution Count:5 | 5 |
1796 | | - |
1797 | if (format.hasProperty(QTextFormat::ListNumberPrefix)) { evaluated: format.hasProperty(QTextFormat::ListNumberPrefix) yes Evaluation Count:1 | yes Evaluation Count:4 |
| 1-4 |
1798 | QString numberPrefix = format.numberPrefix(); | - |
1799 | numberPrefix.replace(QLatin1Char('"'), QLatin1String("\\22")); | - |
1800 | numberPrefix.replace(QLatin1Char('\''), QLatin1String("\\27")); | - |
1801 | styleString += QLatin1String(" -qt-list-number-prefix: "); | - |
1802 | styleString += QLatin1Char('\''); | - |
1803 | styleString += numberPrefix; | - |
1804 | styleString += QLatin1Char('\''); | - |
1805 | styleString += QLatin1Char(';'); | - |
1806 | } executed: } Execution Count:1 | 1 |
1807 | | - |
1808 | if (format.hasProperty(QTextFormat::ListNumberSuffix)) { evaluated: format.hasProperty(QTextFormat::ListNumberSuffix) yes Evaluation Count:1 | yes Evaluation Count:4 |
| 1-4 |
1809 | if (format.numberSuffix() != QLatin1String(".")) { partially evaluated: format.numberSuffix() != QLatin1String(".") yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1810 | QString numberSuffix = format.numberSuffix(); | - |
1811 | numberSuffix.replace(QLatin1Char('"'), QLatin1String("\\22")); | - |
1812 | numberSuffix.replace(QLatin1Char('\''), QLatin1String("\\27")); | - |
1813 | styleString += QLatin1String(" -qt-list-number-suffix: "); | - |
1814 | styleString += QLatin1Char('\''); | - |
1815 | styleString += numberSuffix; | - |
1816 | styleString += QLatin1Char('\''); | - |
1817 | styleString += QLatin1Char(';'); | - |
1818 | } executed: } Execution Count:1 | 1 |
1819 | } executed: } Execution Count:1 | 1 |
1820 | | - |
1821 | html += QLatin1String(" style=\""); | - |
1822 | html += styleString; | - |
1823 | html += QLatin1String("\">"); | - |
1824 | } executed: } Execution Count:5 | 5 |
1825 | | - |
1826 | html += QLatin1String("<li"); | - |
1827 | | - |
1828 | const QTextCharFormat blockFmt = formatDifference(defaultCharFormat, block.charFormat()).toCharFormat(); | - |
1829 | if (!blockFmt.properties().isEmpty()) { evaluated: !blockFmt.properties().isEmpty() yes Evaluation Count:1 | yes Evaluation Count:33 |
| 1-33 |
1830 | html += QLatin1String(" style=\""); | - |
1831 | emitCharFormatStyle(blockFmt); | - |
1832 | html += QLatin1Char('\"'); | - |
1833 | | - |
1834 | defaultCharFormat.merge(block.charFormat()); | - |
1835 | } executed: } Execution Count:1 | 1 |
1836 | } executed: } Execution Count:34 | 34 |
1837 | | - |
1838 | const QTextBlockFormat blockFormat = block.blockFormat(); | - |
1839 | if (blockFormat.hasProperty(QTextFormat::BlockTrailingHorizontalRulerWidth)) { evaluated: blockFormat.hasProperty(QTextFormat::BlockTrailingHorizontalRulerWidth) yes Evaluation Count:2 | yes Evaluation Count:144 |
| 2-144 |
1840 | html += QLatin1String("<hr"); | - |
1841 | | - |
1842 | QTextLength width = blockFormat.lengthProperty(QTextFormat::BlockTrailingHorizontalRulerWidth); | - |
1843 | if (width.type() != QTextLength::VariableLength) evaluated: width.type() != QTextLength::VariableLength yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
1844 | emitTextLength("width", width); executed: emitTextLength("width", width); Execution Count:1 | 1 |
1845 | else | - |
1846 | html += QLatin1Char(' '); executed: html += QLatin1Char(' '); Execution Count:1 | 1 |
1847 | | - |
1848 | html += QLatin1String("/>"); | - |
1849 | return; executed: return; Execution Count:2 | 2 |
1850 | } | - |
1851 | | - |
1852 | const bool pre = blockFormat.nonBreakableLines(); | - |
1853 | if (pre) { evaluated: pre yes Evaluation Count:1 | yes Evaluation Count:143 |
| 1-143 |
1854 | if (list) partially evaluated: list no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
1855 | html += QLatin1Char('>'); never executed: html += QLatin1Char('>'); | 0 |
1856 | html += QLatin1String("<pre"); | - |
1857 | } else if (!list) { executed: } Execution Count:1 evaluated: !list yes Evaluation Count:109 | yes Evaluation Count:34 |
| 1-109 |
1858 | html += QLatin1String("<p"); | - |
1859 | } executed: } Execution Count:109 | 109 |
1860 | | - |
1861 | emitBlockAttributes(block); | - |
1862 | | - |
1863 | html += QLatin1Char('>'); | - |
1864 | if (block.begin().atEnd()) evaluated: block.begin().atEnd() yes Evaluation Count:54 | yes Evaluation Count:90 |
| 54-90 |
1865 | html += QLatin1String("<br />"); executed: html += QLatin1String("<br />"); Execution Count:54 | 54 |
1866 | | - |
1867 | QTextBlock::Iterator it = block.begin(); | - |
1868 | if (fragmentMarkers && !it.atEnd() && block == doc->begin()) evaluated: fragmentMarkers yes Evaluation Count:9 | yes Evaluation Count:135 |
partially evaluated: !it.atEnd() yes Evaluation Count:9 | no Evaluation Count:0 |
evaluated: block == doc->begin() yes Evaluation Count:7 | yes Evaluation Count:2 |
| 0-135 |
1869 | html += QLatin1String("<!--StartFragment-->"); executed: html += QLatin1String("<!--StartFragment-->"); Execution Count:7 | 7 |
1870 | | - |
1871 | for (; !it.atEnd(); ++it) evaluated: !it.atEnd() yes Evaluation Count:95 | yes Evaluation Count:144 |
| 95-144 |
1872 | emitFragment(it.fragment()); executed: emitFragment(it.fragment()); Execution Count:95 | 95 |
1873 | | - |
1874 | if (fragmentMarkers && block.position() + block.length() == doc->docHandle()->length()) evaluated: fragmentMarkers yes Evaluation Count:9 | yes Evaluation Count:135 |
evaluated: block.position() + block.length() == doc->docHandle()->length() yes Evaluation Count:7 | yes Evaluation Count:2 |
| 2-135 |
1875 | html += QLatin1String("<!--EndFragment-->"); executed: html += QLatin1String("<!--EndFragment-->"); Execution Count:7 | 7 |
1876 | | - |
1877 | if (pre) evaluated: pre yes Evaluation Count:1 | yes Evaluation Count:143 |
| 1-143 |
1878 | html += QLatin1String("</pre>"); executed: html += QLatin1String("</pre>"); Execution Count:1 | 1 |
1879 | else if (list) evaluated: list yes Evaluation Count:34 | yes Evaluation Count:109 |
| 34-109 |
1880 | html += QLatin1String("</li>"); executed: html += QLatin1String("</li>"); Execution Count:34 | 34 |
1881 | else | - |
1882 | html += QLatin1String("</p>"); executed: html += QLatin1String("</p>"); Execution Count:109 | 109 |
1883 | | - |
1884 | if (list) { evaluated: list yes Evaluation Count:34 | yes Evaluation Count:110 |
| 34-110 |
1885 | if (list->itemNumber(block) == list->count() - 1) { evaluated: list->itemNumber(block) == list->count() - 1 yes Evaluation Count:5 | yes Evaluation Count:29 |
| 5-29 |
1886 | if (isOrderedList(list->format().style())) evaluated: isOrderedList(list->format().style()) yes Evaluation Count:1 | yes Evaluation Count:4 |
| 1-4 |
1887 | html += QLatin1String("</ol>"); executed: html += QLatin1String("</ol>"); Execution Count:1 | 1 |
1888 | else | - |
1889 | html += QLatin1String("</ul>"); executed: html += QLatin1String("</ul>"); Execution Count:4 | 4 |
1890 | } | - |
1891 | } executed: } Execution Count:34 | 34 |
1892 | | - |
1893 | defaultCharFormat = oldDefaultCharFormat; | - |
1894 | } executed: } Execution Count:144 | 144 |
1895 | | - |
1896 | extern bool qHasPixmapTexture(const QBrush& brush); | - |
1897 | | - |
1898 | QString QTextHtmlExporter::findUrlForImage(const QTextDocument *doc, qint64 cacheKey, bool isPixmap) | - |
1899 | { | - |
1900 | QString url; | - |
1901 | if (!doc) | 0 |
1902 | return url; never executed: return url; | 0 |
1903 | | - |
1904 | if (QTextDocument *parent = qobject_cast<QTextDocument *>(doc->parent())) never evaluated: QTextDocument *parent = qobject_cast<QTextDocument *>(doc->parent()) | 0 |
1905 | return findUrlForImage(parent, cacheKey, isPixmap); never executed: return findUrlForImage(parent, cacheKey, isPixmap); | 0 |
1906 | | - |
1907 | if (doc && doc->docHandle()) { never evaluated: doc->docHandle() | 0 |
1908 | QTextDocumentPrivate *priv = doc->docHandle(); | - |
1909 | QMap<QUrl, QVariant>::const_iterator it = priv->cachedResources.constBegin(); | - |
1910 | for (; it != priv->cachedResources.constEnd(); ++it) { never evaluated: it != priv->cachedResources.constEnd() | 0 |
1911 | | - |
1912 | const QVariant &v = it.value(); | - |
1913 | if (v.type() == QVariant::Image && !isPixmap) { never evaluated: v.type() == QVariant::Image never evaluated: !isPixmap | 0 |
1914 | if (qvariant_cast<QImage>(v).cacheKey() == cacheKey) never evaluated: qvariant_cast<QImage>(v).cacheKey() == cacheKey | 0 |
1915 | break; | 0 |
1916 | } | 0 |
1917 | | - |
1918 | if (v.type() == QVariant::Pixmap && isPixmap) { never evaluated: v.type() == QVariant::Pixmap never evaluated: isPixmap | 0 |
1919 | if (qvariant_cast<QPixmap>(v).cacheKey() == cacheKey) never evaluated: qvariant_cast<QPixmap>(v).cacheKey() == cacheKey | 0 |
1920 | break; | 0 |
1921 | } | 0 |
1922 | } | 0 |
1923 | | - |
1924 | if (it != priv->cachedResources.constEnd()) never evaluated: it != priv->cachedResources.constEnd() | 0 |
1925 | url = it.key().toString(); never executed: url = it.key().toString(); | 0 |
1926 | } | 0 |
1927 | | - |
1928 | return url; never executed: return url; | 0 |
1929 | } | - |
1930 | | - |
1931 | void QTextDocumentPrivate::mergeCachedResources(const QTextDocumentPrivate *priv) | - |
1932 | { | - |
1933 | if (!priv) partially evaluated: !priv no Evaluation Count:0 | yes Evaluation Count:667 |
| 0-667 |
1934 | return; | 0 |
1935 | | - |
1936 | cachedResources.unite(priv->cachedResources); | - |
1937 | } executed: } Execution Count:667 | 667 |
1938 | | - |
1939 | void QTextHtmlExporter::emitBackgroundAttribute(const QTextFormat &format) | - |
1940 | { | - |
1941 | if (format.hasProperty(QTextFormat::BackgroundImageUrl)) { evaluated: format.hasProperty(QTextFormat::BackgroundImageUrl) yes Evaluation Count:4 | yes Evaluation Count:157 |
| 4-157 |
1942 | QString url = format.property(QTextFormat::BackgroundImageUrl).toString(); | - |
1943 | emitAttribute("background", url); | - |
1944 | } else { executed: } Execution Count:4 | 4 |
1945 | const QBrush &brush = format.background(); | - |
1946 | if (brush.style() == Qt::SolidPattern) { evaluated: brush.style() == Qt::SolidPattern yes Evaluation Count:9 | yes Evaluation Count:148 |
| 9-148 |
1947 | emitAttribute("bgcolor", colorValue(brush.color())); | - |
1948 | } else if (brush.style() == Qt::TexturePattern) { executed: } Execution Count:9 partially evaluated: brush.style() == Qt::TexturePattern no Evaluation Count:0 | yes Evaluation Count:148 |
| 0-148 |
1949 | const bool isPixmap = qHasPixmapTexture(brush); | - |
1950 | const qint64 cacheKey = isPixmap ? brush.texture().cacheKey() : brush.textureImage().cacheKey(); never evaluated: isPixmap | 0 |
1951 | | - |
1952 | const QString url = findUrlForImage(doc, cacheKey, isPixmap); | - |
1953 | | - |
1954 | if (!url.isEmpty()) never evaluated: !url.isEmpty() | 0 |
1955 | emitAttribute("background", url); never executed: emitAttribute("background", url); | 0 |
1956 | } | 0 |
1957 | } | - |
1958 | } | - |
1959 | | - |
1960 | void QTextHtmlExporter::emitTable(const QTextTable *table) | - |
1961 | { | - |
1962 | QTextTableFormat format = table->format(); | - |
1963 | | - |
1964 | html += QLatin1String("\n<table"); | - |
1965 | | - |
1966 | if (format.hasProperty(QTextFormat::FrameBorder)) partially evaluated: format.hasProperty(QTextFormat::FrameBorder) yes Evaluation Count:18 | no Evaluation Count:0 |
| 0-18 |
1967 | emitAttribute("border", QString::number(format.border())); executed: emitAttribute("border", QString::number(format.border())); Execution Count:18 | 18 |
1968 | | - |
1969 | emitFrameStyle(format, TableFrame); | - |
1970 | | - |
1971 | emitAlignment(format.alignment()); | - |
1972 | emitTextLength("width", format.width()); | - |
1973 | | - |
1974 | if (format.hasProperty(QTextFormat::TableCellSpacing)) partially evaluated: format.hasProperty(QTextFormat::TableCellSpacing) yes Evaluation Count:18 | no Evaluation Count:0 |
| 0-18 |
1975 | emitAttribute("cellspacing", QString::number(format.cellSpacing())); executed: emitAttribute("cellspacing", QString::number(format.cellSpacing())); Execution Count:18 | 18 |
1976 | if (format.hasProperty(QTextFormat::TableCellPadding)) evaluated: format.hasProperty(QTextFormat::TableCellPadding) yes Evaluation Count:6 | yes Evaluation Count:12 |
| 6-12 |
1977 | emitAttribute("cellpadding", QString::number(format.cellPadding())); executed: emitAttribute("cellpadding", QString::number(format.cellPadding())); Execution Count:6 | 6 |
1978 | | - |
1979 | emitBackgroundAttribute(format); | - |
1980 | | - |
1981 | html += QLatin1Char('>'); | - |
1982 | | - |
1983 | const int rows = table->rows(); | - |
1984 | const int columns = table->columns(); | - |
1985 | | - |
1986 | QVector<QTextLength> columnWidths = format.columnWidthConstraints(); | - |
1987 | if (columnWidths.isEmpty()) { evaluated: columnWidths.isEmpty() yes Evaluation Count:12 | yes Evaluation Count:6 |
| 6-12 |
1988 | columnWidths.resize(columns); | - |
1989 | columnWidths.fill(QTextLength()); | - |
1990 | } executed: } Execution Count:12 | 12 |
1991 | qt_noop(); | - |
1992 | | - |
1993 | QVarLengthArray<bool> widthEmittedForColumn(columns); | - |
1994 | for (int i = 0; i < columns; ++i) evaluated: i < columns yes Evaluation Count:32 | yes Evaluation Count:18 |
| 18-32 |
1995 | widthEmittedForColumn[i] = false; executed: widthEmittedForColumn[i] = false; Execution Count:32 | 32 |
1996 | | - |
1997 | const int headerRowCount = qMin(format.headerRowCount(), rows); | - |
1998 | if (headerRowCount > 0) evaluated: headerRowCount > 0 yes Evaluation Count:1 | yes Evaluation Count:17 |
| 1-17 |
1999 | html += QLatin1String("<thead>"); executed: html += QLatin1String("<thead>"); Execution Count:1 | 1 |
2000 | | - |
2001 | for (int row = 0; row < rows; ++row) { evaluated: row < rows yes Evaluation Count:29 | yes Evaluation Count:18 |
| 18-29 |
2002 | html += QLatin1String("\n<tr>"); | - |
2003 | | - |
2004 | for (int col = 0; col < columns; ++col) { evaluated: col < columns yes Evaluation Count:54 | yes Evaluation Count:29 |
| 29-54 |
2005 | const QTextTableCell cell = table->cellAt(row, col); | - |
2006 | | - |
2007 | | - |
2008 | if (cell.row() != row) partially evaluated: cell.row() != row no Evaluation Count:0 | yes Evaluation Count:54 |
| 0-54 |
2009 | continue; never executed: continue; | 0 |
2010 | | - |
2011 | if (cell.column() != col) evaluated: cell.column() != col yes Evaluation Count:3 | yes Evaluation Count:51 |
| 3-51 |
2012 | continue; executed: continue; Execution Count:3 | 3 |
2013 | | - |
2014 | html += QLatin1String("\n<td"); | - |
2015 | | - |
2016 | if (!widthEmittedForColumn[col] && cell.columnSpan() == 1) { evaluated: !widthEmittedForColumn[col] yes Evaluation Count:31 | yes Evaluation Count:20 |
evaluated: cell.columnSpan() == 1 yes Evaluation Count:28 | yes Evaluation Count:3 |
| 3-31 |
2017 | emitTextLength("width", columnWidths.at(col)); | - |
2018 | widthEmittedForColumn[col] = true; | - |
2019 | } executed: } Execution Count:28 | 28 |
2020 | | - |
2021 | if (cell.columnSpan() > 1) evaluated: cell.columnSpan() > 1 yes Evaluation Count:3 | yes Evaluation Count:48 |
| 3-48 |
2022 | emitAttribute("colspan", QString::number(cell.columnSpan())); executed: emitAttribute("colspan", QString::number(cell.columnSpan())); Execution Count:3 | 3 |
2023 | | - |
2024 | if (cell.rowSpan() > 1) partially evaluated: cell.rowSpan() > 1 no Evaluation Count:0 | yes Evaluation Count:51 |
| 0-51 |
2025 | emitAttribute("rowspan", QString::number(cell.rowSpan())); never executed: emitAttribute("rowspan", QString::number(cell.rowSpan())); | 0 |
2026 | | - |
2027 | const QTextTableCellFormat cellFormat = cell.format().toTableCellFormat(); | - |
2028 | emitBackgroundAttribute(cellFormat); | - |
2029 | | - |
2030 | QTextCharFormat oldDefaultCharFormat = defaultCharFormat; | - |
2031 | | - |
2032 | QTextCharFormat::VerticalAlignment valign = cellFormat.verticalAlignment(); | - |
2033 | | - |
2034 | QString styleString; | - |
2035 | if (valign >= QTextCharFormat::AlignMiddle && valign <= QTextCharFormat::AlignBottom) { evaluated: valign >= QTextCharFormat::AlignMiddle yes Evaluation Count:3 | yes Evaluation Count:48 |
partially evaluated: valign <= QTextCharFormat::AlignBottom yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-48 |
2036 | styleString += QLatin1String(" vertical-align:"); | - |
2037 | switch (valign) { | - |
2038 | case QTextCharFormat::AlignMiddle: | - |
2039 | styleString += QLatin1String("middle"); | - |
2040 | break; executed: break; Execution Count:1 | 1 |
2041 | case QTextCharFormat::AlignTop: | - |
2042 | styleString += QLatin1String("top"); | - |
2043 | break; executed: break; Execution Count:1 | 1 |
2044 | case QTextCharFormat::AlignBottom: | - |
2045 | styleString += QLatin1String("bottom"); | - |
2046 | break; executed: break; Execution Count:1 | 1 |
2047 | default: | - |
2048 | break; | 0 |
2049 | } | - |
2050 | styleString += QLatin1Char(';'); | - |
2051 | | - |
2052 | QTextCharFormat temp; | - |
2053 | temp.setVerticalAlignment(valign); | - |
2054 | defaultCharFormat.merge(temp); | - |
2055 | } executed: } Execution Count:3 | 3 |
2056 | | - |
2057 | if (cellFormat.hasProperty(QTextFormat::TableCellLeftPadding)) evaluated: cellFormat.hasProperty(QTextFormat::TableCellLeftPadding) yes Evaluation Count:1 | yes Evaluation Count:50 |
| 1-50 |
2058 | styleString += QLatin1String(" padding-left:") + QString::number(cellFormat.leftPadding()) + QLatin1Char(';'); executed: styleString += QLatin1String(" padding-left:") + QString::number(cellFormat.leftPadding()) + QLatin1Char(';'); Execution Count:1 | 1 |
2059 | if (cellFormat.hasProperty(QTextFormat::TableCellRightPadding)) evaluated: cellFormat.hasProperty(QTextFormat::TableCellRightPadding) yes Evaluation Count:1 | yes Evaluation Count:50 |
| 1-50 |
2060 | styleString += QLatin1String(" padding-right:") + QString::number(cellFormat.rightPadding()) + QLatin1Char(';'); executed: styleString += QLatin1String(" padding-right:") + QString::number(cellFormat.rightPadding()) + QLatin1Char(';'); Execution Count:1 | 1 |
2061 | if (cellFormat.hasProperty(QTextFormat::TableCellTopPadding)) evaluated: cellFormat.hasProperty(QTextFormat::TableCellTopPadding) yes Evaluation Count:1 | yes Evaluation Count:50 |
| 1-50 |
2062 | styleString += QLatin1String(" padding-top:") + QString::number(cellFormat.topPadding()) + QLatin1Char(';'); executed: styleString += QLatin1String(" padding-top:") + QString::number(cellFormat.topPadding()) + QLatin1Char(';'); Execution Count:1 | 1 |
2063 | if (cellFormat.hasProperty(QTextFormat::TableCellBottomPadding)) evaluated: cellFormat.hasProperty(QTextFormat::TableCellBottomPadding) yes Evaluation Count:1 | yes Evaluation Count:50 |
| 1-50 |
2064 | styleString += QLatin1String(" padding-bottom:") + QString::number(cellFormat.bottomPadding()) + QLatin1Char(';'); executed: styleString += QLatin1String(" padding-bottom:") + QString::number(cellFormat.bottomPadding()) + QLatin1Char(';'); Execution Count:1 | 1 |
2065 | | - |
2066 | if (!styleString.isEmpty()) evaluated: !styleString.isEmpty() yes Evaluation Count:7 | yes Evaluation Count:44 |
| 7-44 |
2067 | html += QLatin1String(" style=\"") + styleString + QLatin1Char('\"'); executed: html += QLatin1String(" style=\"") + styleString + QLatin1Char('\"'); Execution Count:7 | 7 |
2068 | | - |
2069 | html += QLatin1Char('>'); | - |
2070 | | - |
2071 | emitFrame(cell.begin()); | - |
2072 | | - |
2073 | html += QLatin1String("</td>"); | - |
2074 | | - |
2075 | defaultCharFormat = oldDefaultCharFormat; | - |
2076 | } executed: } Execution Count:51 | 51 |
2077 | | - |
2078 | html += QLatin1String("</tr>"); | - |
2079 | if (headerRowCount > 0 && row == headerRowCount - 1) evaluated: headerRowCount > 0 yes Evaluation Count:4 | yes Evaluation Count:25 |
evaluated: row == headerRowCount - 1 yes Evaluation Count:1 | yes Evaluation Count:3 |
| 1-25 |
2080 | html += QLatin1String("</thead>"); executed: html += QLatin1String("</thead>"); Execution Count:1 | 1 |
2081 | } executed: } Execution Count:29 | 29 |
2082 | | - |
2083 | html += QLatin1String("</table>"); | - |
2084 | } executed: } Execution Count:18 | 18 |
2085 | | - |
2086 | void QTextHtmlExporter::emitFrame(QTextFrame::Iterator frameIt) | - |
2087 | { | - |
2088 | if (!frameIt.atEnd()) { partially evaluated: !frameIt.atEnd() yes Evaluation Count:152 | no Evaluation Count:0 |
| 0-152 |
2089 | QTextFrame::Iterator next = frameIt; | - |
2090 | ++next; | - |
2091 | if (next.atEnd() evaluated: next.atEnd() yes Evaluation Count:107 | yes Evaluation Count:45 |
| 45-107 |
2092 | && frameIt.currentFrame() == 0 partially evaluated: frameIt.currentFrame() == 0 yes Evaluation Count:107 | no Evaluation Count:0 |
| 0-107 |
2093 | && frameIt.parentFrame() != doc->rootFrame() evaluated: frameIt.parentFrame() != doc->rootFrame() yes Evaluation Count:53 | yes Evaluation Count:54 |
| 53-54 |
2094 | && frameIt.currentBlock().begin().atEnd()) evaluated: frameIt.currentBlock().begin().atEnd() yes Evaluation Count:43 | yes Evaluation Count:10 |
| 10-43 |
2095 | return; executed: return; Execution Count:43 | 43 |
2096 | } executed: } Execution Count:109 | 109 |
2097 | | - |
2098 | for (QTextFrame::Iterator it = frameIt; | - |
2099 | !it.atEnd(); ++it) { evaluated: !it.atEnd() yes Evaluation Count:208 | yes Evaluation Count:109 |
| 109-208 |
2100 | if (QTextFrame *f = it.currentFrame()) { evaluated: QTextFrame *f = it.currentFrame() yes Evaluation Count:21 | yes Evaluation Count:187 |
| 21-187 |
2101 | if (QTextTable *table = qobject_cast<QTextTable *>(f)) { evaluated: QTextTable *table = qobject_cast<QTextTable *>(f) yes Evaluation Count:18 | yes Evaluation Count:3 |
| 3-18 |
2102 | emitTable(table); | - |
2103 | } else { executed: } Execution Count:18 | 18 |
2104 | emitTextFrame(f); | - |
2105 | } executed: } Execution Count:3 | 3 |
2106 | } else if (it.currentBlock().isValid()) { partially evaluated: it.currentBlock().isValid() yes Evaluation Count:187 | no Evaluation Count:0 |
| 0-187 |
2107 | emitBlock(it.currentBlock()); | - |
2108 | } executed: } Execution Count:187 | 187 |
2109 | } | - |
2110 | } executed: } Execution Count:109 | 109 |
2111 | | - |
2112 | void QTextHtmlExporter::emitTextFrame(const QTextFrame *f) | - |
2113 | { | - |
2114 | FrameType frameType = f->parentFrame() ? TextFrame : RootFrame; evaluated: f->parentFrame() yes Evaluation Count:3 | yes Evaluation Count:1 |
| 1-3 |
2115 | | - |
2116 | html += QLatin1String("\n<table"); | - |
2117 | QTextFrameFormat format = f->frameFormat(); | - |
2118 | | - |
2119 | if (format.hasProperty(QTextFormat::FrameBorder)) partially evaluated: format.hasProperty(QTextFormat::FrameBorder) yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
2120 | emitAttribute("border", QString::number(format.border())); executed: emitAttribute("border", QString::number(format.border())); Execution Count:4 | 4 |
2121 | | - |
2122 | emitFrameStyle(format, frameType); | - |
2123 | | - |
2124 | emitTextLength("width", format.width()); | - |
2125 | emitTextLength("height", format.height()); | - |
2126 | | - |
2127 | | - |
2128 | if (frameType != RootFrame) evaluated: frameType != RootFrame yes Evaluation Count:3 | yes Evaluation Count:1 |
| 1-3 |
2129 | emitBackgroundAttribute(format); executed: emitBackgroundAttribute(format); Execution Count:3 | 3 |
2130 | | - |
2131 | html += QLatin1Char('>'); | - |
2132 | html += QLatin1String("\n<tr>\n<td style=\"border: none;\">"); | - |
2133 | emitFrame(f->begin()); | - |
2134 | html += QLatin1String("</td></tr></table>"); | - |
2135 | } executed: } Execution Count:4 | 4 |
2136 | | - |
2137 | void QTextHtmlExporter::emitFrameStyle(const QTextFrameFormat &format, FrameType frameType) | - |
2138 | { | - |
2139 | QLatin1String styleAttribute(" style=\""); | - |
2140 | html += styleAttribute; | - |
2141 | const int originalHtmlLength = html.length(); | - |
2142 | | - |
2143 | if (frameType == TextFrame) evaluated: frameType == TextFrame yes Evaluation Count:3 | yes Evaluation Count:19 |
| 3-19 |
2144 | html += QLatin1String("-qt-table-type: frame;"); executed: html += QLatin1String("-qt-table-type: frame;"); Execution Count:3 | 3 |
2145 | else if (frameType == RootFrame) evaluated: frameType == RootFrame yes Evaluation Count:1 | yes Evaluation Count:18 |
| 1-18 |
2146 | html += QLatin1String("-qt-table-type: root;"); executed: html += QLatin1String("-qt-table-type: root;"); Execution Count:1 | 1 |
2147 | | - |
2148 | const QTextFrameFormat defaultFormat; | - |
2149 | | - |
2150 | emitFloatStyle(format.position(), OmitStyleTag); | - |
2151 | emitPageBreakPolicy(format.pageBreakPolicy()); | - |
2152 | | - |
2153 | if (format.borderBrush() != defaultFormat.borderBrush()) { evaluated: format.borderBrush() != defaultFormat.borderBrush() yes Evaluation Count:1 | yes Evaluation Count:21 |
| 1-21 |
2154 | html += QLatin1String(" border-color:"); | - |
2155 | html += colorValue(format.borderBrush().color()); | - |
2156 | html += QLatin1Char(';'); | - |
2157 | } executed: } Execution Count:1 | 1 |
2158 | | - |
2159 | if (format.borderStyle() != defaultFormat.borderStyle()) evaluated: format.borderStyle() != defaultFormat.borderStyle() yes Evaluation Count:1 | yes Evaluation Count:21 |
| 1-21 |
2160 | emitBorderStyle(format.borderStyle()); executed: emitBorderStyle(format.borderStyle()); Execution Count:1 | 1 |
2161 | | - |
2162 | if (format.hasProperty(QTextFormat::FrameMargin) evaluated: format.hasProperty(QTextFormat::FrameMargin) yes Evaluation Count:7 | yes Evaluation Count:15 |
| 7-15 |
2163 | || format.hasProperty(QTextFormat::FrameLeftMargin) evaluated: format.hasProperty(QTextFormat::FrameLeftMargin) yes Evaluation Count:2 | yes Evaluation Count:13 |
| 2-13 |
2164 | || format.hasProperty(QTextFormat::FrameRightMargin) partially evaluated: format.hasProperty(QTextFormat::FrameRightMargin) no Evaluation Count:0 | yes Evaluation Count:13 |
| 0-13 |
2165 | || format.hasProperty(QTextFormat::FrameTopMargin) partially evaluated: format.hasProperty(QTextFormat::FrameTopMargin) no Evaluation Count:0 | yes Evaluation Count:13 |
| 0-13 |
2166 | || format.hasProperty(QTextFormat::FrameBottomMargin)) partially evaluated: format.hasProperty(QTextFormat::FrameBottomMargin) no Evaluation Count:0 | yes Evaluation Count:13 |
| 0-13 |
2167 | emitMargins(QString::number(format.topMargin()), | 9 |
2168 | QString::number(format.bottomMargin()), | 9 |
2169 | QString::number(format.leftMargin()), | 9 |
2170 | QString::number(format.rightMargin())); executed: emitMargins(QString::number(format.topMargin()), QString::number(format.bottomMargin()), QString::number(format.leftMargin()), QString::number(format.rightMargin())); Execution Count:9 | 9 |
2171 | | - |
2172 | if (html.length() == originalHtmlLength) evaluated: html.length() == originalHtmlLength yes Evaluation Count:10 | yes Evaluation Count:12 |
| 10-12 |
2173 | html.chop(qstrlen(styleAttribute.latin1())); executed: html.chop(qstrlen(styleAttribute.latin1())); Execution Count:10 | 10 |
2174 | else | - |
2175 | html += QLatin1Char('\"'); executed: html += QLatin1Char('\"'); Execution Count:12 | 12 |
2176 | } | - |
2177 | QString QTextDocument::toHtml(const QByteArray &encoding) const | - |
2178 | { | - |
2179 | return QTextHtmlExporter(this).toHtml(encoding); executed: return QTextHtmlExporter(this).toHtml(encoding); Execution Count:89 | 89 |
2180 | } | - |
2181 | | - |
2182 | | - |
2183 | | - |
2184 | | - |
2185 | | - |
2186 | QVector<QTextFormat> QTextDocument::allFormats() const | - |
2187 | { | - |
2188 | const QTextDocumentPrivate * const d = d_func(); | - |
2189 | return d->formatCollection()->formats; executed: return d->formatCollection()->formats; Execution Count:8 | 8 |
2190 | } | - |
2191 | | - |
2192 | | - |
2193 | | - |
2194 | | - |
2195 | | - |
2196 | | - |
2197 | | - |
2198 | QTextDocumentPrivate *QTextDocument::docHandle() const | - |
2199 | { | - |
2200 | const QTextDocumentPrivate * const d = d_func(); | - |
2201 | return const_cast<QTextDocumentPrivate *>(d); executed: return const_cast<QTextDocumentPrivate *>(d); Execution Count:64970 | 64970 |
2202 | } | - |
2203 | | - |
2204 | | - |
| | |