#include <q3richtext_p.h>
Inheritance diagram for Q3TextDocument:


Definition at line 710 of file q3richtext_p.h.
Definition at line 722 of file q3richtext_p.h.
00722 { 00723 Standard = 0, 00724 Temp = 32000 // This selection must not be drawn, it's used e.g. by undo/redo to 00725 // remove multiple lines with removeSelectedText() 00726 };
| Q3TextDocument::Q3TextDocument | ( | Q3TextDocument * | p | ) |
Definition at line 1300 of file q3richtext.cpp.
References fCollection, init(), and par.
Referenced by hasSelectionTextColor(), selectionColor(), selectionTextColor(), setSelectionColor(), and setSelectionTextColor().
01301 : par(p), parentPar(0) 01302 #ifndef QT_NO_TEXTCUSTOMITEM 01303 , tc(0) 01304 #endif 01305 , tArray(0), tStopWidth(0) 01306 { 01307 fCollection = par ? par->fCollection : new Q3TextFormatCollection; 01308 init(); 01309 }
Here is the call graph for this function:

| Q3TextDocument::~Q3TextDocument | ( | ) | [virtual] |
Definition at line 1366 of file q3richtext.cpp.
References backBrush, buf_pixmap, clear(), commandHistory, fCollection, flow_, indenter, par, pFormatter, pProcessor, removeChild(), and tArray.
01367 { 01368 delete commandHistory; 01369 if (par) 01370 par->removeChild(this); 01371 clear(); 01372 delete flow_; 01373 if (!par) { 01374 delete pFormatter; 01375 delete fCollection; 01376 } 01377 delete pProcessor; 01378 delete buf_pixmap; 01379 delete indenter; 01380 delete backBrush; 01381 delete [] tArray; 01382 }
Here is the call graph for this function:

| Q3TextDocument* Q3TextDocument::parent | ( | ) | const [inline] |
Returns a pointer to the parent object.
Reimplemented from QObject.
Definition at line 731 of file q3richtext_p.h.
Referenced by draw(), drawParagraph(), Q3TextCursor::insert(), Q3TextCursor::remove(), Q3TextCursor::removePreviousChar(), removeSelection(), and selectedText().
00731 { return par; }
| Q3TextParagraph* Q3TextDocument::parentParagraph | ( | ) | const [inline] |
Definition at line 732 of file q3richtext_p.h.
Referenced by Q3TextParagraph::setChanged().
00732 { return parentPar; }
Definition at line 2241 of file q3richtext.cpp.
References Qt::AutoText, QMap< Key, T >::clear(), context(), focusIndicator, Q3StyleSheet::mightBeRichText(), Q3TextDocument::Focus::parag, Qt::RichText, selections, setPlainText(), setRichText(), text(), and txtFormat.
Referenced by Q3SimpleRichText::Q3SimpleRichText(), Q3SimpleRichText::setDefaultFont(), and Q3TextEdit::setText().
02242 { 02243 focusIndicator.parag = 0; 02244 selections.clear(); 02245 if (txtFormat == Qt::AutoText && Q3StyleSheet::mightBeRichText(text) || 02246 txtFormat == Qt::RichText) 02247 setRichText(text, context); 02248 else 02249 setPlainText(text); 02250 }
Here is the call graph for this function:

Definition at line 735 of file q3richtext_p.h.
Referenced by Q3TextEdit::documentTitle().
00735 { return attribs; }
| QString Q3TextDocument::text | ( | ) | const |
Definition at line 2461 of file q3richtext.cpp.
References Qt::AutoText, plainText(), preferRichText, Qt::RichText, richText(), and txtFormat.
Referenced by Q3TextEdit::optimDrawContents(), originalText(), setPlainText(), setRichText(), setRichTextInternal(), setText(), and Q3TextEdit::text().
02462 { 02463 if (txtFormat == Qt::AutoText && preferRichText || txtFormat == Qt::RichText) 02464 return richText(); 02465 return plainText(); 02466 }
Here is the call graph for this function:

| QString Q3TextDocument::text | ( | int | parag | ) | const |
Definition at line 2468 of file q3richtext.cpp.
References Qt::AutoText, p, paragAt(), preferRichText, Qt::RichText, and txtFormat.
02469 { 02470 Q3TextParagraph *p = paragAt(parag); 02471 if (!p) 02472 return QString(); 02473 02474 if (txtFormat == Qt::AutoText && preferRichText || txtFormat == Qt::RichText) 02475 return p->richText(); 02476 else 02477 return p->string()->toString(); 02478 }
Here is the call graph for this function:

| QString Q3TextDocument::originalText | ( | ) | const [inline] |
Definition at line 1773 of file q3richtext_p.h.
References oText, oTextValid, and text().
Referenced by Q3TextEdit::checkOptimMode(), Q3SimpleRichText::setDefaultFont(), and Q3TextEdit::text().
01774 { 01775 if (oTextValid) 01776 return oText; 01777 return text(); 01778 }
Here is the call graph for this function:

| int Q3TextDocument::x | ( | ) | const [inline] |
Definition at line 1590 of file q3richtext_p.h.
References cx.
Referenced by Q3TextParagraph::documentX(), Q3TextTable::down(), Q3TextTable::enterAt(), Q3TextTable::next(), Q3TextTable::prev(), and Q3TextTable::up().
01591 { 01592 return cx; 01593 }
| int Q3TextDocument::y | ( | ) | const [inline] |
Definition at line 1595 of file q3richtext_p.h.
References cy.
Referenced by Q3TextParagraph::documentY(), draw(), inSelection(), and Q3TextEdit::paintDocument().
01596 { 01597 return cy; 01598 }
| int Q3TextDocument::width | ( | ) | const [inline] |
Definition at line 1600 of file q3richtext_p.h.
References cw, flow_, qMax(), and Q3TextFlow::width().
Referenced by Q3SimpleRichTextData::adjustSize(), Q3TextParagraph::documentWidth(), draw(), drawParagraph(), Q3TextEdit::heightForWidth(), Q3TextParagraph::paint(), Q3TextEdit::paintDocument(), Q3TextBrowser::popupDetail(), and Q3SimpleRichText::width().
Here is the call graph for this function:

| int Q3TextDocument::widthUsed | ( | ) | const |
Definition at line 1401 of file q3richtext.cpp.
References border_tolerance, and wused.
Referenced by Q3SimpleRichTextData::adjustSize(), Q3TextTableCell::sizeHint(), and Q3SimpleRichText::widthUsed().
01402 { 01403 return wused + 2*border_tolerance; 01404 }
| int Q3TextDocument::visibleWidth | ( | ) | const [inline] |
Definition at line 1605 of file q3richtext_p.h.
References vw.
Referenced by Q3TextParagraph::documentVisibleWidth(), and Q3TextEdit::resizeEvent().
01606 { 01607 return vw; 01608 }
| int Q3TextDocument::height | ( | ) | const |
Definition at line 1406 of file q3richtext.cpp.
References QRect::bottom(), Q3TextFlow::boundingRect(), flow_, h, QRect::height(), lParag, qMax(), Q3TextParagraph::rect(), and QRect::top().
Referenced by Q3SimpleRichTextData::adjustSize(), draw(), Q3TextEdit::formatMore(), Q3SimpleRichText::height(), Q3TextTableCell::heightForWidth(), Q3TextEdit::heightForWidth(), Q3SimpleRichText::inText(), Q3TextEdit::paintDocument(), Q3TextBrowser::popupDetail(), setRichTextMarginsInternal(), Q3TextEdit::sync(), Q3TextTableCell::verticalAlignmentOffset(), and Q3TextEdit::viewportResizeEvent().
01407 { 01408 int h = 0; 01409 if (lParag) 01410 h = lParag->rect().top() + lParag->rect().height() + 1; 01411 int fh = flow_->boundingRect().bottom(); 01412 return qMax(h, fh); 01413 }
Here is the call graph for this function:

| void Q3TextDocument::setWidth | ( | int | w | ) | [inline] |
Definition at line 1630 of file q3richtext_p.h.
References cw, flow_, minw, qMax(), Q3TextFlow::setWidth(), and vw.
Referenced by Q3TextEdit::doResize(), Q3TextEdit::heightForWidth(), Q3TextEdit::setText(), Q3TextEdit::setWordWrap(), and Q3TextEdit::setWrapColumnOrWidth().
Here is the call graph for this function:

| int Q3TextDocument::minimumWidth | ( | ) | const [inline] |
Definition at line 1637 of file q3richtext_p.h.
References minw.
Referenced by Q3TextTableCell::minimumSize().
01638 { 01639 return minw; 01640 }
| bool Q3TextDocument::setMinimumWidth | ( | int | needed, | |
| int | used = -1, |
|||
| Q3TextParagraph * | parag = 0 | |||
| ) |
Definition at line 1422 of file q3richtext.cpp.
References cw, emit, fParag, minimumWidthChanged(), minw, minwParag, p, qMax(), tp, and wused.
Referenced by Q3TextEdit::changeEvent(), Q3TextEdit::doResize(), Q3TextEdit::eventFilter(), Q3TextParagraph::format(), Q3TextEdit::setText(), Q3TextEdit::setWordWrap(), and Q3TextEdit::setWrapColumnOrWidth().
01423 { 01424 if (needed == -1) { 01425 minw = 0; 01426 wused = 0; 01427 p = 0; 01428 } 01429 if (p == minwParag) { 01430 if (minw > needed) { 01431 Q3TextParagraph *tp = fParag; 01432 while (tp) { 01433 if (tp != p && tp->minwidth > needed) { 01434 needed = tp->minwidth; 01435 minwParag = tp; 01436 } 01437 tp = tp->n; 01438 } 01439 } 01440 minw = needed; 01441 emit minimumWidthChanged(minw); 01442 } else if (needed > minw) { 01443 minw = needed; 01444 minwParag = p; 01445 emit minimumWidthChanged(minw); 01446 } 01447 wused = qMax(wused, used); 01448 wused = qMax(wused, minw); 01449 cw = qMax(minw, cw); 01450 return true; 01451 }
Here is the call graph for this function:

| void Q3TextDocument::setY | ( | int | y | ) | [inline] |
| int Q3TextDocument::leftMargin | ( | ) | const [inline] |
Definition at line 1647 of file q3richtext_p.h.
References leftmargin.
Referenced by Q3TextFormatterBreakInWords::format(), and Q3TextFormatterBreakWords::format().
01648 { 01649 return leftmargin; 01650 }
| void Q3TextDocument::setLeftMargin | ( | int | lm | ) | [inline] |
Definition at line 1652 of file q3richtext_p.h.
References leftmargin.
Referenced by Q3SimpleRichText::Q3SimpleRichText().
01653 { 01654 leftmargin = lm; 01655 }
| int Q3TextDocument::rightMargin | ( | ) | const [inline] |
Definition at line 1657 of file q3richtext_p.h.
References rightmargin.
Referenced by Q3TextFormatterBreakInWords::format(), and Q3TextFormatterBreakWords::format().
01658 { 01659 return rightmargin; 01660 }
| void Q3TextDocument::setRightMargin | ( | int | rm | ) | [inline] |
Definition at line 1662 of file q3richtext_p.h.
References rightmargin.
Referenced by Q3SimpleRichText::Q3SimpleRichText().
01663 { 01664 rightmargin = rm; 01665 }
| Q3TextParagraph * Q3TextDocument::firstParagraph | ( | ) | const [inline] |
Definition at line 1610 of file q3richtext_p.h.
References fParag.
Referenced by Q3TextTableCell::adjustToPainter(), Q3SimpleRichText::anchorAt(), Q3MultiLineEdit::atBeginning(), Q3TextEdit::changeEvent(), Q3TextEdit::charAt(), Q3TextEdit::doResize(), Q3TextTable::down(), draw(), Q3TextTable::enterAt(), Q3TextEdit::eventFilter(), find(), Q3TextEdit::init(), Q3SimpleRichText::inText(), Q3TextEdit::keyPressEvent(), Q3TextEdit::lines(), Q3TextTable::next(), Q3TextEdit::optimDrawContents(), Q3TextEdit::paragraphAt(), Q3TextEdit::pasteSubType(), Q3TextEdit::placeCursor(), Q3TextCursor::Q3TextCursor(), Q3SyntaxHighlighter::rehighlight(), Q3TextEdit::removeParagraph(), Q3TextEdit::removeSelectedText(), Q3TextEdit::repaintChanged(), Q3MultiLineEdit::setAlignment(), Q3TextEdit::setTabStopWidth(), Q3TextEdit::setText(), Q3TextEdit::setWordWrap(), Q3TextEdit::setWrapColumnOrWidth(), Q3TextEdit::setWrapPolicy(), and Q3TextEdit::text().
01611 { 01612 return fParag; 01613 }
| Q3TextParagraph * Q3TextDocument::lastParagraph | ( | ) | const [inline] |
Definition at line 1615 of file q3richtext_p.h.
References lParag.
Referenced by Q3TextEdit::append(), Q3MultiLineEdit::atEnd(), draw(), Q3TextDeleteCommand::execute(), find(), Q3TextEdit::init(), Q3TextEdit::insertParagraph(), Q3TextEdit::moveCursor(), Q3MultiLineEdit::numLines(), Q3TextEdit::optimDrawContents(), Q3TextEdit::paintDocument(), Q3TextEdit::paragraphs(), Q3TextTable::prev(), Q3TextEdit::removeParagraph(), Q3TextEdit::scrollToAnchor(), setSelectionEnd(), Q3TextDeleteCommand::unexecute(), Q3TextTable::up(), and Q3TextEdit::updateCursor().
01616 { 01617 return lParag; 01618 }
| void Q3TextDocument::setFirstParagraph | ( | Q3TextParagraph * | p | ) | [inline] |
Definition at line 1620 of file q3richtext_p.h.
Referenced by Q3TextParagraph::Q3TextParagraph(), and Q3TextParagraph::setPrev().
| void Q3TextDocument::setLastParagraph | ( | Q3TextParagraph * | p | ) | [inline] |
Definition at line 1625 of file q3richtext_p.h.
Referenced by Q3TextParagraph::join(), Q3TextParagraph::Q3TextParagraph(), and Q3TextParagraph::setNext().
| void Q3TextDocument::invalidate | ( | ) |
Definition at line 2480 of file q3richtext.cpp.
Referenced by Q3TextEdit::doResize(), Q3TextEdit::heightForWidth(), Q3SyntaxHighlighter::Q3SyntaxHighlighter(), Q3TextEdit::setTabStopWidth(), Q3TextEdit::setWordWrap(), Q3TextEdit::setWrapColumnOrWidth(), and Q3TextEdit::setWrapPolicy().
02481 { 02482 Q3TextParagraph *s = fParag; 02483 while (s) { 02484 s->invalidate(0); 02485 s = s->next(); 02486 } 02487 }
| void Q3TextDocument::setPreProcessor | ( | Q3TextPreProcessor * | sh | ) | [inline] |
Definition at line 1672 of file q3richtext_p.h.
References pProcessor.
Referenced by Q3SyntaxHighlighter::Q3SyntaxHighlighter(), and Q3SyntaxHighlighter::~Q3SyntaxHighlighter().
01673 { 01674 pProcessor = sh; 01675 }
| Q3TextPreProcessor * Q3TextDocument::preProcessor | ( | ) | const [inline] |
Definition at line 1667 of file q3richtext_p.h.
References pProcessor.
Referenced by Q3TextEdit::append(), Q3TextParagraph::format(), Q3TextEdit::insert(), and Q3TextEdit::pasteSubType().
01668 { 01669 return pProcessor; 01670 }
| void Q3TextDocument::setFormatter | ( | Q3TextFormatter * | f | ) | [inline] |
Definition at line 1677 of file q3richtext_p.h.
References pFormatter.
Referenced by Q3TextEdit::init(), Q3TextEdit::optimDrawContents(), Q3SimpleRichText::Q3SimpleRichText(), Q3TextTableCell::Q3TextTableCell(), and Q3TextEdit::setWrapPolicy().
01678 { 01679 delete pFormatter; 01680 pFormatter = f; 01681 }
| Q3TextFormatter * Q3TextDocument::formatter | ( | ) | const [inline] |
Definition at line 1683 of file q3richtext_p.h.
References pFormatter.
Referenced by Q3TextParagraph::format(), Q3TextParagraph::formatter(), Q3TextEdit::optimDrawContents(), Q3IconViewItemLineEdit::Q3IconViewItemLineEdit(), Q3TextTableCell::Q3TextTableCell(), Q3SimpleRichText::setWidth(), Q3TextEdit::setWordWrap(), and Q3TextEdit::setWrapColumnOrWidth().
01684 { 01685 return pFormatter; 01686 }
| void Q3TextDocument::setIndent | ( | Q3TextIndent * | i | ) | [inline] |
| Q3TextIndent * Q3TextDocument::indent | ( | ) | const [inline] |
Definition at line 1693 of file q3richtext_p.h.
References indenter.
Referenced by Q3TextParagraph::indent().
01694 { 01695 return indenter; 01696 }
| QColor Q3TextDocument::selectionColor | ( | int | id | ) | const [inline] |
Definition at line 1698 of file q3richtext_p.h.
References p, and Q3TextDocument().
Referenced by Q3TextParagraph::setColorForSelection().
01699 { 01700 const Q3TextDocument *p = this; 01701 while (p->par) 01702 p = p->par; 01703 return p->selectionColors[id].background; 01704 }
Here is the call graph for this function:

| QColor Q3TextDocument::selectionTextColor | ( | int | id | ) | const [inline] |
Definition at line 1706 of file q3richtext_p.h.
References p, and Q3TextDocument().
Referenced by Q3TextParagraph::setColorForSelection().
01707 { 01708 const Q3TextDocument *p = this; 01709 while (p->par) 01710 p = p->par; 01711 return p->selectionColors[id].text; 01712 }
Here is the call graph for this function:

| bool Q3TextDocument::hasSelectionTextColor | ( | int | id | ) | const [inline] |
Definition at line 1714 of file q3richtext_p.h.
References p, and Q3TextDocument().
Referenced by Q3TextParagraph::setColorForSelection().
01715 { 01716 const Q3TextDocument *p = this; 01717 while (p->par) 01718 p = p->par; 01719 return p->selectionColors.contains(id); 01720 }
Here is the call graph for this function:

| void Q3TextDocument::setSelectionColor | ( | int | id, | |
| const QColor & | c | |||
| ) | [inline] |
Definition at line 1722 of file q3richtext_p.h.
References c, p, and Q3TextDocument().
Referenced by Q3TextEdit::inputMethodEvent(), and Q3TextEdit::setSelectionAttributes().
01723 { 01724 Q3TextDocument *p = this; 01725 while (p->par) 01726 p = p->par; 01727 p->selectionColors[id].background = c; 01728 }
Here is the call graph for this function:

| void Q3TextDocument::setSelectionTextColor | ( | int | id, | |
| const QColor & | b | |||
| ) | [inline] |
Definition at line 1730 of file q3richtext_p.h.
References c, p, and Q3TextDocument().
Referenced by Q3TextEdit::inputMethodEvent(), and Q3TextEdit::setSelectionAttributes().
01731 { 01732 Q3TextDocument *p = this; 01733 while (p->par) 01734 p = p->par; 01735 p->selectionColors[id].text = c; 01736 }
Here is the call graph for this function:

| bool Q3TextDocument::hasSelection | ( | int | id, | |
| bool | visible = false | |||
| ) | const |
Definition at line 148 of file q3richtext_p.cpp.
References QMap< Key, T >::end(), QMap< Key, T >::find(), and selections.
Referenced by Q3TextEdit::contentsDropEvent(), Q3TextEdit::contentsMouseMoveEvent(), Q3TextEdit::contentsMousePressEvent(), Q3TextEdit::contentsMouseReleaseEvent(), Q3TextEdit::createPopupMenu(), Q3TextEdit::del(), Q3TextEdit::dragObject(), Q3TextEdit::find(), Q3TextEdit::getSelection(), Q3TextEdit::handleMouseMove(), Q3TextEdit::hasSelectedText(), Q3TextEdit::indent(), Q3TextEdit::insert(), Q3TextEdit::keyPressEvent(), Q3TextEdit::moveCursor(), Q3TextEdit::optimDrawContents(), Q3TextEdit::pasteSubType(), Q3TextEdit::removeSelectedText(), Q3TextEdit::selectAll(), Q3TextEdit::setAlignment(), Q3TextEdit::setFormat(), Q3TextEdit::setParagType(), and Q3TextEdit::setSelection().
00149 { 00150 return (selections.find(id) != selections.end() && 00151 (!visible || 00152 ((Q3TextDocument*)this)->selectionStartCursor(id) != 00153 ((Q3TextDocument*)this)->selectionEndCursor(id))); 00154 }
Here is the call graph for this function:

| void Q3TextDocument::setSelectionStart | ( | int | id, | |
| const Q3TextCursor & | cursor | |||
| ) |
Definition at line 156 of file q3richtext_p.cpp.
References Q3TextDocumentSelection::endCursor, selections, Q3TextDocumentSelection::startCursor, and Q3TextDocumentSelection::swapped.
Referenced by Q3TextEdit::append(), Q3TextEdit::contentsMouseDoubleClickEvent(), Q3TextEdit::contentsMousePressEvent(), Q3TextEdit::contentsMouseReleaseEvent(), Q3TextEdit::doKeyboardAction(), Q3TextDeleteCommand::execute(), Q3TextFormatCommand::execute(), find(), Q3TextEdit::inputMethodEvent(), Q3TextEdit::insert(), Q3TextEdit::moveCursor(), Q3TextEdit::optimDrawContents(), Q3TextEdit::optimSetTextFormat(), Q3TextEdit::pasteSubType(), Q3TextEdit::removeParagraph(), Q3TextEdit::setSelection(), and setSelectionEnd().
00157 { 00158 Q3TextDocumentSelection sel; 00159 sel.startCursor = cursor; 00160 sel.endCursor = cursor; 00161 sel.swapped = false; 00162 selections[id] = sel; 00163 }
| bool Q3TextDocument::setSelectionEnd | ( | int | id, | |
| const Q3TextCursor & | cursor | |||
| ) |
Definition at line 2560 of file q3richtext.cpp.
References c, QMap< Key, T >::end(), Q3TextDocumentSelection::endCursor, QMap< Key, T >::find(), Q3TextCursor::index(), inSelection(), lastParagraph(), Q3TextParagraph::length(), p, Q3TextParagraph::paragId(), Q3TextCursor::paragraph(), qMax(), qMin(), removeSelection(), Q3TextParagraph::removeSelection(), Q3TextCursor::restoreState(), selections, Q3TextParagraph::selectionStart(), Q3TextParagraph::setSelection(), setSelectionEndHelper(), setSelectionStart(), start, Q3TextDocumentSelection::startCursor, and Q3TextDocumentSelection::swapped.
Referenced by Q3TextEdit::append(), Q3TextEdit::contentsMouseDoubleClickEvent(), Q3TextEdit::contentsMousePressEvent(), Q3TextEdit::doKeyboardAction(), Q3TextDeleteCommand::execute(), Q3TextFormatCommand::execute(), find(), Q3TextEdit::handleMouseMove(), Q3TextEdit::inputMethodEvent(), Q3TextEdit::insert(), Q3MultiLineEdit::insertAndMark(), Q3TextEdit::moveCursor(), Q3TextEdit::optimDrawContents(), Q3TextEdit::optimSetTextFormat(), Q3TextEdit::pasteSubType(), Q3TextEdit::removeParagraph(), Q3MultiLineEdit::setCursorPosition(), and Q3TextEdit::setSelection().
02561 { 02562 QMap<int, Q3TextDocumentSelection>::Iterator it = selections.find(id); 02563 if (it == selections.end()) 02564 return false; 02565 Q3TextDocumentSelection &sel = *it; 02566 02567 Q3TextCursor start = sel.startCursor; 02568 Q3TextCursor end = cursor; 02569 02570 if (start == end) { 02571 removeSelection(id); 02572 setSelectionStart(id, cursor); 02573 return true; 02574 } 02575 02576 if (sel.endCursor.paragraph() == end.paragraph()) { 02577 setSelectionEndHelper(id, sel, start, end); 02578 return true; 02579 } 02580 02581 bool inSelection = false; 02582 Q3TextCursor c(this); 02583 Q3TextCursor tmp = sel.startCursor; 02584 if (sel.swapped) 02585 tmp = sel.endCursor; 02586 tmp.restoreState(); 02587 Q3TextCursor tmp2 = cursor; 02588 tmp2.restoreState(); 02589 c.setParagraph(tmp.paragraph()->paragId() < tmp2.paragraph()->paragId() ? tmp.paragraph() : tmp2.paragraph()); 02590 bool hadStart = false; 02591 bool hadEnd = false; 02592 bool hadStartParag = false; 02593 bool hadEndParag = false; 02594 bool hadOldStart = false; 02595 bool hadOldEnd = false; 02596 bool leftSelection = false; 02597 sel.swapped = false; 02598 for (;;) { 02599 if (c == start) 02600 hadStart = true; 02601 if (c == end) 02602 hadEnd = true; 02603 if (c.paragraph() == start.paragraph()) 02604 hadStartParag = true; 02605 if (c.paragraph() == end.paragraph()) 02606 hadEndParag = true; 02607 if (c == sel.startCursor) 02608 hadOldStart = true; 02609 if (c == sel.endCursor) 02610 hadOldEnd = true; 02611 02612 if (!sel.swapped && 02613 (hadEnd && !hadStart || 02614 hadEnd && hadStart && start.paragraph() == end.paragraph() && start.index() > end.index())) 02615 sel.swapped = true; 02616 02617 if (c == end && hadStartParag || 02618 c == start && hadEndParag) { 02619 Q3TextCursor tmp = c; 02620 tmp.restoreState(); 02621 if (tmp.paragraph() != c.paragraph()) { 02622 int sstart = tmp.paragraph()->selectionStart(id); 02623 tmp.paragraph()->removeSelection(id); 02624 tmp.paragraph()->setSelection(id, sstart, tmp.index()); 02625 } 02626 } 02627 02628 if (inSelection && 02629 (c == end && hadStart || c == start && hadEnd)) 02630 leftSelection = true; 02631 else if (!leftSelection && !inSelection && (hadStart || hadEnd)) 02632 inSelection = true; 02633 02634 bool noSelectionAnymore = hadOldStart && hadOldEnd && leftSelection && !inSelection && !c.paragraph()->hasSelection(id) && c.atParagEnd(); 02635 c.paragraph()->removeSelection(id); 02636 if (inSelection) { 02637 if (c.paragraph() == start.paragraph() && start.paragraph() == end.paragraph()) { 02638 c.paragraph()->setSelection(id, qMin(start.index(), end.index()), qMax(start.index(), end.index())); 02639 } else if (c.paragraph() == start.paragraph() && !hadEndParag) { 02640 c.paragraph()->setSelection(id, start.index(), c.paragraph()->length() - 1); 02641 } else if (c.paragraph() == end.paragraph() && !hadStartParag) { 02642 c.paragraph()->setSelection(id, end.index(), c.paragraph()->length() - 1); 02643 } else if (c.paragraph() == end.paragraph() && hadEndParag) { 02644 c.paragraph()->setSelection(id, 0, end.index()); 02645 } else if (c.paragraph() == start.paragraph() && hadStartParag) { 02646 c.paragraph()->setSelection(id, 0, start.index()); 02647 } else { 02648 c.paragraph()->setSelection(id, 0, c.paragraph()->length() - 1); 02649 } 02650 } 02651 02652 if (leftSelection) 02653 inSelection = false; 02654 02655 if (noSelectionAnymore) 02656 break; 02657 // *ugle*hack optimization 02658 Q3TextParagraph *p = c.paragraph(); 02659 if ( p->mightHaveCustomItems || p == start.paragraph() || p == end.paragraph() || p == lastParagraph()) { 02660 c.gotoNextLetter(); 02661 if (p == lastParagraph() && c.atParagEnd()) 02662 break; 02663 } else { 02664 if (p->document()->parent()) 02665 do { 02666 c.gotoNextLetter(); 02667 } while (c.paragraph() == p); 02668 else 02669 c.setParagraph(p->next()); 02670 } 02671 } 02672 02673 if (!sel.swapped) 02674 sel.startCursor.paragraph()->setSelection(id, sel.startCursor.index(), sel.startCursor.paragraph()->length() - 1); 02675 02676 sel.startCursor = start; 02677 sel.endCursor = end; 02678 if (sel.startCursor.paragraph() == sel.endCursor.paragraph()) 02679 sel.swapped = sel.startCursor.index() > sel.endCursor.index(); 02680 02681 setSelectionEndHelper(id, sel, start, end); 02682 02683 return true; 02684 }
Here is the call graph for this function:

| void Q3TextDocument::selectAll | ( | int | id | ) |
Definition at line 2686 of file q3richtext.cpp.
References QList< T >::at(), c, childList, Q3TextDocumentSelection::endCursor, fParag, QMap< Key, T >::insert(), Q3TextParagraph::length(), lParag, p, removeSelection(), selectAll(), selections, QList< T >::size(), Q3TextDocumentSelection::startCursor, and Q3TextDocumentSelection::swapped.
Referenced by Q3TextEdit::clear(), Q3TextEdit::optimDrawContents(), Q3TextEdit::selectAll(), and selectAll().
02687 { 02688 removeSelection(id); 02689 02690 Q3TextDocumentSelection sel; 02691 sel.swapped = false; 02692 Q3TextCursor c(this); 02693 02694 c.setParagraph(fParag); 02695 c.setIndex(0); 02696 sel.startCursor = c; 02697 02698 c.setParagraph(lParag); 02699 c.setIndex(lParag->length() - 1); 02700 sel.endCursor = c; 02701 02702 selections.insert(id, sel); 02703 02704 Q3TextParagraph *p = fParag; 02705 while (p) { 02706 p->setSelection(id, 0, p->length() - 1); 02707 p = p->next(); 02708 } 02709 02710 for (int idx = 0; idx < childList.size(); ++idx) { 02711 Q3TextDocument *dc = childList.at(idx); 02712 dc->selectAll(id); 02713 } 02714 }
Here is the call graph for this function:

| bool Q3TextDocument::removeSelection | ( | int | id | ) |
Definition at line 2716 of file q3richtext.cpp.
References QMap< Key, T >::contains(), Q3TextDocumentSelection::endCursor, lParag, p, parent(), QMap< Key, T >::remove(), selections, start, Q3TextDocumentSelection::startCursor, and Q3TextDocumentSelection::swapped.
Referenced by Q3TextEdit::append(), Q3TextEdit::contentsDropEvent(), Q3TextEdit::contentsMousePressEvent(), Q3TextEdit::contentsMouseReleaseEvent(), Q3TextFormatCommand::execute(), find(), Q3TextEdit::inputMethodEvent(), Q3TextEdit::insert(), Q3TextEdit::insertParagraph(), Q3TextEdit::keyPressEvent(), Q3TextEdit::moveCursor(), Q3TextEdit::optimDrawContents(), Q3TextEdit::optimSetTextFormat(), Q3TextEdit::redo(), Q3TextEdit::removeParagraph(), removeSelectedText(), Q3TextEdit::removeSelectedText(), Q3TextEdit::removeSelection(), Q3TextEdit::selectAll(), selectAll(), Q3TextEdit::setSelection(), setSelectionEnd(), and Q3TextEdit::undo().
02717 { 02718 if (!selections.contains(id)) 02719 return false; 02720 02721 Q3TextDocumentSelection &sel = selections[id]; 02722 02723 Q3TextCursor start = sel.swapped ? sel.endCursor : sel.startCursor; 02724 Q3TextCursor end = sel.swapped ? sel.startCursor : sel.endCursor; 02725 Q3TextParagraph* p = 0; 02726 while (start != end) { 02727 if (p != start.paragraph()) { 02728 p = start.paragraph(); 02729 p->removeSelection(id); 02730 //### avoid endless loop by all means necessary, did somebody mention refactoring? 02731 if (!parent() && p == lParag) 02732 break; 02733 } 02734 start.gotoNextLetter(); 02735 } 02736 p = start.paragraph(); 02737 p->removeSelection(id); 02738 selections.remove(id); 02739 return true; 02740 }
Here is the call graph for this function:

| void Q3TextDocument::selectionStart | ( | int | id, | |
| int & | paragId, | |||
| int & | index | |||
| ) |
Definition at line 2489 of file q3richtext.cpp.
References QMap< Key, T >::end(), Q3TextDocumentSelection::endCursor, QMap< Key, T >::find(), Q3TextCursor::index(), Q3TextParagraph::paragId(), Q3TextCursor::paragraph(), selections, Q3TextDocumentSelection::startCursor, and Q3TextDocumentSelection::swapped.
Referenced by Q3TextEdit::getSelection(), and Q3TextEdit::removeSelectedText().
02490 { 02491 QMap<int, Q3TextDocumentSelection>::Iterator it = selections.find(id); 02492 if (it == selections.end()) 02493 return; 02494 Q3TextDocumentSelection &sel = *it; 02495 paragId = !sel.swapped ? sel.startCursor.paragraph()->paragId() : sel.endCursor.paragraph()->paragId(); 02496 index = !sel.swapped ? sel.startCursor.index() : sel.endCursor.index(); 02497 }
Here is the call graph for this function:

| Q3TextCursor Q3TextDocument::selectionStartCursor | ( | int | id | ) |
Definition at line 2499 of file q3richtext.cpp.
References QMap< Key, T >::end(), Q3TextDocumentSelection::endCursor, QMap< Key, T >::find(), Q3TextCursor, selections, Q3TextDocumentSelection::startCursor, and Q3TextDocumentSelection::swapped.
Referenced by Q3TextEdit::contentsDropEvent(), Q3TextEdit::moveCursor(), Q3TextEdit::removeSelectedText(), Q3TextEdit::setAlignment(), Q3TextEdit::setFormat(), and Q3TextEdit::setParagType().
02500 { 02501 QMap<int, Q3TextDocumentSelection>::Iterator it = selections.find(id); 02502 if (it == selections.end()) 02503 return Q3TextCursor(this); 02504 Q3TextDocumentSelection &sel = *it; 02505 if (sel.swapped) 02506 return sel.endCursor; 02507 return sel.startCursor; 02508 }
Here is the call graph for this function:

| Q3TextCursor Q3TextDocument::selectionEndCursor | ( | int | id | ) |
Definition at line 2510 of file q3richtext.cpp.
References QMap< Key, T >::end(), Q3TextDocumentSelection::endCursor, QMap< Key, T >::find(), Q3TextCursor, selections, Q3TextDocumentSelection::startCursor, and Q3TextDocumentSelection::swapped.
Referenced by Q3TextEdit::contentsDropEvent(), Q3TextEdit::moveCursor(), Q3TextEdit::removeSelectedText(), Q3TextEdit::setAlignment(), Q3TextEdit::setFormat(), and Q3TextEdit::setParagType().
02511 { 02512 QMap<int, Q3TextDocumentSelection>::Iterator it = selections.find(id); 02513 if (it == selections.end()) 02514 return Q3TextCursor(this); 02515 Q3TextDocumentSelection &sel = *it; 02516 if (!sel.swapped) 02517 return sel.endCursor; 02518 return sel.startCursor; 02519 }
Here is the call graph for this function:

| void Q3TextDocument::selectionEnd | ( | int | id, | |
| int & | paragId, | |||
| int & | index | |||
| ) |
Definition at line 2521 of file q3richtext.cpp.
References QMap< Key, T >::end(), Q3TextDocumentSelection::endCursor, QMap< Key, T >::find(), Q3TextCursor::index(), Q3TextParagraph::paragId(), Q3TextCursor::paragraph(), selections, Q3TextDocumentSelection::startCursor, and Q3TextDocumentSelection::swapped.
Referenced by Q3TextEdit::getSelection().
02522 { 02523 QMap<int, Q3TextDocumentSelection>::Iterator it = selections.find(id); 02524 if (it == selections.end()) 02525 return; 02526 Q3TextDocumentSelection &sel = *it; 02527 paragId = sel.swapped ? sel.startCursor.paragraph()->paragId() : sel.endCursor.paragraph()->paragId(); 02528 index = sel.swapped ? sel.startCursor.index() : sel.endCursor.index(); 02529 }
Here is the call graph for this function:

| void Q3TextDocument::setFormat | ( | int | id, | |
| Q3TextFormat * | f, | |||
| int | flags | |||
| ) |
Definition at line 2892 of file q3richtext.cpp.
References QMap< Key, T >::constEnd(), QMap< Key, T >::constFind(), Q3TextDocumentSelection::endCursor, Q3TextCursor::index(), Q3TextParagraph::length(), Q3TextParagraph::next(), p, Q3TextCursor::paragraph(), Q3TextCursor::restoreState(), selections, Q3TextParagraph::setFormat(), Q3TextDocumentSelection::startCursor, and Q3TextDocumentSelection::swapped.
Referenced by Q3TextEdit::append(), Q3TextFormatCommand::execute(), Q3TextEdit::insert(), Q3TextEdit::optimDrawContents(), Q3TextEdit::optimSetTextFormat(), and Q3TextEdit::setFormat().
02893 { 02894 QMap<int, Q3TextDocumentSelection>::ConstIterator it = selections.constFind(id); 02895 if (it == selections.constEnd()) 02896 return; 02897 02898 Q3TextDocumentSelection sel = *it; 02899 02900 Q3TextCursor c1 = sel.startCursor; 02901 Q3TextCursor c2 = sel.endCursor; 02902 if (sel.swapped) { 02903 c2 = sel.startCursor; 02904 c1 = sel.endCursor; 02905 } 02906 02907 c2.restoreState(); 02908 c1.restoreState(); 02909 02910 if (c1.paragraph() == c2.paragraph()) { 02911 c1.paragraph()->setFormat(c1.index(), c2.index() - c1.index(), f, true, flags); 02912 return; 02913 } 02914 02915 c1.paragraph()->setFormat(c1.index(), c1.paragraph()->length() - c1.index(), f, true, flags); 02916 Q3TextParagraph *p = c1.paragraph()->next(); 02917 while (p && p != c2.paragraph()) { 02918 p->setFormat(0, p->length(), f, true, flags); 02919 p = p->next(); 02920 } 02921 c2.paragraph()->setFormat(0, c2.index(), f, true, flags); 02922 }
Here is the call graph for this function:

| int Q3TextDocument::numSelections | ( | ) | const [inline] |
Definition at line 789 of file q3richtext_p.h.
Referenced by Q3TextEdit::contentsMousePressEvent(), Q3TextEdit::contentsMouseReleaseEvent(), Q3TextEdit::insertParagraph(), Q3TextEdit::keyPressEvent(), Q3TextEdit::redo(), Q3TextEdit::removeParagraph(), Q3TextEdit::removeSelectedText(), Q3TextEdit::setSelection(), Q3TextEdit::setSelectionAttributes(), and Q3TextEdit::undo().
00789 { return nSelections; }
| void Q3TextDocument::addSelection | ( | int | id | ) |
Definition at line 2531 of file q3richtext.cpp.
References nSelections, and qMax().
Referenced by Q3TextEdit::setSelection(), and Q3TextEdit::setSelectionAttributes().
02532 { 02533 nSelections = qMax(nSelections, id + 1); 02534 }
Here is the call graph for this function:

| QString Q3TextDocument::selectedText | ( | int | id, | |
| bool | asRichText = false | |||
| ) | const |
Definition at line 2742 of file q3richtext.cpp.
References QList< T >::at(), c, Q3TextParagraph::document(), QMap< Key, T >::end(), Q3TextDocumentSelection::endCursor, QMap< Key, T >::find(), i, Q3TextCursor::index(), QString::indexOf(), QString::lastIndexOf(), QChar::LineSeparator, QString::mid(), QChar::Nbsp, Q3TextCursor::nestedDepth(), Q3TextCursor::oneUp(), p, Q3TextParagraph::paragId(), Q3TextCursor::paragraph(), parent(), qMax(), richText(), richTextExportEnd, richTextExportStart, s, selections, QList< T >::size(), start, Q3TextDocumentSelection::startCursor, Q3TextDocumentSelection::swapped, and t.
Referenced by Q3TextEdit::dragObject(), Q3TextEdit::pasteSubType(), and Q3TextEdit::selectedText().
02743 { 02744 QMap<int, Q3TextDocumentSelection>::ConstIterator it = selections.find(id); 02745 if (it == selections.end()) 02746 return QString(); 02747 02748 Q3TextDocumentSelection sel = *it; 02749 02750 02751 Q3TextCursor c1 = sel.startCursor; 02752 Q3TextCursor c2 = sel.endCursor; 02753 if (sel.swapped) { 02754 c2 = sel.startCursor; 02755 c1 = sel.endCursor; 02756 } 02757 02758 /* 3.0.3 improvement: Make it possible to get a reasonable 02759 selection inside a table. This approach is very conservative: 02760 make sure that both cursors have the same depth level and point 02761 to paragraphs within the same text document. 02762 02763 Meaning if you select text in two table cells, you will get the 02764 entire table. This is still far better than the 3.0.2, where 02765 you always got the entire table. 02766 02767 ### Fix this properly when refactoring 02768 */ 02769 while (c2.nestedDepth() > c1.nestedDepth()) 02770 c2.oneUp(); 02771 while (c1.nestedDepth() > c2.nestedDepth()) 02772 c1.oneUp(); 02773 while (c1.nestedDepth() && c2.nestedDepth() && 02774 c1.paragraph()->document() != c2.paragraph()->document()) { 02775 c1.oneUp(); 02776 c2.oneUp(); 02777 } 02778 // do not trust sel_swapped with tables. Fix this properly when refactoring as well 02779 if (c1.paragraph()->paragId() > c2.paragraph()->paragId() || 02780 (c1.paragraph() == c2.paragraph() && c1.index() > c2.index())) { 02781 Q3TextCursor tmp = c1; 02782 c2 = c1; 02783 c1 = tmp; 02784 } 02785 02786 // end selection 3.0.3 improvement 02787 02788 if (asRichText && !parent()) { 02789 richTextExportStart = &c1; 02790 richTextExportEnd = &c2; 02791 02792 QString sel = richText(); 02793 int from = sel.indexOf("<!--StartFragment-->"); 02794 if (from >= 0) { 02795 from += 20; 02796 // find the previous span and move it into the start fragment before we clip it 02797 QString prevspan; 02798 int pspan = sel.lastIndexOf("<span", from-21); 02799 if (pspan > sel.lastIndexOf("</span", from-21)) { 02800 int spanend = sel.indexOf('>', pspan); 02801 prevspan = sel.mid(pspan, spanend - pspan + 1); 02802 } 02803 int to = sel.lastIndexOf("<!--EndFragment-->"); 02804 if (from <= to) 02805 sel = "<!--StartFragment-->" + prevspan + sel.mid(from, to - from); 02806 } 02807 richTextExportStart = richTextExportEnd = 0; 02808 return sel; 02809 } 02810 02811 QString s; 02812 if (c1.paragraph() == c2.paragraph()) { 02813 Q3TextParagraph *p = c1.paragraph(); 02814 int end = c2.index(); 02815 if (p->at(qMax(0, end - 1))->isCustom()) 02816 ++end; 02817 if (!p->mightHaveCustomItems) { 02818 s += p->string()->toString().mid(c1.index(), end - c1.index()); 02819 } else { 02820 for (int i = c1.index(); i < end; ++i) { 02821 #ifndef QT_NO_TEXTCUSTOMITEM 02822 if (p->at(i)->isCustom()) { 02823 if (p->at(i)->customItem()->isNested()) { 02824 s += "\n"; 02825 Q3TextTable *t = (Q3TextTable*)p->at(i)->customItem(); 02826 QList<Q3TextTableCell *> cells = t->tableCells(); 02827 for (int idx = 0; idx < cells.size(); ++idx) { 02828 Q3TextTableCell *c = cells.at(idx); 02829 s += c->richText()->plainText() + "\n"; 02830 } 02831 s += "\n"; 02832 } 02833 } else 02834 #endif 02835 { 02836 s += p->at(i)->c; 02837 } 02838 } 02839 } 02840 } else { 02841 Q3TextParagraph *p = c1.paragraph(); 02842 int start = c1.index(); 02843 while (p) { 02844 int end = p == c2.paragraph() ? c2.index() : p->length() - 1; 02845 if (p == c2.paragraph() && p->at(qMax(0, end - 1))->isCustom()) 02846 ++end; 02847 if (!p->mightHaveCustomItems) { 02848 s += p->string()->toString().mid(start, end - start); 02849 if (p != c2.paragraph()) 02850 s += "\n"; 02851 } else { 02852 for (int i = start; i < end; ++i) { 02853 #ifndef QT_NO_TEXTCUSTOMITEM 02854 if (p->at(i)->isCustom()) { 02855 if (p->at(i)->customItem()->isNested()) { 02856 s += "\n"; 02857 Q3TextTable *t = (Q3TextTable*)p->at(i)->customItem(); 02858 QList<Q3TextTableCell *> cells = t->tableCells(); 02859 for (int idx = 0; idx < cells.size(); ++idx) { 02860 Q3TextTableCell *c = cells.at(idx); 02861 s += c->richText()->plainText() + "\n"; 02862 } 02863 s += "\n"; 02864 } 02865 } else 02866 #endif 02867 { 02868 s += p->at(i)->c; 02869 } 02870 } 02871 } 02872 start = 0; 02873 if (p == c2.paragraph()) 02874 break; 02875 p = p->next(); 02876 } 02877 } 02878 // ### workaround for plain text export until we get proper 02879 // mime types: turn unicode line seperators into the more 02880 // widely understood \n. Makes copy and pasting code snipplets 02881 // from within Assistent possible 02882 QChar* uc = (QChar*) s.unicode(); 02883 for (int ii = 0; ii < s.length(); ii++) { 02884 if (uc[(int)ii] == QChar::LineSeparator) 02885 uc[(int)ii] = QChar('\n'); 02886 else if ( uc[(int)ii] == QChar::Nbsp ) 02887 uc[(int)ii] = QChar(' '); 02888 } 02889 return s; 02890 }
Here is the call graph for this function:

| void Q3TextDocument::removeSelectedText | ( | int | id, | |
| Q3TextCursor * | cursor | |||
| ) |
Definition at line 2924 of file q3richtext.cpp.
References QMap< Key, T >::end(), Q3TextDocumentSelection::endCursor, QMap< Key, T >::find(), fParag, Q3TextCursor::gotoNextLetter(), Q3TextCursor::gotoPreviousLetter(), Q3TextCursor::index(), Q3TextCursor::isValid(), Q3TextParagraph::join(), Q3TextParagraph::length(), lParag, Q3TextCursor::nestedDepth(), Q3TextParagraph::next(), p, Q3TextCursor::paragraph(), Q3TextParagraph::remove(), removeSelection(), Q3TextCursor::restoreState(), selections, Q3TextCursor::setValid(), Q3TextDocumentSelection::startCursor, and Q3TextDocumentSelection::swapped.
Referenced by Q3TextDeleteCommand::execute(), and Q3TextEdit::removeSelectedText().
02925 { 02926 QMap<int, Q3TextDocumentSelection>::Iterator it = selections.find(id); 02927 if (it == selections.end()) 02928 return; 02929 02930 Q3TextDocumentSelection sel = *it; 02931 Q3TextCursor c1 = sel.startCursor; 02932 Q3TextCursor c2 = sel.endCursor; 02933 if (sel.swapped) { 02934 c2 = sel.startCursor; 02935 c1 = sel.endCursor; 02936 } 02937 02938 // ### no support for editing tables yet 02939 if (c1.nestedDepth() || c2.nestedDepth()) 02940 return; 02941 02942 c2.restoreState(); 02943 c1.restoreState(); 02944 02945 *cursor = c1; 02946 removeSelection(id); 02947 02948 if (c1.paragraph() == c2.paragraph()) { 02949 c1.paragraph()->remove(c1.index(), c2.index() - c1.index()); 02950 return; 02951 } 02952 02953 if (c1.paragraph() == fParag && c1.index() == 0 && 02954 c2.paragraph() == lParag && c2.index() == lParag->length() - 1) 02955 cursor->setValid(false); 02956 02957 bool didGoLeft = false; 02958 if ( c1.index() == 0 && c1.paragraph() != fParag) { 02959 cursor->gotoPreviousLetter(); 02960 didGoLeft = cursor->isValid(); 02961 } 02962 02963 c1.paragraph()->remove(c1.index(), c1.paragraph()->length() - 1 - c1.index()); 02964 Q3TextParagraph *p = c1.paragraph()->next(); 02965 int dy = 0; 02966 Q3TextParagraph *tmp; 02967 while (p && p != c2.paragraph()) { 02968 tmp = p->next(); 02969 dy -= p->rect().height(); 02970 delete p; 02971 p = tmp; 02972 } 02973 c2.paragraph()->remove(0, c2.index()); 02974 while (p) { 02975 p->move(dy); 02976 p->invalidate(0); 02977 p->setEndState(-1); 02978 p = p->next(); 02979 } 02980 02981 02982 c1.paragraph()->join(c2.paragraph()); 02983 02984 if (didGoLeft) 02985 cursor->gotoNextLetter(); 02986 }
Here is the call graph for this function:

| void Q3TextDocument::indentSelection | ( | int | id | ) |
Definition at line 2988 of file q3richtext.cpp.
References QMap< Key, T >::end(), Q3TextDocumentSelection::endCursor, QMap< Key, T >::find(), p, Q3TextParagraph::paragId(), Q3TextCursor::paragraph(), selections, and Q3TextDocumentSelection::startCursor.
Referenced by Q3TextEdit::indent().
02989 { 02990 QMap<int, Q3TextDocumentSelection>::Iterator it = selections.find(id); 02991 if (it == selections.end()) 02992 return; 02993 02994 Q3TextDocumentSelection sel = *it; 02995 Q3TextParagraph *startParag = sel.startCursor.paragraph(); 02996 Q3TextParagraph *endParag = sel.endCursor.paragraph(); 02997 if (sel.endCursor.paragraph()->paragId() < sel.startCursor.paragraph()->paragId()) { 02998 endParag = sel.startCursor.paragraph(); 02999 startParag = sel.endCursor.paragraph(); 03000 } 03001 03002 Q3TextParagraph *p = startParag; 03003 while (p && p != endParag) { 03004 p->indent(); 03005 p = p->next(); 03006 } 03007 }
Here is the call graph for this function:

| Q3TextParagraph * Q3TextDocument::paragAt | ( | int | i | ) | const |
Definition at line 165 of file q3richtext_p.cpp.
References curParag, fParag, and p.
Referenced by Q3TextEdit::clearParagraphBackground(), Q3TextDeleteCommand::execute(), Q3TextFormatCommand::execute(), Q3TextEdit::find(), Q3TextEdit::getFormat(), Q3TextEdit::getParagraphFormat(), Q3TextEdit::insertAt(), Q3TextEdit::insertParagraph(), Q3MultiLineEdit::lineLength(), Q3TextEdit::lineOfChar(), Q3TextEdit::linesOfParagraph(), Q3TextEdit::optimDrawContents(), Q3TextEdit::paragraphBackgroundColor(), Q3TextEdit::paragraphLength(), Q3TextEdit::paragraphRect(), Q3TextStyleCommand::readStyleInformation(), Q3TextEdit::removeParagraph(), Q3TextEdit::setCursorPosition(), Q3TextEdit::setParagraphBackgroundColor(), Q3TextEdit::setSelection(), text(), Q3MultiLineEdit::textLine(), Q3TextFormatCommand::unexecute(), Q3TextDeleteCommand::unexecute(), and Q3TextStyleCommand::writeStyleInformation().
00166 { 00167 Q3TextParagraph* p = curParag; 00168 if (!p || p->paragId() > i) 00169 p = fParag; 00170 while (p && p->paragId() != i) 00171 p = p->next(); 00172 ((Q3TextDocument*)this)->curParag = p; 00173 return p; 00174 }
| void Q3TextDocument::addCommand | ( | Q3TextCommand * | cmd | ) |
Definition at line 3016 of file q3richtext.cpp.
References Q3TextCommandHistory::addCommand(), and commandHistory.
Referenced by Q3TextEdit::UndoRedoInfo::clear().
03017 { 03018 commandHistory->addCommand(cmd); 03019 }
Here is the call graph for this function:

| Q3TextCursor * Q3TextDocument::undo | ( | Q3TextCursor * | c = 0 |
) |
Definition at line 3021 of file q3richtext.cpp.
References c, commandHistory, and Q3TextCommandHistory::undo().
Referenced by Q3TextEdit::undo().
03022 { 03023 return commandHistory->undo(c); 03024 }
Here is the call graph for this function:

| Q3TextCursor * Q3TextDocument::redo | ( | Q3TextCursor * | c = 0 |
) |
Definition at line 3026 of file q3richtext.cpp.
References c, commandHistory, and Q3TextCommandHistory::redo().
Referenced by Q3TextEdit::redo().
03027 { 03028 return commandHistory->redo(c); 03029 }
Here is the call graph for this function:

| Q3TextCommandHistory* Q3TextDocument::commands | ( | ) | const [inline] |
Definition at line 801 of file q3richtext_p.h.
Referenced by Q3TextParagraph::addCommand(), Q3TextEdit::append(), Q3TextEdit::clearUndoRedo(), Q3TextParagraph::commands(), Q3TextEdit::createPopupMenu(), Q3TextEdit::isRedoAvailable(), Q3TextEdit::isUndoAvailable(), Q3TextParagraph::redo(), Q3TextEdit::redo(), Q3TextEdit::setText(), Q3TextEdit::setUndoRedoEnabled(), Q3TextEdit::undo(), and Q3TextParagraph::undo().
00801 { return commandHistory; }
| Q3TextFormatCollection * Q3TextDocument::formatCollection | ( | ) | const [inline] |
Definition at line 1738 of file q3richtext_p.h.
References fCollection.
Referenced by Q3TextEdit::changeEvent(), doLayout(), draw(), Q3TextParagraph::drawString(), Q3TextEdit::eventFilter(), Q3TextParagraph::formatCollection(), Q3TextEdit::handleMouseMove(), init(), Q3TextEdit::init(), Q3TextEdit::inputMethodEvent(), Q3TextFormatCommand::Q3TextFormatCommand(), Q3TextTableCell::Q3TextTableCell(), Q3TextEdit::resetFormat(), richText(), Q3TextEdit::setBold(), Q3TextEdit::setColor(), setDefaultFormat(), Q3TextEdit::setFamily(), Q3TextEdit::setFontInternal(), Q3TextEdit::setFormat(), Q3SyntaxHighlighter::setFormat(), Q3TextEdit::setItalic(), Q3TextEdit::setPointSize(), setRichTextInternal(), setRichTextMarginsInternal(), Q3TextEdit::setUnderline(), Q3TextEdit::setVerticalAlignment(), Q3TextCursor::splitAndInsertEmptyParagraph(), and Q3TextEdit::updateCurrentFormat().
01739 { 01740 return fCollection; 01741 }
| bool Q3TextDocument::find | ( | Q3TextCursor & | cursor, | |
| const QString & | expr, | |||
| bool | cs, | |||
| bool | wo, | |||
| bool | forward | |||
| ) |
Definition at line 3031 of file q3richtext.cpp.
References Q3TextCursor::atParagEnd(), Q3TextCursor::atParagStart(), Qt::CaseInsensitive, Qt::CaseSensitive, firstParagraph(), Q3TextCursor::gotoNextLetter(), Q3TextCursor::gotoPreviousLetter(), Q3TextCursor::index(), QString::isEmpty(), lastParagraph(), Q3TextCursor::paragraph(), removeSelection(), s, Q3TextCursor::setIndex(), setSelectionEnd(), setSelectionStart(), Standard, start, Q3TextParagraph::string(), and Q3TextString::toString().
Referenced by Q3TextEdit::find().
03032 { 03033 Qt::CaseSensitivity caseSensitive = cs ? Qt::CaseSensitive : Qt::CaseInsensitive; 03034 removeSelection(Standard); 03035 if (expr.isEmpty()) 03036 return false; 03037 for (;;) { 03038 QString s = cursor.paragraph()->string()->toString(); 03039 int start = cursor.index(); 03040 for (;;) { 03041 int res = forward 03042 ? s.indexOf(expr, start, caseSensitive) 03043 : s.lastIndexOf(expr, start, caseSensitive); 03044 int end = res + expr.length(); 03045 if (res == -1 || (!forward && start <= res)) 03046 break; 03047 if (!wo || ((res == 0 || !s[res-1].isLetterOrNumber()) 03048 && (end == (int)s.length() || !s[end].isLetterOrNumber()))) { 03049 removeSelection(Standard); 03050 cursor.setIndex(forward ? end : res); 03051 setSelectionStart(Standard, cursor); 03052 cursor.setIndex(forward ? res : end); 03053 setSelectionEnd(Standard, cursor); 03054 if (!forward) 03055 cursor.setIndex(res); 03056 return true; 03057 } 03058 start = res + (forward ? 1 : -1); 03059 } 03060 if (forward) { 03061 if (cursor.paragraph() == lastParagraph() && cursor.atParagEnd()) 03062 break; 03063 cursor.gotoNextLetter(); 03064 } else { 03065 if (cursor.paragraph() == firstParagraph() && cursor.atParagStart()) 03066 break; 03067 cursor.gotoPreviousLetter(); 03068 } 03069 } 03070 return false; 03071 }
Here is the call graph for this function:

| void Q3TextDocument::setTextFormat | ( | Qt::TextFormat | f | ) |
Definition at line 3073 of file q3richtext.cpp.
References fParag, Q3TextParagraph::length(), lParag, Qt::RichText, Q3TextParagraph::rtext, and txtFormat.
Referenced by Q3SimpleRichText::Q3SimpleRichText(), and Q3TextEdit::setTextFormat().
03074 { 03075 txtFormat = f; 03076 if (fParag == lParag && fParag->length() <= 1) 03077 fParag->rtext = (f == Qt::RichText); 03078 }
Here is the call graph for this function:

| Qt::TextFormat Q3TextDocument::textFormat | ( | ) | const |
Definition at line 3080 of file q3richtext.cpp.
References txtFormat.
Referenced by Q3TextEdit::append(), Q3TextParagraph::drawString(), Q3TextEdit::keyPressEvent(), and Q3TextEdit::textFormat().
03081 { 03082 return txtFormat; 03083 }
| bool Q3TextDocument::inSelection | ( | int | selId, | |
| const QPoint & | pos | |||
| ) | const |
Definition at line 3085 of file q3richtext.cpp.
References QMap< Key, T >::end(), Q3TextDocumentSelection::endCursor, QMap< Key, T >::find(), h, i, p, Q3TextParagraph::paragId(), Q3TextCursor::paragraph(), Q3TextParagraph::selectionEnd(), selections, Q3TextParagraph::selectionStart(), Q3TextDocumentSelection::startCursor, and y().
Referenced by Q3TextEdit::contentsMouseMoveEvent(), Q3TextEdit::contentsMousePressEvent(), and setSelectionEnd().
03086 { 03087 QMap<int, Q3TextDocumentSelection>::ConstIterator it = selections.find(selId); 03088 if (it == selections.end()) 03089 return false; 03090 03091 Q3TextDocumentSelection sel = *it; 03092 Q3TextParagraph *startParag = sel.startCursor.paragraph(); 03093 Q3TextParagraph *endParag = sel.endCursor.paragraph(); 03094 if (sel.startCursor.paragraph() == sel.endCursor.paragraph() && 03095 sel.startCursor.paragraph()->selectionStart(selId) == sel.endCursor.paragraph()->selectionEnd(selId)) 03096 return false; 03097 if (sel.endCursor.paragraph()->paragId() < sel.startCursor.paragraph()->paragId()) { 03098 endParag = sel.startCursor.paragraph(); 03099 startParag = sel.endCursor.paragraph(); 03100 } 03101 03102 Q3TextParagraph *p = startParag; 03103 while (p) { 03104 if (p->rect().contains(pos)) { 03105 bool inSel = false; 03106 int selStart = p->selectionStart(selId); 03107 int selEnd = p->selectionEnd(selId); 03108 int y = 0; 03109 int h = 0; 03110 for (int i = 0; i < p->length(); ++i) { 03111 if (i == selStart) 03112 inSel = true; 03113 if (i == selEnd) 03114 break; 03115 if (p->at(i)->lineStart) { 03116 y = (*p->lineStarts.find(i))->y; 03117 h = (*p->lineStarts.find(i))->h; 03118 } 03119 if (pos.y() - p->rect().y() >= y && pos.y() - p->rect().y() <= y + h) { 03120 if (inSel && pos.x() >= p->at(i)->x && 03121 pos.x() <= p->at(i)->x + p->at(i)->format()->width(p->at(i)->c)) 03122 return true; 03123 } 03124 } 03125 } 03126 if (pos.y() < p->rect().y()) 03127 break; 03128 if (p == endParag) 03129 break; 03130 p = p->next(); 03131 } 03132 03133 return false; 03134 }
Here is the call graph for this function:

| Q3StyleSheet* Q3TextDocument::styleSheet | ( | ) | const [inline] |
Definition at line 812 of file q3richtext_p.h.
Referenced by richText(), and Q3TextEdit::styleSheet().
00812 { return sheet_; }
| Q3MimeSourceFactory* Q3TextDocument::mimeSourceFactory | ( | ) | const [inline] |
Definition at line 814 of file q3richtext_p.h.
Referenced by Q3TextEdit::mimeSourceFactory().
00814 { return factory_; }
| QString Q3TextDocument::context | ( | ) | const [inline] |
Definition at line 816 of file q3richtext_p.h.
Referenced by Q3TextEdit::contentsMouseReleaseEvent(), Q3TextEdit::context(), Q3SimpleRichText::context(), Q3TextEdit::handleReadOnlyKeyEvent(), Q3SimpleRichText::setDefaultFont(), setRichText(), setText(), tag(), and Q3TextEdit::updateCursor().
00816 { return contxt; }
| void Q3TextDocument::setStyleSheet | ( | Q3StyleSheet * | s | ) |
Definition at line 3915 of file q3richtext.cpp.
References li_bm, li_tm, list_bm, list_lm, list_tm, Q3StyleSheetItem::margin(), Q3StyleSheetItem::MarginBottom, Q3StyleSheetItem::MarginLeft, Q3StyleSheetItem::MarginTop, par_bm, par_tm, qMax(), s, and sheet_.
Referenced by init(), Q3SimpleRichText::Q3SimpleRichText(), Q3TextTableCell::Q3TextTableCell(), and Q3TextEdit::setStyleSheet().
03916 { 03917 if (!s) 03918 return; 03919 sheet_ = s; 03920 list_tm = list_bm = par_tm = par_bm = 12; 03921 list_lm = 40; 03922 li_tm = li_bm = 0; 03923 Q3StyleSheetItem* item = s->item("ol"); 03924 if (item) { 03925 list_tm = qMax(0,item->margin(Q3StyleSheetItem::MarginTop)); 03926 list_bm = qMax(0,item->margin(Q3StyleSheetItem::MarginBottom)); 03927 list_lm = qMax(0,item->margin(Q3StyleSheetItem::MarginLeft)); 03928 } 03929 if ((item = s->item("li"))) { 03930 li_tm = qMax(0,item->margin(Q3StyleSheetItem::MarginTop)); 03931 li_bm = qMax(0,item->margin(Q3StyleSheetItem::MarginBottom)); 03932 } 03933 if ((item = s->item("p"))) { 03934 par_tm = qMax(0,item->margin(Q3StyleSheetItem::MarginTop)); 03935 par_bm = qMax(0,item->margin(Q3StyleSheetItem::MarginBottom)); 03936 } 03937 }
Here is the call graph for this function:

Definition at line 3324 of file q3richtext.cpp.
References QList< T >::at(), childList, Q3TextFormatCollection::defaultFormat(), fCollection, Q3TextFormat::font(), formatCollection(), fParag, i, p, setDefaultFormat(), sheet_, QList< T >::size(), tStopWidth, Q3TextFormatCollection::updateDefaultFormat(), and Q3TextFormat::width().
Referenced by Q3TextEdit::changeEvent(), draw(), Q3TextEdit::eventFilter(), Q3TextEdit::optimDrawContents(), Q3SimpleRichText::Q3SimpleRichText(), Q3SimpleRichText::setDefaultFont(), and setDefaultFormat().
03325 { 03326 bool reformat = font != fCollection->defaultFormat()->font(); 03327 for (int idx = 0; idx < childList.size(); ++idx) { 03328 Q3TextDocument *dc = childList.at(idx); 03329 dc->setDefaultFormat(font, color); 03330 } 03331 fCollection->updateDefaultFormat(font, color, sheet_); 03332 03333 if (!reformat) 03334 return; 03335 tStopWidth = formatCollection()->defaultFormat()->width('x') * 8; 03336 03337 // invalidate paragraphs and custom items 03338 Q3TextParagraph *p = fParag; 03339 while (p) { 03340 p->invalidate(0); 03341 #ifndef QT_NO_TEXTCUSTOMITEM 03342 for (int i = 0; i < p->length() - 1; ++i) 03343 if (p->at(i)->isCustom()) 03344 p->at(i)->customItem()->invalidate(); 03345 #endif 03346 p = p->next(); 03347 } 03348 }
Here is the call graph for this function:

| void Q3TextDocument::setMimeSourceFactory | ( | Q3MimeSourceFactory * | f | ) | [inline] |
Definition at line 821 of file q3richtext_p.h.
Referenced by Q3SimpleRichText::Q3SimpleRichText(), Q3TextTableCell::Q3TextTableCell(), and Q3TextEdit::setMimeSourceFactory().
00821 { if (f) factory_ = f; }
| void Q3TextDocument::setContext | ( | const QString & | c | ) | [inline] |
| void Q3TextDocument::setUnderlineLinks | ( | bool | b | ) |
Definition at line 3939 of file q3richtext.cpp.
References QList< T >::at(), childList, setUnderlineLinks(), QList< T >::size(), and underlLinks.
Referenced by Q3SimpleRichText::Q3SimpleRichText(), Q3TextEdit::setLinkUnderline(), and setUnderlineLinks().
03939 { 03940 underlLinks = b; 03941 for (int idx = 0; idx < childList.size(); ++idx) { 03942 Q3TextDocument *dc = childList.at(idx); 03943 dc->setUnderlineLinks(b); 03944 } 03945 }
Here is the call graph for this function:

| bool Q3TextDocument::underlineLinks | ( | ) | const [inline] |
Definition at line 826 of file q3richtext_p.h.
Referenced by Q3TextEdit::linkUnderline(), and Q3TextEdit::setLinkUnderline().
00826 { return underlLinks; }
| void Q3TextDocument::setPaper | ( | QBrush * | brush | ) | [inline] |
Definition at line 828 of file q3richtext_p.h.
Referenced by Q3SimpleRichText::draw(), Q3TextEdit::setPaper(), and setRichTextInternal().
00828 { if (backBrush) delete backBrush; backBrush = brush; }
| QBrush* Q3TextDocument::paper | ( | ) | const [inline] |
Definition at line 829 of file q3richtext_p.h.
Referenced by Q3TextTableCell::draw(), draw(), Q3SimpleRichText::draw(), Q3TextEdit::paintDocument(), and Q3TextEdit::paper().
00829 { return backBrush; }
| void Q3TextDocument::doLayout | ( | QPainter * | p, | |
| int | w | |||
| ) |
Definition at line 3136 of file q3richtext.cpp.
References Q3TextParagraph::adjustToPainter(), cw, Q3TextFormatCollection::defaultFormat(), flow_, Q3TextParagraph::format(), formatCollection(), fParag, Q3TextParagraph::invalidate(), is_printer(), minw, Q3TextParagraph::next(), p, Q3TextFormat::painter(), Q3TextFormat::setPainter(), Q3TextFlow::setWidth(), tStopWidth, vw, Q3TextFormat::width(), withoutDoubleBuffer, and wused.
Referenced by Q3SimpleRichTextData::adjustSize(), Q3TextTableCell::draw(), Q3TextTableCell::heightForWidth(), Q3TextEdit::heightForWidth(), Q3TextEdit::optimDrawContents(), Q3TextTableCell::setGeometry(), and Q3SimpleRichText::setWidth().
03137 { 03138 minw = wused = 0; 03139 if (!is_printer(p)) 03140 p = 0; 03141 withoutDoubleBuffer = (p != 0); 03142 QPainter * oldPainter = Q3TextFormat::painter(); 03143 Q3TextFormat::setPainter(p); 03144 tStopWidth = formatCollection()->defaultFormat()->width( 'x' ) * 8; 03145 flow_->setWidth(w); 03146 cw = w; 03147 vw = w; 03148 Q3TextParagraph *parag = fParag; 03149 while (parag) { 03150 parag->invalidate(0); 03151 if (p) 03152 parag->adjustToPainter(p); 03153 parag->format(); 03154 parag = parag->next(); 03155 } 03156 Q3TextFormat::setPainter(oldPainter); 03157 }
Here is the call graph for this function:

| void Q3TextDocument::draw | ( | QPainter * | p, | |
| const QRect & | rect, | |||
| const QPalette & | pal, | |||
| const QBrush * | paper = 0 | |||
| ) |
Definition at line 3168 of file q3richtext.cpp.
References QBrush::color(), Q3TextFlow::drawFloatingItems(), firstParagraph(), flow(), Q3TextParagraph::format(), formatCollection(), QRect::height(), QRect::intersects(), isEmpty(), QRect::isNull(), Q3TextParagraph::isValid(), QRect::isValid(), Q3TextParagraph::next(), p, Q3TextParagraph::paint(), Q3TextFormat::painter(), paper(), QWIDGETSIZE_MAX, Q3TextParagraph::rect(), setDefaultFormat(), Q3TextFormat::setPainter(), QPalette::text(), QRect::width(), QRect::x(), QRect::y(), and y().
Referenced by Q3TextTableCell::draw(), draw(), Q3SimpleRichText::draw(), Q3TextEdit::optimDrawContents(), Q3TextEdit::paintDocument(), and Q3TextBrowser::popupDetail().
03170 { 03171 if (!firstParagraph()) 03172 return; 03173 03174 if (paper) { 03175 p->setBrushOrigin(-qIntCast(p->translationX()), 03176 -qIntCast(p->translationY())); 03177 03178 p->fillRect(rect, *paper); 03179 } 03180 03181 QPainter * oldPainter = Q3TextFormat::painter(); 03182 Q3TextFormat::setPainter(p); 03183 03184 if (formatCollection()->defaultFormat()->color() != pal.text().color()) 03185 setDefaultFormat(formatCollection()->defaultFormat()->font(), pal.text().color()); 03186 03187 Q3TextParagraph *parag = firstParagraph(); 03188 while (parag) { 03189 if (!parag->isValid()) 03190 parag->format(); 03191 int y = parag->rect().y(); 03192 QRect pr(parag->rect()); 03193 pr.setX(0); 03194 pr.setWidth(QWIDGETSIZE_MAX); 03195 if (!rect.isNull() && !rect.intersects(pr)) { 03196 parag = parag->next(); 03197 continue; 03198 } 03199 p->translate(0, y); 03200 if (rect.isValid()) 03201 parag->paint(*p, pal, 0, false, rect.x(), rect.y(), rect.width(), rect.height()); 03202 else 03203 parag->paint(*p, pal, 0, false); 03204 p->translate(0, -y); 03205 parag = parag->next(); 03206 if (!flow()->isEmpty()) 03207 flow()->drawFloatingItems(p, rect.x(), rect.y(), rect.width(), rect.height(), pal, false); 03208 } 03209 Q3TextFormat::setPainter(oldPainter); 03210 }
Here is the call graph for this function:

| void Q3TextDocument::drawParagraph | ( | QPainter * | p, | |
| Q3TextParagraph * | parag, | |||
| int | cx, | |||
| int | cy, | |||
| int | cw, | |||
| int | ch, | |||
| QPixmap *& | doubleBuffer, | |||
| const QPalette & | pal, | |||
| bool | drawCursor, | |||
| Q3TextCursor * | cursor, | |||
| bool | resetChanged = true | |||
| ) |
Definition at line 3212 of file q3richtext.cpp.
References Q3TextParagraph::backgroundBrush(), QPainter::brushOrigin(), Q3TextParagraph::document(), QPainter::fillRect(), nextDoubleBuffered, Q3TextParagraph::paint(), parent(), Q3TextParagraph::rect(), QPainter::setBrushOrigin(), Q3TextParagraph::setChanged(), Q3TextParagraph::tableCell(), QPainter::translate(), width(), QRect::x(), and QRect::y().
Referenced by draw().
03216 { 03217 if (resetChanged) 03218 parag->setChanged(false); 03219 QRect ir(parag->rect()); 03220 #ifndef QT_NO_TEXTCUSTOMITEM 03221 if (!parag->tableCell()) 03222 #endif 03223 ir.setWidth(width()); 03224 03225 painter->translate(ir.x(), ir.y()); 03226 03227 if (!parag->document()->parent()) { 03228 const QPoint oldOrigin = painter->brushOrigin(); 03229 painter->setBrushOrigin(-ir.topLeft()); 03230 painter->fillRect(QRect(0, 0, ir.width(), ir.height()), parag->backgroundBrush(pal)); 03231 painter->setBrushOrigin(oldOrigin); 03232 } 03233 03234 painter->translate(-(ir.x() - parag->rect().x()), 03235 -(ir.y() - parag->rect().y())); 03236 parag->paint(*painter, pal, drawCursor ? cursor : 0, true, cx, cy, cw, ch); 03237 03238 painter->translate(-ir.x(), -ir.y()); 03239 03240 parag->document()->nextDoubleBuffered = false; 03241 }
Here is the call graph for this function:

| Q3TextParagraph * Q3TextDocument::draw | ( | QPainter * | p, | |
| int | cx, | |||
| int | cy, | |||
| int | cw, | |||
| int | ch, | |||
| const QPalette & | pal, | |||
| bool | onlyChanged = false, |
|||
| bool | drawCursor = false, |
|||
| Q3TextCursor * | cursor = 0, |
|||
| bool | resetChanged = true | |||
| ) |
Definition at line 3243 of file q3richtext.cpp.
References QPalette::Base, QPalette::brush(), buf_pixmap, QBrush::color(), Q3TextParagraph::document(), draw(), Q3TextFlow::drawFloatingItems(), drawParagraph(), fillRect(), firstParagraph(), flow(), Q3TextParagraph::format(), formatCollection(), Q3TextParagraph::hasChanged(), QPixmap::height(), height(), QRect::height(), QRect::intersects(), isEmpty(), Q3TextParagraph::isValid(), lastParagraph(), Q3TextParagraph::next(), p, Q3TextFormat::painter(), par, parent(), Q3TextParagraph::rect(), setDefaultFormat(), Q3TextFormat::setPainter(), QRect::setWidth(), QPalette::text(), QRect::width(), width(), withoutDoubleBuffer, QRect::x(), and QRect::y().
03246 { 03247 if (withoutDoubleBuffer || par && par->withoutDoubleBuffer) { 03248 withoutDoubleBuffer = true; 03249 QRect r; 03250 draw(p, r, pal); 03251 return 0; 03252 } 03253 withoutDoubleBuffer = false; 03254 03255 if (!firstParagraph()) 03256 return 0; 03257 03258 QPainter * oldPainter = Q3TextFormat::painter(); 03259 Q3TextFormat::setPainter(p); 03260 if (formatCollection()->defaultFormat()->color() != pal.text().color()) 03261 setDefaultFormat(formatCollection()->defaultFormat()->font(), pal.text().color()); 03262 03263 if (cx < 0 && cy < 0) { 03264 cx = 0; 03265 cy = 0; 03266 cw = width(); 03267 ch = height(); 03268 } 03269 03270 Q3TextParagraph *lastFormatted = 0; 03271 Q3TextParagraph *parag = firstParagraph(); 03272 03273 QPixmap *doubleBuffer = 0; 03274 03275 while (parag) { 03276 lastFormatted = parag; 03277 if (!parag->isValid()) 03278 parag->format(); 03279 03280 QRect pr = parag->rect(); 03281 pr.setWidth(parag->document()->width()); 03282 if (pr.y() > cy + ch) 03283 goto floating; 03284 QRect clipr(cx, cy, cw, ch); 03285 if (!pr.intersects(clipr) || (onlyChanged && !parag->hasChanged())) { 03286 pr.setWidth(parag->document()->width()); 03287 parag = parag->next(); 03288 continue; 03289 } 03290 03291 drawParagraph(p, parag, cx, cy, cw, ch, doubleBuffer, pal, drawCursor, 03292 cursor, resetChanged); 03293 parag = parag->next(); 03294 } 03295 03296 parag = lastParagraph(); 03297 03298 floating: 03299 if (parag->rect().y() + parag->rect().height() < parag->document()->height()) { 03300 if (!parag->document()->parent()) { 03301 QRect fillRect = QRect(0, parag->rect().y() + parag->rect().height(), parag->document()->width(), 03302 parag->document()->height() - (parag->rect().y() + parag->rect().height())); 03303 if (QRect(cx, cy, cw, ch).intersects(fillRect)) 03304 p->fillRect(fillRect, pal.brush(QPalette::Base)); 03305 } 03306 if (!flow()->isEmpty()) { 03307 QRect cr(cx, cy, cw, ch); 03308 flow()->drawFloatingItems(p, cr.x(), cr.y(), cr.width(), cr.height(), pal, false); 03309 } 03310 } 03311 03312 if (buf_pixmap && buf_pixmap->height() > 300) { 03313 delete buf_pixmap; 03314 buf_pixmap = 0; 03315 } 03316 03317 Q3TextFormat::setPainter(oldPainter); 03318 return lastFormatted; 03319 }
Here is the call graph for this function:

| Q3TextCustomItem * Q3TextDocument::tag | ( | Q3StyleSheet * | sheet, | |
| const QString & | name, | |||
| const QMap< QString, QString > & | attr, | |||
| const QString & | context, | |||
| const Q3MimeSourceFactory & | factory, | |||
| bool | emptyTag, | |||
| Q3TextDocument * | doc | |||
| ) | [static] |
Generates an internal object for the tag called name, given the attributes attr, and using additional information provided by the mime source factory factory.
context is the optional context of the document, i.e. the path to look for relative links. This becomes important if the text contains relative references, for example within image tags. QSimpleRichText always uses the default mime source factory (see {Q3MimeSourceFactory::defaultFactory()}) to resolve these references. The context will then be used to calculate the absolute path. See Q3MimeSourceFactory::makeAbsolute() for details.
emptyTag and doc are for internal use only.
This function should not be used in application code.
Definition at line 3371 of file q3richtext.cpp.
References context(), Q3StyleSheet::item(), name, and Q3StyleSheetItem::name().
Referenced by parseCloseTag(), parseOpenTag(), and setRichTextInternal().
03376 { 03377 const Q3StyleSheetItem* style = sheet->item(name); 03378 // first some known tags 03379 if (!style) 03380 return 0; 03381 if (style->name() == "img"