| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/text/qtextobject.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | - | |||||||||||||
| 5 | - | |||||||||||||
| 6 | - | |||||||||||||
| 7 | - | |||||||||||||
| 8 | QTextObject::QTextObject(QTextDocument *doc) | - | ||||||||||||
| 9 | : QObject(*new QTextObjectPrivate(doc), doc) | - | ||||||||||||
| 10 | { | - | ||||||||||||
| 11 | } never executed: end of block | 0 | ||||||||||||
| 12 | - | |||||||||||||
| 13 | - | |||||||||||||
| 14 | - | |||||||||||||
| 15 | - | |||||||||||||
| 16 | - | |||||||||||||
| 17 | - | |||||||||||||
| 18 | QTextObject::QTextObject(QTextObjectPrivate &p, QTextDocument *doc) | - | ||||||||||||
| 19 | : QObject(p, doc) | - | ||||||||||||
| 20 | { | - | ||||||||||||
| 21 | } never executed: end of block | 0 | ||||||||||||
| 22 | - | |||||||||||||
| 23 | - | |||||||||||||
| 24 | - | |||||||||||||
| 25 | - | |||||||||||||
| 26 | - | |||||||||||||
| 27 | - | |||||||||||||
| 28 | - | |||||||||||||
| 29 | QTextObject::~QTextObject() | - | ||||||||||||
| 30 | { | - | ||||||||||||
| 31 | } | - | ||||||||||||
| 32 | - | |||||||||||||
| 33 | - | |||||||||||||
| 34 | - | |||||||||||||
| 35 | - | |||||||||||||
| 36 | - | |||||||||||||
| 37 | - | |||||||||||||
| 38 | QTextFormat QTextObject::format() const | - | ||||||||||||
| 39 | { | - | ||||||||||||
| 40 | const QTextObjectPrivate * const d = d_func(); | - | ||||||||||||
| 41 | return never executed: d->pieceTable->formatCollection()->objectFormat(d->objectIndex);return d->pieceTable->formatCollection()->objectFormat(d->objectIndex);never executed: return d->pieceTable->formatCollection()->objectFormat(d->objectIndex); | 0 | ||||||||||||
| 42 | } | - | ||||||||||||
| 43 | - | |||||||||||||
| 44 | - | |||||||||||||
| 45 | - | |||||||||||||
| 46 | - | |||||||||||||
| 47 | - | |||||||||||||
| 48 | - | |||||||||||||
| 49 | - | |||||||||||||
| 50 | int QTextObject::formatIndex() const | - | ||||||||||||
| 51 | { | - | ||||||||||||
| 52 | const QTextObjectPrivate * const d = d_func(); | - | ||||||||||||
| 53 | return never executed: d->pieceTable->formatCollection()->objectFormatIndex(d->objectIndex);return d->pieceTable->formatCollection()->objectFormatIndex(d->objectIndex);never executed: return d->pieceTable->formatCollection()->objectFormatIndex(d->objectIndex); | 0 | ||||||||||||
| 54 | } | - | ||||||||||||
| 55 | - | |||||||||||||
| 56 | - | |||||||||||||
| 57 | - | |||||||||||||
| 58 | - | |||||||||||||
| 59 | - | |||||||||||||
| 60 | - | |||||||||||||
| 61 | - | |||||||||||||
| 62 | void QTextObject::setFormat(const QTextFormat &format) | - | ||||||||||||
| 63 | { | - | ||||||||||||
| 64 | QTextObjectPrivate * const d = d_func(); | - | ||||||||||||
| 65 | int idx = d->pieceTable->formatCollection()->indexForFormat(format); | - | ||||||||||||
| 66 | d->pieceTable->changeObjectFormat(this, idx); | - | ||||||||||||
| 67 | } never executed: end of block | 0 | ||||||||||||
| 68 | - | |||||||||||||
| 69 | - | |||||||||||||
| 70 | - | |||||||||||||
| 71 | - | |||||||||||||
| 72 | - | |||||||||||||
| 73 | int QTextObject::objectIndex() const | - | ||||||||||||
| 74 | { | - | ||||||||||||
| 75 | const QTextObjectPrivate * const d = d_func(); | - | ||||||||||||
| 76 | return never executed: d->objectIndex;return d->objectIndex;never executed: return d->objectIndex; | 0 | ||||||||||||
| 77 | } | - | ||||||||||||
| 78 | - | |||||||||||||
| 79 | - | |||||||||||||
| 80 | - | |||||||||||||
| 81 | - | |||||||||||||
| 82 | - | |||||||||||||
| 83 | - | |||||||||||||
| 84 | QTextDocument *QTextObject::document() const | - | ||||||||||||
| 85 | { | - | ||||||||||||
| 86 | return never executed: static_cast<QTextDocument *>(parent());return static_cast<QTextDocument *>(parent());never executed: return static_cast<QTextDocument *>(parent()); | 0 | ||||||||||||
| 87 | } | - | ||||||||||||
| 88 | - | |||||||||||||
| 89 | - | |||||||||||||
| 90 | - | |||||||||||||
| 91 | - | |||||||||||||
| 92 | QTextDocumentPrivate *QTextObject::docHandle() const | - | ||||||||||||
| 93 | { | - | ||||||||||||
| 94 | return never executed: static_cast<const QTextDocument *>(parent())->docHandle();return static_cast<const QTextDocument *>(parent())->docHandle();never executed: return static_cast<const QTextDocument *>(parent())->docHandle(); | 0 | ||||||||||||
| 95 | } | - | ||||||||||||
| 96 | void QTextBlockGroupPrivate::markBlocksDirty() | - | ||||||||||||
| 97 | { | - | ||||||||||||
| 98 | for (int i = 0; i < blocks.count()
| 0 | ||||||||||||
| 99 | const QTextBlock &block = blocks.at(i); | - | ||||||||||||
| 100 | pieceTable->documentChange(block.position(), block.length()); | - | ||||||||||||
| 101 | } never executed: end of block | 0 | ||||||||||||
| 102 | } never executed: end of block | 0 | ||||||||||||
| 103 | QTextBlockGroup::QTextBlockGroup(QTextDocument *doc) | - | ||||||||||||
| 104 | : QTextObject(*new QTextBlockGroupPrivate(doc), doc) | - | ||||||||||||
| 105 | { | - | ||||||||||||
| 106 | } never executed: end of block | 0 | ||||||||||||
| 107 | - | |||||||||||||
| 108 | - | |||||||||||||
| 109 | - | |||||||||||||
| 110 | - | |||||||||||||
| 111 | QTextBlockGroup::QTextBlockGroup(QTextBlockGroupPrivate &p, QTextDocument *doc) | - | ||||||||||||
| 112 | : QTextObject(p, doc) | - | ||||||||||||
| 113 | { | - | ||||||||||||
| 114 | } never executed: end of block | 0 | ||||||||||||
| 115 | - | |||||||||||||
| 116 | - | |||||||||||||
| 117 | - | |||||||||||||
| 118 | - | |||||||||||||
| 119 | - | |||||||||||||
| 120 | QTextBlockGroup::~QTextBlockGroup() | - | ||||||||||||
| 121 | { | - | ||||||||||||
| 122 | } | - | ||||||||||||
| 123 | void QTextBlockGroup::blockInserted(const QTextBlock &block) | - | ||||||||||||
| 124 | { | - | ||||||||||||
| 125 | QTextBlockGroupPrivate * const d = d_func(); | - | ||||||||||||
| 126 | QTextBlockGroupPrivate::BlockList::Iterator it = std::lower_bound(d->blocks.begin(), d->blocks.end(), block); | - | ||||||||||||
| 127 | d->blocks.insert(it, block); | - | ||||||||||||
| 128 | d->markBlocksDirty(); | - | ||||||||||||
| 129 | } never executed: end of block | 0 | ||||||||||||
| 130 | - | |||||||||||||
| 131 | - | |||||||||||||
| 132 | - | |||||||||||||
| 133 | - | |||||||||||||
| 134 | - | |||||||||||||
| 135 | - | |||||||||||||
| 136 | void QTextBlockGroup::blockRemoved(const QTextBlock &block) | - | ||||||||||||
| 137 | { | - | ||||||||||||
| 138 | QTextBlockGroupPrivate * const d = d_func(); | - | ||||||||||||
| 139 | d->blocks.removeAll(block); | - | ||||||||||||
| 140 | d->markBlocksDirty(); | - | ||||||||||||
| 141 | if (d->blocks.isEmpty()
| 0 | ||||||||||||
| 142 | document()->docHandle()->deleteObject(this); | - | ||||||||||||
| 143 | return; never executed: return; | 0 | ||||||||||||
| 144 | } | - | ||||||||||||
| 145 | } never executed: end of block | 0 | ||||||||||||
| 146 | - | |||||||||||||
| 147 | - | |||||||||||||
| 148 | - | |||||||||||||
| 149 | - | |||||||||||||
| 150 | - | |||||||||||||
| 151 | - | |||||||||||||
| 152 | - | |||||||||||||
| 153 | void QTextBlockGroup::blockFormatChanged(const QTextBlock &) | - | ||||||||||||
| 154 | { | - | ||||||||||||
| 155 | } | - | ||||||||||||
| 156 | - | |||||||||||||
| 157 | - | |||||||||||||
| 158 | - | |||||||||||||
| 159 | - | |||||||||||||
| 160 | - | |||||||||||||
| 161 | QList<QTextBlock> QTextBlockGroup::blockList() const | - | ||||||||||||
| 162 | { | - | ||||||||||||
| 163 | const QTextBlockGroupPrivate * const d = d_func(); | - | ||||||||||||
| 164 | return never executed: d->blocks;return d->blocks;never executed: return d->blocks; | 0 | ||||||||||||
| 165 | } | - | ||||||||||||
| 166 | - | |||||||||||||
| 167 | - | |||||||||||||
| 168 | - | |||||||||||||
| 169 | QTextFrameLayoutData::~QTextFrameLayoutData() | - | ||||||||||||
| 170 | { | - | ||||||||||||
| 171 | } | - | ||||||||||||
| 172 | QTextFrame::QTextFrame(QTextDocument *doc) | - | ||||||||||||
| 173 | : QTextObject(*new QTextFramePrivate(doc), doc) | - | ||||||||||||
| 174 | { | - | ||||||||||||
| 175 | } never executed: end of block | 0 | ||||||||||||
| 176 | QTextFrame::~QTextFrame() | - | ||||||||||||
| 177 | { | - | ||||||||||||
| 178 | QTextFramePrivate * const d = d_func(); | - | ||||||||||||
| 179 | delete d->layoutData; | - | ||||||||||||
| 180 | } never executed: end of block | 0 | ||||||||||||
| 181 | - | |||||||||||||
| 182 | - | |||||||||||||
| 183 | - | |||||||||||||
| 184 | - | |||||||||||||
| 185 | QTextFrame::QTextFrame(QTextFramePrivate &p, QTextDocument *doc) | - | ||||||||||||
| 186 | : QTextObject(p, doc) | - | ||||||||||||
| 187 | { | - | ||||||||||||
| 188 | } never executed: end of block | 0 | ||||||||||||
| 189 | - | |||||||||||||
| 190 | - | |||||||||||||
| 191 | - | |||||||||||||
| 192 | - | |||||||||||||
| 193 | - | |||||||||||||
| 194 | - | |||||||||||||
| 195 | QList<QTextFrame *> QTextFrame::childFrames() const | - | ||||||||||||
| 196 | { | - | ||||||||||||
| 197 | const QTextFramePrivate * const d = d_func(); | - | ||||||||||||
| 198 | return never executed: d->childFrames;return d->childFrames;never executed: return d->childFrames; | 0 | ||||||||||||
| 199 | } | - | ||||||||||||
| 200 | - | |||||||||||||
| 201 | - | |||||||||||||
| 202 | - | |||||||||||||
| 203 | - | |||||||||||||
| 204 | - | |||||||||||||
| 205 | - | |||||||||||||
| 206 | - | |||||||||||||
| 207 | QTextFrame *QTextFrame::parentFrame() const | - | ||||||||||||
| 208 | { | - | ||||||||||||
| 209 | const QTextFramePrivate * const d = d_func(); | - | ||||||||||||
| 210 | return never executed: d->parentFrame;return d->parentFrame;never executed: return d->parentFrame; | 0 | ||||||||||||
| 211 | } | - | ||||||||||||
| 212 | - | |||||||||||||
| 213 | - | |||||||||||||
| 214 | - | |||||||||||||
| 215 | - | |||||||||||||
| 216 | - | |||||||||||||
| 217 | - | |||||||||||||
| 218 | - | |||||||||||||
| 219 | QTextCursor QTextFrame::firstCursorPosition() const | - | ||||||||||||
| 220 | { | - | ||||||||||||
| 221 | const QTextFramePrivate * const d = d_func(); | - | ||||||||||||
| 222 | return never executed: QTextCursorPrivate::fromPosition(d->pieceTable, firstPosition());return QTextCursorPrivate::fromPosition(d->pieceTable, firstPosition());never executed: return QTextCursorPrivate::fromPosition(d->pieceTable, firstPosition()); | 0 | ||||||||||||
| 223 | } | - | ||||||||||||
| 224 | - | |||||||||||||
| 225 | - | |||||||||||||
| 226 | - | |||||||||||||
| 227 | - | |||||||||||||
| 228 | - | |||||||||||||
| 229 | - | |||||||||||||
| 230 | QTextCursor QTextFrame::lastCursorPosition() const | - | ||||||||||||
| 231 | { | - | ||||||||||||
| 232 | const QTextFramePrivate * const d = d_func(); | - | ||||||||||||
| 233 | return never executed: QTextCursorPrivate::fromPosition(d->pieceTable, lastPosition());return QTextCursorPrivate::fromPosition(d->pieceTable, lastPosition());never executed: return QTextCursorPrivate::fromPosition(d->pieceTable, lastPosition()); | 0 | ||||||||||||
| 234 | } | - | ||||||||||||
| 235 | - | |||||||||||||
| 236 | - | |||||||||||||
| 237 | - | |||||||||||||
| 238 | - | |||||||||||||
| 239 | - | |||||||||||||
| 240 | - | |||||||||||||
| 241 | int QTextFrame::firstPosition() const | - | ||||||||||||
| 242 | { | - | ||||||||||||
| 243 | const QTextFramePrivate * const d = d_func(); | - | ||||||||||||
| 244 | if (!d->fragment_start
| 0 | ||||||||||||
| 245 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 246 | return never executed: d->pieceTable->fragmentMap().position(d->fragment_start) + 1;return d->pieceTable->fragmentMap().position(d->fragment_start) + 1;never executed: return d->pieceTable->fragmentMap().position(d->fragment_start) + 1; | 0 | ||||||||||||
| 247 | } | - | ||||||||||||
| 248 | - | |||||||||||||
| 249 | - | |||||||||||||
| 250 | - | |||||||||||||
| 251 | - | |||||||||||||
| 252 | - | |||||||||||||
| 253 | - | |||||||||||||
| 254 | int QTextFrame::lastPosition() const | - | ||||||||||||
| 255 | { | - | ||||||||||||
| 256 | const QTextFramePrivate * const d = d_func(); | - | ||||||||||||
| 257 | if (!d->fragment_end
| 0 | ||||||||||||
| 258 | return never executed: d->pieceTable->length() - 1;return d->pieceTable->length() - 1;never executed: return d->pieceTable->length() - 1; | 0 | ||||||||||||
| 259 | return never executed: d->pieceTable->fragmentMap().position(d->fragment_end);return d->pieceTable->fragmentMap().position(d->fragment_end);never executed: return d->pieceTable->fragmentMap().position(d->fragment_end); | 0 | ||||||||||||
| 260 | } | - | ||||||||||||
| 261 | - | |||||||||||||
| 262 | - | |||||||||||||
| 263 | - | |||||||||||||
| 264 | - | |||||||||||||
| 265 | QTextFrameLayoutData *QTextFrame::layoutData() const | - | ||||||||||||
| 266 | { | - | ||||||||||||
| 267 | const QTextFramePrivate * const d = d_func(); | - | ||||||||||||
| 268 | return never executed: d->layoutData;return d->layoutData;never executed: return d->layoutData; | 0 | ||||||||||||
| 269 | } | - | ||||||||||||
| 270 | - | |||||||||||||
| 271 | - | |||||||||||||
| 272 | - | |||||||||||||
| 273 | - | |||||||||||||
| 274 | void QTextFrame::setLayoutData(QTextFrameLayoutData *data) | - | ||||||||||||
| 275 | { | - | ||||||||||||
| 276 | QTextFramePrivate * const d = d_func(); | - | ||||||||||||
| 277 | delete d->layoutData; | - | ||||||||||||
| 278 | d->layoutData = data; | - | ||||||||||||
| 279 | } never executed: end of block | 0 | ||||||||||||
| 280 | - | |||||||||||||
| 281 | - | |||||||||||||
| 282 | - | |||||||||||||
| 283 | void QTextFramePrivate::fragmentAdded(QChar type, uint fragment) | - | ||||||||||||
| 284 | { | - | ||||||||||||
| 285 | if (type == QChar(0xfdd0)
| 0 | ||||||||||||
| 286 | ((!(!fragment_start)) ? qt_assert("!fragment_start",__FILE__,538) : qt_noop()); | - | ||||||||||||
| 287 | fragment_start = fragment; | - | ||||||||||||
| 288 | } never executed: else if (type == QChar(0xfdd1)end of block
| 0 | ||||||||||||
| 289 | ((!(!fragment_end)) ? qt_assert("!fragment_end",__FILE__,541) : qt_noop()); | - | ||||||||||||
| 290 | fragment_end = fragment; | - | ||||||||||||
| 291 | } never executed: else if (type == QChar::ObjectReplacementCharacterend of block
| 0 | ||||||||||||
| 292 | ((!(!fragment_start)) ? qt_assert("!fragment_start",__FILE__,544) : qt_noop()); | - | ||||||||||||
| 293 | ((!(!fragment_end)) ? qt_assert("!fragment_end",__FILE__,545) : qt_noop()); | - | ||||||||||||
| 294 | fragment_start = fragment; | - | ||||||||||||
| 295 | fragment_end = fragment; | - | ||||||||||||
| 296 | } never executed: else {end of block | 0 | ||||||||||||
| 297 | ((!(false)) ? qt_assert("false",__FILE__,549) : qt_noop()); | - | ||||||||||||
| 298 | } never executed: end of block | 0 | ||||||||||||
| 299 | } | - | ||||||||||||
| 300 | - | |||||||||||||
| 301 | void QTextFramePrivate::fragmentRemoved(QChar type, uint fragment) | - | ||||||||||||
| 302 | { | - | ||||||||||||
| 303 | (void)fragment;; | - | ||||||||||||
| 304 | if (type == QChar(0xfdd0)
| 0 | ||||||||||||
| 305 | ((!(fragment_start == fragment)) ? qt_assert("fragment_start == fragment",__FILE__,557) : qt_noop()); | - | ||||||||||||
| 306 | fragment_start = 0; | - | ||||||||||||
| 307 | } never executed: else if (type == QChar(0xfdd1)end of block
| 0 | ||||||||||||
| 308 | ((!(fragment_end == fragment)) ? qt_assert("fragment_end == fragment",__FILE__,560) : qt_noop()); | - | ||||||||||||
| 309 | fragment_end = 0; | - | ||||||||||||
| 310 | } never executed: else if (type == QChar::ObjectReplacementCharacterend of block
| 0 | ||||||||||||
| 311 | ((!(fragment_start == fragment)) ? qt_assert("fragment_start == fragment",__FILE__,563) : qt_noop()); | - | ||||||||||||
| 312 | ((!(fragment_end == fragment)) ? qt_assert("fragment_end == fragment",__FILE__,564) : qt_noop()); | - | ||||||||||||
| 313 | fragment_start = 0; | - | ||||||||||||
| 314 | fragment_end = 0; | - | ||||||||||||
| 315 | } never executed: else {end of block | 0 | ||||||||||||
| 316 | ((!(false)) ? qt_assert("false",__FILE__,568) : qt_noop()); | - | ||||||||||||
| 317 | } never executed: end of block | 0 | ||||||||||||
| 318 | remove_me(); | - | ||||||||||||
| 319 | } never executed: end of block | 0 | ||||||||||||
| 320 | - | |||||||||||||
| 321 | - | |||||||||||||
| 322 | void QTextFramePrivate::remove_me() | - | ||||||||||||
| 323 | { | - | ||||||||||||
| 324 | QTextFrame * const q = q_func(); | - | ||||||||||||
| 325 | if (fragment_start == 0
| 0 | ||||||||||||
| 326 | && !parentFrame
| 0 | ||||||||||||
| 327 | q->document()->docHandle()->deleteObject(q); | - | ||||||||||||
| 328 | return; never executed: return; | 0 | ||||||||||||
| 329 | } | - | ||||||||||||
| 330 | - | |||||||||||||
| 331 | if (!parentFrame
| 0 | ||||||||||||
| 332 | return; never executed: return; | 0 | ||||||||||||
| 333 | - | |||||||||||||
| 334 | int index = parentFrame->d_func()->childFrames.indexOf(q); | - | ||||||||||||
| 335 | - | |||||||||||||
| 336 | - | |||||||||||||
| 337 | for (int i = 0; i < childFrames.size()
| 0 | ||||||||||||
| 338 | QTextFrame *c = childFrames.at(i); | - | ||||||||||||
| 339 | parentFrame->d_func()->childFrames.insert(index, c); | - | ||||||||||||
| 340 | c->d_func()->parentFrame = parentFrame; | - | ||||||||||||
| 341 | ++index; | - | ||||||||||||
| 342 | } never executed: end of block | 0 | ||||||||||||
| 343 | ((!(parentFrame->d_func()->childFrames.at(index) == q)) ? qt_assert("parentFrame->d_func()->childFrames.at(index) == q",__FILE__,595) : qt_noop()); | - | ||||||||||||
| 344 | parentFrame->d_func()->childFrames.removeAt(index); | - | ||||||||||||
| 345 | - | |||||||||||||
| 346 | childFrames.clear(); | - | ||||||||||||
| 347 | parentFrame = 0; | - | ||||||||||||
| 348 | } never executed: end of block | 0 | ||||||||||||
| 349 | QTextFrame::iterator QTextFrame::begin() const | - | ||||||||||||
| 350 | { | - | ||||||||||||
| 351 | const QTextDocumentPrivate *priv = docHandle(); | - | ||||||||||||
| 352 | int b = priv->blockMap().findNode(firstPosition()); | - | ||||||||||||
| 353 | int e = priv->blockMap().findNode(lastPosition()+1); | - | ||||||||||||
| 354 | return never executed: iterator(const_cast<QTextFrame *>(this), b, b, e);return iterator(const_cast<QTextFrame *>(this), b, b, e);never executed: return iterator(const_cast<QTextFrame *>(this), b, b, e); | 0 | ||||||||||||
| 355 | } | - | ||||||||||||
| 356 | - | |||||||||||||
| 357 | - | |||||||||||||
| 358 | - | |||||||||||||
| 359 | - | |||||||||||||
| 360 | - | |||||||||||||
| 361 | - | |||||||||||||
| 362 | QTextFrame::iterator QTextFrame::end() const | - | ||||||||||||
| 363 | { | - | ||||||||||||
| 364 | const QTextDocumentPrivate *priv = docHandle(); | - | ||||||||||||
| 365 | int b = priv->blockMap().findNode(firstPosition()); | - | ||||||||||||
| 366 | int e = priv->blockMap().findNode(lastPosition()+1); | - | ||||||||||||
| 367 | return never executed: iterator(const_cast<QTextFrame *>(this), e, b, e);return iterator(const_cast<QTextFrame *>(this), e, b, e);never executed: return iterator(const_cast<QTextFrame *>(this), e, b, e); | 0 | ||||||||||||
| 368 | } | - | ||||||||||||
| 369 | - | |||||||||||||
| 370 | - | |||||||||||||
| 371 | - | |||||||||||||
| 372 | - | |||||||||||||
| 373 | QTextFrame::iterator::iterator() | - | ||||||||||||
| 374 | { | - | ||||||||||||
| 375 | f = 0; | - | ||||||||||||
| 376 | b = 0; | - | ||||||||||||
| 377 | e = 0; | - | ||||||||||||
| 378 | cf = 0; | - | ||||||||||||
| 379 | cb = 0; | - | ||||||||||||
| 380 | } never executed: end of block | 0 | ||||||||||||
| 381 | - | |||||||||||||
| 382 | - | |||||||||||||
| 383 | - | |||||||||||||
| 384 | - | |||||||||||||
| 385 | QTextFrame::iterator::iterator(QTextFrame *frame, int block, int begin, int end) | - | ||||||||||||
| 386 | { | - | ||||||||||||
| 387 | f = frame; | - | ||||||||||||
| 388 | b = begin; | - | ||||||||||||
| 389 | e = end; | - | ||||||||||||
| 390 | cf = 0; | - | ||||||||||||
| 391 | cb = block; | - | ||||||||||||
| 392 | } never executed: end of block | 0 | ||||||||||||
| 393 | - | |||||||||||||
| 394 | - | |||||||||||||
| 395 | - | |||||||||||||
| 396 | - | |||||||||||||
| 397 | - | |||||||||||||
| 398 | - | |||||||||||||
| 399 | QTextFrame::iterator::iterator(const iterator &other) noexcept | - | ||||||||||||
| 400 | { | - | ||||||||||||
| 401 | f = other.f; | - | ||||||||||||
| 402 | b = other.b; | - | ||||||||||||
| 403 | e = other.e; | - | ||||||||||||
| 404 | cf = other.cf; | - | ||||||||||||
| 405 | cb = other.cb; | - | ||||||||||||
| 406 | } never executed: end of block | 0 | ||||||||||||
| 407 | - | |||||||||||||
| 408 | - | |||||||||||||
| 409 | - | |||||||||||||
| 410 | - | |||||||||||||
| 411 | - | |||||||||||||
| 412 | QTextFrame::iterator &QTextFrame::iterator::operator=(const iterator &other) noexcept | - | ||||||||||||
| 413 | { | - | ||||||||||||
| 414 | f = other.f; | - | ||||||||||||
| 415 | b = other.b; | - | ||||||||||||
| 416 | e = other.e; | - | ||||||||||||
| 417 | cf = other.cf; | - | ||||||||||||
| 418 | cb = other.cb; | - | ||||||||||||
| 419 | return never executed: *this;return *this;never executed: return *this; | 0 | ||||||||||||
| 420 | } | - | ||||||||||||
| 421 | QTextFrame *QTextFrame::iterator::currentFrame() const | - | ||||||||||||
| 422 | { | - | ||||||||||||
| 423 | return never executed: cf;return cf;never executed: return cf; | 0 | ||||||||||||
| 424 | } | - | ||||||||||||
| 425 | - | |||||||||||||
| 426 | - | |||||||||||||
| 427 | - | |||||||||||||
| 428 | - | |||||||||||||
| 429 | - | |||||||||||||
| 430 | - | |||||||||||||
| 431 | - | |||||||||||||
| 432 | QTextBlock QTextFrame::iterator::currentBlock() const | - | ||||||||||||
| 433 | { | - | ||||||||||||
| 434 | if (!f
| 0 | ||||||||||||
| 435 | return never executed: QTextBlock();return QTextBlock();never executed: return QTextBlock(); | 0 | ||||||||||||
| 436 | return never executed: QTextBlock(f->docHandle(), cb);return QTextBlock(f->docHandle(), cb);never executed: return QTextBlock(f->docHandle(), cb); | 0 | ||||||||||||
| 437 | } | - | ||||||||||||
| 438 | - | |||||||||||||
| 439 | - | |||||||||||||
| 440 | - | |||||||||||||
| 441 | - | |||||||||||||
| 442 | - | |||||||||||||
| 443 | - | |||||||||||||
| 444 | QTextFrame::iterator &QTextFrame::iterator::operator++() | - | ||||||||||||
| 445 | { | - | ||||||||||||
| 446 | const QTextDocumentPrivate *priv = f->docHandle(); | - | ||||||||||||
| 447 | const QTextDocumentPrivate::BlockMap &map = priv->blockMap(); | - | ||||||||||||
| 448 | if (cf
| 0 | ||||||||||||
| 449 | int end = cf->lastPosition() + 1; | - | ||||||||||||
| 450 | cb = map.findNode(end); | - | ||||||||||||
| 451 | cf = 0; | - | ||||||||||||
| 452 | } never executed: else if (cbend of block
| 0 | ||||||||||||
| 453 | cb = map.next(cb); | - | ||||||||||||
| 454 | if (cb == e
| 0 | ||||||||||||
| 455 | return never executed: *this;return *this;never executed: return *this; | 0 | ||||||||||||
| 456 | - | |||||||||||||
| 457 | if (!f->d_func()->childFrames.isEmpty()
| 0 | ||||||||||||
| 458 | int pos = map.position(cb); | - | ||||||||||||
| 459 | - | |||||||||||||
| 460 | QTextDocumentPrivate::FragmentIterator frag = priv->find(pos-1); | - | ||||||||||||
| 461 | if (priv->buffer().at(frag->stringPosition) != QChar::ParagraphSeparator
| 0 | ||||||||||||
| 462 | QTextFrame *nf = qobject_cast<QTextFrame *>(priv->objectForFormat(frag->format)); | - | ||||||||||||
| 463 | if (nf
| 0 | ||||||||||||
| 464 | if (priv->buffer().at(frag->stringPosition) == QChar(0xfdd0)
| 0 | ||||||||||||
| 465 | cf = nf; | - | ||||||||||||
| 466 | cb = 0; | - | ||||||||||||
| 467 | } never executed: else {end of block | 0 | ||||||||||||
| 468 | ((!(priv->buffer().at(frag->stringPosition) != QChar(0xfdd1))) ? qt_assert("priv->buffer().at(frag->stringPosition) != QTextEndOfFrame",__FILE__,759) : qt_noop()); | - | ||||||||||||
| 469 | } never executed: end of block | 0 | ||||||||||||
| 470 | } | - | ||||||||||||
| 471 | } never executed: end of block | 0 | ||||||||||||
| 472 | } never executed: end of block | 0 | ||||||||||||
| 473 | } never executed: end of block | 0 | ||||||||||||
| 474 | return never executed: *this;return *this;never executed: return *this; | 0 | ||||||||||||
| 475 | } | - | ||||||||||||
| 476 | - | |||||||||||||
| 477 | - | |||||||||||||
| 478 | - | |||||||||||||
| 479 | - | |||||||||||||
| 480 | - | |||||||||||||
| 481 | - | |||||||||||||
| 482 | QTextFrame::iterator &QTextFrame::iterator::operator--() | - | ||||||||||||
| 483 | { | - | ||||||||||||
| 484 | const QTextDocumentPrivate *priv = f->docHandle(); | - | ||||||||||||
| 485 | const QTextDocumentPrivate::BlockMap &map = priv->blockMap(); | - | ||||||||||||
| 486 | if (cf
| 0 | ||||||||||||
| 487 | int start = cf->firstPosition() - 1; | - | ||||||||||||
| 488 | cb = map.findNode(start); | - | ||||||||||||
| 489 | cf = 0; | - | ||||||||||||
| 490 | } never executed: else {end of block | 0 | ||||||||||||
| 491 | if (cb == b
| 0 | ||||||||||||
| 492 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||
| 493 | if (cb != e
| 0 | ||||||||||||
| 494 | int pos = map.position(cb); | - | ||||||||||||
| 495 | - | |||||||||||||
| 496 | QTextDocumentPrivate::FragmentIterator frag = priv->find(pos-1); | - | ||||||||||||
| 497 | if (priv->buffer().at(frag->stringPosition) != QChar::ParagraphSeparator
| 0 | ||||||||||||
| 498 | QTextFrame *pf = qobject_cast<QTextFrame *>(priv->objectForFormat(frag->format)); | - | ||||||||||||
| 499 | if (pf
| 0 | ||||||||||||
| 500 | if (priv->buffer().at(frag->stringPosition) == QChar(0xfdd0)
| 0 | ||||||||||||
| 501 | ((!(pf == f)) ? qt_assert("pf == f",__FILE__,792) : qt_noop()); | - | ||||||||||||
| 502 | } never executed: else if (priv->buffer().at(frag->stringPosition) == QChar(0xfdd1)end of block
| 0 | ||||||||||||
| 503 | ((!(pf != f)) ? qt_assert("pf != f",__FILE__,794) : qt_noop()); | - | ||||||||||||
| 504 | cf = pf; | - | ||||||||||||
| 505 | cb = 0; | - | ||||||||||||
| 506 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||
| 507 | } | - | ||||||||||||
| 508 | } never executed: end of block | 0 | ||||||||||||
| 509 | } never executed: end of block | 0 | ||||||||||||
| 510 | } never executed: end of block | 0 | ||||||||||||
| 511 | cb = map.previous(cb); | - | ||||||||||||
| 512 | } never executed: end of block | 0 | ||||||||||||
| 513 | end: code before this statement never executed: end: | 0 | ||||||||||||
| 514 | return never executed: *this;return *this;never executed: return *this; | 0 | ||||||||||||
| 515 | } | - | ||||||||||||
| 516 | QTextBlockUserData::~QTextBlockUserData() | - | ||||||||||||
| 517 | { | - | ||||||||||||
| 518 | } | - | ||||||||||||
| 519 | bool QTextBlock::isValid() const | - | ||||||||||||
| 520 | { | - | ||||||||||||
| 521 | return never executed: p != 0 && p->blockMap().isValid(n);return p != 0 && p->blockMap().isValid(n);never executed: return p != 0 && p->blockMap().isValid(n); | 0 | ||||||||||||
| 522 | } | - | ||||||||||||
| 523 | int QTextBlock::position() const | - | ||||||||||||
| 524 | { | - | ||||||||||||
| 525 | if (!p
| 0 | ||||||||||||
| 526 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 527 | - | |||||||||||||
| 528 | return never executed: p->blockMap().position(n);return p->blockMap().position(n);never executed: return p->blockMap().position(n); | 0 | ||||||||||||
| 529 | } | - | ||||||||||||
| 530 | int QTextBlock::length() const | - | ||||||||||||
| 531 | { | - | ||||||||||||
| 532 | if (!p
| 0 | ||||||||||||
| 533 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 534 | - | |||||||||||||
| 535 | return never executed: p->blockMap().size(n);return p->blockMap().size(n);never executed: return p->blockMap().size(n); | 0 | ||||||||||||
| 536 | } | - | ||||||||||||
| 537 | - | |||||||||||||
| 538 | - | |||||||||||||
| 539 | - | |||||||||||||
| 540 | - | |||||||||||||
| 541 | - | |||||||||||||
| 542 | bool QTextBlock::contains(int position) const | - | ||||||||||||
| 543 | { | - | ||||||||||||
| 544 | if (!p
| 0 | ||||||||||||
| 545 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||
| 546 | - | |||||||||||||
| 547 | int pos = p->blockMap().position(n); | - | ||||||||||||
| 548 | int len = p->blockMap().size(n); | - | ||||||||||||
| 549 | return never executed: position >= pos && position < pos + len;return position >= pos && position < pos + len;never executed: return position >= pos && position < pos + len; | 0 | ||||||||||||
| 550 | } | - | ||||||||||||
| 551 | QTextLayout *QTextBlock::layout() const | - | ||||||||||||
| 552 | { | - | ||||||||||||
| 553 | if (!p
| 0 | ||||||||||||
| 554 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 555 | - | |||||||||||||
| 556 | const QTextBlockData *b = p->blockMap().fragment(n); | - | ||||||||||||
| 557 | if (!b->layout
| 0 | ||||||||||||
| 558 | b->layout = new QTextLayout(*this); never executed: b->layout = new QTextLayout(*this); | 0 | ||||||||||||
| 559 | return never executed: b->layout;return b->layout;never executed: return b->layout; | 0 | ||||||||||||
| 560 | } | - | ||||||||||||
| 561 | void QTextBlock::clearLayout() | - | ||||||||||||
| 562 | { | - | ||||||||||||
| 563 | if (!p
| 0 | ||||||||||||
| 564 | return; never executed: return; | 0 | ||||||||||||
| 565 | - | |||||||||||||
| 566 | const QTextBlockData *b = p->blockMap().fragment(n); | - | ||||||||||||
| 567 | if (b->layout
| 0 | ||||||||||||
| 568 | b->layout->clearLayout(); never executed: b->layout->clearLayout(); | 0 | ||||||||||||
| 569 | } never executed: end of block | 0 | ||||||||||||
| 570 | - | |||||||||||||
| 571 | - | |||||||||||||
| 572 | - | |||||||||||||
| 573 | - | |||||||||||||
| 574 | - | |||||||||||||
| 575 | - | |||||||||||||
| 576 | QTextBlockFormat QTextBlock::blockFormat() const | - | ||||||||||||
| 577 | { | - | ||||||||||||
| 578 | if (!p
| 0 | ||||||||||||
| 579 | return never executed: QTextFormat().toBlockFormat();return QTextFormat().toBlockFormat();never executed: return QTextFormat().toBlockFormat(); | 0 | ||||||||||||
| 580 | - | |||||||||||||
| 581 | return never executed: p->formatCollection()->blockFormat(p->blockMap().fragment(n)->format);return p->formatCollection()->blockFormat(p->blockMap().fragment(n)->format);never executed: return p->formatCollection()->blockFormat(p->blockMap().fragment(n)->format); | 0 | ||||||||||||
| 582 | } | - | ||||||||||||
| 583 | - | |||||||||||||
| 584 | - | |||||||||||||
| 585 | - | |||||||||||||
| 586 | - | |||||||||||||
| 587 | - | |||||||||||||
| 588 | - | |||||||||||||
| 589 | - | |||||||||||||
| 590 | int QTextBlock::blockFormatIndex() const | - | ||||||||||||
| 591 | { | - | ||||||||||||
| 592 | if (!p
| 0 | ||||||||||||
| 593 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||
| 594 | - | |||||||||||||
| 595 | return never executed: p->blockMap().fragment(n)->format;return p->blockMap().fragment(n)->format;never executed: return p->blockMap().fragment(n)->format; | 0 | ||||||||||||
| 596 | } | - | ||||||||||||
| 597 | QTextCharFormat QTextBlock::charFormat() const | - | ||||||||||||
| 598 | { | - | ||||||||||||
| 599 | if (!p
| 0 | ||||||||||||
| 600 | return never executed: QTextFormat().toCharFormat();return QTextFormat().toCharFormat();never executed: return QTextFormat().toCharFormat(); | 0 | ||||||||||||
| 601 | - | |||||||||||||
| 602 | return never executed: p->formatCollection()->charFormat(charFormatIndex());return p->formatCollection()->charFormat(charFormatIndex());never executed: return p->formatCollection()->charFormat(charFormatIndex()); | 0 | ||||||||||||
| 603 | } | - | ||||||||||||
| 604 | - | |||||||||||||
| 605 | - | |||||||||||||
| 606 | - | |||||||||||||
| 607 | - | |||||||||||||
| 608 | - | |||||||||||||
| 609 | - | |||||||||||||
| 610 | - | |||||||||||||
| 611 | int QTextBlock::charFormatIndex() const | - | ||||||||||||
| 612 | { | - | ||||||||||||
| 613 | if (!p
| 0 | ||||||||||||
| 614 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||
| 615 | - | |||||||||||||
| 616 | return never executed: p->blockCharFormatIndex(n);return p->blockCharFormatIndex(n);never executed: return p->blockCharFormatIndex(n); | 0 | ||||||||||||
| 617 | } | - | ||||||||||||
| 618 | Qt::LayoutDirection QTextBlock::textDirection() const | - | ||||||||||||
| 619 | { | - | ||||||||||||
| 620 | Qt::LayoutDirection dir = blockFormat().layoutDirection(); | - | ||||||||||||
| 621 | if (dir != Qt::LayoutDirectionAuto
| 0 | ||||||||||||
| 622 | return never executed: dir;return dir;never executed: return dir; | 0 | ||||||||||||
| 623 | - | |||||||||||||
| 624 | dir = p->defaultTextOption.textDirection(); | - | ||||||||||||
| 625 | if (dir != Qt::LayoutDirectionAuto
| 0 | ||||||||||||
| 626 | return never executed: dir;return dir;never executed: return dir; | 0 | ||||||||||||
| 627 | - | |||||||||||||
| 628 | const QString buffer = p->buffer(); | - | ||||||||||||
| 629 | - | |||||||||||||
| 630 | const int pos = position(); | - | ||||||||||||
| 631 | QTextDocumentPrivate::FragmentIterator it = p->find(pos); | - | ||||||||||||
| 632 | QTextDocumentPrivate::FragmentIterator end = p->find(pos + length() - 1); | - | ||||||||||||
| 633 | for (; it != end
| 0 | ||||||||||||
| 634 | const QTextFragmentData * const frag = it.value(); | - | ||||||||||||
| 635 | const QChar *p = buffer.constData() + frag->stringPosition; | - | ||||||||||||
| 636 | const QChar * const end = p + frag->size_array[0]; | - | ||||||||||||
| 637 | while (p < end
| 0 | ||||||||||||
| 638 | uint ucs4 = p->unicode(); | - | ||||||||||||
| 639 | if (QChar::isHighSurrogate(ucs4)
| 0 | ||||||||||||
| 640 | ushort low = p[1].unicode(); | - | ||||||||||||
| 641 | if (QChar::isLowSurrogate(low)
| 0 | ||||||||||||
| 642 | ucs4 = QChar::surrogateToUcs4(ucs4, low); | - | ||||||||||||
| 643 | ++p; | - | ||||||||||||
| 644 | } never executed: end of block | 0 | ||||||||||||
| 645 | } never executed: end of block | 0 | ||||||||||||
| 646 | switch (QChar::direction(ucs4)) { | - | ||||||||||||
| 647 | case never executed: QChar::DirL:case QChar::DirL:never executed: case QChar::DirL: | 0 | ||||||||||||
| 648 | return never executed: Qt::LeftToRight;return Qt::LeftToRight;never executed: return Qt::LeftToRight; | 0 | ||||||||||||
| 649 | case never executed: QChar::DirR:case QChar::DirR:never executed: case QChar::DirR: | 0 | ||||||||||||
| 650 | case never executed: QChar::DirAL:case QChar::DirAL:never executed: case QChar::DirAL: | 0 | ||||||||||||
| 651 | return never executed: Qt::RightToLeft;return Qt::RightToLeft;never executed: return Qt::RightToLeft; | 0 | ||||||||||||
| 652 | default never executed: :default:never executed: default: | 0 | ||||||||||||
| 653 | break; never executed: break; | 0 | ||||||||||||
| 654 | } | - | ||||||||||||
| 655 | ++p; | - | ||||||||||||
| 656 | } never executed: end of block | 0 | ||||||||||||
| 657 | } never executed: end of block | 0 | ||||||||||||
| 658 | return never executed: Qt::LeftToRight;return Qt::LeftToRight;never executed: return Qt::LeftToRight; | 0 | ||||||||||||
| 659 | } | - | ||||||||||||
| 660 | - | |||||||||||||
| 661 | - | |||||||||||||
| 662 | - | |||||||||||||
| 663 | - | |||||||||||||
| 664 | - | |||||||||||||
| 665 | - | |||||||||||||
| 666 | QString QTextBlock::text() const | - | ||||||||||||
| 667 | { | - | ||||||||||||
| 668 | if (!p
| 0 | ||||||||||||
| 669 | return never executed: QString();return QString();never executed: return QString(); | 0 | ||||||||||||
| 670 | - | |||||||||||||
| 671 | const QString buffer = p->buffer(); | - | ||||||||||||
| 672 | QString text; | - | ||||||||||||
| 673 | text.reserve(length()); | - | ||||||||||||
| 674 | - | |||||||||||||
| 675 | const int pos = position(); | - | ||||||||||||
| 676 | QTextDocumentPrivate::FragmentIterator it = p->find(pos); | - | ||||||||||||
| 677 | QTextDocumentPrivate::FragmentIterator end = p->find(pos + length() - 1); | - | ||||||||||||
| 678 | for (; it != end
| 0 | ||||||||||||
| 679 | const QTextFragmentData * const frag = it.value(); | - | ||||||||||||
| 680 | text += QString::fromRawData(buffer.constData() + frag->stringPosition, frag->size_array[0]); | - | ||||||||||||
| 681 | } never executed: end of block | 0 | ||||||||||||
| 682 | - | |||||||||||||
| 683 | return never executed: text;return text;never executed: return text; | 0 | ||||||||||||
| 684 | } | - | ||||||||||||
| 685 | QVector<QTextLayout::FormatRange> QTextBlock::textFormats() const | - | ||||||||||||
| 686 | { | - | ||||||||||||
| 687 | QVector<QTextLayout::FormatRange> formats; | - | ||||||||||||
| 688 | if (!p
| 0 | ||||||||||||
| 689 | return never executed: formats;return formats;never executed: return formats; | 0 | ||||||||||||
| 690 | - | |||||||||||||
| 691 | const QTextFormatCollection *formatCollection = p->formatCollection(); | - | ||||||||||||
| 692 | - | |||||||||||||
| 693 | int start = 0; | - | ||||||||||||
| 694 | int cur = start; | - | ||||||||||||
| 695 | int format = -1; | - | ||||||||||||
| 696 | - | |||||||||||||
| 697 | const int pos = position(); | - | ||||||||||||
| 698 | QTextDocumentPrivate::FragmentIterator it = p->find(pos); | - | ||||||||||||
| 699 | QTextDocumentPrivate::FragmentIterator end = p->find(pos + length() - 1); | - | ||||||||||||
| 700 | for (; it != end
| 0 | ||||||||||||
| 701 | const QTextFragmentData * const frag = it.value(); | - | ||||||||||||
| 702 | if (format != it.value()->format
| 0 | ||||||||||||
| 703 | if (cur - start > 0
| 0 | ||||||||||||
| 704 | QTextLayout::FormatRange range; | - | ||||||||||||
| 705 | range.start = start; | - | ||||||||||||
| 706 | range.length = cur - start; | - | ||||||||||||
| 707 | range.format = formatCollection->charFormat(format); | - | ||||||||||||
| 708 | formats.append(range); | - | ||||||||||||
| 709 | } never executed: end of block | 0 | ||||||||||||
| 710 | - | |||||||||||||
| 711 | format = frag->format; | - | ||||||||||||
| 712 | start = cur; | - | ||||||||||||
| 713 | } never executed: end of block | 0 | ||||||||||||
| 714 | cur += frag->size_array[0]; | - | ||||||||||||
| 715 | } never executed: end of block | 0 | ||||||||||||
| 716 | if (cur - start > 0
| 0 | ||||||||||||
| 717 | QTextLayout::FormatRange range; | - | ||||||||||||
| 718 | range.start = start; | - | ||||||||||||
| 719 | range.length = cur - start; | - | ||||||||||||
| 720 | range.format = formatCollection->charFormat(format); | - | ||||||||||||
| 721 | formats.append(range); | - | ||||||||||||
| 722 | } never executed: end of block | 0 | ||||||||||||
| 723 | - | |||||||||||||
| 724 | return never executed: formats;return formats;never executed: return formats; | 0 | ||||||||||||
| 725 | } | - | ||||||||||||
| 726 | - | |||||||||||||
| 727 | - | |||||||||||||
| 728 | - | |||||||||||||
| 729 | - | |||||||||||||
| 730 | - | |||||||||||||
| 731 | const QTextDocument *QTextBlock::document() const | - | ||||||||||||
| 732 | { | - | ||||||||||||
| 733 | return never executed: p ? p->document() : 0;return p ? p->document() : 0;never executed: return p ? p->document() : 0; | 0 | ||||||||||||
| 734 | } | - | ||||||||||||
| 735 | - | |||||||||||||
| 736 | - | |||||||||||||
| 737 | - | |||||||||||||
| 738 | - | |||||||||||||
| 739 | - | |||||||||||||
| 740 | QTextList *QTextBlock::textList() const | - | ||||||||||||
| 741 | { | - | ||||||||||||
| 742 | if (!isValid()
| 0 | ||||||||||||
| 743 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 744 | - | |||||||||||||
| 745 | const QTextBlockFormat fmt = blockFormat(); | - | ||||||||||||
| 746 | QTextObject *obj = p->document()->objectForFormat(fmt); | - | ||||||||||||
| 747 | return never executed: qobject_cast<QTextList *>(obj);return qobject_cast<QTextList *>(obj);never executed: return qobject_cast<QTextList *>(obj); | 0 | ||||||||||||
| 748 | } | - | ||||||||||||
| 749 | - | |||||||||||||
| 750 | - | |||||||||||||
| 751 | - | |||||||||||||
| 752 | - | |||||||||||||
| 753 | - | |||||||||||||
| 754 | - | |||||||||||||
| 755 | - | |||||||||||||
| 756 | QTextBlockUserData *QTextBlock::userData() const | - | ||||||||||||
| 757 | { | - | ||||||||||||
| 758 | if (!p
| 0 | ||||||||||||
| 759 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 760 | - | |||||||||||||
| 761 | const QTextBlockData *b = p->blockMap().fragment(n); | - | ||||||||||||
| 762 | return never executed: b->userData;return b->userData;never executed: return b->userData; | 0 | ||||||||||||
| 763 | } | - | ||||||||||||
| 764 | void QTextBlock::setUserData(QTextBlockUserData *data) | - | ||||||||||||
| 765 | { | - | ||||||||||||
| 766 | if (!p
| 0 | ||||||||||||
| 767 | return; never executed: return; | 0 | ||||||||||||
| 768 | - | |||||||||||||
| 769 | const QTextBlockData *b = p->blockMap().fragment(n); | - | ||||||||||||
| 770 | if (data != b->userData
| 0 | ||||||||||||
| 771 | delete b->userData; never executed: delete b->userData; | 0 | ||||||||||||
| 772 | b->userData = data; | - | ||||||||||||
| 773 | } never executed: end of block | 0 | ||||||||||||
| 774 | - | |||||||||||||
| 775 | - | |||||||||||||
| 776 | - | |||||||||||||
| 777 | - | |||||||||||||
| 778 | - | |||||||||||||
| 779 | - | |||||||||||||
| 780 | int QTextBlock::userState() const | - | ||||||||||||
| 781 | { | - | ||||||||||||
| 782 | if (!p
| 0 | ||||||||||||
| 783 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||
| 784 | - | |||||||||||||
| 785 | const QTextBlockData *b = p->blockMap().fragment(n); | - | ||||||||||||
| 786 | return never executed: b->userState;return b->userState;never executed: return b->userState; | 0 | ||||||||||||
| 787 | } | - | ||||||||||||
| 788 | - | |||||||||||||
| 789 | - | |||||||||||||
| 790 | - | |||||||||||||
| 791 | - | |||||||||||||
| 792 | - | |||||||||||||
| 793 | - | |||||||||||||
| 794 | - | |||||||||||||
| 795 | void QTextBlock::setUserState(int state) | - | ||||||||||||
| 796 | { | - | ||||||||||||
| 797 | if (!p
| 0 | ||||||||||||
| 798 | return; never executed: return; | 0 | ||||||||||||
| 799 | - | |||||||||||||
| 800 | const QTextBlockData *b = p->blockMap().fragment(n); | - | ||||||||||||
| 801 | b->userState = state; | - | ||||||||||||
| 802 | } never executed: end of block | 0 | ||||||||||||
| 803 | int QTextBlock::revision() const | - | ||||||||||||
| 804 | { | - | ||||||||||||
| 805 | if (!p
| 0 | ||||||||||||
| 806 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||
| 807 | - | |||||||||||||
| 808 | const QTextBlockData *b = p->blockMap().fragment(n); | - | ||||||||||||
| 809 | return never executed: b->revision;return b->revision;never executed: return b->revision; | 0 | ||||||||||||
| 810 | } | - | ||||||||||||
| 811 | void QTextBlock::setRevision(int rev) | - | ||||||||||||
| 812 | { | - | ||||||||||||
| 813 | if (!p
| 0 | ||||||||||||
| 814 | return; never executed: return; | 0 | ||||||||||||
| 815 | - | |||||||||||||
| 816 | const QTextBlockData *b = p->blockMap().fragment(n); | - | ||||||||||||
| 817 | b->revision = rev; | - | ||||||||||||
| 818 | } never executed: end of block | 0 | ||||||||||||
| 819 | bool QTextBlock::isVisible() const | - | ||||||||||||
| 820 | { | - | ||||||||||||
| 821 | if (!p
| 0 | ||||||||||||
| 822 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||
| 823 | - | |||||||||||||
| 824 | const QTextBlockData *b = p->blockMap().fragment(n); | - | ||||||||||||
| 825 | return never executed: !b->hidden;return !b->hidden;never executed: return !b->hidden; | 0 | ||||||||||||
| 826 | } | - | ||||||||||||
| 827 | void QTextBlock::setVisible(bool visible) | - | ||||||||||||
| 828 | { | - | ||||||||||||
| 829 | if (!p
| 0 | ||||||||||||
| 830 | return; never executed: return; | 0 | ||||||||||||
| 831 | - | |||||||||||||
| 832 | const QTextBlockData *b = p->blockMap().fragment(n); | - | ||||||||||||
| 833 | b->hidden = !visible; | - | ||||||||||||
| 834 | } never executed: end of block | 0 | ||||||||||||
| 835 | int QTextBlock::blockNumber() const | - | ||||||||||||
| 836 | { | - | ||||||||||||
| 837 | if (!p
| 0 | ||||||||||||
| 838 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||
| 839 | return never executed: p->blockMap().position(n, 1);return p->blockMap().position(n, 1);never executed: return p->blockMap().position(n, 1); | 0 | ||||||||||||
| 840 | } | - | ||||||||||||
| 841 | int QTextBlock::firstLineNumber() const | - | ||||||||||||
| 842 | { | - | ||||||||||||
| 843 | if (!p
| 0 | ||||||||||||
| 844 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||
| 845 | return never executed: p->blockMap().position(n, 2);return p->blockMap().position(n, 2);never executed: return p->blockMap().position(n, 2); | 0 | ||||||||||||
| 846 | } | - | ||||||||||||
| 847 | void QTextBlock::setLineCount(int count) | - | ||||||||||||
| 848 | { | - | ||||||||||||
| 849 | if (!p
| 0 | ||||||||||||
| 850 | return; never executed: return; | 0 | ||||||||||||
| 851 | p->blockMap().setSize(n, count, 2); | - | ||||||||||||
| 852 | } never executed: end of block | 0 | ||||||||||||
| 853 | - | |||||||||||||
| 854 | - | |||||||||||||
| 855 | - | |||||||||||||
| 856 | - | |||||||||||||
| 857 | - | |||||||||||||
| 858 | - | |||||||||||||
| 859 | - | |||||||||||||
| 860 | int QTextBlock::lineCount() const | - | ||||||||||||
| 861 | { | - | ||||||||||||
| 862 | if (!p
| 0 | ||||||||||||
| 863 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||
| 864 | return never executed: p->blockMap().size(n, 2);return p->blockMap().size(n, 2);never executed: return p->blockMap().size(n, 2); | 0 | ||||||||||||
| 865 | } | - | ||||||||||||
| 866 | QTextBlock::iterator QTextBlock::begin() const | - | ||||||||||||
| 867 | { | - | ||||||||||||
| 868 | if (!p
| 0 | ||||||||||||
| 869 | return never executed: iterator();return iterator();never executed: return iterator(); | 0 | ||||||||||||
| 870 | - | |||||||||||||
| 871 | int pos = position(); | - | ||||||||||||
| 872 | int len = length() - 1; | - | ||||||||||||
| 873 | int b = p->fragmentMap().findNode(pos); | - | ||||||||||||
| 874 | int e = p->fragmentMap().findNode(pos+len); | - | ||||||||||||
| 875 | return never executed: iterator(p, b, e, b);return iterator(p, b, e, b);never executed: return iterator(p, b, e, b); | 0 | ||||||||||||
| 876 | } | - | ||||||||||||
| 877 | - | |||||||||||||
| 878 | - | |||||||||||||
| 879 | - | |||||||||||||
| 880 | - | |||||||||||||
| 881 | - | |||||||||||||
| 882 | - | |||||||||||||
| 883 | - | |||||||||||||
| 884 | QTextBlock::iterator QTextBlock::end() const | - | ||||||||||||
| 885 | { | - | ||||||||||||
| 886 | if (!p
| 0 | ||||||||||||
| 887 | return never executed: iterator();return iterator();never executed: return iterator(); | 0 | ||||||||||||
| 888 | - | |||||||||||||
| 889 | int pos = position(); | - | ||||||||||||
| 890 | int len = length() - 1; | - | ||||||||||||
| 891 | int b = p->fragmentMap().findNode(pos); | - | ||||||||||||
| 892 | int e = p->fragmentMap().findNode(pos+len); | - | ||||||||||||
| 893 | return never executed: iterator(p, b, e, e);return iterator(p, b, e, e);never executed: return iterator(p, b, e, e); | 0 | ||||||||||||
| 894 | } | - | ||||||||||||
| 895 | QTextBlock QTextBlock::next() const | - | ||||||||||||
| 896 | { | - | ||||||||||||
| 897 | if (!isValid()
| 0 | ||||||||||||
| 898 | return never executed: QTextBlock();return QTextBlock();never executed: return QTextBlock(); | 0 | ||||||||||||
| 899 | - | |||||||||||||
| 900 | return never executed: QTextBlock(p, p->blockMap().next(n));return QTextBlock(p, p->blockMap().next(n));never executed: return QTextBlock(p, p->blockMap().next(n)); | 0 | ||||||||||||
| 901 | } | - | ||||||||||||
| 902 | QTextBlock QTextBlock::previous() const | - | ||||||||||||
| 903 | { | - | ||||||||||||
| 904 | if (!p
| 0 | ||||||||||||
| 905 | return never executed: QTextBlock();return QTextBlock();never executed: return QTextBlock(); | 0 | ||||||||||||
| 906 | - | |||||||||||||
| 907 | return never executed: QTextBlock(p, p->blockMap().previous(n));return QTextBlock(p, p->blockMap().previous(n));never executed: return QTextBlock(p, p->blockMap().previous(n)); | 0 | ||||||||||||
| 908 | } | - | ||||||||||||
| 909 | - | |||||||||||||
| 910 | - | |||||||||||||
| 911 | - | |||||||||||||
| 912 | - | |||||||||||||
| 913 | - | |||||||||||||
| 914 | QTextFragment QTextBlock::iterator::fragment() const | - | ||||||||||||
| 915 | { | - | ||||||||||||
| 916 | int ne = n; | - | ||||||||||||
| 917 | int formatIndex = p->fragmentMap().fragment(n)->format; | - | ||||||||||||
| 918 | do { | - | ||||||||||||
| 919 | ne = p->fragmentMap().next(ne); | - | ||||||||||||
| 920 | } never executed: while (ne != eend of block
| 0 | ||||||||||||
| 921 | return never executed: QTextFragment(p, n, ne);return QTextFragment(p, n, ne);never executed: return QTextFragment(p, n, ne); | 0 | ||||||||||||
| 922 | } | - | ||||||||||||
| 923 | - | |||||||||||||
| 924 | - | |||||||||||||
| 925 | - | |||||||||||||
| 926 | - | |||||||||||||
| 927 | - | |||||||||||||
| 928 | - | |||||||||||||
| 929 | - | |||||||||||||
| 930 | QTextBlock::iterator &QTextBlock::iterator::operator++() | - | ||||||||||||
| 931 | { | - | ||||||||||||
| 932 | int ne = n; | - | ||||||||||||
| 933 | int formatIndex = p->fragmentMap().fragment(n)->format; | - | ||||||||||||
| 934 | do { | - | ||||||||||||
| 935 | ne = p->fragmentMap().next(ne); | - | ||||||||||||
| 936 | } never executed: while (ne != eend of block
| 0 | ||||||||||||
| 937 | n = ne; | - | ||||||||||||
| 938 | return never executed: *this;return *this;never executed: return *this; | 0 | ||||||||||||
| 939 | } | - | ||||||||||||
| 940 | - | |||||||||||||
| 941 | - | |||||||||||||
| 942 | - | |||||||||||||
| 943 | - | |||||||||||||
| 944 | - | |||||||||||||
| 945 | - | |||||||||||||
| 946 | QTextBlock::iterator &QTextBlock::iterator::operator--() | - | ||||||||||||
| 947 | { | - | ||||||||||||
| 948 | n = p->fragmentMap().previous(n); | - | ||||||||||||
| 949 | - | |||||||||||||
| 950 | if (n == b
| 0 | ||||||||||||
| 951 | return never executed: *this;return *this;never executed: return *this; | 0 | ||||||||||||
| 952 | - | |||||||||||||
| 953 | int formatIndex = p->fragmentMap().fragment(n)->format; | - | ||||||||||||
| 954 | int last = n; | - | ||||||||||||
| 955 | - | |||||||||||||
| 956 | while (n != b
| 0 | ||||||||||||
| 957 | last = n; | - | ||||||||||||
| 958 | n = p->fragmentMap().previous(n); | - | ||||||||||||
| 959 | } never executed: end of block | 0 | ||||||||||||
| 960 | - | |||||||||||||
| 961 | n = last; | - | ||||||||||||
| 962 | return never executed: *this;return *this;never executed: return *this; | 0 | ||||||||||||
| 963 | } | - | ||||||||||||
| 964 | QList<QGlyphRun> QTextFragment::glyphRuns(int pos, int len) const | - | ||||||||||||
| 965 | { | - | ||||||||||||
| 966 | if (!p
| 0 | ||||||||||||
| 967 | return never executed: QList<QGlyphRun>();return QList<QGlyphRun>();never executed: return QList<QGlyphRun>(); | 0 | ||||||||||||
| 968 | - | |||||||||||||
| 969 | int blockNode = p->blockMap().findNode(position()); | - | ||||||||||||
| 970 | - | |||||||||||||
| 971 | const QTextBlockData *blockData = p->blockMap().fragment(blockNode); | - | ||||||||||||
| 972 | QTextLayout *layout = blockData->layout; | - | ||||||||||||
| 973 | - | |||||||||||||
| 974 | int blockPosition = p->blockMap().position(blockNode); | - | ||||||||||||
| 975 | if (pos < 0
| 0 | ||||||||||||
| 976 | pos = position() - blockPosition; never executed: pos = position() - blockPosition; | 0 | ||||||||||||
| 977 | if (len < 0
| 0 | ||||||||||||
| 978 | len = length(); never executed: len = length(); | 0 | ||||||||||||
| 979 | if (len == 0
| 0 | ||||||||||||
| 980 | return never executed: QList<QGlyphRun>();return QList<QGlyphRun>();never executed: return QList<QGlyphRun>(); | 0 | ||||||||||||
| 981 | - | |||||||||||||
| 982 | QList<QGlyphRun> ret; | - | ||||||||||||
| 983 | for (int i=0; i<layout->lineCount()
| 0 | ||||||||||||
| 984 | QTextLine textLine = layout->lineAt(i); | - | ||||||||||||
| 985 | ret += textLine.glyphRuns(pos, len); | - | ||||||||||||
| 986 | } never executed: end of block | 0 | ||||||||||||
| 987 | - | |||||||||||||
| 988 | return never executed: ret;return ret;never executed: return ret; | 0 | ||||||||||||
| 989 | } | - | ||||||||||||
| 990 | - | |||||||||||||
| 991 | - | |||||||||||||
| 992 | - | |||||||||||||
| 993 | - | |||||||||||||
| 994 | - | |||||||||||||
| 995 | int QTextFragment::position() const | - | ||||||||||||
| 996 | { | - | ||||||||||||
| 997 | if (!p
| 0 | ||||||||||||
| 998 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 999 | - | |||||||||||||
| 1000 | return never executed: p->fragmentMap().position(n);return p->fragmentMap().position(n);never executed: return p->fragmentMap().position(n); | 0 | ||||||||||||
| 1001 | } | - | ||||||||||||
| 1002 | - | |||||||||||||
| 1003 | - | |||||||||||||
| 1004 | - | |||||||||||||
| 1005 | - | |||||||||||||
| 1006 | - | |||||||||||||
| 1007 | - | |||||||||||||
| 1008 | int QTextFragment::length() const | - | ||||||||||||
| 1009 | { | - | ||||||||||||
| 1010 | if (!p
| 0 | ||||||||||||
| 1011 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 1012 | - | |||||||||||||
| 1013 | int len = 0; | - | ||||||||||||
| 1014 | int f = n; | - | ||||||||||||
| 1015 | while (f != ne
| 0 | ||||||||||||
| 1016 | len += p->fragmentMap().size(f); | - | ||||||||||||
| 1017 | f = p->fragmentMap().next(f); | - | ||||||||||||
| 1018 | } never executed: end of block | 0 | ||||||||||||
| 1019 | return never executed: len;return len;never executed: return len; | 0 | ||||||||||||
| 1020 | } | - | ||||||||||||
| 1021 | - | |||||||||||||
| 1022 | - | |||||||||||||
| 1023 | - | |||||||||||||
| 1024 | - | |||||||||||||
| 1025 | - | |||||||||||||
| 1026 | bool QTextFragment::contains(int position) const | - | ||||||||||||
| 1027 | { | - | ||||||||||||
| 1028 | if (!p
| 0 | ||||||||||||
| 1029 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||
| 1030 | int pos = this->position(); | - | ||||||||||||
| 1031 | return never executed: position >= pos && position < pos + length();return position >= pos && position < pos + length();never executed: return position >= pos && position < pos + length(); | 0 | ||||||||||||
| 1032 | } | - | ||||||||||||
| 1033 | - | |||||||||||||
| 1034 | - | |||||||||||||
| 1035 | - | |||||||||||||
| 1036 | - | |||||||||||||
| 1037 | - | |||||||||||||
| 1038 | - | |||||||||||||
| 1039 | QTextCharFormat QTextFragment::charFormat() const | - | ||||||||||||
| 1040 | { | - | ||||||||||||
| 1041 | if (!p
| 0 | ||||||||||||
| 1042 | return never executed: QTextCharFormat();return QTextCharFormat();never executed: return QTextCharFormat(); | 0 | ||||||||||||
| 1043 | const QTextFragmentData *data = p->fragmentMap().fragment(n); | - | ||||||||||||
| 1044 | return never executed: p->formatCollection()->charFormat(data->format);return p->formatCollection()->charFormat(data->format);never executed: return p->formatCollection()->charFormat(data->format); | 0 | ||||||||||||
| 1045 | } | - | ||||||||||||
| 1046 | - | |||||||||||||
| 1047 | - | |||||||||||||
| 1048 | - | |||||||||||||
| 1049 | - | |||||||||||||
| 1050 | - | |||||||||||||
| 1051 | - | |||||||||||||
| 1052 | - | |||||||||||||
| 1053 | int QTextFragment::charFormatIndex() const | - | ||||||||||||
| 1054 | { | - | ||||||||||||
| 1055 | if (!p
| 0 | ||||||||||||
| 1056 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||
| 1057 | const QTextFragmentData *data = p->fragmentMap().fragment(n); | - | ||||||||||||
| 1058 | return never executed: data->format;return data->format;never executed: return data->format; | 0 | ||||||||||||
| 1059 | } | - | ||||||||||||
| 1060 | - | |||||||||||||
| 1061 | - | |||||||||||||
| 1062 | - | |||||||||||||
| 1063 | - | |||||||||||||
| 1064 | - | |||||||||||||
| 1065 | - | |||||||||||||
| 1066 | QString QTextFragment::text() const | - | ||||||||||||
| 1067 | { | - | ||||||||||||
| 1068 | if (!p
| 0 | ||||||||||||
| 1069 | return never executed: QString();return QString();never executed: return QString(); | 0 | ||||||||||||
| 1070 | - | |||||||||||||
| 1071 | QString result; | - | ||||||||||||
| 1072 | QString buffer = p->buffer(); | - | ||||||||||||
| 1073 | int f = n; | - | ||||||||||||
| 1074 | while (f != ne
| 0 | ||||||||||||
| 1075 | const QTextFragmentData * const frag = p->fragmentMap().fragment(f); | - | ||||||||||||
| 1076 | result += QString(buffer.constData() + frag->stringPosition, frag->size_array[0]); | - | ||||||||||||
| 1077 | f = p->fragmentMap().next(f); | - | ||||||||||||
| 1078 | } never executed: end of block | 0 | ||||||||||||
| 1079 | return never executed: result;return result;never executed: return result; | 0 | ||||||||||||
| 1080 | } | - | ||||||||||||
| 1081 | - | |||||||||||||
| 1082 | - | |||||||||||||
| Switch to Source code | Preprocessed file |