#include <q3richtext_p.h>
Collaboration diagram for Q3TextCursor:

Definition at line 276 of file q3richtext_p.h.
Public Member Functions | |
| Q3TextCursor (Q3TextDocument *=0) | |
| Q3TextCursor (const Q3TextCursor &c) | |
| Q3TextCursor & | operator= (const Q3TextCursor &c) |
| virtual | ~Q3TextCursor () |
| bool | operator== (const Q3TextCursor &c) const |
| bool | operator!= (const Q3TextCursor &c) const |
| Q3TextParagraph * | paragraph () const |
| Q3TextDocument * | document () const |
| int | index () const |
| void | gotoPosition (Q3TextParagraph *p, int index=0) |
| void | setIndex (int index) |
| void | setParagraph (Q3TextParagraph *p) |
| void | gotoLeft () |
| void | gotoRight () |
| void | gotoNextLetter () |
| void | gotoPreviousLetter () |
| void | gotoUp () |
| void | gotoDown () |
| void | gotoLineEnd () |
| void | gotoLineStart () |
| void | gotoHome () |
| void | gotoEnd () |
| void | gotoPageUp (int visibleHeight) |
| void | gotoPageDown (int visibleHeight) |
| void | gotoNextWord (bool onlySpace=false) |
| void | gotoPreviousWord (bool onlySpace=false) |
| void | gotoWordLeft () |
| void | gotoWordRight () |
| void | insert (const QString &s, bool checkNewLine, QVector< Q3TextStringChar > *formatting=0) |
| void | splitAndInsertEmptyParagraph (bool ind=true, bool updateIds=true) |
| bool | remove () |
| bool | removePreviousChar () |
| void | indent () |
| bool | atParagStart () |
| bool | atParagEnd () |
| int | x () const |
| int | y () const |
| int | globalX () const |
| int | globalY () const |
| Q3TextParagraph * | topParagraph () const |
| int | offsetX () const |
| int | offsetY () const |
| int | totalOffsetX () const |
| int | totalOffsetY () const |
| bool | place (const QPoint &pos, Q3TextParagraph *s) |
| bool | place (const QPoint &pos, Q3TextParagraph *s, bool link) |
| void | restoreState () |
| int | nestedDepth () const |
| void | oneUp () |
| void | setValid (bool b) |
| bool | isValid () const |
| void | fixCursorPosition () |
Private Types | |
| enum | Operation |
Private Member Functions | |
| void | push () |
| void | pop () |
| bool | processNesting (Operation op) |
| void | invalidateNested () |
| void | gotoIntoNested (const QPoint &globalPos) |
Private Attributes | |
| Q3TextParagraph * | para |
| int | idx |
| int | tmpX |
| int | ox |
| int | oy |
| QStack< int > | indices |
| QStack< Q3TextParagraph * > | paras |
| QStack< int > | xOffsets |
| QStack< int > | yOffsets |
| uint | valid: 1 |
enum Q3TextCursor::Operation [private] |
| Q3TextCursor::Q3TextCursor | ( | Q3TextDocument * | = 0 |
) |
Definition at line 408 of file q3richtext.cpp.
References Q3TextDocument::firstParagraph(), and para.
00409 : idx(0), tmpX(-1), ox(0), oy(0), 00410 valid(true) 00411 { 00412 para = dc ? dc->firstParagraph() : 0; 00413 }
Here is the call graph for this function:

| Q3TextCursor::Q3TextCursor | ( | const Q3TextCursor & | c | ) |
Definition at line 415 of file q3richtext.cpp.
References c, idx, indices, ox, oy, para, paras, tmpX, valid, xOffsets, and yOffsets.
00416 { 00417 ox = c.ox; 00418 oy = c.oy; 00419 idx = c.idx; 00420 para = c.para; 00421 tmpX = c.tmpX; 00422 indices = c.indices; 00423 paras = c.paras; 00424 xOffsets = c.xOffsets; 00425 yOffsets = c.yOffsets; 00426 valid = c.valid; 00427 }
| Q3TextCursor::~Q3TextCursor | ( | ) | [virtual] |
| Q3TextCursor & Q3TextCursor::operator= | ( | const Q3TextCursor & | c | ) |
Definition at line 433 of file q3richtext.cpp.
References c, idx, indices, ox, oy, para, paras, tmpX, valid, xOffsets, and yOffsets.
00434 { 00435 ox = c.ox; 00436 oy = c.oy; 00437 idx = c.idx; 00438 para = c.para; 00439 tmpX = c.tmpX; 00440 indices = c.indices; 00441 paras = c.paras; 00442 xOffsets = c.xOffsets; 00443 yOffsets = c.yOffsets; 00444 valid = c.valid; 00445 00446 return *this; 00447 }
| bool Q3TextCursor::operator== | ( | const Q3TextCursor & | c | ) | const |
| bool Q3TextCursor::operator!= | ( | const Q3TextCursor & | c | ) | const [inline] |
| Q3TextParagraph* Q3TextCursor::paragraph | ( | ) | const [inline] |
Definition at line 287 of file q3richtext_p.h.
Referenced by Q3MultiLineEdit::atBeginning(), Q3MultiLineEdit::atEnd(), Q3TextEdit::contentsDropEvent(), Q3TextEdit::contentsMouseDoubleClickEvent(), Q3TextEdit::find(), Q3TextDocument::find(), Q3TextEdit::handleMouseMove(), Q3TextDocument::indentSelection(), Q3TextDocument::inSelection(), Q3TextEdit::insert(), Q3TextEdit::optimDrawContents(), Q3TextParagraph::paint(), Q3TextEdit::pasteSubType(), Q3TextEdit::readFormats(), Q3TextDocument::removeSelectedText(), Q3TextParagraph::richText(), Q3TextDocument::richText(), Q3TextDocument::selectedText(), Q3TextDocument::selectionEnd(), Q3TextDocument::selectionStart(), Q3TextEdit::setFormat(), Q3TextDocument::setFormat(), Q3TextDocument::setRichTextInternal(), Q3TextDocument::setSelectionEnd(), setSelectionEndHelper(), and Q3TextDeleteCommand::unexecute().
00287 { return para; }
| Q3TextDocument * Q3TextCursor::document | ( | ) | const |
Definition at line 122 of file q3richtext_p.cpp.
References Q3TextParagraph::document(), and para.
Referenced by gotoEnd(), gotoHome(), gotoIntoNested(), and place().
Here is the call graph for this function:

| int Q3TextCursor::index | ( | ) | const [inline] |
Definition at line 1583 of file q3richtext_p.h.
References idx.
Referenced by Q3TextEdit::contentsDropEvent(), Q3TextEdit::contentsMouseDoubleClickEvent(), Q3TextEdit::find(), Q3TextDocument::find(), gotoPageDown(), gotoPageUp(), Q3TextEdit::handleMouseMove(), Q3TextEdit::insert(), Q3TextParagraph::paint(), Q3TextEdit::pasteSubType(), place(), Q3TextEdit::readFormats(), Q3TextDocument::removeSelectedText(), Q3TextParagraph::richText(), Q3TextDocument::richText(), Q3TextDocument::selectedText(), Q3TextDocument::selectionEnd(), Q3TextDocument::selectionStart(), Q3TextEdit::setFormat(), Q3TextDocument::setFormat(), Q3TextDocument::setSelectionEnd(), and setSelectionEndHelper().
01584 { 01585 return idx; 01586 }
| void Q3TextCursor::gotoPosition | ( | Q3TextParagraph * | p, | |
| int | index = 0 | |||
| ) |
Definition at line 127 of file q3richtext_p.cpp.
References Q3TextParagraph::document(), fixCursorPosition(), idx, indices, QVector< T >::isEmpty(), length, p, para, pop(), qWarning(), and tmpX.
Referenced by Q3TextEdit::find(), gotoEnd(), and gotoHome().
00128 { 00129 if (para && p != para) { 00130 while (para->document() != p->document() && !indices.isEmpty()) 00131 pop(); 00132 Q_ASSERT(indices.isEmpty() || para->document() == p->document()); 00133 } 00134 para = p; 00135 if (index < 0 || index >= para->length()) { 00136 qWarning("Q3TextCursor::gotoParagraph Index: %d out of range", index); 00137 if (index < 0 || para->length() == 0) 00138 index = 0; 00139 else 00140 index = para->length() - 1; 00141 } 00142 00143 tmpX = -1; 00144 idx = index; 00145 fixCursorPosition(); 00146 }
Here is the call graph for this function:

| void Q3TextCursor::setIndex | ( | int | index | ) | [inline] |
Definition at line 293 of file q3richtext_p.h.
Referenced by Q3TextEdit::contentsDropEvent(), Q3TextDeleteCommand::execute(), Q3TextFormatCommand::execute(), Q3TextDocument::find(), Q3TextEdit::optimDrawContents(), Q3TextEdit::optimSetTextFormat(), Q3TextEdit::pasteSubType(), place(), Q3TextEdit::removeParagraph(), Q3TextFormatCommand::unexecute(), and Q3TextDeleteCommand::unexecute().
00293 { gotoPosition(paragraph(), index); }
| void Q3TextCursor::setParagraph | ( | Q3TextParagraph * | p | ) | [inline] |
Definition at line 294 of file q3richtext_p.h.
References p.
Referenced by Q3TextDeleteCommand::execute(), Q3TextFormatCommand::execute(), Q3TextEdit::optimDrawContents(), Q3TextEdit::pasteSubType(), place(), Q3TextEdit::removeParagraph(), Q3TextFormatCommand::unexecute(), and Q3TextDeleteCommand::unexecute().
00294 { gotoPosition(p, 0); }
| void Q3TextCursor::gotoLeft | ( | ) |
Definition at line 587 of file q3richtext.cpp.
References gotoNextLetter(), gotoPreviousLetter(), Q3TextString::isRightToLeft(), para, and Q3TextParagraph::string().
Referenced by Q3TextFormatCommand::execute(), and Q3TextFormatCommand::unexecute().
00588 { 00589 if (para->string()->isRightToLeft()) 00590 gotoNextLetter(); 00591 else 00592 gotoPreviousLetter(); 00593 }
Here is the call graph for this function:

| void Q3TextCursor::gotoRight | ( | ) |
Definition at line 799 of file q3richtext.cpp.
References gotoNextLetter(), gotoPreviousLetter(), Q3TextString::isRightToLeft(), para, and Q3TextParagraph::string().
00800 { 00801 if (para->string()->isRightToLeft()) 00802 gotoPreviousLetter(); 00803 else 00804 gotoNextLetter(); 00805 }
Here is the call graph for this function:

| void Q3TextCursor::gotoNextLetter | ( | ) |
Definition at line 807 of file q3richtext.cpp.
References Q3TextParagraph::at(), Q3TextStringChar::customItem(), EnterBegin, idx, Q3TextStringChar::isCustom(), Q3TextCustomItem::isNested(), Q3TextParagraph::isVisible(), length, nestedDepth(), Q3TextParagraph::next(), Next, Q3TextString::nextCursorPosition(), para, pop(), processNesting(), Q3TextParagraph::string(), and tmpX.
Referenced by Q3TextEdit::contentsMouseDoubleClickEvent(), Q3TextDeleteCommand::execute(), Q3TextEdit::find(), Q3TextDocument::find(), gotoLeft(), gotoRight(), Q3TextEdit::insert(), Q3TextEdit::pasteSubType(), and Q3TextDocument::removeSelectedText().
00808 { 00809 tmpX = -1; 00810 00811 #ifndef QT_NO_TEXTCUSTOMITEM 00812 const Q3TextStringChar *tsc = para->at(idx); 00813 if (tsc && tsc->isCustom() && tsc->customItem()->isNested()) { 00814 if (processNesting(EnterBegin)) 00815 return; 00816 } 00817 #endif 00818 00819 if (idx < para->length() - 1) { 00820 idx = para->string()->nextCursorPosition(idx); 00821 } else if (para->next()) { 00822 para = para->next(); 00823 while (!para->isVisible() && para->next()) 00824 para = para->next(); 00825 idx = 0; 00826 } else if (nestedDepth()) { 00827 pop(); 00828 processNesting(Next); 00829 if (idx == -1) { 00830 pop(); 00831 if (idx < para->length() - 1) { 00832 idx = para->string()->nextCursorPosition(idx); 00833 } else if (para->next()) { 00834 para = para->next(); 00835 idx = 0; 00836 } 00837 } 00838 } 00839 }
Here is the call graph for this function:

| void Q3TextCursor::gotoPreviousLetter | ( | ) |
Definition at line 595 of file q3richtext.cpp.
References Q3TextParagraph::at(), Q3TextStringChar::customItem(), EnterEnd, idx, Q3TextStringChar::isCustom(), Q3TextCustomItem::isNested(), Q3TextParagraph::isVisible(), Q3TextParagraph::length(), nestedDepth(), para, pop(), Q3TextParagraph::prev(), Prev, Q3TextString::previousCursorPosition(), processNesting(), Q3TextParagraph::string(), and tmpX.
Referenced by Q3TextEdit::contentsMouseDoubleClickEvent(), Q3TextEdit::find(), Q3TextDocument::find(), gotoLeft(), gotoPreviousWord(), gotoRight(), Q3TextEdit::pasteSubType(), Q3TextDocument::removeSelectedText(), and Q3TextDocument::setRichTextInternal().
00596 { 00597 tmpX = -1; 00598 00599 if (idx > 0) { 00600 idx = para->string()->previousCursorPosition(idx); 00601 #ifndef QT_NO_TEXTCUSTOMITEM 00602 const Q3TextStringChar *tsc = para->at(idx); 00603 if (tsc && tsc->isCustom() && tsc->customItem()->isNested()) 00604 processNesting(EnterEnd); 00605 #endif 00606 } else if (para->prev()) { 00607 para = para->prev(); 00608 while (!para->isVisible() && para->prev()) 00609 para = para->prev(); 00610 idx = para->length() - 1; 00611 } else if (nestedDepth()) { 00612 pop(); 00613 processNesting(Prev); 00614 if (idx == -1) { 00615 pop(); 00616 if (idx > 0) { 00617 idx = para->string()->previousCursorPosition(idx); 00618 #ifndef QT_NO_TEXTCUSTOMITEM 00619 const Q3TextStringChar *tsc = para->at(idx); 00620 if (tsc && tsc->isCustom() && tsc->customItem()->isNested()) 00621 processNesting(EnterEnd); 00622 #endif 00623 } else if (para->prev()) { 00624 para = para->prev(); 00625 idx = para->length() - 1; 00626 } 00627 } 00628 } 00629 }
Here is the call graph for this function:

| void Q3TextCursor::gotoUp | ( | ) |
Definition at line 841 of file q3richtext.cpp.
References Q3TextParagraph::at(), c, fixCursorPosition(), idx, length, Q3TextParagraph::lines(), Q3TextParagraph::lineStartOfChar(), Q3TextParagraph::lineStartOfLine(), nestedDepth(), p, para, pop(), Q3TextParagraph::prev(), processNesting(), tmpX, Up, Q3TextStringChar::x, and x().
Referenced by gotoPageUp().
00842 { 00843 int indexOfLineStart; 00844 int line; 00845 Q3TextStringChar *c = para->lineStartOfChar(idx, &indexOfLineStart, &line); 00846 if (!c) 00847 return; 00848 00849 if (tmpX < 0) 00850 tmpX = x(); 00851 00852 if (indexOfLineStart == 0) { 00853 if (!para->prev()) { 00854 if (!nestedDepth()) 00855 return; 00856 pop(); 00857 processNesting(Up); 00858 if (idx == -1) { 00859 pop(); 00860 if (!para->prev()) 00861 return; 00862 idx = tmpX = 0; 00863 } else { 00864 tmpX = -1; 00865 return; 00866 } 00867 } 00868 Q3TextParagraph *p = para->prev(); 00869 while (p && !p->isVisible()) 00870 p = p->prev(); 00871 if (p) 00872 para = p; 00873 int lastLine = para->lines() - 1; 00874 if (!para->lineStartOfLine(lastLine, &indexOfLineStart)) 00875 return; 00876 idx = indexOfLineStart; 00877 while (idx < para->length()-1 && para->at(idx)->x < tmpX) 00878 ++idx; 00879 if (idx > indexOfLineStart && 00880 para->at(idx)->x - tmpX > tmpX - para->at(idx-1)->x) 00881 --idx; 00882 } else { 00883 --line; 00884 int oldIndexOfLineStart = indexOfLineStart; 00885 if (!para->lineStartOfLine(line, &indexOfLineStart)) 00886 return; 00887 idx = indexOfLineStart; 00888 while (idx < oldIndexOfLineStart-1 && para->at(idx)->x < tmpX) 00889 ++idx; 00890 if (idx > indexOfLineStart && 00891 para->at(idx)->x - tmpX > tmpX - para->at(idx-1)->x) 00892 --idx; 00893 } 00894 fixCursorPosition(); 00895 }
Here is the call graph for this function:

| void Q3TextCursor::gotoDown | ( | ) |
Definition at line 897 of file q3richtext.cpp.
References Q3TextParagraph::at(), c, Down, fixCursorPosition(), idx, Q3TextParagraph::length(), Q3TextParagraph::lines(), Q3TextParagraph::lineStartOfChar(), Q3TextParagraph::lineStartOfLine(), nestedDepth(), Q3TextParagraph::next(), para, pop(), processNesting(), s, tmpX, Q3TextStringChar::x, and x().
Referenced by gotoPageDown().
00898 { 00899 int indexOfLineStart; 00900 int line; 00901 Q3TextStringChar *c = para->lineStartOfChar(idx, &indexOfLineStart, &line); 00902 if (!c) 00903 return; 00904 00905 if (tmpX < 0) 00906 tmpX = x(); 00907 00908 if (line == para->lines() - 1) { 00909 if (!para->next()) { 00910 if (!nestedDepth()) 00911 return; 00912 pop(); 00913 processNesting(Down); 00914 if (idx == -1) { 00915 pop(); 00916 if (!para->next()) 00917 return; 00918 idx = tmpX = 0; 00919 } else { 00920 tmpX = -1; 00921 return; 00922 } 00923 } 00924 Q3TextParagraph *s = para->next(); 00925 while (s && !s->isVisible()) 00926 s = s->next(); 00927 if (s) 00928 para = s; 00929 if (!para->lineStartOfLine(0, &indexOfLineStart)) 00930 return; 00931 int end; 00932 if (para->lines() == 1) 00933 end = para->length(); 00934 else 00935 para->lineStartOfLine(1, &end); 00936 00937 idx = indexOfLineStart; 00938 while (idx < end-1 && para->at(idx)->x < tmpX) 00939 ++idx; 00940 if (idx > indexOfLineStart && 00941 para->at(idx)->x - tmpX > tmpX - para->at(idx-1)->x) 00942 --idx; 00943 } else { 00944 ++line; 00945 int end; 00946 if (line == para->lines() - 1) 00947 end = para->length(); 00948 else 00949 para->lineStartOfLine(line + 1, &end); 00950 if (!para->lineStartOfLine(line, &indexOfLineStart)) 00951 return; 00952 idx = indexOfLineStart; 00953 while (idx < end-1 && para->at(idx)->x < tmpX) 00954 ++idx; 00955 if (idx > indexOfLineStart && 00956 para->at(idx)->x - tmpX > tmpX - para->at(idx-1)->x) 00957 --idx; 00958 } 00959 fixCursorPosition(); 00960 }
Here is the call graph for this function:

| void Q3TextCursor::gotoLineEnd | ( | ) |
Definition at line 962 of file q3richtext.cpp.
References c, idx, Q3TextParagraph::length(), Q3TextParagraph::lines(), Q3TextParagraph::lineStartOfChar(), Q3TextParagraph::lineStartOfLine(), para, and tmpX.
Referenced by Q3TextEdit::contentsMousePressEvent(), gotoEnd(), and gotoNextWord().
00963 { 00964 tmpX = -1; 00965 int indexOfLineStart; 00966 int line; 00967 Q3TextStringChar *c = para->lineStartOfChar(idx, &indexOfLineStart, &line); 00968 if (!c) 00969 return; 00970 00971 if (line == para->lines() - 1) { 00972 idx = para->length() - 1; 00973 } else { 00974 c = para->lineStartOfLine(++line, &indexOfLineStart); 00975 indexOfLineStart--; 00976 idx = indexOfLineStart; 00977 } 00978 }
Here is the call graph for this function:

| void Q3TextCursor::gotoLineStart | ( | ) |
Definition at line 980 of file q3richtext.cpp.
References c, idx, Q3TextParagraph::lineStartOfChar(), para, and tmpX.
Referenced by gotoHome().
00981 { 00982 tmpX = -1; 00983 int indexOfLineStart; 00984 int line; 00985 Q3TextStringChar *c = para->lineStartOfChar(idx, &indexOfLineStart, &line); 00986 if (!c) 00987 return; 00988 00989 idx = indexOfLineStart; 00990 }
Here is the call graph for this function:

| void Q3TextCursor::gotoHome | ( | ) |
Definition at line 992 of file q3richtext.cpp.
References document(), gotoLineStart(), gotoPosition(), and topParagraph().
00993 { 00994 if (topParagraph()->document()) 00995 gotoPosition(topParagraph()->document()->firstParagraph()); 00996 else 00997 gotoLineStart(); 00998 }
Here is the call graph for this function:

| void Q3TextCursor::gotoEnd | ( | ) |
Definition at line 1000 of file q3richtext.cpp.
References document(), gotoLineEnd(), gotoPosition(), isValid(), length, and topParagraph().
Referenced by Q3TextEdit::find().
01001 { 01002 if (topParagraph()->document() && topParagraph()->document()->lastParagraph()->isValid()) 01003 gotoPosition(topParagraph()->document()->lastParagraph(), 01004 topParagraph()->document()->lastParagraph()->length() - 1); 01005 else 01006 gotoLineEnd(); 01007 }
Here is the call graph for this function:

| void Q3TextCursor::gotoPageUp | ( | int | visibleHeight | ) |
Definition at line 1009 of file q3richtext.cpp.
References globalY(), gotoUp(), idx, index(), and para.
01010 { 01011 int targetY = globalY() - visibleHeight; 01012 Q3TextParagraph* old; int index; 01013 do { 01014 old = para; index = idx; 01015 gotoUp(); 01016 } while ((old != para || index != idx) && globalY() > targetY); 01017 }
Here is the call graph for this function:

| void Q3TextCursor::gotoPageDown | ( | int | visibleHeight | ) |
Definition at line 1019 of file q3richtext.cpp.
References globalY(), gotoDown(), idx, index(), and para.
01020 { 01021 int targetY = globalY() + visibleHeight; 01022 Q3TextParagraph* old; int index; 01023 do { 01024 old = para; index = idx; 01025 gotoDown(); 01026 } while ((old != para || index != idx) && globalY() < targetY); 01027 }
Here is the call graph for this function:

| void Q3TextCursor::gotoNextWord | ( | bool | onlySpace = false |
) |
Definition at line 1087 of file q3richtext.cpp.
References gotoLineEnd(), i, idx, int, is_seperator(), Q3TextParagraph::next(), p, para, s, Q3TextParagraph::string(), and tmpX.
Referenced by Q3TextEdit::contentsMouseDoubleClickEvent(), gotoWordLeft(), gotoWordRight(), and Q3TextEdit::handleMouseMove().
01088 { 01089 tmpX = -1; 01090 Q3TextString *s = para->string(); 01091 bool allowSame = false; 01092 for (int i = idx; i < (int)s->length(); ++i) { 01093 if (!is_seperator(s->at(i).c, onlySpace)) { 01094 if (!allowSame) 01095 continue; 01096 idx = i; 01097 return; 01098 } 01099 if (!allowSame && is_seperator(s->at(i).c, onlySpace)) 01100 allowSame = true; 01101 01102 } 01103 01104 if (idx < ((int)s->length()-1)) { 01105 gotoLineEnd(); 01106 } else if (para->next()) { 01107 Q3TextParagraph *p = para->next(); 01108 while (p && !p->isVisible()) 01109 p = p->next(); 01110 if (s) { 01111 para = p; 01112 idx = 0; 01113 } 01114 } else { 01115 gotoLineEnd(); 01116 } 01117 }
Here is the call graph for this function:

| void Q3TextCursor::gotoPreviousWord | ( | bool | onlySpace = false |
) |
Definition at line 1066 of file q3richtext.cpp.
References gotoPreviousLetter(), i, idx, is_seperator(), para, s, Q3TextParagraph::string(), and tmpX.
Referenced by Q3TextEdit::contentsMouseDoubleClickEvent(), gotoWordLeft(), gotoWordRight(), and Q3TextEdit::handleMouseMove().
01067 { 01068 gotoPreviousLetter(); 01069 tmpX = -1; 01070 Q3TextString *s = para->string(); 01071 bool allowSame = false; 01072 if (idx == ((int)s->length()-1)) 01073 return; 01074 for (int i = idx; i >= 0; --i) { 01075 if (is_seperator(s->at(i).c, onlySpace)) { 01076 if (!allowSame) 01077 continue; 01078 idx = i + 1; 01079 return; 01080 } 01081 if (!allowSame && !is_seperator(s->at(i).c, onlySpace)) 01082 allowSame = true; 01083 } 01084 idx = 0; 01085 }
Here is the call graph for this function:

| void Q3TextCursor::gotoWordLeft | ( | ) |
Definition at line 1037 of file q3richtext.cpp.
References gotoNextWord(), gotoPreviousWord(), Q3TextString::isRightToLeft(), para, and Q3TextParagraph::string().
01038 { 01039 if (para->string()->isRightToLeft()) 01040 gotoNextWord(); 01041 else 01042 gotoPreviousWord(); 01043 }
Here is the call graph for this function:

| void Q3TextCursor::gotoWordRight | ( | ) |
Definition at line 1029 of file q3richtext.cpp.
References gotoNextWord(), gotoPreviousWord(), Q3TextString::isRightToLeft(), para, and Q3TextParagraph::string().
01030 { 01031 if (para->string()->isRightToLeft()) 01032 gotoPreviousWord(); 01033 else 01034 gotoNextWord(); 01035 }
Here is the call graph for this function:

| void Q3TextCursor::insert | ( | const QString & | s, | |
| bool | checkNewLine, | |||
| QVector< Q3TextStringChar > * | formatting = 0 | |||
| ) |
Definition at line 504 of file q3richtext.cpp.
References Q3TextFormat::addRef(), QVector< T >::at(), Q3TextParagraph::document(), fixCursorPosition(), Q3TextStringChar::format, Q3TextParagraph::format(), h, QRect::height(), i, idx, Q3TextParagraph::insert(), int, Q3TextParagraph::invalidate(), invalidateNested(), len, Q3TextDocument::nextDoubleBuffered, p, para, Q3TextDocument::parent(), Q3TextParagraph::prev(), Q3TextParagraph::rect(), s, Q3TextParagraph::setEndState(), Q3TextString::setFormat(), splitAndInsertEmptyParagraph(), start, Q3TextParagraph::string(), tmpX, QRect::y(), and y().
Referenced by Q3TextDeleteCommand::unexecute().
00505 { 00506 tmpX = -1; 00507 bool justInsert = true; 00508 QString s(str); 00509 #if defined(Q_WS_WIN) 00510 if (checkNewLine) { 00511 int i = 0; 00512 while ((i = s.indexOf('\r', i)) != -1) 00513 s.remove(i ,1); 00514 } 00515 #endif 00516 if (checkNewLine) 00517 justInsert = s.indexOf('\n') == -1; 00518 if (justInsert) { // we ignore new lines and insert all in the current para at the current index 00519 para->insert(idx, s.unicode(), s.length()); 00520 if (formatting) { 00521 for (int i = 0; i < (int)s.length(); ++i) { 00522 if (formatting->at(i).format()) { 00523 formatting->at(i).format()->addRef(); 00524 para->string()->setFormat(idx + i, formatting->at(i).format(), true); 00525 } 00526 } 00527 } 00528 idx += s.length(); 00529 } else { // we split at new lines 00530 int start = -1; 00531 int end; 00532 int y = para->rect().y() + para->rect().height(); 00533 int lastIndex = 0; 00534 do { 00535 end = s.indexOf('\n', start + 1); // find line break 00536 if (end == -1) // didn't find one, so end of line is end of string 00537 end = s.length(); 00538 int len = (start == -1 ? end : end - start - 1); 00539 if (len > 0) // insert the line 00540 para->insert(idx, s.unicode() + start + 1, len); 00541 else 00542 para->invalidate(0); 00543 if (formatting) { // set formats to the chars of the line 00544 for (int i = 0; i < len; ++i) { 00545 if (formatting->at(i + lastIndex).format()) { 00546 formatting->at(i + lastIndex).format()->addRef(); 00547 para->string()->setFormat(i + idx, formatting->at(i + lastIndex).format(), true); 00548 } 00549 } 00550 lastIndex += len; 00551 } 00552 start = end; // next start is at the end of this line 00553 idx += len; // increase the index of the cursor to the end of the inserted text 00554 if (s[end] == '\n') { // if at the end was a line break, break the line 00555 splitAndInsertEmptyParagraph(false, true); 00556 para->setEndState(-1); 00557 para->prev()->format(-1, false); 00558 lastIndex++; 00559 } 00560 00561 } while (end < (int)s.length()); 00562 00563 para->format(-1, false); 00564 int dy = para->rect().y() + para->rect().height() - y; 00565 Q3TextParagraph *p = para; 00566 p->setParagId(p->prev() ? p->prev()->paragId() + 1 : 0); 00567 p = p->next(); 00568 while (p) { 00569 p->setParagId(p->prev()->paragId() + 1); 00570 p->move(dy); 00571 p->invalidate(0); 00572 p->setEndState(-1); 00573 p = p->next(); 00574 } 00575 } 00576 00577 int h = para->rect().height(); 00578 para->format(-1, true); 00579 if (h != para->rect().height()) 00580 invalidateNested(); 00581 else if (para->document() && para->document()->parent()) 00582 para->document()->nextDoubleBuffered = true; 00583 00584 fixCursorPosition(); 00585 }
Here is the call graph for this function:

| void Q3TextCursor::splitAndInsertEmptyParagraph | ( | bool | ind = true, |
|
| bool | updateIds = true | |||
| ) |
Definition at line 1129 of file q3richtext.cpp.
References Q3TextParagraph::at(), atParagEnd(), atParagStart(), Q3TextFormat::color(), Q3TextDocument::createParagraph(), Q3TextParagraph::document(), Q3TextFormat::font(), Q3TextStringChar::format, Q3TextFormatCollection::format(), Q3TextDocument::formatCollection(), i, idx, indent(), invalidateNested(), Q3TextFormat::isMisspelled(), QString::length(), Q3TextParagraph::length(), QString::mid(), n, Q3TextParagraph::next(), p, para, Q3TextParagraph::prev(), Q3TextFormat::removeRef(), s, Q3TextParagraph::string(), tmpX, Q3TextString::toString(), Q3TextParagraph::truncate(), and Q3TextDocument::useFormatCollection().
Referenced by insert(), and Q3TextDocument::setRichTextInternal().
01130 { 01131 if (!para->document()) 01132 return; 01133 tmpX = -1; 01134 Q3TextFormat *f = 0; 01135 if (para->document()->useFormatCollection()) { 01136 f = para->at(idx)->format(); 01137 if (idx == para->length() - 1 && idx > 0) 01138 f = para->at(idx - 1)->format(); 01139 if (f->isMisspelled()) { 01140 f->removeRef(); 01141 f = para->document()->formatCollection()->format(f->font(), f->color()); 01142 } 01143 } 01144 01145 if (atParagEnd()) { 01146 Q3TextParagraph *n = para->next(); 01147 Q3TextParagraph *s = para->document()->createParagraph(para->document(), para, n, updateIds); 01148 if (f) 01149 s->setFormat(0, 1, f, true); 01150 s->copyParagData(para); 01151 if (ind) { 01152 int oi, ni; 01153 s->indent(&oi, &ni); 01154 para = s; 01155 idx = ni; 01156 } else { 01157 para = s; 01158 idx = 0; 01159 } 01160 } else if (atParagStart()) { 01161 Q3TextParagraph *p = para->prev(); 01162 Q3TextParagraph *s = para->document()->createParagraph(para->document(), p, para, updateIds); 01163 if (f) 01164 s->setFormat(0, 1, f, true); 01165 s->copyParagData(para); 01166 if (ind) { 01167 s->indent(); 01168 s->format(); 01169 indent(); 01170 para->format(); 01171 } 01172 } else { 01173 QString str = para->string()->toString().mid(idx, 0xFFFFFF); 01174 Q3TextParagraph *n = para->next(); 01175 Q3TextParagraph *s = para->document()->createParagraph(para->document(), para, n, updateIds); 01176 s->copyParagData(para); 01177 s->remove(0, 1); 01178 s->append(str, true); 01179 for (int i = 0; i < str.length(); ++i) { 01180 Q3TextStringChar* tsc = para->at(idx + i); 01181 s->setFormat(i, 1, tsc->format(), true); 01182 #ifndef QT_NO_TEXTCUSTOMITEM 01183 if (tsc->isCustom()) { 01184 Q3TextCustomItem * item = tsc->customItem(); 01185 s->at(i)->setCustomItem(item); 01186 tsc->loseCustomItem(); 01187 } 01188 #endif 01189 if (tsc->isAnchor()) 01190 s->at(i)->setAnchor(tsc->anchorName(), 01191 tsc->anchorHref()); 01192 } 01193 para->truncate(idx); 01194 if (ind) { 01195 int oi, ni; 01196 s->indent(&oi, &ni); 01197 para = s; 01198 idx = ni; 01199 } else { 01200 para = s; 01201 idx = 0; 01202 } 01203 } 01204 01205 invalidateNested(); 01206 }
Here is the call graph for this function:

| bool Q3TextCursor::remove | ( | ) |
Definition at line 1208 of file q3richtext.cpp.
References atParagEnd(), Q3TextParagraph::document(), Q3TextParagraph::format(), h, QRect::height(), idx, invalidateNested(), Q3TextParagraph::join(), Q3TextParagraph::next(), next, Q3TextString::nextCursorPosition(), Q3TextDocument::nextDoubleBuffered, para, Q3TextDocument::parent(), Q3TextParagraph::rect(), Q3TextParagraph::remove(), Q3TextParagraph::string(), and tmpX.
Referenced by Q3TextDocument::setRichTextInternal().
01209 { 01210 tmpX = -1; 01211 if (!atParagEnd()) { 01212 int next = para->string()->nextCursorPosition(idx); 01213 para->remove(idx, next-idx); 01214 int h = para->rect().height(); 01215 para->format(-1, true); 01216 if (h != para->rect().height()) 01217 invalidateNested(); 01218 else if (para->document() && para->document()->parent()) 01219 para->document()->nextDoubleBuffered = true; 01220 return false; 01221 } else if (para->next()) { 01222 para->join(para->next()); 01223 invalidateNested(); 01224 return true; 01225 } 01226 return false; 01227 }
Here is the call graph for this function:

| bool Q3TextCursor::removePreviousChar | ( | ) |
Definition at line 1230 of file q3richtext.cpp.
References atParagStart(), Q3TextParagraph::document(), fixCursorPosition(), Q3TextParagraph::format(), h, QRect::height(), idx, invalidateNested(), Q3TextParagraph::join(), Q3TextParagraph::next(), Q3TextDocument::nextDoubleBuffered, para, Q3TextDocument::parent(), Q3TextParagraph::prev(), Q3TextParagraph::rect(), Q3TextParagraph::remove(), and tmpX.
01231 { 01232 tmpX = -1; 01233 if (!atParagStart()) { 01234 para->remove(idx-1, 1); 01235 int h = para->rect().height(); 01236 idx--; 01237 // shouldn't be needed, just to make sure. 01238 fixCursorPosition(); 01239 para->format(-1, true); 01240 if (h != para->rect().height()) 01241 invalidateNested(); 01242 else if (para->document() && para->document()->parent()) 01243 para->document()->nextDoubleBuffered = true; 01244 return false; 01245 } else if (para->prev()) { 01246 para = para->prev(); 01247 para->join(para->next()); 01248 invalidateNested(); 01249 return true; 01250 } 01251 return false; 01252 }
Here is the call graph for this function:

| void Q3TextCursor::indent | ( | ) |
Definition at line 1254 of file q3richtext.cpp.
References idx, Q3TextParagraph::indent(), and para.
Referenced by splitAndInsertEmptyParagraph().
01255 { 01256 int oi = 0, ni = 0; 01257 para->indent(&oi, &ni); 01258 if (oi == ni) 01259 return; 01260 01261 if (idx >= oi) 01262 idx += ni - oi; 01263 else 01264 idx = ni; 01265 }
Here is the call graph for this function:

| bool Q3TextCursor::atParagStart | ( | ) |
Definition at line 1119 of file q3richtext.cpp.
References idx.
Referenced by Q3MultiLineEdit::atBeginning(), Q3TextDocument::find(), removePreviousChar(), and splitAndInsertEmptyParagraph().
01120 { 01121 return idx == 0; 01122 }
| bool Q3TextCursor::atParagEnd | ( | ) |
Definition at line 1124 of file q3richtext.cpp.
References idx, Q3TextParagraph::length(), and para.
Referenced by Q3MultiLineEdit::atEnd(), Q3TextEdit::contentsMouseDoubleClickEvent(), Q3TextDocument::find(), remove(), and splitAndInsertEmptyParagraph().
Here is the call graph for this function:

| int Q3TextCursor::x | ( | ) | const |
Definition at line 94 of file q3richtext_p.cpp.
References Qt::AlignJustify, Q3TextParagraph::alignment(), Q3TextParagraph::at(), c, Q3TextStringChar::c, idx, Q3TextParagraph::length(), para, Q3TextParagraph::string(), Q3TextString::width(), and Q3TextStringChar::x.
Referenced by fixCursorPosition(), globalX(), gotoDown(), gotoUp(), Q3TextParagraph::paint(), and place().
00095 { 00096 if (idx >= para->length()) 00097 return 0; 00098 Q3TextStringChar *c = para->at(idx); 00099 int curx = c->x; 00100 if (!c->rightToLeft && 00101 c->c.isSpace() && 00102 idx > 0 && 00103 para->at(idx - 1)->c != '\t' && 00104 !c->lineStart && 00105 (para->alignment() & Qt::AlignJustify) == Qt::AlignJustify) 00106 curx = para->at(idx - 1)->x + para->string()->width(idx - 1); 00107 if (c->rightToLeft) 00108 curx += para->string()->width(idx); 00109 return curx; 00110 }
Here is the call graph for this function:

| int Q3TextCursor::y | ( | ) | const |
Definition at line 112 of file q3richtext_p.cpp.
References idx, Q3TextParagraph::lineStartOfChar(), Q3TextParagraph::lineY(), and para.
Referenced by globalY(), gotoIntoNested(), insert(), place(), and processNesting().
00113 { 00114 int dummy, line; 00115 para->lineStartOfChar(idx, &dummy, &line); 00116 return para->lineY(line); 00117 }
Here is the call graph for this function:

| int Q3TextCursor::globalX | ( | ) | const |
Definition at line 119 of file q3richtext_p.cpp.
References para, Q3TextParagraph::rect(), totalOffsetX(), QRect::x(), and x().
00119 { return totalOffsetX() + para->rect().x() + x(); }
Here is the call graph for this function:

| int Q3TextCursor::globalY | ( | ) | const |
Definition at line 120 of file q3richtext_p.cpp.
References para, Q3TextParagraph::rect(), totalOffsetY(), QRect::y(), and y().
Referenced by gotoPageDown(), and gotoPageUp().
00120 { return totalOffsetY() + para->rect().y() + y(); }
Here is the call graph for this function:

| Q3TextParagraph* Q3TextCursor::topParagraph | ( | ) | const [inline] |
Definition at line 328 of file q3richtext_p.h.
Referenced by Q3TextEdit::find(), gotoEnd(), gotoHome(), Q3TextEdit::setAlignment(), and Q3TextEdit::setParagType().
| int Q3TextCursor::offsetX | ( | ) | const [inline] |
Definition at line 329 of file q3richtext_p.h.
Referenced by place().
00329 { return ox; } // inner document offset
| int Q3TextCursor::offsetY | ( | ) | const [inline] |
Definition at line 330 of file q3richtext_p.h.
Referenced by place().
00330 { return oy; } // inner document offset
| int Q3TextCursor::totalOffsetX | ( | ) | const |
Definition at line 454 of file q3richtext.cpp.
References QVector< T >::begin(), QVector< T >::end(), ox, and xOffsets.
Referenced by globalX().
00455 { 00456 int xoff = ox; 00457 for (QStack<int>::ConstIterator xit = xOffsets.begin(); xit != xOffsets.end(); ++xit) 00458 xoff += *xit; 00459 return xoff; 00460 }
Here is the call graph for this function:

| int Q3TextCursor::totalOffsetY | ( | ) | const |
Definition at line 462 of file q3richtext.cpp.
References QVector< T >::begin(), QVector< T >::end(), oy, and yOffsets.
Referenced by globalY().
00463 { 00464 int yoff = oy; 00465 for (QStack<int>::ConstIterator yit = yOffsets.begin(); yit != yOffsets.end(); ++yit) 00466 yoff += *yit; 00467 return yoff; 00468 }
Here is the call graph for this function:

| bool Q3TextCursor::place | ( | const QPoint & | pos, | |
| Q3TextParagraph * | s | |||
| ) | [inline] |
| bool Q3TextCursor::place | ( | const QPoint & | pos, | |
| Q3TextParagraph * | s, | |||
| bool | link | |||
| ) |
Definition at line 655 of file q3richtext.cpp.
References Q3TextParagraph::at(), Q3TextStringChar::customItem(), diff(), Q3TextParagraph::document(), document(), gotoIntoNested(), Q3TextStringChar::height(), QRect::height(), i, index(), Q3TextStringChar::isCustom(), Q3TextCustomItem::isNested(), offsetX(), offsetY(), p, para, place(), pop(), QWIDGETSIZE_MAX, Q3TextStringChar::rightToLeft, s, setIndex(), setParagraph(), QRect::setWidth(), QPoint::setX(), QPoint::setY(), Q3TextParagraph::string(), Q3TextString::validCursorPosition(), width, Q3TextStringChar::x, QPoint::x(), x(), QRect::y(), QPoint::y(), and y().
00656 { 00657 QPoint pos(p); 00658 QRect r; 00659 Q3TextParagraph *str = s; 00660 if (pos.y() < s->rect().y()) { 00661 pos.setY(s->rect().y()); 00662 #ifdef Q_WS_MAC 00663 pos.setX(s->rect().x()); 00664 #endif 00665 } 00666 while (s) { 00667 r = s->rect(); 00668 r.setWidth(document() ? document()->width() : QWIDGETSIZE_MAX); 00669 if (s->isVisible()) 00670 str = s; 00671 if (pos.y() >= r.y() && pos.y() <= r.y() + r.height()) 00672 break; 00673 if (!s->next()) { 00674 #ifdef Q_WS_MAC 00675 pos.setX(s->rect().x() + s->rect().width()); 00676 #endif 00677 break; 00678 } 00679 s = s->next(); 00680 } 00681 00682 if (!s || !str) 00683 return false; 00684 00685 s = str; 00686 00687 setParagraph(s); 00688 int y = s->rect().y(); 00689 int lines = s->lines(); 00690 Q3TextStringChar *chr = 0; 00691 int index = 0; 00692 int i = 0; 00693 int cy = 0; 00694 int ch = 0; 00695 for (; i < lines; ++i) { 00696 chr = s->lineStartOfLine(i, &index); 00697 cy = s->lineY(i); 00698 ch = s->lineHeight(i); 00699 if (!chr) 00700 return false; 00701 if (pos.y() <= y + cy + ch) 00702 break; 00703 } 00704 int nextLine; 00705 if (i < lines - 1) 00706 s->lineStartOfLine(i+1, &nextLine); 00707 else 00708 nextLine = s->length(); 00709 i = index; 00710 int x = s->rect().x(); 00711 if (pos.x() < x) 00712 pos.setX(x + 1); 00713 int cw; 00714 int curpos = s->length()-1; 00715 int dist = 10000000; 00716 bool inCustom = false; 00717 while (i < nextLine) { 00718 chr = s->at(i); 00719 int cpos = x + chr->x; 00720 cw = s->string()->width(i); 00721 #ifndef QT_NO_TEXTCUSTOMITEM 00722 if (chr->isCustom() && chr->customItem()->isNested()) { 00723 if (pos.x() >= cpos && pos.x() <= cpos + cw && 00724 pos.y() >= y + cy && pos.y() <= y + cy + chr->height()) { 00725 inCustom = true; 00726 curpos = i; 00727 break; 00728 } 00729 } else 00730 #endif 00731 { 00732 if(chr->rightToLeft) 00733 cpos += cw; 00734 int diff = cpos - pos.x(); 00735 bool dm = diff < 0 ? !chr->rightToLeft : chr->rightToLeft; 00736 if ((QABS(diff) < dist || (dist == diff && dm == true)) && para->string()->validCursorPosition(i)) { 00737 dist = QABS(diff); 00738 if (!link || pos.x() >= x + chr->x) 00739 curpos = i; 00740 } 00741 } 00742 i++; 00743 } 00744 setIndex(curpos); 00745 00746 #ifndef QT_NO_TEXTCUSTOMITEM 00747 if (inCustom && para->document() && para->at(curpos)->isCustom() && para->at(curpos)->customItem()->isNested()) { 00748 Q3TextDocument *oldDoc = para->document(); 00749 gotoIntoNested(pos); 00750 if (oldDoc == para->document()) 00751 return true; 00752 QPoint p(pos.x() - offsetX(), pos.y() - offsetY()); 00753 if (!place(p, document()->firstParagraph(), link)) 00754 pop(); 00755 } 00756 #endif 00757 return true; 00758 }
Here is the call graph for this function:

| void Q3TextCursor::restoreState | ( | ) |
Definition at line 649 of file q3richtext.cpp.
References indices, QVector< T >::isEmpty(), and pop().
Referenced by Q3TextEdit::contentsDropEvent(), Q3TextEdit::readFormats(), Q3TextDocument::removeSelectedText(), Q3TextEdit::removeSelectedText(), Q3TextEdit::setFormat(), Q3TextDocument::setFormat(), and Q3TextDocument::setSelectionEnd().
Here is the call graph for this function:

| int Q3TextCursor::nestedDepth | ( | ) | const [inline] |
Definition at line 339 of file q3richtext_p.h.
Referenced by gotoDown(), gotoNextLetter(), gotoPreviousLetter(), gotoUp(), invalidateNested(), Q3TextDocument::removeSelectedText(), Q3TextEdit::removeSelectedText(), and Q3TextDocument::selectedText().
| void Q3TextCursor::oneUp | ( | ) | [inline] |
| void Q3TextCursor::setValid | ( | bool | b | ) | [inline] |
| bool Q3TextCursor::isValid | ( | ) | const [inline] |
Definition at line 342 of file q3richtext_p.h.
Referenced by gotoEnd(), and Q3TextDocument::removeSelectedText().
00342 { return valid; }
| void Q3TextCursor::fixCursorPosition | ( | ) |
Definition at line 1267 of file q3richtext.cpp.
References Q3TextString::at(), c, diff(), idx, Q3TextParagraph::length(), Q3TextParagraph::lineStartOfChar(), para, start, Q3TextParagraph::string(), Q3TextString::validCursorPosition(), Q3TextString::width(), Q3TextStringChar::x, and x().
Referenced by gotoDown(), gotoPosition(), gotoUp(), insert(), and removePreviousChar().
01268 { 01269 // searches for the closest valid cursor position 01270 if (para->string()->validCursorPosition(idx)) 01271 return; 01272 01273 int lineIdx; 01274 Q3TextStringChar *start = para->lineStartOfChar(idx, &lineIdx, 0); 01275 int x = para->string()->at(idx).x; 01276 int diff = QABS(start->x - x); 01277 int best = lineIdx; 01278 01279 Q3TextStringChar *c = start; 01280 ++c; 01281 01282 Q3TextStringChar *end = ¶->string()->at(para->length()-1); 01283 while (c <= end && !c->lineStart) { 01284 int xp = c->x; 01285 if (c->rightToLeft) 01286 xp += para->string()->width(lineIdx + (c-start)); 01287 int ndiff = QABS(xp - x); 01288 if (ndiff < diff && para->string()->validCursorPosition(lineIdx + (c-start))) { 01289 diff = ndiff; 01290 best = lineIdx + (c-start); 01291 } 01292 ++c; 01293 } 01294 idx = best; 01295 }
Here is the call graph for this function:

| void Q3TextCursor::push | ( | ) | [private] |
Definition at line 631 of file q3richtext.cpp.
References idx, indices, ox, oy, para, paras, QStack< T >::push(), xOffsets, and yOffsets.
Referenced by gotoIntoNested(), and processNesting().
00632 { 00633 indices.push(idx); 00634 paras.push(para); 00635 xOffsets.push(ox); 00636 yOffsets.push(oy); 00637 }
Here is the call graph for this function:

| void Q3TextCursor::pop | ( | ) | [private] |
Definition at line 639 of file q3richtext.cpp.
References idx, indices, QVector< T >::isEmpty(), ox, oy, para, paras, QStack< T >::pop(), xOffsets, and yOffsets.
Referenced by gotoDown(), gotoNextLetter(), gotoPosition(), gotoPreviousLetter(), gotoUp(), place(), processNesting(), and restoreState().
00640 { 00641 if (indices.isEmpty()) 00642 return; 00643 idx = indices.pop(); 00644 para = paras.pop(); 00645 ox = xOffsets.pop(); 00646 oy = yOffsets.pop(); 00647 }
Here is the call graph for this function:

| bool Q3TextCursor::processNesting | ( | Operation | op | ) | [private] |
Definition at line 760 of file q3richtext.cpp.
References Q3TextParagraph::at(), Q3TextStringChar::customItem(), Q3TextParagraph::document(), Down, Q3TextCustomItem::down(), Q3TextCustomItem::enter(), EnterBegin, EnterEnd, idx, Q3TextParagraph::lineHeightOfChar(), Q3TextCustomItem::next(), Next, ox, oy, para, pop(), Q3TextCustomItem::prev(), Prev, push(), Q3TextParagraph::rect(), Up, Q3TextCustomItem::up(), Q3TextStringChar::x, QRect::y(), and y().
Referenced by gotoDown(), gotoNextLetter(), gotoPreviousLetter(), and gotoUp().
00761 { 00762 if (!para->document()) 00763 return false; 00764 Q3TextDocument* doc = para->document(); 00765 push(); 00766 ox = para->at(idx)->x; 00767 int bl, y; 00768 para->lineHeightOfChar(idx, &bl, &y); 00769 oy = y + para->rect().y(); 00770 bool ok = false; 00771 00772 #ifndef QT_NO_TEXTCUSTOMITEM 00773 switch (op) { 00774 case EnterBegin: 00775 ok = para->at(idx)->customItem()->enter(this, doc, para, idx, ox, oy); 00776 break; 00777 case EnterEnd: 00778 ok = para->at(idx)->customItem()->enter(this, doc, para, idx, ox, oy, true); 00779 break; 00780 case Next: 00781 ok = para->at(idx)->customItem()->next(this, doc, para, idx, ox, oy); 00782 break; 00783 case Prev: 00784 ok = para->at(idx)->customItem()->prev(this, doc, para, idx, ox, oy); 00785 break; 00786 case Down: 00787 ok = para->at(idx)->customItem()->down(this, doc, para, idx, ox, oy); 00788 break; 00789 case Up: 00790 ok = para->at(idx)->customItem()->up(this, doc, para, idx, ox, oy); 00791 break; 00792 } 00793 if (!ok) 00794 #endif 00795 pop(); 00796 return ok; 00797 }
Here is the call graph for this function:

| void Q3TextCursor::invalidateNested | ( | ) | [private] |
Definition at line 487 of file q3richtext.cpp.
References QVector< T >::begin(), QVector< T >::end(), indices, nestedDepth(), para, and paras.
Referenced by insert(), remove(), removePreviousChar(), and splitAndInsertEmptyParagraph().
00488 { 00489 if (nestedDepth()) { 00490 QStack<Q3TextParagraph*>::Iterator it = paras.begin(); 00491 QStack<int>::Iterator it2 = indices.begin(); 00492 for (; it != paras.end(); ++it, ++it2) { 00493 if (*it == para) 00494 continue; 00495 (*it)->invalidate(0); 00496 #ifndef QT_NO_TEXTCUSTOMITEM 00497 if ((*it)->at(*it2)->isCustom()) 00498 (*it)->at(*it2)->customItem()->invalidate(); 00499 #endif 00500 } 00501 } 00502 }
Here is the call graph for this function:

| void Q3TextCursor::gotoIntoNested | ( | const QPoint & | globalPos | ) | [private] |
Definition at line 471 of file q3richtext.cpp.
References Q3TextParagraph::at(), Q3TextStringChar::customItem(), document(), Q3TextCustomItem::enterAt(), idx, Q3TextStringChar::isCustom(), Q3TextParagraph::lineHeightOfChar(), ox, oy, para, push(), Q3TextParagraph::rect(), Q3TextStringChar::x, QRect::y(), and y().
Referenced by place().
00472 { 00473 if (!para) 00474 return; 00475 Q_ASSERT(para->at(idx)->isCustom()); 00476 push(); 00477 ox = 0; 00478 int bl, y; 00479 para->lineHeightOfChar(idx, &bl, &y); 00480 oy = y + para->rect().y(); 00481 ox = para->at(idx)->x; 00482 Q3TextDocument* doc = document(); 00483 para->at(idx)->customItem()->enterAt(this, doc, para, idx, ox, oy, globalPos-QPoint(ox,oy)); 00484 }
Here is the call graph for this function:

Q3TextParagraph* Q3TextCursor::para [private] |
Definition at line 354 of file q3richtext_p.h.
Referenced by atParagEnd(), document(), fixCursorPosition(), globalX(), globalY(), gotoDown(), gotoIntoNested(), gotoLeft(), gotoLineEnd(), gotoLineStart(), gotoNextLetter(), gotoNextWord(), gotoPageDown(), gotoPageUp(), gotoPosition(), gotoPreviousLetter(), gotoPreviousWord(), gotoRight(), gotoUp(), gotoWordLeft(), gotoWordRight(), indent(), insert(), invalidateNested(), operator=(), operator==(), place(), pop(), processNesting(), push(), Q3TextCursor(), remove(), removePreviousChar(), splitAndInsertEmptyParagraph(), x(), and y().
int Q3TextCursor::idx [private] |
Definition at line 355 of file q3richtext_p.h.
Referenced by atParagEnd(), atParagStart(), fixCursorPosition(), gotoDown(), gotoIntoNested(), gotoLineEnd(), gotoLineStart(), gotoNextLetter(), gotoNextWord(), gotoPageDown(), gotoPageUp(), gotoPosition(), gotoPreviousLetter(), gotoPreviousWord(), gotoUp(), indent(), index(), insert(), operator=(), operator==(), pop(), processNesting(), push(), Q3TextCursor(), remove(), removePreviousChar(), splitAndInsertEmptyParagraph(), x(), and y().
int Q3TextCursor::tmpX [private] |
Definition at line 355 of file q3richtext_p.h.
Referenced by gotoDown(), gotoLineEnd(), gotoLineStart(), gotoNextLetter(), gotoNextWord(), gotoPosition(), gotoPreviousLetter(), gotoPreviousWord(), gotoUp(), insert(), operator=(), Q3TextCursor(), remove(), removePreviousChar(), and splitAndInsertEmptyParagraph().
int Q3TextCursor::ox [private] |
Definition at line 356 of file q3richtext_p.h.
Referenced by gotoIntoNested(), operator=(), pop(), processNesting(), push(), Q3TextCursor(), and totalOffsetX().
int Q3TextCursor::oy [private] |
Definition at line 356 of file q3richtext_p.h.
Referenced by gotoIntoNested(), operator=(), pop(), processNesting(), push(), Q3TextCursor(), and totalOffsetY().
QStack<int> Q3TextCursor::indices [private] |
Definition at line 357 of file q3richtext_p.h.
Referenced by gotoPosition(), invalidateNested(), operator=(), pop(), push(), Q3TextCursor(), and restoreState().
QStack<Q3TextParagraph*> Q3TextCursor::paras [private] |
Definition at line 358 of file q3richtext_p.h.
Referenced by invalidateNested(), operator=(), pop(), push(), and Q3TextCursor().
QStack<int> Q3TextCursor::xOffsets [private] |
Definition at line 359 of file q3richtext_p.h.
Referenced by operator=(), pop(), push(), Q3TextCursor(), and totalOffsetX().
QStack<int> Q3TextCursor::yOffsets [private] |
Definition at line 360 of file q3richtext_p.h.
Referenced by operator=(), pop(), push(), Q3TextCursor(), and totalOffsetY().
uint Q3TextCursor::valid [private] |
1.5.1