qtextobject.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/text/qtextobject.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2015 The Qt Company Ltd.-
4** Contact: http://www.qt.io/licensing/-
5**-
6** This file is part of the QtGui module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL21$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see http://www.qt.io/terms-conditions. For further-
15** information use the contact form at http://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 2.1 or version 3 as published by the Free-
20** Software Foundation and appearing in the file LICENSE.LGPLv21 and-
21** LICENSE.LGPLv3 included in the packaging of this file. Please review the-
22** following information to ensure the GNU Lesser General Public License-
23** requirements will be met: https://www.gnu.org/licenses/lgpl.html and-
24** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.-
25**-
26** As a special exception, The Qt Company gives you certain additional-
27** rights. These rights are described in The Qt Company LGPL Exception-
28** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.-
29**-
30** $QT_END_LICENSE$-
31**-
32****************************************************************************/-
33-
34#include "qtextobject.h"-
35#include "qtextobject_p.h"-
36#include "qtextcursor_p.h"-
37#include "qtextdocument.h"-
38#include "qtextformat_p.h"-
39#include "qtextdocument_p.h"-
40#include "qtextcursor.h"-
41#include "qtextlist.h"-
42#include "qabstracttextdocumentlayout.h"-
43#include "qtextengine_p.h"-
44#include "qdebug.h"-
45-
46#include <algorithm>-
47-
48QT_BEGIN_NAMESPACE-
49-
50// ### DOC: We ought to explain the CONCEPT of objectIndexes if-
51// relevant to the public API-
52/*!-
53 \class QTextObject-
54 \reentrant-
55-
56 \brief The QTextObject class is a base class for different kinds-
57 of objects that can group parts of a QTextDocument together.-
58 \inmodule QtGui-
59-
60 \ingroup richtext-processing-
61-
62 The common grouping text objects are lists (QTextList), frames-
63 (QTextFrame), and tables (QTextTable). A text object has an-
64 associated format() and document().-
65-
66 There are essentially two kinds of text objects: those that are used-
67 with blocks (block formats), and those that are used with characters-
68 (character formats). The first kind are derived from QTextBlockGroup,-
69 and the second kind from QTextFrame.-
70-
71 You rarely need to use this class directly. When creating custom text-
72 objects, you will also need to reimplement QTextDocument::createObject()-
73 which acts as a factory method for creating text objects.-
74-
75 \sa QTextDocument, {Text Object Example}-
76*/-
77-
78/*!-
79 \fn QTextObject::QTextObject(QTextDocument *document)-
80-
81 Creates a new QTextObject for the given \a document.-
82-
83 \warning This function should never be called directly, but only-
84 from QTextDocument::createObject().-
85*/-
86QTextObject::QTextObject(QTextDocument *doc)-
87 : QObject(*new QTextObjectPrivate(doc), doc)-
88{-
89}
never executed: end of block
0
90-
91/*!-
92 \fn QTextObject::QTextObject(QTextObjectPrivate &p, QTextDocument *document)-
93-
94 \internal-
95*/-
96QTextObject::QTextObject(QTextObjectPrivate &p, QTextDocument *doc)-
97 : QObject(p, doc)-
98{-
99}
never executed: end of block
0
100-
101/*!-
102 Destroys the text object.-
103-
104 \warning Text objects are owned by the document, so you should-
105 never destroy them yourself.-
106*/-
107QTextObject::~QTextObject()-
108{-
109}-
110-
111/*!-
112 Returns the text object's format.-
113-
114 \sa setFormat(), document()-
115*/-
116QTextFormat QTextObject::format() const-
117{-
118 Q_D(const QTextObject);-
119 return d->pieceTable->formatCollection()->objectFormat(d->objectIndex);
never executed: return d->pieceTable->formatCollection()->objectFormat(d->objectIndex);
0
120}-
121-
122/*!-
123 Returns the index of the object's format in the document's internal-
124 list of formats.-
125-
126 \sa QTextDocument::allFormats()-
127*/-
128int QTextObject::formatIndex() const-
129{-
130 Q_D(const QTextObject);-
131 return d->pieceTable->formatCollection()->objectFormatIndex(d->objectIndex);
never executed: return d->pieceTable->formatCollection()->objectFormatIndex(d->objectIndex);
0
132}-
133-
134-
135/*!-
136 Sets the text object's \a format.-
137-
138 \sa format()-
139*/-
140void QTextObject::setFormat(const QTextFormat &format)-
141{-
142 Q_D(QTextObject);-
143 int idx = d->pieceTable->formatCollection()->indexForFormat(format);-
144 d->pieceTable->changeObjectFormat(this, idx);-
145}
never executed: end of block
0
146-
147/*!-
148 Returns the object index of this object. This can be used together with-
149 QTextFormat::setObjectIndex().-
150*/-
151int QTextObject::objectIndex() const-
152{-
153 Q_D(const QTextObject);-
154 return d->objectIndex;
never executed: return d->objectIndex;
0
155}-
156-
157/*!-
158 Returns the document this object belongs to.-
159-
160 \sa format()-
161*/-
162QTextDocument *QTextObject::document() const-
163{-
164 return static_cast<QTextDocument *>(parent());
never executed: return static_cast<QTextDocument *>(parent());
0
165}-
166-
167/*!-
168 \internal-
169*/-
170QTextDocumentPrivate *QTextObject::docHandle() const-
171{-
172 return static_cast<const QTextDocument *>(parent())->docHandle();
never executed: return static_cast<const QTextDocument *>(parent())->docHandle();
0
173}-
174-
175/*!-
176 \class QTextBlockGroup-
177 \reentrant-
178-
179 \brief The QTextBlockGroup class provides a container for text blocks within-
180 a QTextDocument.-
181 \inmodule QtGui-
182-
183 \ingroup richtext-processing-
184-
185 Block groups can be used to organize blocks of text within a document.-
186 They maintain an up-to-date list of the text blocks that belong to-
187 them, even when text blocks are being edited.-
188-
189 Each group has a parent document which is specified when the group is-
190 constructed.-
191-
192 Text blocks can be inserted into a group with blockInserted(), and removed-
193 with blockRemoved(). If a block's format is changed, blockFormatChanged()-
194 is called.-
195-
196 The list of blocks in the group is returned by blockList(). Note that the-
197 blocks in the list are not necessarily adjacent elements in the document;-
198 for example, the top-level items in a multi-level list will be separated-
199 by the items in lower levels of the list.-
200-
201 \sa QTextBlock, QTextDocument-
202*/-
203-
204void QTextBlockGroupPrivate::markBlocksDirty()-
205{-
206 for (int i = 0; i < blocks.count(); ++i) {
i < blocks.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
207 const QTextBlock &block = blocks.at(i);-
208 pieceTable->documentChange(block.position(), block.length());-
209 }
never executed: end of block
0
210}
never executed: end of block
0
211-
212/*!-
213 \fn QTextBlockGroup::QTextBlockGroup(QTextDocument *document)-
214-
215 Creates a new new block group for the given \a document.-
216-
217 \warning This function should only be called from-
218 QTextDocument::createObject().-
219*/-
220QTextBlockGroup::QTextBlockGroup(QTextDocument *doc)-
221 : QTextObject(*new QTextBlockGroupPrivate(doc), doc)-
222{-
223}
never executed: end of block
0
224-
225/*!-
226 \internal-
227*/-
228QTextBlockGroup::QTextBlockGroup(QTextBlockGroupPrivate &p, QTextDocument *doc)-
229 : QTextObject(p, doc)-
230{-
231}
never executed: end of block
0
232-
233/*!-
234 Destroys this block group; the blocks are not deleted, they simply-
235 don't belong to this block anymore.-
236*/-
237QTextBlockGroup::~QTextBlockGroup()-
238{-
239}-
240-
241// ### DOC: Shouldn't this be insertBlock()?-
242/*!-
243 Appends the given \a block to the end of the group.-
244-
245 \warning If you reimplement this function you must call the base-
246 class implementation.-
247*/-
248void QTextBlockGroup::blockInserted(const QTextBlock &block)-
249{-
250 Q_D(QTextBlockGroup);-
251 QTextBlockGroupPrivate::BlockList::Iterator it = std::lower_bound(d->blocks.begin(), d->blocks.end(), block);-
252 d->blocks.insert(it, block);-
253 d->markBlocksDirty();-
254}
never executed: end of block
0
255-
256// ### DOC: Shouldn't this be removeBlock()?-
257/*!-
258 Removes the given \a block from the group; the block itself is not-
259 deleted, it simply isn't a member of this group anymore.-
260*/-
261void QTextBlockGroup::blockRemoved(const QTextBlock &block)-
262{-
263 Q_D(QTextBlockGroup);-
264 d->blocks.removeAll(block);-
265 d->markBlocksDirty();-
266 if (d->blocks.isEmpty()) {
d->blocks.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
267 document()->docHandle()->deleteObject(this);-
268 return;
never executed: return;
0
269 }-
270}
never executed: end of block
0
271-
272/*!-
273 This function is called whenever the specified \a block of text is changed.-
274 The text block is a member of this group.-
275-
276 The base class implementation does nothing.-
277*/-
278void QTextBlockGroup::blockFormatChanged(const QTextBlock &)-
279{-
280}-
281-
282/*!-
283 Returns a (possibly empty) list of all the blocks that are part of-
284 the block group.-
285*/-
286QList<QTextBlock> QTextBlockGroup::blockList() const-
287{-
288 Q_D(const QTextBlockGroup);-
289 return d->blocks;
never executed: return d->blocks;
0
290}-
291-
292-
293-
294QTextFrameLayoutData::~QTextFrameLayoutData()-
295{-
296}-
297-
298-
299/*!-
300 \class QTextFrame-
301 \reentrant-
302-
303 \brief The QTextFrame class represents a frame in a QTextDocument.-
304 \inmodule QtGui-
305-
306 \ingroup richtext-processing-
307-
308 Text frames provide structure for the text in a document. They are used-
309 as generic containers for other document elements.-
310 Frames are usually created by using QTextCursor::insertFrame().-
311-
312 \omit-
313 Each frame in a document consists of a frame start character,-
314 QChar(0xFDD0), followed by the frame's contents, followed by a-
315 frame end character, QChar(0xFDD1). The character formats of the-
316 start and end character contain a reference to the frame object's-
317 objectIndex.-
318 \endomit-
319-
320 Frames can be used to create hierarchical structures in rich text documents.-
321 Each document has a root frame (QTextDocument::rootFrame()), and each frame-
322 beneath the root frame has a parent frame and a (possibly empty) list of-
323 child frames. The parent frame can be found with parentFrame(), and the-
324 childFrames() function provides a list of child frames.-
325-
326 Each frame contains at least one text block to enable text cursors to-
327 insert new document elements within. As a result, the QTextFrame::iterator-
328 class is used to traverse both the blocks and child frames within a given-
329 frame. The first and last child elements in the frame can be found with-
330 begin() and end().-
331-
332 A frame also has a format (specified using QTextFrameFormat) which can be set-
333 with setFormat() and read with format().-
334-
335 Text cursors can be obtained that point to the first and last valid cursor-
336 positions within a frame; use the firstCursorPosition() and-
337 lastCursorPosition() functions for this. The frame's extent in the-
338 document can be found with firstPosition() and lastPosition().-
339-
340 You can iterate over a frame's contents using the-
341 QTextFrame::iterator class: this provides read-only access to its-
342 internal list of text blocks and child frames.-
343-
344 \sa QTextCursor, QTextDocument-
345*/-
346-
347/*!-
348 \typedef QTextFrame::Iterator-
349-
350 Qt-style synonym for QTextFrame::iterator.-
351*/-
352-
353/*!-
354 \fn QTextFrame *QTextFrame::iterator::parentFrame() const-
355-
356 Returns the parent frame of the current frame.-
357-
358 \sa currentFrame(), QTextFrame::parentFrame()-
359*/-
360-
361/*!-
362 \fn bool QTextFrame::iterator::operator==(const iterator &other) const-
363-
364 Retuns true if the iterator is the same as the \a other iterator;-
365 otherwise returns \c false.-
366*/-
367-
368/*!-
369 \fn bool QTextFrame::iterator::operator!=(const iterator &other) const-
370-
371 Retuns true if the iterator is different from the \a other iterator;-
372 otherwise returns \c false.-
373*/-
374-
375/*!-
376 \fn QTextFrame::iterator QTextFrame::iterator::operator++(int)-
377-
378 The postfix ++ operator (\c{i++}) advances the iterator to the-
379 next item in the text frame, and returns an iterator to the old item.-
380*/-
381-
382/*!-
383 \fn QTextFrame::iterator QTextFrame::iterator::operator--(int)-
384-
385 The postfix -- operator (\c{i--}) makes the preceding item in the-
386 current frame, and returns an iterator to the old item.-
387*/-
388-
389/*!-
390 \fn void QTextFrame::setFrameFormat(const QTextFrameFormat &format)-
391-
392 Sets the frame's \a format.-
393-
394 \sa frameFormat()-
395*/-
396-
397/*!-
398 \fn QTextFrameFormat QTextFrame::frameFormat() const-
399-
400 Returns the frame's format.-
401-
402 \sa setFrameFormat()-
403*/-
404-
405/*!-
406 \fn QTextFrame::QTextFrame(QTextDocument *document)-
407-
408 Creates a new empty frame for the text \a document.-
409*/-
410QTextFrame::QTextFrame(QTextDocument *doc)-
411 : QTextObject(*new QTextFramePrivate(doc), doc)-
412{-
413}
never executed: end of block
0
414-
415/*!-
416 Destroys the text frame.-
417-
418 \warning Text frames are owned by the document, so you should-
419 never destroy them yourself. In order to remove a frame from-
420 its document, remove its contents using a \c QTextCursor.-
421*/-
422QTextFrame::~QTextFrame()-
423{-
424 Q_D(QTextFrame);-
425 delete d->layoutData;-
426}
never executed: end of block
0
427-
428/*!-
429 \internal-
430*/-
431QTextFrame::QTextFrame(QTextFramePrivate &p, QTextDocument *doc)-
432 : QTextObject(p, doc)-
433{-
434}
never executed: end of block
0
435-
436/*!-
437 Returns a (possibly empty) list of the frame's child frames.-
438-
439 \sa parentFrame()-
440*/-
441QList<QTextFrame *> QTextFrame::childFrames() const-
442{-
443 Q_D(const QTextFrame);-
444 return d->childFrames;
never executed: return d->childFrames;
0
445}-
446-
447/*!-
448 Returns the frame's parent frame. If the frame is the root frame of a-
449 document, this will return 0.-
450-
451 \sa childFrames(), QTextDocument::rootFrame()-
452*/-
453QTextFrame *QTextFrame::parentFrame() const-
454{-
455 Q_D(const QTextFrame);-
456 return d->parentFrame;
never executed: return d->parentFrame;
0
457}-
458-
459-
460/*!-
461 Returns the first cursor position inside the frame.-
462-
463 \sa lastCursorPosition(), firstPosition(), lastPosition()-
464*/-
465QTextCursor QTextFrame::firstCursorPosition() const-
466{-
467 Q_D(const QTextFrame);-
468 return QTextCursorPrivate::fromPosition(d->pieceTable, firstPosition());
never executed: return QTextCursorPrivate::fromPosition(d->pieceTable, firstPosition());
0
469}-
470-
471/*!-
472 Returns the last cursor position inside the frame.-
473-
474 \sa firstCursorPosition(), firstPosition(), lastPosition()-
475*/-
476QTextCursor QTextFrame::lastCursorPosition() const-
477{-
478 Q_D(const QTextFrame);-
479 return QTextCursorPrivate::fromPosition(d->pieceTable, lastPosition());
never executed: return QTextCursorPrivate::fromPosition(d->pieceTable, lastPosition());
0
480}-
481-
482/*!-
483 Returns the first document position inside the frame.-
484-
485 \sa lastPosition(), firstCursorPosition(), lastCursorPosition()-
486*/-
487int QTextFrame::firstPosition() const-
488{-
489 Q_D(const QTextFrame);-
490 if (!d->fragment_start)
!d->fragment_startDescription
TRUEnever evaluated
FALSEnever evaluated
0
491 return 0;
never executed: return 0;
0
492 return d->pieceTable->fragmentMap().position(d->fragment_start) + 1;
never executed: return d->pieceTable->fragmentMap().position(d->fragment_start) + 1;
0
493}-
494-
495/*!-
496 Returns the last document position inside the frame.-
497-
498 \sa firstPosition(), firstCursorPosition(), lastCursorPosition()-
499*/-
500int QTextFrame::lastPosition() const-
501{-
502 Q_D(const QTextFrame);-
503 if (!d->fragment_end)
!d->fragment_endDescription
TRUEnever evaluated
FALSEnever evaluated
0
504 return d->pieceTable->length() - 1;
never executed: return d->pieceTable->length() - 1;
0
505 return d->pieceTable->fragmentMap().position(d->fragment_end);
never executed: return d->pieceTable->fragmentMap().position(d->fragment_end);
0
506}-
507-
508/*!-
509 \internal-
510*/-
511QTextFrameLayoutData *QTextFrame::layoutData() const-
512{-
513 Q_D(const QTextFrame);-
514 return d->layoutData;
never executed: return d->layoutData;
0
515}-
516-
517/*!-
518 \internal-
519*/-
520void QTextFrame::setLayoutData(QTextFrameLayoutData *data)-
521{-
522 Q_D(QTextFrame);-
523 delete d->layoutData;-
524 d->layoutData = data;-
525}
never executed: end of block
0
526-
527-
528-
529void QTextFramePrivate::fragmentAdded(QChar type, uint fragment)-
530{-
531 if (type == QTextBeginningOfFrame) {
type == QChar(0xfdd0)Description
TRUEnever evaluated
FALSEnever evaluated
0
532 Q_ASSERT(!fragment_start);-
533 fragment_start = fragment;-
534 } else if (type == QTextEndOfFrame) {
never executed: end of block
type == QChar(0xfdd1)Description
TRUEnever evaluated
FALSEnever evaluated
0
535 Q_ASSERT(!fragment_end);-
536 fragment_end = fragment;-
537 } else if (type == QChar::ObjectReplacementCharacter) {
never executed: end of block
type == QChar:...ementCharacterDescription
TRUEnever evaluated
FALSEnever evaluated
0
538 Q_ASSERT(!fragment_start);-
539 Q_ASSERT(!fragment_end);-
540 fragment_start = fragment;-
541 fragment_end = fragment;-
542 } else {
never executed: end of block
0
543 Q_ASSERT(false);-
544 }
never executed: end of block
0
545}-
546-
547void QTextFramePrivate::fragmentRemoved(QChar type, uint fragment)-
548{-
549 Q_UNUSED(fragment); // --release warning-
550 if (type == QTextBeginningOfFrame) {
type == QChar(0xfdd0)Description
TRUEnever evaluated
FALSEnever evaluated
0
551 Q_ASSERT(fragment_start == fragment);-
552 fragment_start = 0;-
553 } else if (type == QTextEndOfFrame) {
never executed: end of block
type == QChar(0xfdd1)Description
TRUEnever evaluated
FALSEnever evaluated
0
554 Q_ASSERT(fragment_end == fragment);-
555 fragment_end = 0;-
556 } else if (type == QChar::ObjectReplacementCharacter) {
never executed: end of block
type == QChar:...ementCharacterDescription
TRUEnever evaluated
FALSEnever evaluated
0
557 Q_ASSERT(fragment_start == fragment);-
558 Q_ASSERT(fragment_end == fragment);-
559 fragment_start = 0;-
560 fragment_end = 0;-
561 } else {
never executed: end of block
0
562 Q_ASSERT(false);-
563 }
never executed: end of block
0
564 remove_me();-
565}
never executed: end of block
0
566-
567-
568void QTextFramePrivate::remove_me()-
569{-
570 Q_Q(QTextFrame);-
571 if (fragment_start == 0 && fragment_end == 0
fragment_start == 0Description
TRUEnever evaluated
FALSEnever evaluated
fragment_end == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
572 && !parentFrame) {
!parentFrameDescription
TRUEnever evaluated
FALSEnever evaluated
0
573 q->document()->docHandle()->deleteObject(q);-
574 return;
never executed: return;
0
575 }-
576-
577 if (!parentFrame)
!parentFrameDescription
TRUEnever evaluated
FALSEnever evaluated
0
578 return;
never executed: return;
0
579-
580 int index = parentFrame->d_func()->childFrames.indexOf(q);-
581-
582 // iterator over all children and move them to the parent-
583 for (int i = 0; i < childFrames.size(); ++i) {
i < childFrames.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
584 QTextFrame *c = childFrames.at(i);-
585 parentFrame->d_func()->childFrames.insert(index, c);-
586 c->d_func()->parentFrame = parentFrame;-
587 ++index;-
588 }
never executed: end of block
0
589 Q_ASSERT(parentFrame->d_func()->childFrames.at(index) == q);-
590 parentFrame->d_func()->childFrames.removeAt(index);-
591-
592 childFrames.clear();-
593 parentFrame = 0;-
594}
never executed: end of block
0
595-
596/*!-
597 \class QTextFrame::iterator-
598 \reentrant-
599-
600 \brief The iterator class provides an iterator for reading-
601 the contents of a QTextFrame.-
602-
603 \inmodule QtGui-
604 \ingroup richtext-processing-
605-
606 A frame consists of an arbitrary sequence of \l{QTextBlock}s and-
607 child \l{QTextFrame}s. This class provides a way to iterate over the-
608 child objects of a frame, and read their contents. It does not provide-
609 a way to modify the contents of the frame.-
610-
611*/-
612-
613/*!-
614 \fn bool QTextFrame::iterator::atEnd() const-
615-
616 Returns \c true if the current item is the last item in the text frame.-
617*/-
618-
619/*!-
620 Returns an iterator pointing to the first document element inside the frame.-
621 Please see the document \l{STL-style-Iterators} for more information.-
622-
623 \sa end()-
624*/-
625QTextFrame::iterator QTextFrame::begin() const-
626{-
627 const QTextDocumentPrivate *priv = docHandle();-
628 int b = priv->blockMap().findNode(firstPosition());-
629 int e = priv->blockMap().findNode(lastPosition()+1);-
630 return iterator(const_cast<QTextFrame *>(this), b, b, e);
never executed: return iterator(const_cast<QTextFrame *>(this), b, b, e);
0
631}-
632-
633/*!-
634 Returns an iterator pointing to the position past the last document element inside the frame.-
635 Please see the document \l{STL-Style Iterators} for more information.-
636 \sa begin()-
637*/-
638QTextFrame::iterator QTextFrame::end() const-
639{-
640 const QTextDocumentPrivate *priv = docHandle();-
641 int b = priv->blockMap().findNode(firstPosition());-
642 int e = priv->blockMap().findNode(lastPosition()+1);-
643 return iterator(const_cast<QTextFrame *>(this), e, b, e);
never executed: return iterator(const_cast<QTextFrame *>(this), e, b, e);
0
644}-
645-
646/*!-
647 Constructs an invalid iterator.-
648*/-
649QTextFrame::iterator::iterator()-
650{-
651 f = 0;-
652 b = 0;-
653 e = 0;-
654 cf = 0;-
655 cb = 0;-
656}
never executed: end of block
0
657-
658/*!-
659 \internal-
660*/-
661QTextFrame::iterator::iterator(QTextFrame *frame, int block, int begin, int end)-
662{-
663 f = frame;-
664 b = begin;-
665 e = end;-
666 cf = 0;-
667 cb = block;-
668}
never executed: end of block
0
669-
670/*!-
671 Copy constructor. Constructs a copy of the \a other iterator.-
672*/-
673QTextFrame::iterator::iterator(const iterator &other)-
674{-
675 f = other.f;-
676 b = other.b;-
677 e = other.e;-
678 cf = other.cf;-
679 cb = other.cb;-
680}
never executed: end of block
0
681-
682/*!-
683 Assigns \a other to this iterator and returns a reference to-
684 this iterator.-
685*/-
686QTextFrame::iterator &QTextFrame::iterator::operator=(const iterator &other)-
687{-
688 f = other.f;-
689 b = other.b;-
690 e = other.e;-
691 cf = other.cf;-
692 cb = other.cb;-
693 return *this;
never executed: return *this;
0
694}-
695-
696/*!-
697 Returns the current frame pointed to by the iterator, or 0 if the-
698 iterator currently points to a block.-
699-
700 \sa currentBlock()-
701*/-
702QTextFrame *QTextFrame::iterator::currentFrame() const-
703{-
704 return cf;
never executed: return cf;
0
705}-
706-
707/*!-
708 Returns the current block the iterator points to. If the iterator-
709 points to a child frame, the returned block is invalid.-
710-
711 \sa currentFrame()-
712*/-
713QTextBlock QTextFrame::iterator::currentBlock() const-
714{-
715 if (!f)
!fDescription
TRUEnever evaluated
FALSEnever evaluated
0
716 return QTextBlock();
never executed: return QTextBlock();
0
717 return QTextBlock(f->docHandle(), cb);
never executed: return QTextBlock(f->docHandle(), cb);
0
718}-
719-
720/*!-
721 Moves the iterator to the next frame or block.-
722-
723 \sa currentBlock(), currentFrame()-
724*/-
725QTextFrame::iterator &QTextFrame::iterator::operator++()-
726{-
727 const QTextDocumentPrivate *priv = f->docHandle();-
728 const QTextDocumentPrivate::BlockMap &map = priv->blockMap();-
729 if (cf) {
cfDescription
TRUEnever evaluated
FALSEnever evaluated
0
730 int end = cf->lastPosition() + 1;-
731 cb = map.findNode(end);-
732 cf = 0;-
733 } else if (cb) {
never executed: end of block
cbDescription
TRUEnever evaluated
FALSEnever evaluated
0
734 cb = map.next(cb);-
735 if (cb == e)
cb == eDescription
TRUEnever evaluated
FALSEnever evaluated
0
736 return *this;
never executed: return *this;
0
737-
738 if (!f->d_func()->childFrames.isEmpty()) {
!f->d_func()->...ames.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
739 int pos = map.position(cb);-
740 // check if we entered a frame-
741 QTextDocumentPrivate::FragmentIterator frag = priv->find(pos-1);-
742 if (priv->buffer().at(frag->stringPosition) != QChar::ParagraphSeparator) {
priv->buffer()...graphSeparatorDescription
TRUEnever evaluated
FALSEnever evaluated
0
743 QTextFrame *nf = qobject_cast<QTextFrame *>(priv->objectForFormat(frag->format));-
744 if (nf) {
nfDescription
TRUEnever evaluated
FALSEnever evaluated
0
745 if (priv->buffer().at(frag->stringPosition) == QTextBeginningOfFrame && nf != f) {
priv->buffer()... QChar(0xfdd0)Description
TRUEnever evaluated
FALSEnever evaluated
nf != fDescription
TRUEnever evaluated
FALSEnever evaluated
0
746 cf = nf;-
747 cb = 0;-
748 } else {
never executed: end of block
0
749 Q_ASSERT(priv->buffer().at(frag->stringPosition) != QTextEndOfFrame);-
750 }
never executed: end of block
0
751 }-
752 }
never executed: end of block
0
753 }
never executed: end of block
0
754 }
never executed: end of block
0
755 return *this;
never executed: return *this;
0
756}-
757-
758/*!-
759 Moves the iterator to the previous frame or block.-
760-
761 \sa currentBlock(), currentFrame()-
762*/-
763QTextFrame::iterator &QTextFrame::iterator::operator--()-
764{-
765 const QTextDocumentPrivate *priv = f->docHandle();-
766 const QTextDocumentPrivate::BlockMap &map = priv->blockMap();-
767 if (cf) {
cfDescription
TRUEnever evaluated
FALSEnever evaluated
0
768 int start = cf->firstPosition() - 1;-
769 cb = map.findNode(start);-
770 cf = 0;-
771 } else {
never executed: end of block
0
772 if (cb == b)
cb == bDescription
TRUEnever evaluated
FALSEnever evaluated
0
773 goto end;
never executed: goto end;
0
774 if (cb != e) {
cb != eDescription
TRUEnever evaluated
FALSEnever evaluated
0
775 int pos = map.position(cb);-
776 // check if we have to enter a frame-
777 QTextDocumentPrivate::FragmentIterator frag = priv->find(pos-1);-
778 if (priv->buffer().at(frag->stringPosition) != QChar::ParagraphSeparator) {
priv->buffer()...graphSeparatorDescription
TRUEnever evaluated
FALSEnever evaluated
0
779 QTextFrame *pf = qobject_cast<QTextFrame *>(priv->objectForFormat(frag->format));-
780 if (pf) {
pfDescription
TRUEnever evaluated
FALSEnever evaluated
0
781 if (priv->buffer().at(frag->stringPosition) == QTextBeginningOfFrame) {
priv->buffer()... QChar(0xfdd0)Description
TRUEnever evaluated
FALSEnever evaluated
0
782 Q_ASSERT(pf == f);-
783 } else if (priv->buffer().at(frag->stringPosition) == QTextEndOfFrame) {
never executed: end of block
priv->buffer()... QChar(0xfdd1)Description
TRUEnever evaluated
FALSEnever evaluated
0
784 Q_ASSERT(pf != f);-
785 cf = pf;-
786 cb = 0;-
787 goto end;
never executed: goto end;
0
788 }-
789 }
never executed: end of block
0
790 }
never executed: end of block
0
791 }
never executed: end of block
0
792 cb = map.previous(cb);-
793 }
never executed: end of block
0
794 end:
code before this statement never executed: end:
0
795 return *this;
never executed: return *this;
0
796}-
797-
798/*!-
799 \class QTextBlockUserData-
800 \reentrant-
801-
802 \brief The QTextBlockUserData class is used to associate custom data with blocks of text.-
803 \inmodule QtGui-
804 \since 4.1-
805-
806 \ingroup richtext-processing-
807-
808 QTextBlockUserData provides an abstract interface for container classes that are used-
809 to associate application-specific user data with text blocks in a QTextDocument.-
810-
811 Generally, subclasses of this class provide functions to allow data to be stored-
812 and retrieved, and instances are attached to blocks of text using-
813 QTextBlock::setUserData(). This makes it possible to store additional data per text-
814 block in a way that can be retrieved safely by the application.-
815-
816 Each subclass should provide a reimplementation of the destructor to ensure that any-
817 private data is automatically cleaned up when user data objects are deleted.-
818-
819 \sa QTextBlock-
820*/-
821-
822/*!-
823 Destroys the user data.-
824*/-
825QTextBlockUserData::~QTextBlockUserData()-
826{-
827}-
828-
829/*!-
830 \class QTextBlock-
831 \reentrant-
832-
833 \brief The QTextBlock class provides a container for text fragments in a-
834 QTextDocument.-
835 \inmodule QtGui-
836-
837 \ingroup richtext-processing-
838-
839 A text block encapsulates a block or paragraph of text in a QTextDocument.-
840 QTextBlock provides read-only access to the block/paragraph structure of-
841 QTextDocuments. It is mainly of use if you want to implement your own-
842 layouts for the visual representation of a QTextDocument, or if you want to-
843 iterate over a document and write out the contents in your own custom-
844 format.-
845-
846 Text blocks are created by their parent documents. If you need to create-
847 a new text block, or modify the contents of a document while examining its-
848 contents, use the cursor-based interface provided by QTextCursor instead.-
849-
850 Each text block is located at a specific position() in a document().-
851 The contents of the block can be obtained by using the text() function.-
852 The length() function determines the block's size within the document-
853 (including formatting characters).-
854 The visual properties of the block are determined by its text layout(),-
855 its charFormat(), and its blockFormat().-
856-
857 The next() and previous() functions enable iteration over consecutive-
858 valid blocks in a document under the condition that the document is not-
859 modified by other means during the iteration process. Note that, although-
860 blocks are returned in sequence, adjacent blocks may come from different-
861 places in the document structure. The validity of a block can be determined-
862 by calling isValid().-
863-
864 QTextBlock provides comparison operators to make it easier to work with-
865 blocks: \l operator==() compares two block for equality, \l operator!=()-
866 compares two blocks for inequality, and \l operator<() determines whether-
867 a block precedes another in the same document.-
868-
869 \image qtextblock-sequence.png-
870-
871 \sa QTextBlockFormat, QTextCharFormat, QTextFragment-
872 */-
873-
874/*!-
875 \fn QTextBlock::QTextBlock(QTextDocumentPrivate *priv, int b)-
876-
877 \internal-
878*/-
879-
880/*!-
881 \fn QTextBlock::QTextBlock()-
882-
883 \internal-
884*/-
885-
886/*!-
887 \fn QTextBlock::QTextBlock(const QTextBlock &other)-
888-
889 Copies the \a other text block's attributes to this text block.-
890*/-
891-
892/*!-
893 \fn bool QTextBlock::isValid() const-
894-
895 Returns \c true if this text block is valid; otherwise returns \c false.-
896*/-
897-
898bool QTextBlock::isValid() const-
899{-
900 return p != 0 && p->blockMap().isValid(n);
never executed: return p != 0 && p->blockMap().isValid(n);
p != 0Description
TRUEnever evaluated
FALSEnever evaluated
p->blockMap().isValid(n)Description
TRUEnever evaluated
FALSEnever evaluated
0
901}-
902-
903/*!-
904 \fn QTextBlock &QTextBlock::operator=(const QTextBlock &other)-
905-
906 Assigns the \a other text block to this text block.-
907*/-
908-
909/*!-
910 \fn bool QTextBlock::operator==(const QTextBlock &other) const-
911-
912 Returns \c true if this text block is the same as the \a other text-
913 block.-
914*/-
915-
916/*!-
917 \fn bool QTextBlock::operator!=(const QTextBlock &other) const-
918-
919 Returns \c true if this text block is different from the \a other-
920 text block.-
921*/-
922-
923/*!-
924 \fn bool QTextBlock::operator<(const QTextBlock &other) const-
925-
926 Returns \c true if this text block occurs before the \a other text-
927 block in the document.-
928*/-
929-
930/*!-
931 \class QTextBlock::iterator-
932 \reentrant-
933-
934 \brief The QTextBlock::iterator class provides an iterator for reading-
935 the contents of a QTextBlock.-
936 \inmodule QtGui-
937-
938 \ingroup richtext-processing-
939-
940 A block consists of a sequence of text fragments. This class provides-
941 a way to iterate over these, and read their contents. It does not provide-
942 a way to modify the internal structure or contents of the block.-
943-
944 An iterator can be constructed and used to access the fragments within-
945 a text block in the following way:-
946-
947 \snippet textblock-fragments/xmlwriter.cpp 4-
948 \snippet textblock-fragments/xmlwriter.cpp 7-
949-
950 \sa QTextFragment-
951*/-
952-
953/*!-
954 \typedef QTextBlock::Iterator-
955-
956 Qt-style synonym for QTextBlock::iterator.-
957*/-
958-
959/*!-
960 \fn QTextBlock::iterator::iterator()-
961-
962 Constructs an iterator for this text block.-
963*/-
964-
965/*!-
966 \fn QTextBlock::iterator::iterator(const iterator &other)-
967-
968 Copy constructor. Constructs a copy of the \a other iterator.-
969*/-
970-
971/*!-
972 \fn bool QTextBlock::iterator::atEnd() const-
973-
974 Returns \c true if the current item is the last item in the text block.-
975*/-
976-
977/*!-
978 \fn bool QTextBlock::iterator::operator==(const iterator &other) const-
979-
980 Retuns true if this iterator is the same as the \a other iterator;-
981 otherwise returns \c false.-
982*/-
983-
984/*!-
985 \fn bool QTextBlock::iterator::operator!=(const iterator &other) const-
986-
987 Retuns true if this iterator is different from the \a other iterator;-
988 otherwise returns \c false.-
989*/-
990-
991/*!-
992 \fn QTextBlock::iterator QTextBlock::iterator::operator++(int)-
993-
994 The postfix ++ operator (\c{i++}) advances the iterator to the-
995 next item in the text block and returns an iterator to the old current-
996 item.-
997*/-
998-
999/*!-
1000 \fn QTextBlock::iterator QTextBlock::iterator::operator--(int)-
1001-
1002 The postfix -- operator (\c{i--}) makes the preceding item current and-
1003 returns an iterator to the old current item.-
1004*/-
1005-
1006/*!-
1007 \fn QTextDocumentPrivate *QTextBlock::docHandle() const-
1008-
1009 \internal-
1010*/-
1011-
1012/*!-
1013 \fn int QTextBlock::fragmentIndex() const-
1014-
1015 \internal-
1016*/-
1017-
1018/*!-
1019 Returns the index of the block's first character within the document.-
1020 */-
1021int QTextBlock::position() const-
1022{-
1023 if (!p || !n)
!pDescription
TRUEnever evaluated
FALSEnever evaluated
!nDescription
TRUEnever evaluated
FALSEnever evaluated
0
1024 return 0;
never executed: return 0;
0
1025-
1026 return p->blockMap().position(n);
never executed: return p->blockMap().position(n);
0
1027}-
1028-
1029/*!-
1030 Returns the length of the block in characters.-
1031-
1032 \note The length returned includes all formatting characters,-
1033 for example, newline.-
1034-
1035 \sa text(), charFormat(), blockFormat()-
1036 */-
1037int QTextBlock::length() const-
1038{-
1039 if (!p || !n)
!pDescription
TRUEnever evaluated
FALSEnever evaluated
!nDescription
TRUEnever evaluated
FALSEnever evaluated
0
1040 return 0;
never executed: return 0;
0
1041-
1042 return p->blockMap().size(n);
never executed: return p->blockMap().size(n);
0
1043}-
1044-
1045/*!-
1046 Returns \c true if the given \a position is located within the text-
1047 block; otherwise returns \c false.-
1048 */-
1049bool QTextBlock::contains(int position) const-
1050{-
1051 if (!p || !n)
!pDescription
TRUEnever evaluated
FALSEnever evaluated
!nDescription
TRUEnever evaluated
FALSEnever evaluated
0
1052 return false;
never executed: return false;
0
1053-
1054 int pos = p->blockMap().position(n);-
1055 int len = p->blockMap().size(n);-
1056 return position >= pos && position < pos + len;
never executed: return position >= pos && position < pos + len;
position >= posDescription
TRUEnever evaluated
FALSEnever evaluated
position < pos + lenDescription
TRUEnever evaluated
FALSEnever evaluated
0
1057}-
1058-
1059/*!-
1060 Returns the QTextLayout that is used to lay out and display the-
1061 block's contents.-
1062-
1063 Note that the returned QTextLayout object can only be modified from the-
1064 documentChanged implementation of a QAbstractTextDocumentLayout subclass.-
1065 Any changes applied from the outside cause undefined behavior.-
1066-
1067 \sa clearLayout()-
1068 */-
1069QTextLayout *QTextBlock::layout() const-
1070{-
1071 if (!p || !n)
!pDescription
TRUEnever evaluated
FALSEnever evaluated
!nDescription
TRUEnever evaluated
FALSEnever evaluated
0
1072 return 0;
never executed: return 0;
0
1073-
1074 const QTextBlockData *b = p->blockMap().fragment(n);-
1075 if (!b->layout)
!b->layoutDescription
TRUEnever evaluated
FALSEnever evaluated
0
1076 b->layout = new QTextLayout(*this);
never executed: b->layout = new QTextLayout(*this);
0
1077 return b->layout;
never executed: return b->layout;
0
1078}-
1079-
1080/*!-
1081 \since 4.4-
1082 Clears the QTextLayout that is used to lay out and display the-
1083 block's contents.-
1084-
1085 \sa layout()-
1086 */-
1087void QTextBlock::clearLayout()-
1088{-
1089 if (!p || !n)
!pDescription
TRUEnever evaluated
FALSEnever evaluated
!nDescription
TRUEnever evaluated
FALSEnever evaluated
0
1090 return;
never executed: return;
0
1091-
1092 const QTextBlockData *b = p->blockMap().fragment(n);-
1093 if (b->layout)
b->layoutDescription
TRUEnever evaluated
FALSEnever evaluated
0
1094 b->layout->clearLayout();
never executed: b->layout->clearLayout();
0
1095}
never executed: end of block
0
1096-
1097/*!-
1098 Returns the QTextBlockFormat that describes block-specific properties.-
1099-
1100 \sa charFormat()-
1101 */-
1102QTextBlockFormat QTextBlock::blockFormat() const-
1103{-
1104 if (!p || !n)
!pDescription
TRUEnever evaluated
FALSEnever evaluated
!nDescription
TRUEnever evaluated
FALSEnever evaluated
0
1105 return QTextFormat().toBlockFormat();
never executed: return QTextFormat().toBlockFormat();
0
1106-
1107 return p->formatCollection()->blockFormat(p->blockMap().fragment(n)->format);
never executed: return p->formatCollection()->blockFormat(p->blockMap().fragment(n)->format);
0
1108}-
1109-
1110/*!-
1111 Returns an index into the document's internal list of block formats-
1112 for the text block's format.-
1113-
1114 \sa QTextDocument::allFormats()-
1115*/-
1116int QTextBlock::blockFormatIndex() const-
1117{-
1118 if (!p || !n)
!pDescription
TRUEnever evaluated
FALSEnever evaluated
!nDescription
TRUEnever evaluated
FALSEnever evaluated
0
1119 return -1;
never executed: return -1;
0
1120-
1121 return p->blockMap().fragment(n)->format;
never executed: return p->blockMap().fragment(n)->format;
0
1122}-
1123-
1124/*!-
1125 Returns the QTextCharFormat that describes the block's character-
1126 format. The block's character format is used when inserting text into-
1127 an empty block.-
1128-
1129 \sa blockFormat()-
1130 */-
1131QTextCharFormat QTextBlock::charFormat() const-
1132{-
1133 if (!p || !n)
!pDescription
TRUEnever evaluated
FALSEnever evaluated
!nDescription
TRUEnever evaluated
FALSEnever evaluated
0
1134 return QTextFormat().toCharFormat();
never executed: return QTextFormat().toCharFormat();
0
1135-
1136 return p->formatCollection()->charFormat(charFormatIndex());
never executed: return p->formatCollection()->charFormat(charFormatIndex());
0
1137}-
1138-
1139/*!-
1140 Returns an index into the document's internal list of character formats-
1141 for the text block's character format.-
1142-
1143 \sa QTextDocument::allFormats()-
1144*/-
1145int QTextBlock::charFormatIndex() const-
1146{-
1147 if (!p || !n)
!pDescription
TRUEnever evaluated
FALSEnever evaluated
!nDescription
TRUEnever evaluated
FALSEnever evaluated
0
1148 return -1;
never executed: return -1;
0
1149-
1150 return p->blockCharFormatIndex(n);
never executed: return p->blockCharFormatIndex(n);
0
1151}-
1152-
1153/*!-
1154 \since 4.7-
1155-
1156 Returns the resolved text direction.-
1157-
1158 If the block has no explicit direction set, it will resolve the-
1159 direction from the blocks content. Returns either Qt::LeftToRight-
1160 or Qt::RightToLeft.-
1161-
1162 \sa QTextFormat::layoutDirection(), QString::isRightToLeft(), Qt::LayoutDirection-
1163*/-
1164Qt::LayoutDirection QTextBlock::textDirection() const-
1165{-
1166 Qt::LayoutDirection dir = blockFormat().layoutDirection();-
1167 if (dir != Qt::LayoutDirectionAuto)
dir != Qt::LayoutDirectionAutoDescription
TRUEnever evaluated
FALSEnever evaluated
0
1168 return dir;
never executed: return dir;
0
1169-
1170 dir = p->defaultTextOption.textDirection();-
1171 if (dir != Qt::LayoutDirectionAuto)
dir != Qt::LayoutDirectionAutoDescription
TRUEnever evaluated
FALSEnever evaluated
0
1172 return dir;
never executed: return dir;
0
1173-
1174 const QString buffer = p->buffer();-
1175-
1176 const int pos = position();-
1177 QTextDocumentPrivate::FragmentIterator it = p->find(pos);-
1178 QTextDocumentPrivate::FragmentIterator end = p->find(pos + length() - 1); // -1 to omit the block separator char-
1179 for (; it != end; ++it) {
it != endDescription
TRUEnever evaluated
FALSEnever evaluated
0
1180 const QTextFragmentData * const frag = it.value();-
1181 const QChar *p = buffer.constData() + frag->stringPosition;-
1182 const QChar * const end = p + frag->size_array[0];-
1183 while (p < end) {
p < endDescription
TRUEnever evaluated
FALSEnever evaluated
0
1184 uint ucs4 = p->unicode();-
1185 if (QChar::isHighSurrogate(ucs4) && p + 1 < end) {
QChar::isHighSurrogate(ucs4)Description
TRUEnever evaluated
FALSEnever evaluated
p + 1 < endDescription
TRUEnever evaluated
FALSEnever evaluated
0
1186 ushort low = p[1].unicode();-
1187 if (QChar::isLowSurrogate(low)) {
QChar::isLowSurrogate(low)Description
TRUEnever evaluated
FALSEnever evaluated
0
1188 ucs4 = QChar::surrogateToUcs4(ucs4, low);-
1189 ++p;-
1190 }
never executed: end of block
0
1191 }
never executed: end of block
0
1192 switch (QChar::direction(ucs4)) {-
1193 case QChar::DirL:
never executed: case QChar::DirL:
0
1194 return Qt::LeftToRight;
never executed: return Qt::LeftToRight;
0
1195 case QChar::DirR:
never executed: case QChar::DirR:
0
1196 case QChar::DirAL:
never executed: case QChar::DirAL:
0
1197 return Qt::RightToLeft;
never executed: return Qt::RightToLeft;
0
1198 default:
never executed: default:
0
1199 break;
never executed: break;
0
1200 }-
1201 ++p;-
1202 }
never executed: end of block
0
1203 }
never executed: end of block
0
1204 return Qt::LeftToRight;
never executed: return Qt::LeftToRight;
0
1205}-
1206-
1207/*!-
1208 Returns the block's contents as plain text.-
1209-
1210 \sa length(), charFormat(), blockFormat()-
1211 */-
1212QString QTextBlock::text() const-
1213{-
1214 if (!p || !n)
!pDescription
TRUEnever evaluated
FALSEnever evaluated
!nDescription
TRUEnever evaluated
FALSEnever evaluated
0
1215 return QString();
never executed: return QString();
0
1216-
1217 const QString buffer = p->buffer();-
1218 QString text;-
1219 text.reserve(length());-
1220-
1221 const int pos = position();-
1222 QTextDocumentPrivate::FragmentIterator it = p->find(pos);-
1223 QTextDocumentPrivate::FragmentIterator end = p->find(pos + length() - 1); // -1 to omit the block separator char-
1224 for (; it != end; ++it) {
it != endDescription
TRUEnever evaluated
FALSEnever evaluated
0
1225 const QTextFragmentData * const frag = it.value();-
1226 text += QString::fromRawData(buffer.constData() + frag->stringPosition, frag->size_array[0]);-
1227 }
never executed: end of block
0
1228-
1229 return text;
never executed: return text;
0
1230}-
1231-
1232/*!-
1233 \since 5.3-
1234-
1235 Returns the block's text format options as a list of continuous ranges-
1236 of QTextCharFormat. The range's character format is used when inserting text-
1237 within the range boundaries.-
1238-
1239 \sa charFormat(), blockFormat()-
1240*/-
1241QVector<QTextLayout::FormatRange> QTextBlock::textFormats() const-
1242{-
1243 QVector<QTextLayout::FormatRange> formats;-
1244 if (!p || !n)
!pDescription
TRUEnever evaluated
FALSEnever evaluated
!nDescription
TRUEnever evaluated
FALSEnever evaluated
0
1245 return formats;
never executed: return formats;
0
1246-
1247 const QTextFormatCollection *formatCollection = p->formatCollection();-
1248-
1249 int start = 0;-
1250 int cur = start;-
1251 int format = -1;-
1252-
1253 const int pos = position();-
1254 QTextDocumentPrivate::FragmentIterator it = p->find(pos);-
1255 QTextDocumentPrivate::FragmentIterator end = p->find(pos + length() - 1); // -1 to omit the block separator char-
1256 for (; it != end; ++it) {
it != endDescription
TRUEnever evaluated
FALSEnever evaluated
0
1257 const QTextFragmentData * const frag = it.value();-
1258 if (format != it.value()->format) {
format != it.value()->formatDescription
TRUEnever evaluated
FALSEnever evaluated
0
1259 if (cur - start > 0) {
cur - start > 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1260 QTextLayout::FormatRange range;-
1261 range.start = start;-
1262 range.length = cur - start;-
1263 range.format = formatCollection->charFormat(format);-
1264 formats.append(range);-
1265 }
never executed: end of block
0
1266-
1267 format = frag->format;-
1268 start = cur;-
1269 }
never executed: end of block
0
1270 cur += frag->size_array[0];-
1271 }
never executed: end of block
0
1272 if (cur - start > 0) {
cur - start > 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1273 QTextLayout::FormatRange range;-
1274 range.start = start;-
1275 range.length = cur - start;-
1276 range.format = formatCollection->charFormat(format);-
1277 formats.append(range);-
1278 }
never executed: end of block
0
1279-
1280 return formats;
never executed: return formats;
0
1281}-
1282-
1283/*!-
1284 Returns the text document this text block belongs to, or 0 if the-
1285 text block does not belong to any document.-
1286*/-
1287const QTextDocument *QTextBlock::document() const-
1288{-
1289 return p ? p->document() : 0;
never executed: return p ? p->document() : 0;
pDescription
TRUEnever evaluated
FALSEnever evaluated
0
1290}-
1291-
1292/*!-
1293 If the block represents a list item, returns the list that the item belongs-
1294 to; otherwise returns 0.-
1295*/-
1296QTextList *QTextBlock::textList() const-
1297{-
1298 if (!isValid())
!isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
1299 return 0;
never executed: return 0;
0
1300-
1301 const QTextBlockFormat fmt = blockFormat();-
1302 QTextObject *obj = p->document()->objectForFormat(fmt);-
1303 return qobject_cast<QTextList *>(obj);
never executed: return qobject_cast<QTextList *>(obj);
0
1304}-
1305-
1306/*!-
1307 \since 4.1-
1308-
1309 Returns a pointer to a QTextBlockUserData object if previously set with-
1310 setUserData() or a null pointer.-
1311*/-
1312QTextBlockUserData *QTextBlock::userData() const-
1313{-
1314 if (!p || !n)
!pDescription
TRUEnever evaluated
FALSEnever evaluated
!nDescription
TRUEnever evaluated
FALSEnever evaluated
0
1315 return 0;
never executed: return 0;
0
1316-
1317 const QTextBlockData *b = p->blockMap().fragment(n);-
1318 return b->userData;
never executed: return b->userData;
0
1319}-
1320-
1321/*!-
1322 \since 4.1-
1323-
1324 Attaches the given \a data object to the text block.-
1325-
1326 QTextBlockUserData can be used to store custom settings. The-
1327 ownership is passed to the underlying text document, i.e. the-
1328 provided QTextBlockUserData object will be deleted if the-
1329 corresponding text block gets deleted. The user data object is-
1330 not stored in the undo history, so it will not be available after-
1331 undoing the deletion of a text block.-
1332-
1333 For example, if you write a programming editor in an IDE, you may-
1334 want to let your user set breakpoints visually in your code for an-
1335 integrated debugger. In a programming editor a line of text-
1336 usually corresponds to one QTextBlock. The QTextBlockUserData-
1337 interface allows the developer to store data for each QTextBlock,-
1338 like for example in which lines of the source code the user has a-
1339 breakpoint set. Of course this could also be stored externally,-
1340 but by storing it inside the QTextDocument, it will for example be-
1341 automatically deleted when the user deletes the associated-
1342 line. It's really just a way to store custom information in the-
1343 QTextDocument without using custom properties in QTextFormat which-
1344 would affect the undo/redo stack.-
1345*/-
1346void QTextBlock::setUserData(QTextBlockUserData *data)-
1347{-
1348 if (!p || !n)
!pDescription
TRUEnever evaluated
FALSEnever evaluated
!nDescription
TRUEnever evaluated
FALSEnever evaluated
0
1349 return;
never executed: return;
0
1350-
1351 const QTextBlockData *b = p->blockMap().fragment(n);-
1352 if (data != b->userData)
data != b->userDataDescription
TRUEnever evaluated
FALSEnever evaluated
0
1353 delete b->userData;
never executed: delete b->userData;
0
1354 b->userData = data;-
1355}
never executed: end of block
0
1356-
1357/*!-
1358 \since 4.1-
1359-
1360 Returns the integer value previously set with setUserState() or -1.-
1361*/-
1362int QTextBlock::userState() const-
1363{-
1364 if (!p || !n)
!pDescription
TRUEnever evaluated
FALSEnever evaluated
!nDescription
TRUEnever evaluated
FALSEnever evaluated
0
1365 return -1;
never executed: return -1;
0
1366-
1367 const QTextBlockData *b = p->blockMap().fragment(n);-
1368 return b->userState;
never executed: return b->userState;
0
1369}-
1370-
1371/*!-
1372 \since 4.1-
1373-
1374 Stores the specified \a state integer value in the text block. This may be-
1375 useful for example in a syntax highlighter to store a text parsing state.-
1376*/-
1377void QTextBlock::setUserState(int state)-
1378{-
1379 if (!p || !n)
!pDescription
TRUEnever evaluated
FALSEnever evaluated
!nDescription
TRUEnever evaluated
FALSEnever evaluated
0
1380 return;
never executed: return;
0
1381-
1382 const QTextBlockData *b = p->blockMap().fragment(n);-
1383 b->userState = state;-
1384}
never executed: end of block
0
1385-
1386/*!-
1387 \since 4.4-
1388-
1389 Returns the blocks revision.-
1390-
1391 \sa setRevision(), QTextDocument::revision()-
1392*/-
1393int QTextBlock::revision() const-
1394{-
1395 if (!p || !n)
!pDescription
TRUEnever evaluated
FALSEnever evaluated
!nDescription
TRUEnever evaluated
FALSEnever evaluated
0
1396 return -1;
never executed: return -1;
0
1397-
1398 const QTextBlockData *b = p->blockMap().fragment(n);-
1399 return b->revision;
never executed: return b->revision;
0
1400}-
1401-
1402/*!-
1403 \since 4.4-
1404-
1405 Sets a blocks revision to \a rev.-
1406-
1407 \sa revision(), QTextDocument::revision()-
1408*/-
1409void QTextBlock::setRevision(int rev)-
1410{-
1411 if (!p || !n)
!pDescription
TRUEnever evaluated
FALSEnever evaluated
!nDescription
TRUEnever evaluated
FALSEnever evaluated
0
1412 return;
never executed: return;
0
1413-
1414 const QTextBlockData *b = p->blockMap().fragment(n);-
1415 b->revision = rev;-
1416}
never executed: end of block
0
1417-
1418/*!-
1419 \since 4.4-
1420-
1421 Returns \c true if the block is visible; otherwise returns \c false.-
1422-
1423 \sa setVisible()-
1424*/-
1425bool QTextBlock::isVisible() const-
1426{-
1427 if (!p || !n)
!pDescription
TRUEnever evaluated
FALSEnever evaluated
!nDescription
TRUEnever evaluated
FALSEnever evaluated
0
1428 return true;
never executed: return true;
0
1429-
1430 const QTextBlockData *b = p->blockMap().fragment(n);-
1431 return !b->hidden;
never executed: return !b->hidden;
0
1432}-
1433-
1434/*!-
1435 \since 4.4-
1436-
1437 Sets the block's visibility to \a visible.-
1438-
1439 \sa isVisible()-
1440*/-
1441void QTextBlock::setVisible(bool visible)-
1442{-
1443 if (!p || !n)
!pDescription
TRUEnever evaluated
FALSEnever evaluated
!nDescription
TRUEnever evaluated
FALSEnever evaluated
0
1444 return;
never executed: return;
0
1445-
1446 const QTextBlockData *b = p->blockMap().fragment(n);-
1447 b->hidden = !visible;-
1448}
never executed: end of block
0
1449-
1450-
1451/*!-
1452\since 4.4-
1453-
1454 Returns the number of this block, or -1 if the block is invalid.-
1455-
1456 \sa QTextCursor::blockNumber()-
1457-
1458*/-
1459int QTextBlock::blockNumber() const-
1460{-
1461 if (!p || !n)
!pDescription
TRUEnever evaluated
FALSEnever evaluated
!nDescription
TRUEnever evaluated
FALSEnever evaluated
0
1462 return -1;
never executed: return -1;
0
1463 return p->blockMap().position(n, 1);
never executed: return p->blockMap().position(n, 1);
0
1464}-
1465-
1466/*!-
1467\since 4.5-
1468-
1469 Returns the first line number of this block, or -1 if the block is invalid.-
1470 Unless the layout supports it, the line number is identical to the block number.-
1471-
1472 \sa QTextBlock::blockNumber()-
1473-
1474*/-
1475int QTextBlock::firstLineNumber() const-
1476{-
1477 if (!p || !n)
!pDescription
TRUEnever evaluated
FALSEnever evaluated
!nDescription
TRUEnever evaluated
FALSEnever evaluated
0
1478 return -1;
never executed: return -1;
0
1479 return p->blockMap().position(n, 2);
never executed: return p->blockMap().position(n, 2);
0
1480}-
1481-
1482-
1483/*!-
1484\since 4.5-
1485-
1486Sets the line count to \a count.-
1487-
1488\sa lineCount()-
1489*/-
1490void QTextBlock::setLineCount(int count)-
1491{-
1492 if (!p || !n)
!pDescription
TRUEnever evaluated
FALSEnever evaluated
!nDescription
TRUEnever evaluated
FALSEnever evaluated
0
1493 return;
never executed: return;
0
1494 p->blockMap().setSize(n, count, 2);-
1495}
never executed: end of block
0
1496/*!-
1497\since 4.5-
1498-
1499Returns the line count. Not all document layouts support this feature.-
1500-
1501\sa setLineCount()-
1502 */-
1503int QTextBlock::lineCount() const-
1504{-
1505 if (!p || !n)
!pDescription
TRUEnever evaluated
FALSEnever evaluated
!nDescription
TRUEnever evaluated
FALSEnever evaluated
0
1506 return -1;
never executed: return -1;
0
1507 return p->blockMap().size(n, 2);
never executed: return p->blockMap().size(n, 2);
0
1508}-
1509-
1510-
1511/*!-
1512 Returns a text block iterator pointing to the beginning of the-
1513 text block.-
1514-
1515 \sa end()-
1516*/-
1517QTextBlock::iterator QTextBlock::begin() const-
1518{-
1519 if (!p || !n)
!pDescription
TRUEnever evaluated
FALSEnever evaluated
!nDescription
TRUEnever evaluated
FALSEnever evaluated
0
1520 return iterator();
never executed: return iterator();
0
1521-
1522 int pos = position();-
1523 int len = length() - 1; // exclude the fragment that holds the paragraph separator-
1524 int b = p->fragmentMap().findNode(pos);-
1525 int e = p->fragmentMap().findNode(pos+len);-
1526 return iterator(p, b, e, b);
never executed: return iterator(p, b, e, b);
0
1527}-
1528-
1529/*!-
1530 Returns a text block iterator pointing to the end of the text-
1531 block.-
1532-
1533 \sa begin(), next(), previous()-
1534*/-
1535QTextBlock::iterator QTextBlock::end() const-
1536{-
1537 if (!p || !n)
!pDescription
TRUEnever evaluated
FALSEnever evaluated
!nDescription
TRUEnever evaluated
FALSEnever evaluated
0
1538 return iterator();
never executed: return iterator();
0
1539-
1540 int pos = position();-
1541 int len = length() - 1; // exclude the fragment that holds the paragraph separator-
1542 int b = p->fragmentMap().findNode(pos);-
1543 int e = p->fragmentMap().findNode(pos+len);-
1544 return iterator(p, b, e, e);
never executed: return iterator(p, b, e, e);
0
1545}-
1546-
1547-
1548/*!-
1549 Returns the text block in the document after this block, or an empty-
1550 text block if this is the last one.-
1551-
1552 Note that the next block may be in a different frame or table to this block.-
1553-
1554 \sa previous(), begin(), end()-
1555*/-
1556QTextBlock QTextBlock::next() const-
1557{-
1558 if (!isValid())
!isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
1559 return QTextBlock();
never executed: return QTextBlock();
0
1560-
1561 return QTextBlock(p, p->blockMap().next(n));
never executed: return QTextBlock(p, p->blockMap().next(n));
0
1562}-
1563-
1564/*!-
1565 Returns the text block in the document before this block, or an empty text-
1566 block if this is the first one.-
1567-
1568 Note that the previous block may be in a different frame or table to this block.-
1569-
1570 \sa next(), begin(), end()-
1571*/-
1572QTextBlock QTextBlock::previous() const-
1573{-
1574 if (!p)
!pDescription
TRUEnever evaluated
FALSEnever evaluated
0
1575 return QTextBlock();
never executed: return QTextBlock();
0
1576-
1577 return QTextBlock(p, p->blockMap().previous(n));
never executed: return QTextBlock(p, p->blockMap().previous(n));
0
1578}-
1579-
1580-
1581/*!-
1582 Returns the text fragment the iterator currently points to.-
1583*/-
1584QTextFragment QTextBlock::iterator::fragment() const-
1585{-
1586 int ne = n;-
1587 int formatIndex = p->fragmentMap().fragment(n)->format;-
1588 do {-
1589 ne = p->fragmentMap().next(ne);-
1590 } while (ne != e && p->fragmentMap().fragment(ne)->format == formatIndex);
never executed: end of block
ne != eDescription
TRUEnever evaluated
FALSEnever evaluated
p->fragmentMap...== formatIndexDescription
TRUEnever evaluated
FALSEnever evaluated
0
1591 return QTextFragment(p, n, ne);
never executed: return QTextFragment(p, n, ne);
0
1592}-
1593-
1594/*!-
1595 The prefix ++ operator (\c{++i}) advances the iterator to the-
1596 next item in the hash and returns an iterator to the new current-
1597 item.-
1598*/-
1599-
1600QTextBlock::iterator &QTextBlock::iterator::operator++()-
1601{-
1602 int ne = n;-
1603 int formatIndex = p->fragmentMap().fragment(n)->format;-
1604 do {-
1605 ne = p->fragmentMap().next(ne);-
1606 } while (ne != e && p->fragmentMap().fragment(ne)->format == formatIndex);
never executed: end of block
ne != eDescription
TRUEnever evaluated
FALSEnever evaluated
p->fragmentMap...== formatIndexDescription
TRUEnever evaluated
FALSEnever evaluated
0
1607 n = ne;-
1608 return *this;
never executed: return *this;
0
1609}-
1610-
1611/*!-
1612 The prefix -- operator (\c{--i}) makes the preceding item-
1613 current and returns an iterator pointing to the new current item.-
1614*/-
1615-
1616QTextBlock::iterator &QTextBlock::iterator::operator--()-
1617{-
1618 n = p->fragmentMap().previous(n);-
1619-
1620 if (n == b)
n == bDescription
TRUEnever evaluated
FALSEnever evaluated
0
1621 return *this;
never executed: return *this;
0
1622-
1623 int formatIndex = p->fragmentMap().fragment(n)->format;-
1624 int last = n;-
1625-
1626 while (n != b && p->fragmentMap().fragment(n)->format != formatIndex) {
n != bDescription
TRUEnever evaluated
FALSEnever evaluated
p->fragmentMap...!= formatIndexDescription
TRUEnever evaluated
FALSEnever evaluated
0
1627 last = n;-
1628 n = p->fragmentMap().previous(n);-
1629 }
never executed: end of block
0
1630-
1631 n = last;-
1632 return *this;
never executed: return *this;
0
1633}-
1634-
1635-
1636/*!-
1637 \class QTextFragment-
1638 \reentrant-
1639-
1640 \brief The QTextFragment class holds a piece of text in a-
1641 QTextDocument with a single QTextCharFormat.-
1642 \inmodule QtGui-
1643-
1644 \ingroup richtext-processing-
1645-
1646 A text fragment describes a piece of text that is stored with a single-
1647 character format. Text in which the character format changes can be-
1648 represented by sequences of text fragments with different formats.-
1649-
1650 If the user edits the text in a fragment and introduces a different-
1651 character format, the fragment's text will be split at each point where-
1652 the format changes, and new fragments will be created.-
1653 For example, changing the style of some text in the middle of a-
1654 sentence will cause the fragment to be broken into three separate fragments:-
1655 the first and third with the same format as before, and the second with-
1656 the new style. The first fragment will contain the text from the beginning-
1657 of the sentence, the second will contain the text from the middle, and the-
1658 third takes the text from the end of the sentence.-
1659-
1660 \image qtextfragment-split.png-
1661-
1662 A fragment's text and character format can be obtained with the text()-
1663 and charFormat() functions. The length() function gives the length of-
1664 the text in the fragment. position() gives the position in the document-
1665 of the start of the fragment. To determine whether the fragment contains-
1666 a particular position within the document, use the contains() function.-
1667-
1668 \sa QTextDocument, {Rich Text Document Structure}-
1669*/-
1670-
1671/*!-
1672 \fn QTextFragment::QTextFragment(const QTextDocumentPrivate *priv, int f, int fe)-
1673 \internal-
1674*/-
1675-
1676/*!-
1677 \fn QTextFragment::QTextFragment()-
1678-
1679 Creates a new empty text fragment.-
1680*/-
1681-
1682/*!-
1683 \fn QTextFragment::QTextFragment(const QTextFragment &other)-
1684-
1685 Copies the content (text and format) of the \a other text fragment-
1686 to this text fragment.-
1687*/-
1688-
1689/*!-
1690 \fn QTextFragment &QTextFragment::operator=(const QTextFragment-
1691 &other)-
1692-
1693 Assigns the content (text and format) of the \a other text fragment-
1694 to this text fragment.-
1695*/-
1696-
1697/*!-
1698 \fn bool QTextFragment::isValid() const-
1699-
1700 Returns \c true if this is a valid text fragment (i.e. has a valid-
1701 position in a document); otherwise returns \c false.-
1702*/-
1703-
1704/*!-
1705 \fn bool QTextFragment::operator==(const QTextFragment &other) const-
1706-
1707 Returns \c true if this text fragment is the same (at the same-
1708 position) as the \a other text fragment; otherwise returns \c false.-
1709*/-
1710-
1711/*!-
1712 \fn bool QTextFragment::operator!=(const QTextFragment &other) const-
1713-
1714 Returns \c true if this text fragment is different (at a different-
1715 position) from the \a other text fragment; otherwise returns-
1716 false.-
1717*/-
1718-
1719/*!-
1720 \fn bool QTextFragment::operator<(const QTextFragment &other) const-
1721-
1722 Returns \c true if this text fragment appears earlier in the document-
1723 than the \a other text fragment; otherwise returns \c false.-
1724*/-
1725-
1726/*!-
1727 Returns the glyphs corresponding to \a len characters of this text fragment starting at-
1728 position \a pos. The positions of the glyphs are relative to the position of the QTextBlock's-
1729 layout.-
1730-
1731 If \a pos is less than zero, it will default to the start of the QTextFragment. If \a len-
1732 is less than zero, it will default to the length of the fragment.-
1733-
1734 \sa QGlyphRun, QTextBlock::layout(), QTextLayout::position(), QPainter::drawGlyphRun()-
1735*/-
1736#if !defined(QT_NO_RAWFONT)-
1737QList<QGlyphRun> QTextFragment::glyphRuns(int pos, int len) const-
1738{-
1739 if (!p || !n)
!pDescription
TRUEnever evaluated
FALSEnever evaluated
!nDescription
TRUEnever evaluated
FALSEnever evaluated
0
1740 return QList<QGlyphRun>();
never executed: return QList<QGlyphRun>();
0
1741-
1742 int blockNode = p->blockMap().findNode(position());-
1743-
1744 const QTextBlockData *blockData = p->blockMap().fragment(blockNode);-
1745 QTextLayout *layout = blockData->layout;-
1746-
1747 int blockPosition = p->blockMap().position(blockNode);-
1748 if (pos < 0)
pos < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1749 pos = position() - blockPosition;
never executed: pos = position() - blockPosition;
0
1750 if (len < 0)
len < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1751 len = length();
never executed: len = length();
0
1752 if (len == 0)
len == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1753 return QList<QGlyphRun>();
never executed: return QList<QGlyphRun>();
0
1754-
1755 QList<QGlyphRun> ret;-
1756 for (int i=0; i<layout->lineCount(); ++i) {
i<layout->lineCount()Description
TRUEnever evaluated
FALSEnever evaluated
0
1757 QTextLine textLine = layout->lineAt(i);-
1758 ret += textLine.glyphRuns(pos, len);-
1759 }
never executed: end of block
0
1760-
1761 return ret;
never executed: return ret;
0
1762}-
1763#endif // QT_NO_RAWFONT-
1764-
1765/*!-
1766 Returns the position of this text fragment in the document.-
1767*/-
1768int QTextFragment::position() const-
1769{-
1770 if (!p || !n)
!pDescription
TRUEnever evaluated
FALSEnever evaluated
!nDescription
TRUEnever evaluated
FALSEnever evaluated
0
1771 return 0; // ### -1 instead?
never executed: return 0;
0
1772-
1773 return p->fragmentMap().position(n);
never executed: return p->fragmentMap().position(n);
0
1774}-
1775-
1776/*!-
1777 Returns the number of characters in the text fragment.-
1778-
1779 \sa text()-
1780*/-
1781int QTextFragment::length() const-
1782{-
1783 if (!p || !n)
!pDescription
TRUEnever evaluated
FALSEnever evaluated
!nDescription
TRUEnever evaluated
FALSEnever evaluated
0
1784 return 0;
never executed: return 0;
0
1785-
1786 int len = 0;-
1787 int f = n;-
1788 while (f != ne) {
f != neDescription
TRUEnever evaluated
FALSEnever evaluated
0
1789 len += p->fragmentMap().size(f);-
1790 f = p->fragmentMap().next(f);-
1791 }
never executed: end of block
0
1792 return len;
never executed: return len;
0
1793}-
1794-
1795/*!-
1796 Returns \c true if the text fragment contains the text at the given-
1797 \a position in the document; otherwise returns \c false.-
1798*/-
1799bool QTextFragment::contains(int position) const-
1800{-
1801 if (!p || !n)
!pDescription
TRUEnever evaluated
FALSEnever evaluated
!nDescription
TRUEnever evaluated
FALSEnever evaluated
0
1802 return false;
never executed: return false;
0
1803 int pos = this->position();-
1804 return position >= pos && position < pos + length();
never executed: return position >= pos && position < pos + length();
position >= posDescription
TRUEnever evaluated
FALSEnever evaluated
position < pos + length()Description
TRUEnever evaluated
FALSEnever evaluated
0
1805}-
1806-
1807/*!-
1808 Returns the text fragment's character format.-
1809-
1810 \sa text()-
1811*/-
1812QTextCharFormat QTextFragment::charFormat() const-
1813{-
1814 if (!p || !n)
!pDescription
TRUEnever evaluated
FALSEnever evaluated
!nDescription
TRUEnever evaluated
FALSEnever evaluated
0
1815 return QTextCharFormat();
never executed: return QTextCharFormat();
0
1816 const QTextFragmentData *data = p->fragmentMap().fragment(n);-
1817 return p->formatCollection()->charFormat(data->format);
never executed: return p->formatCollection()->charFormat(data->format);
0
1818}-
1819-
1820/*!-
1821 Returns an index into the document's internal list of character formats-
1822 for the text fragment's character format.-
1823-
1824 \sa QTextDocument::allFormats()-
1825*/-
1826int QTextFragment::charFormatIndex() const-
1827{-
1828 if (!p || !n)
!pDescription
TRUEnever evaluated
FALSEnever evaluated
!nDescription
TRUEnever evaluated
FALSEnever evaluated
0
1829 return -1;
never executed: return -1;
0
1830 const QTextFragmentData *data = p->fragmentMap().fragment(n);-
1831 return data->format;
never executed: return data->format;
0
1832}-
1833-
1834/*!-
1835 Returns the text fragment's as plain text.-
1836-
1837 \sa length(), charFormat()-
1838*/-
1839QString QTextFragment::text() const-
1840{-
1841 if (!p || !n)
!pDescription
TRUEnever evaluated
FALSEnever evaluated
!nDescription
TRUEnever evaluated
FALSEnever evaluated
0
1842 return QString();
never executed: return QString();
0
1843-
1844 QString result;-
1845 QString buffer = p->buffer();-
1846 int f = n;-
1847 while (f != ne) {
f != neDescription
TRUEnever evaluated
FALSEnever evaluated
0
1848 const QTextFragmentData * const frag = p->fragmentMap().fragment(f);-
1849 result += QString(buffer.constData() + frag->stringPosition, frag->size_array[0]);-
1850 f = p->fragmentMap().next(f);-
1851 }
never executed: end of block
0
1852 return result;
never executed: return result;
0
1853}-
1854-
1855QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9