126 return d->pieceTable->formatCollection()->objectFormat(
d->objectIndex);
138 return d->pieceTable->formatCollection()->objectFormatIndex(
d->objectIndex);
150 int idx =
d->pieceTable->formatCollection()->indexForFormat(format);
151 d->pieceTable->changeObjectFormat(
this, idx);
161 return d->objectIndex;
215 for (
int i = 0; i < blocks.count(); ++i) {
261 d->blocks.insert(it, block);
262 d->markBlocksDirty();
273 d->blocks.removeAll(block);
274 d->markBlocksDirty();
275 if (
d->blocks.isEmpty()) {
454 delete d->layoutData;
473 return d->childFrames;
485 return d->parentFrame;
519 if (!
d->fragment_start)
521 return d->pieceTable->fragmentMap().position(
d->fragment_start) + 1;
532 if (!
d->fragment_end)
533 return d->pieceTable->length() - 1;
534 return d->pieceTable->fragmentMap().position(
d->fragment_end);
543 return d->layoutData;
552 delete d->layoutData;
553 d->layoutData =
data;
562 fragment_start = fragment;
565 fragment_end = fragment;
569 fragment_start = fragment;
570 fragment_end = fragment;
580 Q_ASSERT(fragment_start == fragment);
586 Q_ASSERT(fragment_start == fragment);
600 if (fragment_start == 0 && fragment_end == 0
602 q->document()->docHandle()->deleteObject(q);
664 return iterator(const_cast<QTextFrame *>(
this), b, b, e);
677 return iterator(const_cast<QTextFrame *>(
this), e, b, e);
764 int end = cf->lastPosition() + 1;
772 if (!f->d_func()->childFrames.isEmpty()) {
802 int start = cf->firstPosition() - 1;
1103 return p->blockMap().position(n);
1119 return p->blockMap().size(n);
1131 int pos = p->blockMap().position(n);
1132 int len = p->blockMap().size(n);
1133 return position >= pos && position < pos + len;
1187 return p->formatCollection()->blockFormat(p->blockMap().fragment(n)->format);
1201 return p->blockMap().fragment(n)->format;
1216 return p->formatCollection()->charFormat(charFormatIndex());
1230 return p->blockCharFormatIndex(n);
1253 dir = p->defaultTextOption.textDirection();
1257 const QString buffer = p->buffer();
1262 for (; it !=
end; ++
it) {
1293 const QString buffer = p->buffer();
1300 for (; it !=
end; ++
it) {
1315 return p ? p->document() : 0;
1516 return p->blockMap().position(n, 1);
1535 return p->blockMap().position(n, 2);
1550 p->blockMap().setSize(n, count, 2);
1563 return p->blockMap().size(n, 2);
1579 int len = length() - 1;
1580 int b = p->fragmentMap().findNode(pos);
1581 int e = p->fragmentMap().findNode(pos+len);
1597 int len = length() - 1;
1598 int b = p->fragmentMap().findNode(pos);
1599 int e = p->fragmentMap().findNode(pos+len);
1614 if (!isValid() || !p->blockMap().isValid(n))
1633 return QTextBlock(p, p->blockMap().previous(n));
1643 int formatIndex = p->fragmentMap().fragment(n)->format;
1645 ne = p->fragmentMap().next(ne);
1646 }
while (ne != e && p->fragmentMap().fragment(ne)->format ==
formatIndex);
1659 int formatIndex = p->fragmentMap().fragment(n)->format;
1661 ne = p->fragmentMap().next(ne);
1662 }
while (ne != e && p->fragmentMap().fragment(ne)->format ==
formatIndex);
1674 n = p->fragmentMap().previous(n);
1679 int formatIndex = p->fragmentMap().fragment(n)->format;
1682 while (n != b && p->fragmentMap().fragment(n)->format !=
formatIndex) {
1684 n = p->fragmentMap().previous(n);
1811 #if !defined(QT_NO_RAWFONT) 1822 int blockNode = p->blockMap().findNode(pos);
1824 const QTextBlockData *blockData = p->blockMap().fragment(blockNode);
1828 for (
int i=0; i<layout->
lineCount(); ++i) {
1830 ret += textLine.
glyphs(pos, len);
1835 #endif // QT_NO_RAWFONT 1845 return p->fragmentMap().position(n);
1861 len += p->fragmentMap().size(f);
1862 f = p->fragmentMap().next(f);
1876 return position >= pos && position < pos + length();
1889 return p->formatCollection()->charFormat(data->
format);
1922 f = p->fragmentMap().next(f);
void setRevision(int rev)
Sets a blocks revision to rev.
iterator()
Constructs an invalid iterator.
int revision() const
Returns the blocks revision.
QString text() const
Returns the block's contents as plain text.
int formatIndex() const
Returns the index of the object's format in the document's internal list of formats.
The QTextCharFormat class provides formatting information for characters in a QTextDocument.
bool contains(int position) const
Returns true if the text fragment contains the text at the given position in the document; otherwise ...
int blockFormatIndex() const
Returns an index into the document's internal list of block formats for the text block's format...
#define QT_END_NAMESPACE
This macro expands to.
int charFormatIndex() const
Returns an index into the document's internal list of character formats for the text fragment's chara...
QTextList * textList() const
If the block represents a list item, returns the list that the item belongs to; otherwise returns 0...
virtual ~QTextFrameLayoutData()
const QChar at(int i) const
Returns the character at the given index position in the string.
void setUserState(int state)
Stores the specified state integer value in the text block.
void setLineCount(int count)
ushort unicode() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
#define it(className, varName)
iterator end() const
Returns a text block iterator pointing to the end of the text block.
QList< QGlyphRun > glyphs(int from, int length) const
Returns the glyph indexes and positions for all glyphs in this QTextLine which reside in QScriptItems...
The QTextFrame class represents a frame in a QTextDocument.
void deleteObject(QTextObject *object)
QTextFrame * currentFrame() const
Returns the current frame pointed to by the iterator, or 0 if the iterator currently points to a bloc...
The QTextLine class represents a line of text inside a QTextLayout.
static qreal position(QGraphicsObject *item, QDeclarativeAnchorLine::AnchorLine anchorLine)
QString text() const
Returns the text fragment's as plain text.
QTextDocument * document() const
Returns the document this object belongs to.
iterator begin() const
Returns a text block iterator pointing to the beginning of the text block.
void insert(int i, const T &t)
Inserts value at index position i in the list.
#define QTextBeginningOfFrame
virtual ~QTextBlockUserData()
Destroys the user data.
The QString class provides a Unicode character string.
T * qobject_cast(QObject *object)
void clearLayout()
Clears the QTextLayout that is used to lay out and display the block's contents.
The QObject class is the base class of all Qt objects.
int firstPosition() const
Returns the first document position inside the frame.
QTextObject * objectForFormat(const QTextFormat &) const
Returns the text object associated with the format f.
The QChar class provides a 16-bit Unicode character.
static QString fromRawData(const QChar *, int size)
Constructs a QString that uses the first size Unicode characters in the array unicode.
FragmentMap::ConstIterator FragmentIterator
iterator Iterator
Qt-style synonym for QList::iterator.
QTextBlock next() const
Returns the text block in the document after this block, or an empty text block if this is the last o...
int position() const
Returns the index of the block's first character within the document.
QTextBlock previous() const
Returns the text block in the document before this block, or an empty text block if this is the first...
void reserve(int size)
Attempts to allocate memory for at least size characters.
iterator & operator++()
Moves the iterator to the next frame or block.
QTextCharFormat charFormat() const
Returns the text fragment's character format.
bool isVisible() const
Returns true if the block is visible; otherwise returns false.
#define QT_BEGIN_NAMESPACE
This macro expands to.
FragmentIterator find(int pos) const
iterator & operator--()
The prefix – operator (–i) makes the preceding item current and returns an iterator pointing to the...
QTextObject(QTextDocument *doc)
Creates a new QTextObject for the given document.
~QTextObject()
Destroys the text object.
virtual void fragmentAdded(const QChar &type, uint fragment)
int objectIndex() const
Returns the object index of this object.
QTextFrameLayoutData * layoutData() const
int lastPosition() const
Returns the last document position inside the frame.
The QTextFormat class provides formatting information for a QTextDocument.
QTextFrame * parentFrame() const
Returns the frame's parent frame.
QTextDocumentPrivate * docHandle() const
So that not all classes have to be friends of each other.
The QTextCursor class offers an API to access and modify QTextDocuments.
QTextDocumentPrivate * docHandle() const
const T & at(int i) const
Returns the item at index position i in the list.
QTextObject * objectForFormat(int formatIndex) const
bool contains(int position) const
Returns true if the given position is located within the text block; otherwise returns false...
void setUserData(QTextBlockUserData *data)
Attaches the given data object to the text block.
The QTextBlock class provides a container for text fragments in a QTextDocument.
static const char * data(const QByteArray &arr)
QTextBlockFormat toBlockFormat() const
Returns this format as a block format.
uint position(uint node, uint field=0) const
void clear()
Removes all items from the list.
int length() const
Returns the length of the block in characters.
const BlockMap & blockMap() const
~QTextBlockGroup()
Destroys this block group; the blocks are not deleted, they simply don't belong to this block anymore...
QList< QGlyphRun > glyphRuns() const
Returns the glyphs of this text fragment.
int length() const
Returns the number of characters in the text fragment.
The QTextFragment class holds a piece of text in a QTextDocument with a single QTextCharFormat.
QTextLine lineAt(int i) const
Returns the {i}-th line of text in this text layout.
The QTextBlock::iterator class provides an iterator for reading the contents of a QTextBlock...
QTextCharFormat charFormat() const
Returns the QTextCharFormat that describes the block's character format.
virtual void blockInserted(const QTextBlock &block)
Appends the given block to the end of the group.
int firstLineNumber() const
Returns the first line number of this block, or -1 if the block is invalid.
The iterator class provides an iterator for reading the contents of a QTextFrame. ...
The QTextBlockUserData class is used to associate custom data with blocks of text.
iterator & operator++()
The prefix ++ operator (++i) advances the iterator to the next item in the hash and returns an iterat...
QTextFormat format() const
Returns the text object's format.
QList< QTextFrame * > childFrames() const
Returns a (possibly empty) list of the frame's child frames.
QList< QTextBlock > blockList() const
Returns a (possibly empty) list of all the blocks that are part of the block group.
int userState() const
Returns the integer value previously set with setUserState() or -1.
Q_OUTOFLINE_TEMPLATE RandomAccessIterator qLowerBound(RandomAccessIterator begin, RandomAccessIterator end, const T &value)
int position() const
Returns the position of this text fragment in the document.
QTextBlockUserData * userData
virtual void blockRemoved(const QTextBlock &block)
Removes the given block from the group; the block itself is not deleted, it simply isn't a member of ...
The QTextLayout class is used to lay out and render text.
~QTextFrame()
Destroys the frame, and removes it from the document's layout.
int indexOf(const T &t, int from=0) const
Returns the index position of the first occurrence of value in the list, searching forward from index...
void setFormat(const QTextFormat &format)
Sets the text object's format.
QTextCursor firstCursorPosition() const
Returns the first cursor position inside the frame.
The QTextBlockGroup class provides a container for text blocks within a QTextDocument.
uint previous(uint n) const
uint findNode(int k, uint field=0) const
QObject * parent() const
Returns a pointer to the parent object.
int size() const
Returns the number of items in the list.
The QTextBlockFormat class provides formatting information for blocks of text in a QTextDocument...
Qt::LayoutDirection textDirection() const
Returns the resolved text direction.
iterator & operator=(const iterator &o)
Assigns other to this iterator and returns a reference to this iterator.
QTextCursor lastCursorPosition() const
Returns the last cursor position inside the frame.
void clearLayout()
Clears the line information in the layout.
The QTextDocument class holds formatted text that can be viewed and edited using a QTextEdit...
QTextBlockGroup(QTextDocument *doc)
Creates a new new block group for the given document.
The QTextList class provides a decorated list of items in a QTextDocument.
QTextCharFormat toCharFormat() const
Returns this format as a character format.
int charFormatIndex() const
Returns an index into the document's internal list of character formats for the text block's characte...
iterator & operator--()
Moves the iterator to the previous frame or block.
virtual void blockFormatChanged(const QTextBlock &block)
This function is called whenever the specified block of text is changed.
Direction direction() const
Returns the character's direction.
virtual void fragmentRemoved(const QChar &type, uint fragment)
void setLayoutData(QTextFrameLayoutData *data)
QTextFragment fragment() const
Returns the text fragment the iterator currently points to.
The QTextObject class is a base class for different kinds of objects that can group parts of a QTextD...
QTextBlock currentBlock() const
Returns the current block the iterator points to.
const QTextDocument * document() const
Returns the text document this text block belongs to, or 0 if the text block does not belong to any d...
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
void setVisible(bool visible)
Sets the block's visibility to visible.
iterator end() const
Returns an iterator pointing to the position past the last document element inside the frame...
QTextBlockFormat blockFormat() const
Returns the QTextBlockFormat that describes block-specific properties.
const QChar * constData() const
Returns a pointer to the data stored in the QString.
QTextFrame(QTextDocument *doc)
Creates a new empty frame for the text document.
int blockNumber() const
Returns the number of this block, or -1 if the block is invalid.
int lineCount() const
Returns the number of lines in this text layout.
iterator begin() const
Returns an iterator pointing to the first document element inside the frame.
QTextBlockUserData * userData() const
Returns a pointer to a QTextBlockUserData object if previously set with setUserData() or a null point...
void removeAt(int i)
Removes the item at index position i.
QTextLayout * layout() const
Returns the QTextLayout that is used to lay out and display the block's contents. ...