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 ()
KoTextStringstring () const
KoTextStringCharat (int i) const
int leftGap () const
int length () const
int lastCharPos () const
void setFormat (KoTextFormat *fm)
KoTextFormatparagFormat () const
KoTextDocumentdocument () const
QRect rect () const
void setRect (const QRect &rect)
void setHeight (int h)
void setWidth (int w)
void show ()
void hide ()
bool isVisible () const
KoTextParagprev () const
KoTextParagnext () 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
KoTextStringCharlineStartOfChar (int i, int *index=0, int *line=0) const
int lines () const
KoTextStringCharlineStartOfLine (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
KoTextFormatCollectionformatCollection () const
KoTextFormatterBaseformatter () 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)
KoTextDocumenttextDocument () const
KoTextFormatparagraphFormat () const
virtual void setParagLayout (const KoParagLayout &layout, int flags=KoParagLayout::All, int marginIndex=-1)
const KoParagLayoutparagLayout ()
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)
KoParagCountercounter ()
int counterWidth () const
KoParagStylestyle () 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)
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 358 of file KoTextParag.h.


Member Function Documentation

void KoTextParag::applyStyle KoParagStyle style  ) 
 

Applies the style directly (without undo/redo! See KoTextObject for undo/redo).

Definition at line 2210 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 1231 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 1056 of file KoTextParag.cpp.

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 2003 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 2432 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 3068 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 2282 of file KoTextParag.cpp.

void KoTextParag::fixParagWidth bool  viewFormattingChars  ) 
 

The app should call this during formatting - e.g. in formatVertically.

Definition at line 3056 of file KoTextParag.cpp.

bool KoTextParag::hasChanged  )  const [inline]
 

'changed' tells the painting code what it needs to paint

Definition at line 440 of file KoTextParag.h.

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::isNewLinesAllowed  )  const [inline]
 

Return whether '
' should break the paragraph into multiple lines.

Definition at line 567 of file KoTextParag.h.

bool KoTextParag::isValid  )  const [inline]
 

Returns false if format() needs to be called on this paragraph.

Definition at line 435 of file KoTextParag.h.

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::loadOasis const QDomElement &  e,
KoOasisContext context,
KoStyleCollection styleCollection,
uint &  pos
[virtual]
 

Load from XML.

Definition at line 2803 of file KoTextParag.cpp.

int KoTextParag::nextTab int  i,
int  x,
int  availableWidth
 

"Reimplemented" (compared to nextTabDefault) to implement non-left-aligned tabs

Definition at line 2086 of file KoTextParag.cpp.

QRect KoTextParag::pixelRect KoTextZoomHandler zh  )  const
 

Returns:
the parag rect, in pixels. This takes care of some rounding problems

Definition at line 1366 of file KoTextParag.cpp.

void KoTextParag::removeCustomItem int  index  ) 
 

Remove the custom item from position index, but doesn't delete it.

Definition at line 2272 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.

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 2826 of file KoTextParag.cpp.

void KoTextParag::setAlign int  align  ) 
 

Use this to change the paragraph alignment, not KoTextParag::setAlignment !

Definition at line 960 of file KoTextParag.cpp.

void KoTextParag::setCustomItem int  index,
KoTextCustomItem custom,
KoTextFormat currentFormat
 

Set a custom item at position index, with format currentFormat (convenience method).

Definition at line 2258 of file KoTextParag.cpp.

void KoTextParag::setNewLinesAllowed bool  b  )  [inline]
 

Set whether '
' should break the paragraph into multiple lines Not used.

Definition at line 562 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 2218 of file KoTextParag.cpp.

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::setStyle KoParagStyle style  )  [inline]
 

Sets the style in this paragraph, but doesn't _apply_ it, only sets a reference.

Definition at line 283 of file KoTextParag.h.

void KoTextParag::setTabList const KoTabulatorList &  tabList  ) 
 

Set tabulator positions.

Definition at line 2063 of file KoTextParag.cpp.

double KoTextParag::shadowDistanceY  )  const
 

Return the Y for the shadow distance in pt.

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).

KoParagStyle* KoTextParag::style  )  const [inline]
 

Style used by this paragraph.

Definition at line 281 of file KoTextParag.h.

QMap<int, int>& KoTextParag::tabCache  )  [inline]
 

Cache to find a tab by char index, QMap<char index, tab index>.

Definition at line 309 of file KoTextParag.h.

const KoTabulatorList& KoTextParag::tabList  )  const [inline]
 

Get tabulator positions.

Definition at line 288 of file KoTextParag.h.

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.

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 2643 of file KoTextParag.cpp.


The documentation for this class was generated from the following files:
KDE Home | KDE Accessibility Home | Description of Access Keys