Q3TextParagraph Class Reference

#include <q3richtext_p.h>

Collaboration diagram for Q3TextParagraph:

Collaboration graph
[legend]
List of all members.

Detailed Description

Definition at line 1096 of file q3richtext_p.h.

Public Member Functions

 Q3TextParagraph (Q3TextDocument *dc, Q3TextParagraph *pr=0, Q3TextParagraph *nx=0, bool updateIds=true)
 ~Q3TextParagraph ()
Q3TextStringstring () const
Q3TextStringCharat (int i) const
int leftGap () const
int length () const
void setListStyle (Q3StyleSheetItem::ListStyle ls)
Q3StyleSheetItem::ListStyle listStyle () const
void setListItem (bool li)
bool isListItem () const
void setListValue (int v)
int listValue () const
void setListDepth (int depth)
int listDepth () const
Q3TextDocumentdocument () const
Q3TextParagraphPseudoDocumentpseudoDocument () const
QRect rect () const
void setHeight (int h)
void show ()
void hide ()
bool isVisible () const
Q3TextParagraphprev () const
Q3TextParagraphnext () const
void setPrev (Q3TextParagraph *s)
void setNext (Q3TextParagraph *s)
void insert (int index, const QString &s)
void insert (int index, const QChar *unicode, int len)
void append (const QString &s, bool reallyAtEnd=false)
void truncate (int index)
void remove (int index, int len)
void join (Q3TextParagraph *s)
void invalidate (int chr)
void move (int &dy)
void format (int start=-1, bool doMove=true)
bool isValid () const
bool hasChanged () const
void setChanged (bool b, bool recursive=false)
int lineHeightOfChar (int i, int *bl=0, int *y=0) const
Q3TextStringCharlineStartOfChar (int i, int *index=0, int *line=0) const
int lines () const
Q3TextStringCharlineStartOfLine (int line, int *index=0) const
int lineY (int l) const
int lineBaseLine (int l) const
int lineHeight (int l) const
void lineInfo (int l, int &y, int &h, int &bl) const
void setSelection (int id, int start, int end)
void removeSelection (int id)
int selectionStart (int id) const
int selectionEnd (int id) const
bool hasSelection (int id) const
bool hasAnySelection () const
bool fullSelected (int id) const
void setEndState (int s)
int endState () const
void setParagId (int i)
int paragId () const
bool firstPreProcess () const
void setFirstPreProcess (bool b)
void indent (int *oldIndent=0, int *newIndent=0)
void setExtraData (Q3TextParagraphData *data)
Q3TextParagraphDataextraData () const
QMap< int, QTextLineStart * > & lineStartList ()
void setFormat (int index, int len, Q3TextFormat *f, bool useCollection=true, int flags=-1)
void setAlignment (int a)
int alignment () const
void paint (QPainter &painter, const QPalette &pal, Q3TextCursor *cursor=0, bool drawSelections=false, int clipx=-1, int clipy=-1, int clipw=-1, int cliph=-1)
int topMargin () const
int bottomMargin () const
int leftMargin () const
int firstLineMargin () const
int rightMargin () const
int lineSpacing () const
void registerFloatingItem (Q3TextCustomItem *i)
void unregisterFloatingItem (Q3TextCustomItem *i)
void setFullWidth (bool b)
bool isFullWidth () const
Q3TextTableCelltableCell () const
QBrushbackground () const
int documentWidth () const
int documentVisibleWidth () const
int documentX () const
int documentY () const
Q3TextFormatCollectionformatCollection () const
Q3TextFormatterformatter () const
int nextTab (int i, int x)
int * tabArray () const
void setTabArray (int *a)
void setTabStops (int tw)
void adjustToPainter (QPainter *p)
void setNewLinesAllowed (bool b)
bool isNewLinesAllowed () const
QString richText () const
void addCommand (Q3TextCommand *cmd)
Q3TextCursorundo (Q3TextCursor *c=0)
Q3TextCursorredo (Q3TextCursor *c=0)
Q3TextCommandHistorycommands () const
void copyParagData (Q3TextParagraph *parag)
void setBreakable (bool b)
bool isBreakable () const
void setBackgroundColor (const QColor &c)
QColorbackgroundColor () const
void clearBackgroundColor ()
void setMovedDown (bool b)
bool wasMovedDown () const
void setDirection (QChar::Direction)
QChar::Direction direction () const
void setPaintDevice (QPaintDevice *pd)
void readStyleInformation (QDataStream &stream)
void writeStyleInformation (QDataStream &stream) const

Protected Member Functions

void setColorForSelection (QColor &c, QPainter &p, const QPalette &pal, int selection)
void drawLabel (QPainter *p, int x, int y, int w, int h, int base, const QPalette &pal)
void drawString (QPainter &painter, const QString &str, int start, int len, int xstart, int y, int baseLine, int w, int h, bool drawSelections, int fullSelectionWidth, Q3TextStringChar *formatChar, const QPalette &pal, bool rightToLeft)

Private Member Functions

QMap< int, Q3TextParagraphSelection > & selections () const
QList< Q3TextCustomItem * > & floatingItems () const
QBrush backgroundBrush (const QPalette &pal)
void invalidateStyleCache ()

Private Attributes

QMap< int, QTextLineStart * > lineStarts
QRect r
Q3TextParagraphp
Q3TextParagraphn
void * docOrPseudo
uint changed: 1
uint firstFormat: 1
uint firstPProcess: 1
uint needPreProcess: 1
uint fullWidth: 1
uint lastInFrame: 1
uint visible: 1
uint breakable: 1
uint movedDown: 1
uint mightHaveCustomItems: 1
uint hasdoc: 1
uint litem: 1
uint rtext: 1
signed int align: 5
uint lstyle: 4
int invalid
int state
int id
Q3TextStringstr
QMap< int, Q3TextParagraphSelection > * mSelections
QList< Q3TextCustomItem * > * mFloatingItems
short utm
short ubm
short ulm
short urm
short uflm
short ulinespacing
short tabStopWidth
short minwidth
int * tArray
Q3TextParagraphDataeData
short list_val
ushort ldepth
QColorbgcol
QPaintDevicepaintdevice

Friends

class Q3TextDocument
class Q3TextCursor
class Q3SyntaxHighlighter


Constructor & Destructor Documentation

Q3TextParagraph::Q3TextParagraph ( Q3TextDocument dc,
Q3TextParagraph pr = 0,
Q3TextParagraph nx = 0,
bool  updateIds = true 
)

Definition at line 4057 of file q3richtext.cpp.

References bgcol, Q3TextParagraphPseudoDocument::commandHistory, Q3TextFormatCollection::defaultFormat(), docOrPseudo, document(), formatCollection(), hasdoc, id, Q3TextString::insert(), list_val, Q3StyleSheetItem::ListDisc, lstyle, n, p, paintdevice, pseudoDocument(), s, Q3TextDocument::setFirstParagraph(), Q3TextDocument::setLastParagraph(), state, str, tabStopWidth, and Q3TextFormat::width().

04058     : p(pr), n(nx), docOrPseudo(dc),
04059       changed(false), firstFormat(true), firstPProcess(true), needPreProcess(false), fullWidth(true),
04060       lastInFrame(false), visible(true), breakable(true), movedDown(false),
04061       mightHaveCustomItems(false), hasdoc(dc != 0), litem(false), rtext(false),
04062       align(0), lstyle(Q3StyleSheetItem::ListDisc), invalid(0), mSelections(0),
04063 #ifndef QT_NO_TEXTCUSTOMITEM
04064       mFloatingItems(0),
04065 #endif
04066       utm(0), ubm(0), ulm(0), urm(0), uflm(0), ulinespacing(0),
04067       tabStopWidth(0), minwidth(0), tArray(0), eData(0), ldepth(0)
04068 {
04069     lstyle = Q3StyleSheetItem::ListDisc;
04070     if (!hasdoc)
04071         docOrPseudo = new Q3TextParagraphPseudoDocument;
04072     bgcol = 0;
04073     list_val = -1;
04074     paintdevice = 0;
04075     Q3TextFormat* defFormat = formatCollection()->defaultFormat();
04076     if (!hasdoc) {
04077         tabStopWidth = defFormat->width('x') * 8;
04078         pseudoDocument()->commandHistory = new Q3TextCommandHistory(100);
04079     }
04080 
04081     if (p)
04082         p->n = this;
04083     if (n)
04084         n->p = this;
04085 
04086     if (!p && hasdoc)
04087         document()->setFirstParagraph(this);
04088     if (!n && hasdoc)
04089         document()->setLastParagraph(this);
04090 
04091     state = -1;
04092 
04093     if (p)
04094         id = p->id + 1;
04095     else
04096         id = 0;
04097     if (n && updateIds) {
04098         Q3TextParagraph *s = n;
04099         while (s) {
04100             s->id = s->p->id + 1;
04101             s->invalidateStyleCache();
04102             s = s->n;
04103         }
04104     }
04105 
04106     str = new Q3TextString();
04107     QChar ch(' ');
04108     str->insert(0, &ch, 1, formatCollection()->defaultFormat());
04109 }

Here is the call graph for this function:

Q3TextParagraph::~Q3TextParagraph (  ) 

Definition at line 4111 of file q3richtext.cpp.

References QMap< Key, T >::begin(), bgcol, Q3TextDocument::curParag, document(), eData, QMap< Key, T >::end(), hasdoc, lineStarts, mFloatingItems, Q3TextDocument::minw, Q3TextDocument::minwParag, mSelections, n, p, pseudoDocument(), setNext(), str, and tArray.

04112 {
04113     delete str;
04114     if (hasdoc) {
04115         register Q3TextDocument *doc = document();
04116         if (this == doc->minwParag) {
04117             doc->minwParag = 0;
04118             doc->minw = 0;
04119         }
04120         if (this == doc->curParag)
04121             doc->curParag = 0;
04122     } else {
04123         delete pseudoDocument();
04124     }
04125     delete [] tArray;
04126     delete eData;
04127     QMap<int, QTextLineStart*>::Iterator it = lineStarts.begin();
04128     for (; it != lineStarts.end(); ++it)
04129         delete *it;
04130     if (mSelections)
04131         delete mSelections;
04132 #ifndef QT_NO_TEXTCUSTOMITEM
04133     if (mFloatingItems)
04134         delete mFloatingItems;
04135 #endif
04136     if (p)
04137         p->setNext(n);
04138     if (n)
04139         n->setPrev(p);
04140     delete bgcol;
04141 }

Here is the call graph for this function:


Member Function Documentation

Q3TextString * Q3TextParagraph::string (  )  const [inline]

Definition at line 1941 of file q3richtext_p.h.

References str.

Referenced by Q3TextDocument::find(), Q3TextCursor::fixCursorPosition(), Q3TextFormatterBreakInWords::format(), Q3TextFormatterBreakWords::format(), Q3TextFormatter::formatVertically(), Q3TextCursor::gotoLeft(), Q3TextCursor::gotoNextLetter(), Q3TextCursor::gotoNextWord(), Q3TextCursor::gotoPreviousLetter(), Q3TextCursor::gotoPreviousWord(), Q3TextCursor::gotoRight(), Q3TextCursor::gotoWordLeft(), Q3TextCursor::gotoWordRight(), Q3TextCursor::insert(), leftMargin(), Q3TextEdit::optimDrawContents(), paint(), Q3TextCursor::place(), Q3TextCursor::remove(), rightMargin(), Q3TextDocument::setRichTextInternal(), Q3TextCursor::splitAndInsertEmptyParagraph(), Q3MultiLineEdit::textLine(), and Q3TextCursor::x().

01942 {
01943     return str;
01944 }

Q3TextStringChar * Q3TextParagraph::at ( int  i  )  const [inline]

Definition at line 1850 of file q3richtext_p.h.

References Q3TextString::at(), and str.

Referenced by adjustToPainter(), Q3TextEdit::contentsMouseDoubleClickEvent(), drawLabel(), Q3TextFormatterBreakWords::format(), Q3TextCursor::gotoDown(), Q3TextCursor::gotoIntoNested(), Q3TextCursor::gotoNextLetter(), Q3TextCursor::gotoPreviousLetter(), Q3TextCursor::gotoUp(), Q3TextEdit::handleMouseMove(), Q3TextEdit::insert(), join(), paint(), Q3TextEdit::pasteSubType(), Q3TextCursor::place(), Q3TextCursor::processNesting(), Q3TextEdit::readFormats(), remove(), Q3TextDocument::setRichTextInternal(), Q3TextCursor::splitAndInsertEmptyParagraph(), and Q3TextCursor::x().

01851 {
01852     return &str->at(i);
01853 }

Here is the call graph for this function:

int Q3TextParagraph::leftGap (  )  const

Definition at line 4501 of file q3richtext.cpp.

References Q3TextString::at(), QMap< Key, T >::begin(), QMap< Key, T >::count(), i, Q3TextString::isBidi(), isValid(), QMap< Key, T >::key(), Q3TextString::length(), lineStarts, qMin(), str, Q3TextStringChar::x, and x.

04502 {
04503     if (!isValid())
04504         ((Q3TextParagraph*)this)->format();
04505 
04506     if (str->length() == 0)
04507         return 0;
04508 
04509     int line = 0;
04510     int x = str->length() ? str->at(0).x : 0;  /* set x to x of first char */
04511     if (str->isBidi()) {
04512         for (int i = 1; i < str->length()-1; ++i)
04513             x = qMin(x, str->at(i).x);
04514         return x;
04515     }
04516 
04517     QMap<int, QTextLineStart*>::ConstIterator it = lineStarts.begin();
04518     while (line < (int)lineStarts.count()) {
04519         int i = it.key(); /* char index */
04520         x = qMin(x, str->at(i).x);
04521         ++it;
04522         ++line;
04523     }
04524     return x;
04525 }

Here is the call graph for this function:

int Q3TextParagraph::length (  )  const [inline]

Definition at line 1573 of file q3richtext_p.h.

References Q3TextString::length(), and str.

Referenced by adjustToPainter(), Q3TextCursor::atParagEnd(), drawString(), Q3TextFormatCommand::execute(), Q3TextCursor::fixCursorPosition(), Q3TextDocument::focusNextPrevChild(), Q3TextFormatterBreakInWords::format(), Q3TextFormatterBreakWords::format(), Q3TextCursor::gotoDown(), Q3TextCursor::gotoLineEnd(), Q3TextCursor::gotoPreviousLetter(), join(), Q3MultiLineEdit::lineLength(), Q3TextEdit::optimDrawContents(), paint(), Q3TextTable::prev(), Q3TextEdit::readFormats(), Q3TextDocument::removeSelectedText(), richText(), Q3TextDocument::selectAll(), Q3TextDocument::setFormat(), Q3TextDocument::setRichTextInternal(), Q3TextEdit::setSelection(), Q3TextDocument::setSelectionEnd(), setSelectionEndHelper(), Q3TextDocument::setTextFormat(), Q3TextCursor::splitAndInsertEmptyParagraph(), truncate(), Q3TextFormatCommand::unexecute(), Q3TextTable::up(), and Q3TextCursor::x().

01574 {
01575     return str->length();
01576 }

Here is the call graph for this function:

void Q3TextParagraph::setListStyle ( Q3StyleSheetItem::ListStyle  ls  )  [inline]

Definition at line 1111 of file q3richtext_p.h.

01111 { lstyle = ls; changed = true; }

Q3StyleSheetItem::ListStyle Q3TextParagraph::listStyle (  )  const [inline]

Definition at line 1112 of file q3richtext_p.h.

Referenced by drawLabel().

void Q3TextParagraph::setListItem ( bool  li  ) 

Definition at line 5044 of file q3richtext.cpp.

References changed, litem, prev(), and s.

Referenced by Q3TextDocument::setRichTextMarginsInternal().

05045 {
05046     if ((bool)litem == li)
05047         return;
05048     litem = li;
05049     changed = true;
05050     Q3TextParagraph* s = prev() ? prev() : this;
05051     while (s) {
05052         s->invalidate(0);
05053         s = s->next();
05054     }
05055 }

Here is the call graph for this function:

bool Q3TextParagraph::isListItem (  )  const [inline]

Definition at line 1114 of file q3richtext_p.h.

Referenced by bottomMargin(), indent(), paint(), and topMargin().

01114 { return litem; }

void Q3TextParagraph::setListValue ( int  v  )  [inline]

Definition at line 1115 of file q3richtext_p.h.

Referenced by Q3TextDocument::setRichTextInternal().

01115 { list_val = v; }

int Q3TextParagraph::listValue (  )  const [inline]

Definition at line 1116 of file q3richtext_p.h.

01116 { return list_val > 0 ? list_val : -1; }

void Q3TextParagraph::setListDepth ( int  depth  ) 

Definition at line 5057 of file q3richtext.cpp.

References hasdoc, ldepth, prev(), and s.

05057                                             {
05058     if (!hasdoc || depth == ldepth)
05059         return;
05060     ldepth = depth;
05061     Q3TextParagraph* s = prev() ? prev() : this;
05062     while (s) {
05063         s->invalidate(0);
05064         s = s->next();
05065     }
05066 }

Here is the call graph for this function:

int Q3TextParagraph::listDepth (  )  const [inline]

Definition at line 1119 of file q3richtext_p.h.

Referenced by bottomMargin(), drawLabel(), leftMargin(), rightMargin(), and topMargin().

01119 { return ldepth; }

Q3TextDocument* Q3TextParagraph::document (  )  const [inline]

Definition at line 1124 of file q3richtext_p.h.

Referenced by addCommand(), bottomMargin(), commands(), Q3TextCursor::document(), documentVisibleWidth(), documentWidth(), documentX(), documentY(), Q3TextDocument::draw(), Q3TextDocument::drawParagraph(), drawString(), Q3TextFormatterBreakInWords::format(), format(), formatCollection(), formatter(), Q3TextCursor::gotoPosition(), indent(), Q3TextCursor::insert(), insert(), join(), leftMargin(), move(), nextTab(), paint(), Q3TextCursor::place(), Q3TextCursor::processNesting(), Q3TextParagraph(), redo(), remove(), Q3TextCursor::remove(), Q3TextCursor::removePreviousChar(), rightMargin(), Q3TextDocument::selectedText(), setChanged(), setColorForSelection(), Q3SyntaxHighlighter::setFormat(), setNext(), setPrev(), setTabStops(), Q3TextCursor::splitAndInsertEmptyParagraph(), tabArray(), tableCell(), topMargin(), undo(), and ~Q3TextParagraph().

01124                                             {
01125         if (hasdoc) return (Q3TextDocument*) docOrPseudo;
01126         return 0;
01127     }

Q3TextParagraphPseudoDocument * Q3TextParagraph::pseudoDocument (  )  const [inline]

Definition at line 1946 of file q3richtext_p.h.

References docOrPseudo, and hasdoc.

Referenced by addCommand(), commands(), documentVisibleWidth(), documentWidth(), documentX(), documentY(), format(), formatCollection(), formatter(), Q3TextParagraph(), redo(), undo(), and ~Q3TextParagraph().

01947 {
01948     if (hasdoc)
01949         return 0;
01950     return (Q3TextParagraphPseudoDocument*) docOrPseudo;
01951 }

QRect Q3TextParagraph::rect (  )  const [inline]

Definition at line 1578 of file q3richtext_p.h.

References r.

Referenced by Q3TextDocument::draw(), Q3TextDocument::drawParagraph(), Q3TextFormatterBreakInWords::format(), Q3TextFormatterBreakWords::format(), Q3TextEdit::formatMore(), Q3TextFormatter::formatVertically(), Q3TextCursor::globalX(), Q3TextCursor::globalY(), Q3TextCursor::gotoIntoNested(), Q3TextDocument::height(), Q3TextCursor::insert(), Q3TextCursor::processNesting(), Q3TextCursor::remove(), and Q3TextCursor::removePreviousChar().

01579 {
01580     return r;
01581 }

void Q3TextParagraph::setHeight ( int  h  )  [inline]

Definition at line 1131 of file q3richtext_p.h.

Referenced by Q3TextFormatter::formatVertically().

01131 { r.setHeight(h); }

void Q3TextParagraph::show (  ) 

Definition at line 5277 of file q3richtext.cpp.

References hasdoc, and visible.

05278 {
05279     if (visible || !hasdoc)
05280         return;
05281     visible = true;
05282 }

void Q3TextParagraph::hide (  ) 

Definition at line 5284 of file q3richtext.cpp.

References hasdoc, and visible.

05285 {
05286     if (!visible || !hasdoc)
05287         return;
05288     visible = false;
05289 }

bool Q3TextParagraph::isVisible (  )  const [inline]

Definition at line 1134 of file q3richtext_p.h.

Referenced by Q3TextCursor::gotoNextLetter(), and Q3TextCursor::gotoPreviousLetter().

01134 { return visible; }

Q3TextParagraph * Q3TextParagraph::prev (  )  const [inline]

Definition at line 1887 of file q3richtext_p.h.

References p.

Referenced by drawLabel(), Q3TextFormatterBreakInWords::format(), Q3TextFormatterBreakWords::format(), Q3TextFormatter::formatVertically(), Q3TextCursor::gotoPreviousLetter(), Q3TextCursor::gotoUp(), Q3TextCursor::insert(), Q3TextEdit::pasteSubType(), readStyleInformation(), Q3TextCursor::removePreviousChar(), setListDepth(), setListItem(), Q3TextCursor::splitAndInsertEmptyParagraph(), and topMargin().

01888 {
01889     return p;
01890 }

Q3TextParagraph * Q3TextParagraph::next (  )  const [inline]

Definition at line 1892 of file q3richtext_p.h.

References n.

Referenced by Q3TextTableCell::adjustToPainter(), bottomMargin(), Q3TextDocument::clear(), Q3TextDocument::doLayout(), Q3TextDocument::draw(), Q3TextFormatterBreakInWords::format(), Q3TextFormatterBreakWords::format(), Q3TextEdit::formatMore(), Q3TextFormatter::formatVertically(), Q3TextCursor::gotoDown(), Q3TextCursor::gotoNextLetter(), Q3TextCursor::gotoNextWord(), Q3TextEdit::optimDrawContents(), Q3TextEdit::readFormats(), Q3TextCursor::remove(), Q3TextCursor::removePreviousChar(), Q3TextDocument::removeSelectedText(), Q3TextEdit::setAlignment(), Q3TextDocument::setFormat(), Q3TextEdit::setParagType(), Q3TextDocument::setRichTextMarginsInternal(), Q3TextCursor::splitAndInsertEmptyParagraph(), Q3TextEdit::sync(), and Q3TextFormatCommand::unexecute().

01893 {
01894     return n;
01895 }

void Q3TextParagraph::setPrev ( Q3TextParagraph s  ) 

Definition at line 4150 of file q3richtext.cpp.

References document(), hasdoc, p, s, and Q3TextDocument::setFirstParagraph().

04151 {
04152     p = s;
04153     if (!p && hasdoc)
04154         document()->setFirstParagraph(this);
04155 }

Here is the call graph for this function:

void Q3TextParagraph::setNext ( Q3TextParagraph s  ) 

Definition at line 4143 of file q3richtext.cpp.

References document(), hasdoc, n, s, and Q3TextDocument::setLastParagraph().

Referenced by ~Q3TextParagraph().

04144 {
04145     n = s;
04146     if (!n && hasdoc)
04147         document()->setLastParagraph(this);
04148 }

Here is the call graph for this function:

void Q3TextParagraph::insert ( int  index,
const QString s 
)

Definition at line 4181 of file q3richtext.cpp.

References s.

Referenced by append(), Q3TextCursor::insert(), and truncate().

04182 {
04183     insert(index, s.unicode(), s.length());
04184 }

void Q3TextParagraph::insert ( int  index,
const QChar unicode,
int  len 
)

Definition at line 4186 of file q3richtext.cpp.

References document(), format(), formatCollection(), hasdoc, Q3TextString::insert(), invalidate(), needPreProcess, Q3TextPreProcessor::Standard, and str.

04187 {
04188     if (hasdoc && !document()->useFormatCollection() && document()->preProcessor())
04189         str->insert(index, unicode, len,
04190                      document()->preProcessor()->format(Q3TextPreProcessor::Standard));
04191     else
04192         str->insert(index, unicode, len, formatCollection()->defaultFormat());
04193     invalidate(index);
04194     needPreProcess = true;
04195 }

Here is the call graph for this function:

void Q3TextParagraph::append ( const QString s,
bool  reallyAtEnd = false 
) [inline]

Definition at line 1877 of file q3richtext_p.h.

References insert(), Q3TextString::length(), s, and str.

Referenced by join(), Q3TextDocument::setPlainText(), and Q3TextDocument::setRichTextInternal().

01878 {
01879     if (reallyAtEnd) {
01880         insert(str->length(), s);
01881     } else {
01882         int str_end = str->length() - 1;
01883         insert(str_end > 0 ? str_end : 0, s);
01884     }
01885 }

Here is the call graph for this function:

void Q3TextParagraph::truncate ( int  index  ) 

Definition at line 4197 of file q3richtext.cpp.

References insert(), length(), needPreProcess, str, and Q3TextString::truncate().

Referenced by Q3TextCursor::splitAndInsertEmptyParagraph().

04198 {
04199     str->truncate(index);
04200     insert(length(), " ");
04201     needPreProcess = true;
04202 }

Here is the call graph for this function:

void Q3TextParagraph::remove ( int  index,
int  len 
)

Definition at line 4204 of file q3richtext.cpp.

References at(), c, document(), hasdoc, i, invalidate(), Q3TextString::length(), needPreProcess, Q3TextString::remove(), str, and Q3TextDocument::unregisterCustomItem().

Referenced by join(), Q3TextCursor::remove(), Q3TextCursor::removePreviousChar(), and Q3TextDocument::removeSelectedText().

04205 {
04206     if (index + len - str->length() > 0)
04207         return;
04208 #ifndef QT_NO_TEXTCUSTOMITEM
04209     for (int i = index; i < index + len; ++i) {
04210         Q3TextStringChar *c = at(i);
04211         if (hasdoc && c->isCustom()) {
04212             document()->unregisterCustomItem(c->customItem(), this);
04213         }
04214     }
04215 #endif
04216     str->remove(index, len);
04217     invalidate(0);
04218     needPreProcess = true;
04219 }

Here is the call graph for this function:

void Q3TextParagraph::join ( Q3TextParagraph s  ) 

Definition at line 4221 of file q3richtext.cpp.

References append(), at(), Q3TextString::at(), c, document(), extraData(), format(), hasdoc, QRect::height(), i, invalidate(), Q3TextParagraphData::join(), length(), Q3TextString::length(), n, needPreProcess, p, r, Q3TextDocument::registerCustomItem(), remove(), s, Q3TextStringChar::setAnchor(), Q3TextStringChar::setCustomItem(), setExtraData(), Q3TextString::setFormat(), QRect::setHeight(), Q3TextDocument::setLastParagraph(), start, state, str, and Q3TextDocument::unregisterCustomItem().

Referenced by Q3TextCursor::remove(), Q3TextCursor::removePreviousChar(), and Q3TextDocument::removeSelectedText().

04222 {
04223     int oh = r.height() + s->r.height();
04224     n = s->n;
04225     if (n)
04226         n->p = this;
04227     else if (hasdoc)
04228         document()->setLastParagraph(this);
04229 
04230     int start = str->length();
04231     if (length() > 0 && at(length() - 1)->c == ' ') {
04232         remove(length() - 1, 1);
04233         --start;
04234     }
04235     append(s->str->toString(), true);
04236 
04237     for (int i = 0; i < s->length(); ++i) {
04238         if (!hasdoc || document()->useFormatCollection()) {
04239             s->str->at(i).format()->addRef();
04240             str->setFormat(i + start, s->str->at(i).format(), true);
04241         }
04242 #ifndef QT_NO_TEXTCUSTOMITEM
04243         if (s->str->at(i).isCustom()) {
04244             Q3TextCustomItem * item = s->str->at(i).customItem();
04245             str->at(i + start).setCustomItem(item);
04246             s->str->at(i).loseCustomItem();
04247             if (hasdoc) {
04248                 document()->unregisterCustomItem(item, s);
04249                 document()->registerCustomItem(item, this);
04250             }
04251         }
04252         if (s->str->at(i).isAnchor()) {
04253             str->at(i + start).setAnchor(s->str->at(i).anchorName(),
04254                             s->str->at(i).anchorHref());
04255         }
04256 #endif
04257     }
04258 
04259     if (!extraData() && s->extraData()) {
04260         setExtraData(s->extraData());
04261         s->setExtraData(0);
04262     } else if (extraData() && s->extraData()) {
04263         extraData()->join(s->extraData());
04264     }
04265     delete s;
04266     invalidate(0);
04267     r.setHeight(oh);
04268     needPreProcess = true;
04269     if (n) {
04270         Q3TextParagraph *s = n;
04271         s->invalidate(0);
04272         while (s) {
04273             s->id = s->p->id + 1;
04274             s->state = -1;
04275             s->needPreProcess = true;
04276             s->changed = true;
04277             s->invalidateStyleCache();
04278             s = s->n;
04279         }
04280     }
04281     format();
04282     state = -1;
04283 }

Here is the call graph for this function:

void Q3TextParagraph::invalidate ( int  chr  ) 

Definition at line 4157 of file q3richtext.cpp.

References QList< T >::at(), i, invalid, invalidateStyleCache(), mFloatingItems, qMin(), and QList< T >::size().

Referenced by Q3TextEdit::doKeyboardAction(), Q3TextDocument::doLayout(), Q3TextCursor::insert(), insert(), join(), remove(), setAlignment(), setDirection(), and setFormat().

04158 {
04159     if (invalid < 0)
04160         invalid = chr;
04161     else
04162         invalid = qMin(invalid, chr);
04163 #ifndef QT_NO_TEXTCUSTOMITEM
04164     if (mFloatingItems) {
04165         for (int idx = 0; idx < mFloatingItems->size(); ++idx) {
04166             Q3TextCustomItem *i = mFloatingItems->at(idx);
04167             i->ypos = -1;
04168         }
04169     }
04170 #endif
04171     invalidateStyleCache();
04172 }

Here is the call graph for this function:

void Q3TextParagraph::move ( int &  dy  ) 

Definition at line 4285 of file q3richtext.cpp.

References QList< T >::at(), changed, document(), formatter(), hasdoc, i, lastInFrame, mFloatingItems, p, r, shift(), and QList< T >::size().

04286 {
04287     if (dy == 0)
04288         return;
04289     changed = true;
04290     r.moveBy(0, dy);
04291 #ifndef QT_NO_TEXTCUSTOMITEM
04292     if (mFloatingItems) {
04293         for (int idx = 0; idx < mFloatingItems->size(); ++idx) {
04294             Q3TextCustomItem *i = mFloatingItems->at(idx);
04295             i->ypos += dy;
04296         }
04297     }
04298 #endif
04299     if (p)
04300         p->lastInFrame = true;
04301 
04302     // do page breaks if required
04303     if (hasdoc && document()->isPageBreakEnabled()) {
04304         int shift;
04305         if ((shift = document()->formatter()->formatVertically( document(), this))) {
04306             if (p)
04307                 p->setChanged(true);
04308             dy += shift;
04309         }
04310     }
04311 }

Here is the call graph for this function:

void Q3TextParagraph::format ( int  start = -1,
bool  doMove = true 
)

Definition at line 4313 of file q3richtext.cpp.

References QList< T >::at(), QMap< Key, T >::begin(), changed, QMap< Key, T >::clear(), document(), documentWidth(), documentX(), documentY(), QMap< Key, T >::end(), firstFormat, Q3TextFormatter::format(), formatter(), Q3TextDocument::formatter(), Q3TextFormatter::formatVertically(), hasdoc, QRect::height(), i, invalid, lastInFrame, Q3TextString::length(), lineStarts, mFloatingItems, Q3TextFormatter::minimumWidth(), Q3TextParagraphPseudoDocument::minw, minwidth, movedDown, QRect::moveTopLeft(), n, needPreProcess, p, Q3TextCustomItem::PlaceRight, Q3TextDocument::preProcessor(), Q3TextPreProcessor::process(), pseudoDocument(), qMax(), qMin(), r, s, QRect::setHeight(), Q3TextDocument::setMinimumWidth(), QRect::setWidth(), shift(), QList< T >::size(), state, str, visible, QRect::width(), Q3TextFormatter::widthUsed(), Q3TextParagraphPseudoDocument::wused, QRect::x(), QRect::y(), and y.

Referenced by Q3TextDocument::doLayout(), Q3TextDocument::draw(), drawLabel(), drawString(), Q3TextEdit::formatMore(), Q3TextCursor::insert(), insert(), join(), Q3TextCursor::remove(), Q3TextCursor::removePreviousChar(), and Q3TextEdit::sync().

04314 {
04315     if (!str || str->length() == 0 || !formatter())
04316         return;
04317 
04318     if (hasdoc &&
04319          document()->preProcessor() &&
04320          (needPreProcess || state == -1))
04321         document()->preProcessor()->process(document(), this, invalid <= 0 ? 0 : invalid);
04322     needPreProcess = false;
04323 
04324     if (invalid == -1)
04325         return;
04326 
04327     r.moveTopLeft(QPoint(documentX(), p ? p->r.y() + p->r.height() : documentY()));
04328     if (p)
04329         p->lastInFrame = false;
04330 
04331     movedDown = false;
04332     bool formattedAgain = false;
04333 
04334  formatAgain:
04335 
04336     r.setWidth(documentWidth());
04337 #ifndef QT_NO_TEXTCUSTOMITEM
04338     if (hasdoc && mFloatingItems) {
04339         for (int idx = 0; idx < mFloatingItems->size(); ++idx) {
04340             Q3TextCustomItem *i = mFloatingItems->at(idx);
04341             i->ypos = r.y();
04342             if (i->placement() == Q3TextCustomItem::PlaceRight) {
04343                 i->xpos = r.x() + r.width() - i->width;
04344             }
04345         }
04346     }
04347 #endif
04348     QMap<int, QTextLineStart*> oldLineStarts = lineStarts;
04349     lineStarts.clear();
04350     int y = formatter()->format(document(), this, start, oldLineStarts);
04351 
04352 
04353     r.setWidth(qMax(r.width(), formatter()->minimumWidth()));
04354 
04355 
04356     QMap<int, QTextLineStart*>::Iterator it = oldLineStarts.begin();
04357 
04358     for (; it != oldLineStarts.end(); ++it)
04359         delete *it;
04360 
04361     if (!hasdoc) { // qt_format_text bounding rect handling
04362         it = lineStarts.begin();
04363         int usedw = 0;
04364         for (; it != lineStarts.end(); ++it)
04365             usedw = qMax(usedw, (*it)->w);
04366         if (r.width() <= 0) {
04367             // if the user specifies an invalid rect, this means that the
04368             // bounding box should grow to the width that the text actually
04369             // needs
04370             r.setWidth(usedw);
04371         } else {
04372             r.setWidth(qMin(usedw, r.width()));
04373         }
04374     }
04375 
04376     if (y != r.height())
04377         r.setHeight(y);
04378 
04379     if (!visible) {
04380         r.setHeight(0);
04381     } else {
04382         int minw = minwidth = formatter()->minimumWidth();
04383         int wused = formatter()->widthUsed();
04384         wused = qMax(minw, wused);
04385         if (hasdoc) {
04386             document()->setMinimumWidth(minw, wused, this);
04387         }  else {
04388             pseudoDocument()->minw = qMax(pseudoDocument()->minw, minw);
04389             pseudoDocument()->wused = qMax(pseudoDocument()->wused, wused);
04390         }
04391     }
04392 
04393     // do page breaks if required
04394     if (hasdoc && document()->isPageBreakEnabled()) {
04395         int shift = document()->formatter()->formatVertically(document(), this);
04396         if (shift && !formattedAgain) {
04397             formattedAgain = true;
04398             goto formatAgain;
04399         }
04400     }
04401 
04402     if (n && doMove && n->invalid == -1 && r.y() + r.height() != n->r.y()) {
04403         int dy = (r.y() + r.height()) - n->r.y();
04404         Q3TextParagraph *s = n;
04405         bool makeInvalid = p && p->lastInFrame;
04406         while (s && dy) {
04407             if (!s->isFullWidth())
04408                 makeInvalid = true;
04409             if (makeInvalid)
04410                 s->invalidate(0);
04411             s->move(dy);
04412             if (s->lastInFrame)
04413                 makeInvalid = true;
04414             s = s->n;
04415         }
04416     }
04417 
04418     firstFormat = false;
04419     changed = true;
04420     invalid = -1;
04421     //#####   string()->setTextChanged(false);
04422 }

Here is the call graph for this function:

bool Q3TextParagraph::isValid (  )  const [inline]

Definition at line 1855 of file q3richtext_p.h.

References invalid.

Referenced by Q3TextDocument::draw(), leftGap(), lineBaseLine(), lineHeight(), lineHeightOfChar(), lineInfo(), lines(), lineStartOfChar(), lineStartOfLine(), lineY(), and Q3TextEdit::paintDocument().

01856 {
01857     return invalid == -1;
01858 }

bool Q3TextParagraph::hasChanged (  )  const [inline]

Definition at line 1860 of file q3richtext_p.h.

References changed.

Referenced by Q3TextDocument::draw().

01861 {
01862     return changed;
01863 }

void Q3TextParagraph::setChanged ( bool  b,
bool  recursive = false 
)

Definition at line 5304 of file q3richtext.cpp.

References changed, document(), Q3TextDocument::parentParagraph(), and setChanged().

Referenced by clearBackgroundColor(), Q3TextDocument::drawParagraph(), Q3TextDocument::focusNextPrevChild(), removeSelection(), setBackgroundColor(), setChanged(), and setSelection().

05305 {
05306     changed = b;
05307     if (recursive) {
05308         if (document() && document()->parentParagraph())
05309             document()->parentParagraph()->setChanged(b, recursive);
05310     }
05311 }

Here is the call graph for this function:

int Q3TextParagraph::lineHeightOfChar ( int  i,
int *  bl = 0,
int *  y = 0 
) const

Definition at line 4424 of file q3richtext.cpp.

References QMap< Key, T >::begin(), QMap< Key, T >::end(), isValid(), QMap< Key, T >::key(), lineStarts, and qWarning().

Referenced by Q3TextCursor::gotoIntoNested(), and Q3TextCursor::processNesting().

04425 {
04426     if (!isValid())
04427         ((Q3TextParagraph*)this)->format();
04428 
04429     QMap<int, QTextLineStart*>::ConstIterator it = lineStarts.end();
04430     --it;
04431     for (;;) {
04432         if (i >= it.key()) {
04433             if (bl)
04434                 *bl = (*it)->baseLine;
04435             if (y)
04436                 *y = (*it)->y;
04437             return (*it)->h;
04438         }
04439         if (it == lineStarts.begin())
04440             break;
04441         --it;
04442     }
04443 
04444     qWarning("Q3TextParagraph::lineHeightOfChar: couldn't find lh for %d", i);
04445     return 15;
04446 }

Here is the call graph for this function:

Q3TextStringChar * Q3TextParagraph::lineStartOfChar ( int  i,
int *  index = 0,
int *  line = 0 
) const

Definition at line 4448 of file q3richtext.cpp.

References Q3TextString::at(), QMap< Key, T >::begin(), QMap< Key, T >::count(), QMap< Key, T >::end(), Q3TextStringChar::format, int, isValid(), QMap< Key, T >::key(), l, lineStarts, qWarning(), and str.

Referenced by Q3TextCursor::fixCursorPosition(), Q3TextCursor::gotoDown(), Q3TextCursor::gotoLineEnd(), Q3TextCursor::gotoLineStart(), Q3TextCursor::gotoUp(), Q3TextEdit::handleMouseMove(), and Q3TextCursor::y().

04449 {
04450     if (!isValid())
04451         ((Q3TextParagraph*)this)->format();
04452 
04453     int l = (int)lineStarts.count() - 1;
04454     QMap<int, QTextLineStart*>::ConstIterator it = lineStarts.end();
04455     --it;
04456     for (;;) {
04457         if (i >= it.key()) {
04458             if (index)
04459                 *index = it.key();
04460             if (line)
04461                 *line = l;
04462             return &str->at(it.key());
04463         }
04464         if (it == lineStarts.begin())
04465             break;
04466         --it;
04467         --l;
04468     }
04469 
04470     qWarning("Q3TextParagraph::lineStartOfChar: couldn't find %d", i);
04471     return 0;
04472 }

Here is the call graph for this function:

int Q3TextParagraph::lines (  )  const

Definition at line 4474 of file q3richtext.cpp.

References QMap< Key, T >::count(), isValid(), and lineStarts.

Referenced by Q3TextCursor::gotoDown(), Q3TextCursor::gotoLineEnd(), and Q3TextCursor::gotoUp().

04475 {
04476     if (!isValid())
04477         ((Q3TextParagraph*)this)->format();
04478 
04479     return (int)lineStarts.count();
04480 }

Here is the call graph for this function:

Q3TextStringChar * Q3TextParagraph::lineStartOfLine ( int  line,
int *  index = 0 
) const

Definition at line 4482 of file q3richtext.cpp.

References Q3TextString::at(), QMap< Key, T >::begin(), QMap< Key, T >::count(), Q3TextStringChar::format, i, isValid(), lineStarts, qWarning(), and str.

Referenced by Q3TextCursor::gotoDown(), Q3TextCursor::gotoLineEnd(), and Q3TextCursor::gotoUp().

04483 {
04484     if (!isValid())
04485         ((Q3TextParagraph*)this)->format();
04486 
04487     if (line >= 0 && line < (int)lineStarts.count()) {
04488         QMap<int, QTextLineStart*>::ConstIterator it = lineStarts.begin();
04489         while (line-- > 0)
04490             ++it;
04491         int i = it.key();
04492         if (index)
04493             *index = i;
04494         return &str->at(i);
04495     }
04496 
04497     qWarning("Q3TextParagraph::lineStartOfLine: couldn't find %d", line);
04498     return 0;
04499 }

Here is the call graph for this function:

int Q3TextParagraph::lineY ( int  l  )  const

Definition at line 484 of file q3richtext_p.cpp.

References QMap< Key, T >::begin(), QMap< Key, T >::count(), isValid(), lineStarts, and qWarning().

Referenced by Q3TextCursor::y().

00485 {
00486     if (l > (int)lineStarts.count() - 1) {
00487         qWarning("Q3TextParagraph::lineY: line %d out of range!", l);
00488         return 0;
00489     }
00490 
00491     if (!isValid())
00492         ((Q3TextParagraph*)this)->format();
00493 
00494     QMap<int, QTextLineStart*>::ConstIterator it = lineStarts.begin();
00495     while (l-- > 0)
00496         ++it;
00497     return (*it)->y;
00498 }

Here is the call graph for this function:

int Q3TextParagraph::lineBaseLine ( int  l  )  const

Definition at line 500 of file q3richtext_p.cpp.

References QMap< Key, T >::begin(), QMap< Key, T >::count(), isValid(), lineStarts, and qWarning().

00501 {
00502     if (l > (int)lineStarts.count() - 1) {
00503         qWarning("Q3TextParagraph::lineBaseLine: line %d out of range!", l);
00504         return 10;
00505     }
00506 
00507     if (!isValid())
00508         ((Q3TextParagraph*)this)->format();
00509 
00510     QMap<int, QTextLineStart*>::ConstIterator it = lineStarts.begin();
00511     while (l-- > 0)
00512         ++it;
00513     return (*it)->baseLine;
00514 }

Here is the call graph for this function:

int Q3TextParagraph::lineHeight ( int  l  )  const

Definition at line 516 of file q3richtext_p.cpp.

References QMap< Key, T >::begin(), QMap< Key, T >::count(), isValid(), lineStarts, and qWarning().

00517 {
00518     if (l > (int)lineStarts.count() - 1) {
00519         qWarning("Q3TextParagraph::lineHeight: line %d out of range!", l);
00520         return 15;
00521     }
00522 
00523     if (!isValid())
00524         ((Q3TextParagraph*)this)->format();
00525 
00526     QMap<int, QTextLineStart*>::ConstIterator it = lineStarts.begin();
00527     while (l-- > 0)
00528         ++it;
00529     return (*it)->h;
00530 }

Here is the call graph for this function:

void Q3TextParagraph::lineInfo ( int  l,
int &  y,
int &  h,
int &  bl 
) const

Definition at line 532 of file q3richtext_p.cpp.

References QMap< Key, T >::begin(), QMap< Key, T >::count(), isValid(), lineStarts, qDebug(), and qWarning().

Referenced by paint().

00533 {
00534     if (l > (int)lineStarts.count() - 1) {
00535         qWarning("Q3TextParagraph::lineInfo: line %d out of range!", l);
00536         qDebug("%d %d", (int)lineStarts.count() - 1, l);
00537         y = 0;
00538         h = 15;
00539         bl = 10;
00540         return;
00541     }
00542 
00543     if (!isValid())
00544         ((Q3TextParagraph*)this)->format();
00545 
00546     QMap<int, QTextLineStart*>::ConstIterator it = lineStarts.begin();
00547     while (l-- > 0)
00548         ++it;
00549     y = (*it)->y;
00550     h = (*it)->h;
00551     bl = (*it)->baseLine;
00552 }

Here is the call graph for this function:

void Q3TextParagraph::setSelection ( int  id,
int  start,
int  end 
)

Definition at line 425 of file q3richtext_p.cpp.

References QMap< Key, T >::constEnd(), QMap< Key, T >::constFind(), Q3TextParagraphSelection::end, mSelections, selections(), setChanged(), and Q3TextParagraphSelection::start.

Referenced by Q3TextDocument::setSelectionEnd(), and setSelectionEndHelper().

00426 {
00427     QMap<int, Q3TextParagraphSelection>::ConstIterator it = selections().constFind(id);
00428     if (it != mSelections->constEnd()) {
00429         if (start == (*it).start && end == (*it).end)
00430             return;
00431     }
00432 
00433     Q3TextParagraphSelection sel;
00434     sel.start = start;
00435     sel.end = end;
00436     (*mSelections)[id] = sel;
00437     setChanged(true, true);
00438 }

Here is the call graph for this function:

void Q3TextParagraph::removeSelection ( int  id  ) 

Definition at line 440 of file q3richtext_p.cpp.

References hasSelection(), mSelections, QMap< Key, T >::remove(), and setChanged().

Referenced by Q3TextDocument::setSelectionEnd(), and setSelectionEndHelper().

00441 {
00442     if (!hasSelection(id))
00443         return;
00444     if (mSelections)
00445         mSelections->remove(id);
00446     setChanged(true, true);
00447 }

Here is the call graph for this function:

int Q3TextParagraph::selectionStart ( int  id  )  const

Definition at line 449 of file q3richtext_p.cpp.

References QMap< Key, T >::constEnd(), QMap< Key, T >::constFind(), and mSelections.

Referenced by Q3TextDocument::inSelection(), and Q3TextDocument::setSelectionEnd().

00450 {
00451     if (!mSelections)
00452         return -1;
00453     QMap<int, Q3TextParagraphSelection>::ConstIterator it = mSelections->constFind(id);
00454     if (it == mSelections->constEnd())
00455         return -1;
00456     return (*it).start;
00457 }

Here is the call graph for this function:

int Q3TextParagraph::selectionEnd ( int  id  )  const

Definition at line 459 of file q3richtext_p.cpp.

References QMap< Key, T >::constEnd(), QMap< Key, T >::constFind(), and mSelections.

Referenced by Q3TextDocument::inSelection().

00460 {
00461     if (!mSelections)
00462         return -1;
00463     QMap<int, Q3TextParagraphSelection>::ConstIterator it = mSelections->constFind(id);
00464     if (it == mSelections->constEnd())
00465         return -1;
00466     return (*it).end;
00467 }

Here is the call graph for this function:

bool Q3TextParagraph::hasSelection ( int  id  )  const

Definition at line 469 of file q3richtext_p.cpp.

References QMap< Key, T >::contains(), and mSelections.

Referenced by drawString(), and removeSelection().

00470 {
00471     return mSelections ? mSelections->contains(id) : false;
00472 }

Here is the call graph for this function:

bool Q3TextParagraph::hasAnySelection (  )  const [inline]

Definition at line 1897 of file q3richtext_p.h.

References QMap< Key, T >::isEmpty(), mSelections, and selections().

01898 {
01899     return mSelections ? !selections().isEmpty() : false;
01900 }

Here is the call graph for this function:

bool Q3TextParagraph::fullSelected ( int  id  )  const

Definition at line 474 of file q3richtext_p.cpp.

References QMap< Key, T >::constEnd(), QMap< Key, T >::constFind(), Q3TextString::length(), mSelections, and str.

00475 {
00476     if (!mSelections)
00477         return false;
00478     QMap<int, Q3TextParagraphSelection>::ConstIterator it = mSelections->constFind(id);
00479     if (it == mSelections->constEnd())
00480         return false;
00481     return (*it).start == 0 && (*it).end == str->length() - 1;
00482 }

Here is the call graph for this function:

void Q3TextParagraph::setEndState ( int  s  )  [inline]

Definition at line 1902 of file q3richtext_p.h.

References state.

Referenced by Q3TextCursor::insert().

01903 {
01904     if (s == state)
01905         return;
01906     state = s;
01907 }

int Q3TextParagraph::endState (  )  const [inline]

Definition at line 1909 of file q3richtext_p.h.

References state.

Referenced by Q3SyntaxHighlighterInternal::process().

01910 {
01911     return state;
01912 }

void Q3TextParagraph::setParagId ( int  i  )  [inline]

Definition at line 1914 of file q3richtext_p.h.

01915 {
01916     id = i;
01917 }

int Q3TextParagraph::paragId (  )  const [inline]

Definition at line 1919 of file q3richtext_p.h.

References id, and qWarning().

Referenced by Q3TextEdit::contentsDropEvent(), Q3TextDeleteCommand::execute(), Q3TextEdit::find(), Q3TextDocument::indentSelection(), Q3TextEdit::init(), Q3TextDocument::inSelection(), Q3MultiLineEdit::numLines(), Q3TextEdit::paragraphs(), Q3TextEdit::pasteSubType(), Q3TextDocument::selectedText(), Q3TextDocument::selectionEnd(), Q3TextDocument::selectionStart(), Q3TextEdit::setAlignment(), Q3TextEdit::setFormat(), Q3TextEdit::setParagType(), Q3TextDocument::setSelectionEnd(), and Q3TextDeleteCommand::unexecute().

01920 {
01921     if (id == -1)
01922         qWarning("invalid parag id!!!!!!!! (%p)", (void*)this);
01923     return id;
01924 }

Here is the call graph for this function:

bool Q3TextParagraph::firstPreProcess (  )  const [inline]

Definition at line 1926 of file q3richtext_p.h.

References firstPProcess.

01927 {
01928     return firstPProcess;
01929 }

void Q3TextParagraph::setFirstPreProcess ( bool  b  )  [inline]

Definition at line 1931 of file q3richtext_p.h.

References firstPProcess.

01932 {
01933     firstPProcess = b;
01934 }

void Q3TextParagraph::indent ( int *  oldIndent = 0,
int *  newIndent = 0 
)

Definition at line 4565 of file q3richtext.cpp.

References document(), hasdoc, Q3TextIndent::indent(), Q3TextDocument::indent(), and isListItem().

Referenced by Q3TextCursor::indent().

04566 {
04567     if (!hasdoc || !document()->indent() || isListItem()) {
04568         if (oldIndent)
04569             *oldIndent = 0;
04570         if (newIndent)
04571             *newIndent = 0;
04572         if (oldIndent && newIndent)
04573             *newIndent = *oldIndent;
04574         return;
04575     }
04576     document()->indent()->indent(document(), this, oldIndent, newIndent);
04577 }

Here is the call graph for this function:

void Q3TextParagraph::setExtraData ( Q3TextParagraphData data  )  [inline]

Definition at line 2013 of file q3richtext_p.h.

References data, and eData.

Referenced by join().

02014 {
02015     eData = data;
02016 }

Q3TextParagraphData * Q3TextParagraph::extraData (  )  const [inline]

Definition at line 2018 of file q3richtext_p.h.

References eData.

Referenced by join().

02019 {
02020     return eData;
02021 }

QMap< int, QTextLineStart * > & Q3TextParagraph::lineStartList (  )  [inline]

Definition at line 1936 of file q3richtext_p.h.

References lineStarts.

Referenced by Q3TextFormatter::formatVertically(), and Q3TextFormatter::insertLineStart().

01937 {
01938     return lineStarts;
01939 }

void Q3TextParagraph::setFormat ( int  index,
int  len,
Q3TextFormat f,
bool  useCollection = true,
int  flags = -1 
)

Definition at line 4527 of file q3richtext.cpp.

References Q3TextString::at(), changed, QFont::family(), Q3TextFormat::font(), Q3TextFormat::Format, Q3TextStringChar::format, Q3TextFormatCollection::format(), formatCollection(), i, invalid, invalidate(), QFont::italic(), Q3TextFormat::key(), Q3TextString::length(), QFont::pointSize(), Q3TextString::setFormat(), str, Q3TextFormat::vAlign(), and QFont::weight().

Referenced by Q3TextDocument::setFormat(), Q3SyntaxHighlighter::setFormat(), Q3TextDocument::setRichTextInternal(), and Q3TextFormatCommand::unexecute().

04528 {
04529     if (!f)
04530         return;
04531     if (index < 0)
04532         index = 0;
04533     if (index > str->length() - 1)
04534         index = str->length() - 1;
04535     if (index + len >= str->length())
04536         len = str->length() - index;
04537 
04538     Q3TextFormatCollection *fc = 0;
04539     if (useCollection)
04540         fc = formatCollection();
04541     Q3TextFormat *of;
04542     for (int i = 0; i < len; ++i) {
04543         of = str->at(i + index).format();
04544         if (!changed && (!of || f->key() != of->key()))
04545             changed = true;
04546         if (invalid == -1 &&
04547              (f->font().family() != of->font().family() ||
04548                f->font().pointSize() != of->font().pointSize() ||
04549                f->font().weight() != of->font().weight() ||
04550                f->font().italic() != of->font().italic() ||
04551                f->vAlign() != of->vAlign())) {
04552             invalidate(0);
04553         }
04554         if (flags == -1 || flags == Q3TextFormat::Format || !fc) {
04555             if (fc)
04556                 f = fc->format(f);
04557             str->setFormat(i + index, f, useCollection);
04558         } else {
04559             Q3TextFormat *fm = fc->format(of, f, flags);
04560             str->setFormat(i + index, fm, useCollection);
04561         }
04562     }
04563 }

Here is the call graph for this function:

void Q3TextParagraph::setAlignment ( int  a  ) 

Definition at line 555 of file q3richtext_p.cpp.

References align, and invalidate().

Referenced by Q3TextDocument::setRichTextInternal().

00556 {
00557     if (a == (int)align)
00558         return;
00559     align = a;
00560     invalidate(0);
00561 }

Here is the call graph for this function:

int Q3TextParagraph::alignment (  )  const [inline]

Definition at line 1967 of file q3richtext_p.h.

References align.

Referenced by Q3TextFormatterBreakWords::format(), paint(), and Q3TextCursor::x().

01968 {
01969     return align;
01970 }

void Q3TextParagraph::paint ( QPainter painter,
const QPalette pal,
Q3TextCursor cursor = 0,
bool  drawSelections = false,
int  clipx = -1,
int  clipy = -1,
int  clipw = -1,
int  cliph = -1 
)

Definition at line 4579 of file q3richtext.cpp.

References Qt::AlignJustify, alignment(), at(), Q3TextString::at(), Q3TextStringChar::bidiLevel, Qt::black, c, Q3TextStringChar::c, QPalette::color(), QMap< Key, T >::constEnd(), QMap< Key, T >::constFind(), Q3TextStringChar::customItem(), QString::detach(), document(), Q3TextCustomItem::draw(), drawLabel(), QPainter::drawLine(), drawString(), QPainter::fillRect(), flush, Q3TextStringChar::format, h, hasdoc, i, Q3TextCursor::index(), Q3TextString::isBidi(), Q3TextStringChar::isCustom(), Q3TextStringChar::isLink(), isListItem(), QRect::isNull(), Q3TextString::isRightToLeft(), QRect::left(), QString::length(), length(), lineInfo(), Q3TextStringChar::lineStart, mSelections, Q3TextCursor::paragraph(), Q3TextCustomItem::PlaceInline, Q3TextCustomItem::placement(), qMax(), qMin(), r, QPainter::restore(), QRect::right(), Q3TextStringChar::rightToLeft, QPainter::save(), QPainter::setPen(), QRect::setRect(), QStyle::SH_RichText_FullWidthSelection, Q3TextDocument::Standard, str, string(), QApplication::style(), QStyle::styleHint(), QPalette::Text, Q3TextString::toString(), QString::unicode(), QChar::unicode(), visible, Q3TextStringChar::whiteSpace, QRect::width(), Q3TextDocument::width(), Q3TextString::width(), Q3TextStringChar::x, QRect::x(), Q3TextCursor::x(), x, x20, QRect::y(), and y.

Referenced by Q3TextDocument::draw(), and Q3TextDocument::drawParagraph().

04581 {
04582     if (!visible)
04583         return;
04584     int i, y, h, baseLine, xstart, xend = 0;
04585     i = y =h = baseLine = 0;
04586     QRect cursorRect;
04587     drawSelections &= (mSelections != 0);
04588     // macintosh full-width selection style
04589     bool fullWidthStyle = QApplication::style()->styleHint(QStyle::SH_RichText_FullWidthSelection);
04590     int fullSelectionWidth = 0;
04591     if (drawSelections && fullWidthStyle)
04592         fullSelectionWidth = (hasdoc ? document()->width() : r.width());
04593 
04594     QString qstr = str->toString();
04595     qstr.detach();
04596     // ### workaround so that \n are not drawn, actually this should
04597     // be fixed in QFont somewhere (under Windows you get ugly boxes
04598     // otherwise)
04599     QChar* uc = (QChar*) qstr.unicode();
04600     for (int ii = 0; ii < qstr.length(); ii++)
04601         if (uc[(int)ii]== '\n' || uc[(int)ii] == '\t')
04602             uc[(int)ii] = 0x20;
04603 
04604     int line = -1;
04605     int paintStart = 0;
04606     Q3TextStringChar *chr = 0;
04607     Q3TextStringChar *nextchr = at(0);
04608     for (i = 0; i < length(); i++) {
04609         chr = nextchr;
04610         if (i < length()-1)
04611             nextchr = at(i+1);
04612 
04613         // we flush at end of document
04614         bool flush = (i == length()-1);
04615         bool ignoreSoftHyphen = false;
04616         if (!flush) {
04617             // we flush at end of line
04618             flush |= nextchr->lineStart;
04619             // we flush on format changes
04620             flush |= (nextchr->format() != chr->format());
04621             // we flush on link changes
04622             flush |= (nextchr->isLink() != chr->isLink());
04623             // we flush on start of run
04624             flush |= (nextchr->bidiLevel != chr->bidiLevel);
04625             // we flush on bidi changes
04626             flush |= (nextchr->rightToLeft != chr->rightToLeft);
04627             // we flush before and after tabs
04628             flush |= (chr->c == '\t' || nextchr->c == '\t');
04629             // we flush on soft hyphens
04630             if (chr->c.unicode() == 0xad) {
04631                 flush = true;
04632                 if (!nextchr->lineStart)
04633                     ignoreSoftHyphen = true;
04634             }
04635             // we flush on custom items
04636             flush |= chr->isCustom();
04637             // we flush before custom items
04638             flush |= nextchr->isCustom();
04639             // when painting justified, we flush on spaces
04640             if ((alignment() & Qt::AlignJustify) == Qt::AlignJustify)
04641                 flush |= chr->whiteSpace;
04642         }
04643 
04644         // init a new line
04645         if (chr->lineStart) {
04646             ++line;
04647             paintStart = i;
04648             lineInfo(line, y, h, baseLine);
04649             if (clipy != -1 && cliph != 0 && y + r.y() - h > clipy + cliph) { // outside clip area, leave
04650                 break;
04651             }
04652 
04653             // if this is the first line and we are a list item, draw the the bullet label
04654             if (line == 0 && isListItem()) {
04655                 int x = chr->x;
04656                 if (str->isBidi()) {
04657                     if (str->isRightToLeft()) {
04658                         x = chr->x + str->width(0);
04659                         for (int k = 1; k < length(); ++k) {
04660                             if (str->at(k).lineStart)
04661                                 break;
04662                             x = qMax(x, str->at(k).x + str->width(k));
04663                         }
04664                     } else {
04665                         x = chr->x;
04666                         for (int k = 1; k < length(); ++k) {
04667                             if (str->at(k).lineStart)
04668                                 break;
04669                             x = qMin(x, str->at(k).x);
04670                         }
04671                     }
04672                 }
04673                 drawLabel(&painter, x, y, 0, 0, baseLine, pal);
04674             }
04675         }
04676 
04677         // check for cursor mark
04678         if (cursor && this == cursor->paragraph() && i == cursor->index()) {
04679             Q3TextStringChar *c = i == 0 ? chr : chr - 1;
04680             cursorRect.setRect(cursor->x() , y + baseLine - c->format()->ascent(),
04681                                 1, c->format()->height());
04682         }
04683 
04684         if (flush) {  // something changed, draw what we have so far
04685             if (chr->rightToLeft) {
04686                 xstart = chr->x;
04687                 xend = at(paintStart)->x + str->width(paintStart);
04688             } else {
04689                 xstart = at(paintStart)->x;
04690                 xend = chr->x;
04691                 if (i < length() - 1) {
04692                     if (!str->at(i + 1).lineStart &&
04693                          str->at(i + 1).rightToLeft == chr->rightToLeft)
04694                         xend = str->at(i + 1).x;
04695                     else
04696                         xend += str->width(i);
04697                 }
04698             }
04699 
04700             if ((clipx == -1 || clipw <= 0 || (xend >= clipx && xstart <= clipx + clipw)) &&
04701                  (clipy == -1 || clipy < y+r.y()+h)) {
04702                 if (!chr->isCustom())
04703                     drawString(painter, qstr, paintStart, i - paintStart + (ignoreSoftHyphen ? 0 : 1), xstart, y,
04704                                 baseLine, xend-xstart, h, drawSelections, fullSelectionWidth,
04705                                 chr, pal, chr->rightToLeft);
04706 #ifndef QT_NO_TEXTCUSTOMITEM
04707                 else if (chr->customItem()->placement() == Q3TextCustomItem::PlaceInline) {
04708                     bool inSelection = false;
04709                     if (drawSelections) {
04710                         QMap<int, Q3TextParagraphSelection>::ConstIterator it = mSelections->constFind(Q3TextDocument::Standard);
04711                         inSelection = (it != mSelections->constEnd() && (*it).start <= i && (*it).end > i);
04712                     }
04713                     chr->customItem()->draw(&painter, chr->x, y,
04714                                              clipx == -1 ? clipx : (clipx - r.x()),
04715                                              clipy == -1 ? clipy : (clipy - r.y()),
04716                                              clipw, cliph, pal, inSelection);
04717                 }
04718 #endif
04719             }
04720             paintStart = i+1;
04721         }
04722 
04723     }
04724 
04725     // time to draw the cursor
04726     const int cursor_extent = 4;
04727     if (!cursorRect.isNull() && cursor &&
04728          ((clipx == -1 || clipw == -1) || (cursorRect.right()+cursor_extent >= clipx && cursorRect.left()-cursor_extent <= clipx + clipw))) {
04729         painter.fillRect(cursorRect, pal.color(QPalette::Text));
04730         painter.save();
04731         if (string()->isBidi()) {
04732             if (at(cursor->index())->rightToLeft) {
04733                 painter.setPen(Qt::black);
04734                 painter.drawLine(cursorRect.x(), cursorRect.y(), cursorRect.x() - cursor_extent / 2, cursorRect.y() + cursor_extent / 2);
04735                 painter.drawLine(cursorRect.x(), cursorRect.y() + cursor_extent, cursorRect.x() - cursor_extent / 2, cursorRect.y() + cursor_extent / 2);
04736             } else {
04737                 painter.setPen(Qt::black);
04738                 painter.drawLine(cursorRect.x(), cursorRect.y(), cursorRect.x() + cursor_extent / 2, cursorRect.y() + cursor_extent / 2);
04739                 painter.drawLine(cursorRect.x(), cursorRect.y() + cursor_extent, cursorRect.x() + cursor_extent / 2, cursorRect.y() + cursor_extent / 2);
04740             }
04741         }
04742         painter.restore();
04743     }
04744 }

Here is the call graph for this function:

int Q3TextParagraph::topMargin (  )  const

Definition at line 5203 of file q3richtext.cpp.

References document(), isListItem(), Q3TextDocument::li_tm, Q3TextDocument::list_tm, listDepth(), m, Q3TextFormat::painter(), prev(), qMax(), rtext, scale(), and utm.

Referenced by Q3TextFormatterBreakInWords::format(), Q3TextFormatterBreakWords::format(), Q3TextFormatter::formatVertically(), and Q3TextDocument::setRichTextMarginsInternal().

05204 {
05205     int m = 0;
05206     if (rtext) {
05207         m = isListItem() ? (document()->li_tm/qMax(1,listDepth()*listDepth())) :
05208             (listDepth() ? 0 : document()->par_tm);
05209         if (listDepth() == 1 &&( !prev() || prev()->listDepth() < listDepth()))
05210             m = qMax<int>(m, document()->list_tm);
05211     }
05212     m += utm;
05213     return scale(m, Q3TextFormat::painter());
05214 }

Here is the call graph for this function:

int Q3TextParagraph::bottomMargin (  )  const

Definition at line 5216 of file q3richtext.cpp.

References document(), isListItem(), Q3TextDocument::li_bm, Q3TextDocument::list_bm, listDepth(), m, next(), Q3TextFormat::painter(), qMax(), rtext, scale(), and ubm.

Referenced by Q3TextFormatterBreakInWords::format(), Q3TextFormatterBreakWords::format(), Q3TextFormatter::formatVertically(), and Q3TextDocument::setRichTextMarginsInternal().

05217 {
05218     int m = 0;
05219     if (rtext) {
05220         m = isListItem() ? (document()->li_bm/qMax(1,listDepth()*listDepth())) :
05221             (listDepth() ? 0 : document()->par_bm);
05222         if (listDepth() == 1 &&( !next() || next()->listDepth() < listDepth()))
05223             m = qMax<int>(m, document()->list_bm);
05224     }
05225     m += ubm;
05226     return scale(m, Q3TextFormat::painter());
05227 }

Here is the call graph for this function:

int Q3TextParagraph::leftMargin (  )  const

Definition at line 5229 of file q3richtext.cpp.

References document(), Q3TextDocument::list_lm, listDepth(), m, Q3TextFormat::painter(), scale(), string(), and ulm.

Referenced by Q3TextFormatterBreakInWords::format(), Q3TextFormatterBreakWords::format(), and Q3TextDocument::setRichTextMarginsInternal().

05230 {
05231     int m = ulm;
05232     if (listDepth() && !string()->isRightToLeft())
05233         m += listDepth() * document()->list_lm;
05234     return scale(m, Q3TextFormat::painter());
05235 }

Here is the call graph for this function:

int Q3TextParagraph::firstLineMargin (  )  const

Definition at line 5237 of file q3richtext.cpp.

References m, Q3TextFormat::painter(), scale(), and uflm.

Referenced by Q3TextFormatterBreakInWords::format(), Q3TextFormatterBreakWords::format(), and Q3TextDocument::setRichTextMarginsInternal().

05238 {
05239     int m = uflm;
05240     return scale(m, Q3TextFormat::painter());
05241 }

Here is the call graph for this function:

int Q3TextParagraph::rightMargin (  )  const

Definition at line 5243 of file q3richtext.cpp.

References document(), Q3TextDocument::list_lm, listDepth(), m, Q3TextFormat::painter(), scale(), string(), and urm.

Referenced by Q3TextFormatterBreakInWords::format(), Q3TextFormatterBreakWords::format(), and Q3TextDocument::setRichTextMarginsInternal().

05244 {
05245     int m = urm;
05246     if (listDepth() && string()->isRightToLeft())
05247         m += listDepth() * document()->list_lm;
05248     return scale(m, Q3TextFormat::painter());
05249 }

Here is the call graph for this function:

int Q3TextParagraph::lineSpacing (  )  const

Definition at line 5251 of file q3richtext.cpp.

References l, Q3TextFormat::painter(), scale(), and ulinespacing.

Referenced by Q3TextFormatterBreakWords::format().

05252 {
05253     int l = ulinespacing;
05254     l = scale(l, Q3TextFormat::painter());
05255     return l;
05256 }

Here is the call graph for this function:

void Q3TextParagraph::registerFloatingItem ( Q3TextCustomItem i  )  [inline]

Definition at line 1973 of file q3richtext_p.h.

References QList< T >::append(), floatingItems(), and i.

01974 {
01975     floatingItems().append(i);
01976 }

Here is the call graph for this function:

void Q3TextParagraph::unregisterFloatingItem ( Q3TextCustomItem i  )  [inline]

Definition at line 1978 of file q3richtext_p.h.

References floatingItems(), i, and QList< T >::removeAll().

01979 {
01980     floatingItems().removeAll(i);
01981 }

Here is the call graph for this function:

void Q3TextParagraph::setFullWidth ( bool  b  )  [inline]

Definition at line 1211 of file q3richtext_p.h.

Referenced by Q3TextFormatterBreakInWords::format(), and Q3TextFormatterBreakWords::format().

01211 { fullWidth = b; }

bool Q3TextParagraph::isFullWidth (  )  const [inline]

Definition at line 1212 of file q3richtext_p.h.

01212 { return fullWidth; }

Q3TextTableCell * Q3TextParagraph::tableCell (  )  const [inline]

Definition at line 1955 of file q3richtext_p.h.

References document(), hasdoc, and Q3TextDocument::tableCell().

Referenced by background(), and Q3TextDocument::drawParagraph().

01956 {
01957     return hasdoc ? document()->tableCell () : 0;
01958 }

Here is the call graph for this function:

QBrush * Q3TextParagraph::background (  )  const [inline]

Definition at line 1984 of file q3richtext_p.h.

References Q3TextTableCell::backGround(), and tableCell().

01985 {
01986 #ifndef QT_NO_TEXTCUSTOMITEM
01987     return tableCell() ? tableCell()->backGround() : 0;
01988 #else
01989     return 0;
01990 #endif
01991 }

Here is the call graph for this function:

int Q3TextParagraph::documentWidth (  )  const [inline]

Definition at line 1993 of file q3richtext_p.h.

References Q3TextParagraphPseudoDocument::docRect, document(), hasdoc, pseudoDocument(), QRect::width(), and Q3TextDocument::width().

Referenced by format().

01994 {
01995     return hasdoc ? document()->width() : pseudoDocument()->docRect.width();
01996 }

Here is the call graph for this function:

int Q3TextParagraph::documentVisibleWidth (  )  const [inline]

Definition at line 1998 of file q3richtext_p.h.

References Q3TextParagraphPseudoDocument::docRect, document(), hasdoc, pseudoDocument(), Q3TextDocument::visibleWidth(), and QRect::width().

Referenced by Q3TextFormatterBreakInWords::format(), and Q3TextFormatterBreakWords::format().

01999 {
02000     return hasdoc ? document()->visibleWidth() : pseudoDocument()->docRect.width();
02001 }

Here is the call graph for this function:

int Q3TextParagraph::documentX (  )  const [inline]

Definition at line 2003 of file q3richtext_p.h.

References Q3TextParagraphPseudoDocument::docRect, document(), hasdoc, pseudoDocument(), QRect::x(), and Q3TextDocument::x().

Referenced by format().

02004 {
02005     return hasdoc ? document()->x() : pseudoDocument()->docRect.x();
02006 }

Here is the call graph for this function:

int Q3TextParagraph::documentY (  )  const [inline]

Definition at line 2008 of file q3richtext_p.h.

References Q3TextParagraphPseudoDocument::docRect, document(), hasdoc, pseudoDocument(), QRect::y(), and Q3TextDocument::y().

Referenced by format().

02009 {
02010     return hasdoc ? document()->y() : pseudoDocument()->docRect.y();
02011 }

Here is the call graph for this function:

Q3TextFormatCollection * Q3TextParagraph::formatCollection (  )  const

Definition at line 5112 of file q3richtext.cpp.

References Q3TextParagraphPseudoDocument::collection, document(), Q3TextDocument::formatCollection(), hasdoc, Q3TextFormatCollection::paintDevice(), paintdevice, pseudoDocument(), and Q3TextFormatCollection::setPaintDevice().

Referenced by insert(), Q3TextParagraph(), richText(), and setFormat().

05113 {
05114     if (hasdoc)
05115         return document()->formatCollection();
05116     Q3TextFormatCollection* fc = &pseudoDocument()->collection;
05117     if (paintdevice != fc->paintDevice())
05118         fc->setPaintDevice(paintdevice);
05119     return fc;
05120 }

Here is the call graph for this function:

Q3TextFormatter * Q3TextParagraph::formatter (  )  const

Definition at line 563 of file q3richtext_p.cpp.

References document(), Q3TextDocument::formatter(), hasdoc, Q3TextParagraphPseudoDocument::pFormatter, and pseudoDocument().

Referenced by format(), and move().

00564 {
00565     if (hasdoc)
00566         return document()->formatter();
00567     if (pseudoDocument()->pFormatter)
00568         return pseudoDocument()->pFormatter;
00569     return (((Q3TextParagraph*)this)->pseudoDocument()->pFormatter = new Q3TextFormatterBreakWords);
00570 }

Here is the call graph for this function:

int Q3TextParagraph::nextTab ( int  i,
int  x 
)

Definition at line 5076 of file q3richtext.cpp.

References document(), hasdoc, i, n, Q3TextDocument::tabArray(), tabStopWidth, Q3TextDocument::tabStopWidth(), and tArray.

Referenced by Q3TextFormatterBreakInWords::format(), and Q3TextFormatterBreakWords::format().

05077 {
05078     int *ta = tArray;
05079     if (hasdoc) {
05080         if (!ta)
05081             ta = document()->tabArray();
05082         tabStopWidth = document()->tabStopWidth();
05083     }
05084     if (ta) {
05085         int i = 0;
05086         while (ta[i]) {
05087             if (ta[i] >= x)
05088                 return tArray[i];
05089             ++i;
05090         }
05091         return tArray[0];
05092     } else {
05093         int n;
05094         if (tabStopWidth != 0)
05095             n = x / tabStopWidth;
05096         else
05097             return x;
05098         return tabStopWidth * (n + 1);
05099     }
05100 }

Here is the call graph for this function:

int * Q3TextParagraph::tabArray (  )  const

Definition at line 5068 of file q3richtext.cpp.

References document(), hasdoc, Q3TextDocument::tabArray(), and tArray.

05069 {
05070     int *ta = tArray;
05071     if (!ta && hasdoc)
05072         ta = document()->tabArray();
05073     return ta;
05074 }

Here is the call graph for this function:

void Q3TextParagraph::setTabArray ( int *  a  ) 

Definition at line 572 of file q3richtext_p.cpp.

References tArray.

00573 {
00574     delete [] tArray;
00575     tArray = a;
00576 }

void Q3TextParagraph::setTabStops ( int  tw  ) 

Definition at line 578 of file q3richtext_p.cpp.

References document(), hasdoc, Q3TextDocument::setTabStops(), and tabStopWidth.

00579 {
00580     if (hasdoc)
00581         document()->setTabStops(tw);
00582     else
00583         tabStopWidth = tw;
00584 }

Here is the call graph for this function:

void Q3TextParagraph::adjustToPainter ( QPainter p  ) 

Definition at line 5102 of file q3richtext.cpp.

References Q3TextCustomItem::adjustToPainter(), at(), Q3TextStringChar::customItem(), i, length(), and p.

Referenced by Q3TextTableCell::adjustToPainter(), and Q3TextDocument::doLayout().

05103 {
05104 #ifndef QT_NO_TEXTCUSTOMITEM
05105     for (int i = 0; i < length(); ++i) {
05106         if (at(i)->isCustom())
05107             at(i)->customItem()->adjustToPainter(p);
05108     }
05109 #endif
05110 }

Here is the call graph for this function:

void Q3TextParagraph::setNewLinesAllowed ( bool  b  ) 

bool Q3TextParagraph::isNewLinesAllowed (  )  const

QString Q3TextParagraph::richText (  )  const

Definition at line 5122 of file q3richtext.cpp.

References Q3TextStringChar::anchorHref(), Q3TextString::at(), c, Q3TextStringChar::format, formatCollection(), i, Q3TextCursor::index(), Q3TextFormat::key(), l, length(), QChar::LineSeparator, Q3TextFormat::makeFormatEndTags(), Q3TextCursor::paragraph(), richTextExportEnd, richTextExportStart, s, and str.

05123 {
05124     QString s;
05125     Q3TextStringChar *formatChar = 0;
05126     QString spaces;
05127     bool doStart = richTextExportStart && richTextExportStart->paragraph() == this;
05128     bool doEnd = richTextExportEnd && richTextExportEnd->paragraph() == this;
05129     int i;
05130     QString lastAnchorName;
05131     for (i = 0; i < length()-1; ++i) {
05132         if (doStart && i && richTextExportStart->index() == i)
05133             s += "<!--StartFragment-->";
05134         if (doEnd && richTextExportEnd->index() == i)
05135             s += "<!--EndFragment-->";
05136         Q3TextStringChar *c = &str->at(i);
05137         if (c->isAnchor() && !c->anchorName().isEmpty() && c->anchorName() != lastAnchorName) {
05138       lastAnchorName = c->anchorName();
05139             if (c->anchorName().contains('#')) {
05140                 QStringList l = c->anchorName().split('#');
05141                 for (QStringList::ConstIterator it = l.constBegin(); it != l.constEnd(); ++it)
05142                     s += "<a name=\"" + *it + "\"></a>";
05143             } else {
05144                 s += "<a name=\"" + c->anchorName() + "\"></a>";
05145             }
05146         }
05147         if (!formatChar) {
05148             s += c->format()->makeFormatChangeTags(formatCollection()->defaultFormat(),
05149                                                     0, QString(), c->anchorHref());
05150             formatChar = c;
05151         } else if ((formatChar->format()->key() != c->format()->key()) ||
05152                   (c->anchorHref() != formatChar->anchorHref()))  {
05153             s += c->format()->makeFormatChangeTags(formatCollection()->defaultFormat(),
05154                                                     formatChar->format() , formatChar->anchorHref(), c->anchorHref());
05155             formatChar = c;
05156         }
05157         if (c->c == '<')
05158             s += "&lt;";
05159         else if (c->c == '>')
05160             s += "&gt;";
05161         else if (c->c =='&')
05162             s += "&amp;";
05163         else if (c->c =='\"')
05164             s += "&quot;";
05165 #ifndef QT_NO_TEXTCUSTOMITEM
05166         else if (c->isCustom())
05167             s += c->customItem()->richText();
05168 #endif
05169         else if (c->c == '\n' || c->c == QChar::LineSeparator)
05170             s += "<br />"; // space on purpose for compatibility with Netscape, Lynx & Co.
05171         else
05172             s += c->c;
05173     }
05174     if (doEnd && richTextExportEnd->index() == i)
05175         s += "<!--EndFragment-->";
05176     if (formatChar)
05177         s += formatChar->format()-&