lib
KoTextParag Class Reference
List of all members.Detailed Description
Definition at line 52 of file KoTextParag.h.
Public Member Functions | |
KoTextParag (KoTextDocument *d, KoTextParag *pr=0, KoTextParag *nx=0, bool updateIds=TRUE) | |
virtual | ~KoTextParag () |
KoTextString * | string () const |
KoTextStringChar * | at (int i) const |
int | leftGap () const |
int | length () const |
int | lastCharPos () const |
void | setFormat (KoTextFormat *fm) |
KoTextFormat * | paragFormat () const |
KoTextDocument * | document () const |
QRect | rect () const |
void | setRect (const QRect &rect) |
void | setHeight (int h) |
void | setWidth (int w) |
void | show () |
void | hide () |
bool | isVisible () const |
KoTextParag * | prev () const |
KoTextParag * | next () const |
void | setPrev (KoTextParag *s) |
void | setNext (KoTextParag *s) |
void | insert (int index, const QString &s) |
void | append (const QString &s, bool reallyAtEnd=FALSE) |
void | truncate (int index) |
void | remove (int index, int len) |
void | move (int &dy) |
void | format (int start=-1, bool doMove=TRUE) |
void | invalidate (int chr=0) |
bool | isValid () const |
bool | hasChanged () const |
void | setChanged (bool b, bool recursive=FALSE) |
short int | lineChanged () |
void | setLineChanged (short int line) |
int | lineHeightOfChar (int i, int *bl=0, int *y=0) const |
KoTextStringChar * | lineStartOfChar (int i, int *index=0, int *line=0) const |
int | lines () const |
KoTextStringChar * | lineStartOfLine (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 | setParagId (int i) |
int | paragId () const |
QMap< int, KoTextParagLineStart * > & | lineStartList () |
void | setFormat (int index, int len, const KoTextFormat *f, bool useCollection=TRUE, int flags=-1) |
void | setAlignment (uint a) |
void | setAlignmentDirect (uint a) |
uint | alignment () const |
virtual void | paint (QPainter &painter, const QColorGroup &cg, KoTextCursor *cursor, bool drawSelections, int clipx, int clipy, int clipw, int cliph) |
int | topMargin () const |
int | bottomMargin () const |
int | leftMargin () const |
int | firstLineMargin () const |
int | rightMargin () const |
int | lineSpacing (int line) const |
int | calculateLineSpacing (int line, int start, int last) const |
void | registerFloatingItem (KoTextCustomItem *i) |
void | unregisterFloatingItem (KoTextCustomItem *i) |
void | setFullWidth (bool b) |
bool | isFullWidth () const |
int | customItems () const |
void | setDocumentRect (const QRect &r) |
int | documentWidth () const |
int | documentX () const |
int | documentY () const |
KoTextFormatCollection * | formatCollection () const |
KoTextFormatterBase * | formatter () const |
int | widthUsed () const |
int | nextTabDefault (int i, int x) |
int | nextTab (int i, int x, int availableWidth) |
int * | tabArray () const |
void | setTabArray (int *a) |
void | setTabStops (int tw) |
void | setNewLinesAllowed (bool b) |
bool | isNewLinesAllowed () const |
virtual void | join (KoTextParag *s) |
virtual void | copyParagData (KoTextParag *parag) |
void | setMovedDown (bool b) |
bool | wasMovedDown () const |
void | setDirection (QChar::Direction d) |
QChar::Direction | direction () const |
void | setPartOfTableOfContents (bool b) |
bool | partOfTableOfContents () const |
void | insertLineStart (int index, KoTextParagLineStart *ls) |
KoTextDocument * | textDocument () const |
KoTextFormat * | paragraphFormat () const |
virtual void | setParagLayout (const KoParagLayout &layout, int flags=KoParagLayout::All, int marginIndex=-1) |
const KoParagLayout & | paragLayout () |
double | margin (QStyleSheetItem::Margin m) |
const double * | margins () const |
void | setMargin (QStyleSheetItem::Margin m, double _i) |
void | setMargins (const double *_i) |
double | kwLineSpacing () const |
void | setLineSpacing (double _i) |
KoParagLayout::SpacingType | kwLineSpacingType () const |
void | setLineSpacingType (KoParagLayout::SpacingType _type) |
void | setAlign (int align) |
int | resolveAlignment () const |
int | breakableTopMargin () const |
KoBorder | leftBorder () const |
KoBorder | rightBorder () const |
KoBorder | topBorder () const |
KoBorder | bottomBorder () const |
bool | hasBorder () const |
bool | joinBorder () const |
void | setLeftBorder (const KoBorder &_brd) |
void | setRightBorder (const KoBorder &_brd) |
void | setTopBorder (const KoBorder &_brd) |
void | setBottomBorder (const KoBorder &_brd) |
void | setJoinBorder (bool join) |
QColor | backgroundColor () |
void | setBackgroundColor (const QColor &color) |
void | setCounter (const KoParagCounter &counter) |
void | setNoCounter () |
void | setCounter (const KoParagCounter *pCounter) |
KoParagCounter * | counter () |
int | counterWidth () const |
KoParagStyle * | style () const |
void | setStyle (KoParagStyle *style) |
void | applyStyle (KoParagStyle *style) |
const KoTabulatorList & | tabList () const |
void | setTabList (const KoTabulatorList &tabList) |
int | shadowX (KoTextZoomHandler *zh) const |
int | shadowY (KoTextZoomHandler *zh) const |
double | shadowDistanceY () const |
void | setCustomItem (int index, KoTextCustomItem *custom, KoTextFormat *currentFormat) |
void | removeCustomItem (int index) |
int | findCustomItem (const KoTextCustomItem *custom) const |
QMap< int, int > & | tabCache () |
QRect | pixelRect (KoTextZoomHandler *zh) const |
QString | toString (int from=0, int length=0xffffffff) const |
void | fixParagWidth (bool viewFormattingChars) |
virtual void | loadOasis (const QDomElement &e, KoOasisContext &context, KoStyleCollection *styleCollection, uint &pos) |
virtual void | saveOasis (KoXmlWriter &writer, KoSavingContext &context, int from, int to, bool saveAnchorsFramesets=false) const |
void | loadOasisSpan (const QDomElement &parent, KoOasisContext &context, uint &pos, bool stripLeadingSpace=false) |
void | loadOasisSpan (const QDomElement &parent, KoOasisContext &context, uint &pos, bool stripLeadingSpace, bool *hasTrailingSpace) |
void | applyListStyle (KoOasisContext &context, int restartNumbering, bool orderedList, bool heading, int level) |
void | printRTDebug (int) |
Static Public Member Functions | |
static void | drawFontEffects (QPainter *p, KoTextFormat *format, KoTextZoomHandler *zh, QFont font, const QColor &color, int startX, int baseLine, int bw, int y, int h, QChar firstChar) |
Protected Types | |
enum | { FormattingSpace = 1, FormattingBreak = 2, FormattingEndParag = 4, FormattingTabs = 8, AllFormattingChars = FormattingSpace | FormattingBreak | FormattingEndParag | FormattingTabs } |
Protected Member Functions | |
void | drawLabel (QPainter *p, int x, int y, int w, int h, int base, const QColorGroup &cg) |
void | drawCursorDefault (QPainter &painter, KoTextCursor *cursor, int curx, int cury, int curh, const QColorGroup &cg) |
void | drawCursor (QPainter &painter, KoTextCursor *cursor, int curx, int cury, int curh, const QColorGroup &cg) |
void | invalidateCounters () |
bool | lineHyphenated (int l) const |
void | paintLines (QPainter &painter, const QColorGroup &cg, KoTextCursor *cursor, bool drawSelections, int clipx, int clipy, int clipw, int cliph) |
void | drawParagString (QPainter &painter, const QString &str, int start, int len, int startX, int lastY, int baseLine, int bw, int h, bool drawSelections, KoTextFormat *lastFormat, const QMemArray< int > &selectionStarts, const QMemArray< int > &selectionEnds, const QColorGroup &cg, bool rightToLeft, int line) |
void | drawParagStringInternal (QPainter &painter, const QString &s, int start, int len, int startX, int lastY, int baseLine, int bw, int h, bool drawSelections, KoTextFormat *lastFormat, const QMemArray< int > &selectionStarts, const QMemArray< int > &selectionEnds, const QColorGroup &cg, bool rightToLeft, int line, KoTextZoomHandler *zh, bool drawingShadow) |
virtual void | drawFormattingChars (QPainter &painter, int start, int len, int lastY_pix, int baseLine_pix, int h_pix, bool drawSelections, KoTextFormat *format, const QMemArray< int > &selectionStarts, const QMemArray< int > &selectionEnds, const QColorGroup &cg, bool rightToLeft, int line, KoTextZoomHandler *zh, int whichFormattingChars) |
Protected Attributes | |
KoParagLayout | m_layout |
QMap< int, int > | m_tabCache |
Friends | |
class | KoTextDocument |
class | KoTextCursor |
Member Enumeration Documentation
anonymous enum [protected] |
Bitfield for drawFormattingChars's "whichFormattingChars" param.
Definition at line 369 of file KoTextParag.h.
Member Function Documentation
void KoTextParag::invalidate | ( | int | chr = 0 |
) |
Call this to ensure that format() will be called on this paragraph later on.
Definition at line 157 of file KoTextParag.cpp.
bool KoTextParag::isValid | ( | ) | const [inline] |
Returns false if format() needs to be called on this paragraph.
Definition at line 446 of file KoTextParag.h.
bool KoTextParag::hasChanged | ( | ) | const [inline] |
'changed' tells the painting code what it needs to paint
Definition at line 451 of file KoTextParag.h.
int KoTextParag::nextTab | ( | int | i, | |
int | x, | |||
int | availableWidth | |||
) |
"Reimplemented" (compared to nextTabDefault) to implement non-left-aligned tabs
Definition at line 2111 of file KoTextParag.cpp.
void KoTextParag::setNewLinesAllowed | ( | bool | b | ) | [inline] |
Set whether '
' should break the paragraph into multiple lines Not used.
Definition at line 573 of file KoTextParag.h.
bool KoTextParag::isNewLinesAllowed | ( | ) | const [inline] |
Return whether '
' should break the paragraph into multiple lines.
Definition at line 578 of file KoTextParag.h.
void KoTextParag::setPartOfTableOfContents | ( | bool | b | ) | [inline] |
Mark a paragraph as being part of the table of contents (kword only).
Definition at line 193 of file KoTextParag.h.
void KoTextParag::drawCursor | ( | QPainter & | painter, | |
KoTextCursor * | cursor, | |||
int | curx, | |||
int | cury, | |||
int | curh, | |||
const QColorGroup & | cg | |||
) | [protected] |
Draw the cursor mark.
Reimplemented from KoTextParag to convert coordinates first.
Definition at line 2028 of file KoTextParag.cpp.
KoTextDocument* KoTextParag::textDocument | ( | ) | const [inline] |
We extend KoTextParag with more (zoom-aware) features, like linespacing, borders, counter, tabulators, etc.
This also implements WYSIWYG text drawing.
Definition at line 210 of file KoTextParag.h.
void KoTextParag::setParagLayout | ( | const KoParagLayout & | layout, | |
int | flags = KoParagLayout::All , |
|||
int | marginIndex = -1 | |||
) | [virtual] |
Sets all or some parameters from a paragLayout struct.
- Parameters:
-
flags selects which settings to apply, see KoParagLayout's enum.
Definition at line 2243 of file KoTextParag.cpp.
double KoTextParag::kwLineSpacing | ( | ) | const [inline] |
Line spacing in pt if >=0, can also be one of the LS_* values.
Definition at line 229 of file KoTextParag.h.
void KoTextParag::setAlign | ( | int | align | ) |
Use this to change the paragraph alignment, not KoTextParag::setAlignment !
Definition at line 960 of file KoTextParag.cpp.
int KoTextParag::resolveAlignment | ( | ) | const |
Return the real alignment: Auto is resolved to either Left or Right.
Definition at line 968 of file KoTextParag.cpp.
int KoTextParag::breakableTopMargin | ( | ) | const |
The part of the top margin that can be broken by a page break Obviously the non-breakable part (e.g.
border width) is topMargin()-breakableTopMargin()
Definition at line 1253 of file KoTextParag.cpp.
int KoTextParag::counterWidth | ( | ) | const |
The space required to draw the complete counter label (i.e.
the Counter for this paragraph, as well as the Counters for any paragraphs above us in the numbering hierarchy).
- See also:
- drawLabel().
Definition at line 1078 of file KoTextParag.cpp.
KoParagStyle* KoTextParag::style | ( | ) | const [inline] |
void KoTextParag::setStyle | ( | KoParagStyle * | style | ) | [inline] |
Sets the style in this paragraph, but doesn't _apply_ it, only sets a reference.
Definition at line 279 of file KoTextParag.h.
void KoTextParag::applyStyle | ( | KoParagStyle * | style | ) |
Applies the style directly (without undo/redo! See KoTextObject for the full command).
Definition at line 2235 of file KoTextParag.cpp.
const KoTabulatorList& KoTextParag::tabList | ( | ) | const [inline] |
void KoTextParag::setTabList | ( | const KoTabulatorList & | tabList | ) |
int KoTextParag::shadowX | ( | KoTextZoomHandler * | zh | ) | const |
Return the X for the shadow distance in pixels (zoomed).
int KoTextParag::shadowY | ( | KoTextZoomHandler * | zh | ) | const |
Return the Y for the shadow distance in pixels (zoomed).
double KoTextParag::shadowDistanceY | ( | ) | const |
Return the Y for the shadow distance in pt.
void KoTextParag::setCustomItem | ( | int | index, | |
KoTextCustomItem * | custom, | |||
KoTextFormat * | currentFormat | |||
) |
Set a custom
item at position index
, with format currentFormat
(convenience method).
Definition at line 2283 of file KoTextParag.cpp.
void KoTextParag::removeCustomItem | ( | int | index | ) |
Remove the custom item from position index
, but doesn't delete it.
Definition at line 2297 of file KoTextParag.cpp.
int KoTextParag::findCustomItem | ( | const KoTextCustomItem * | custom | ) | const |
Find a custom item that we know is somewhere in this paragraph Returns the index in the paragraph.
Definition at line 2307 of file KoTextParag.cpp.
QMap<int, int>& KoTextParag::tabCache | ( | ) | [inline] |
Cache to find a tab by char index, QMap<char index, tab index>.
Definition at line 305 of file KoTextParag.h.
QRect KoTextParag::pixelRect | ( | KoTextZoomHandler * | zh | ) | const |
- Returns:
- the parag rect, in pixels.
This takes care of some rounding problems
Definition at line 1388 of file KoTextParag.cpp.
void KoTextParag::drawFontEffects | ( | QPainter * | p, | |
KoTextFormat * | format, | |||
KoTextZoomHandler * | zh, | |||
QFont | font, | |||
const QColor & | color, | |||
int | startX, | |||
int | baseLine, | |||
int | bw, | |||
int | y, | |||
int | h, | |||
QChar | firstChar | |||
) | [static] |
draw underline and double underline.
Static because it's used for draw double/simple in variable.
Definition at line 2459 of file KoTextParag.cpp.
QString KoTextParag::toString | ( | int | from = 0 , |
|
int | length = 0xffffffff | |||
) | const |
a bit more clever than KoTextString::toString, e.g.
with numbered lists
Definition at line 2670 of file KoTextParag.cpp.
void KoTextParag::fixParagWidth | ( | bool | viewFormattingChars | ) |
The app should call this during formatting - e.g. in formatVertically.
Definition at line 3142 of file KoTextParag.cpp.
void KoTextParag::loadOasis | ( | const QDomElement & | e, | |
KoOasisContext & | context, | |||
KoStyleCollection * | styleCollection, | |||
uint & | pos | |||
) | [virtual] |
void KoTextParag::saveOasis | ( | KoXmlWriter & | writer, | |
KoSavingContext & | context, | |||
int | from, | |||
int | to, | |||
bool | saveAnchorsFramesets = false | |||
) | const [virtual] |
Save to XML By default the whole paragraph is saved.
from/to allow to save only a portion of it. The 'from' and 'to' characters are both included.
Definition at line 2912 of file KoTextParag.cpp.
void KoTextParag::loadOasisSpan | ( | const QDomElement & | parent, | |
KoOasisContext & | context, | |||
uint & | pos, | |||
bool | stripLeadingSpace = false | |||
) |
Load a section of text from a oasis based xml tree.
- Parameters:
-
parent the xml element that has content as children. context the context stripLeadingSpace whether to remove leading literal whitespace
Definition at line 2736 of file KoTextParag.cpp.
void KoTextParag::loadOasisSpan | ( | const QDomElement & | parent, | |
KoOasisContext & | context, | |||
uint & | pos, | |||
bool | stripLeadingSpace, | |||
bool * | hasTrailingSpace | |||
) |
Load a section of text from a oasis based xml tree.
- Parameters:
-
parent the xml element that has content as children. context the context stripLeadingSpace whether to remove leading literal whitespace hasTrailingSpace whether there was trailing literal whitespace in the span's text
Definition at line 2743 of file KoTextParag.cpp.
void KoTextParag::drawFormattingChars | ( | QPainter & | painter, | |
int | start, | |||
int | len, | |||
int | lastY_pix, | |||
int | baseLine_pix, | |||
int | h_pix, | |||
bool | drawSelections, | |||
KoTextFormat * | format, | |||
const QMemArray< int > & | selectionStarts, | |||
const QMemArray< int > & | selectionEnds, | |||
const QColorGroup & | cg, | |||
bool | rightToLeft, | |||
int | line, | |||
KoTextZoomHandler * | zh, | |||
int | whichFormattingChars | |||
) | [protected, virtual] |
Called by drawParagStringInternal to draw the formatting characters, if the kotextdocument drawingflag for it was set.
The last arg is a bit special: drawParagStringInternal always sets it to "all", but reimplementations can change its value.
Definition at line 3154 of file KoTextParag.cpp.
The documentation for this class was generated from the following files: