lib

KoTextCustomItem Class Reference

#include <KoTextCustomItem.h>

Inheritance diagram for KoTextCustomItem:

KoVariable KoCustomVariable KoDateVariable KoFieldVariable KoPageVariable KoTimeVariable

List of all members.


Detailed Description

KoTextCustomItem is the base class for custom items (i.e.

special chars) Custom items include:

  • variables ( KoVariable, kovariable.h )
  • in kword: inline images ( KWTextImage, kwtextimage.h ) (to be removed)
  • in kword: anchors, i.e. floating frames ( KWAnchor, kwanchor.h )

Definition at line 34 of file KoTextCustomItem.h.


Public Types

enum  Placement { PlaceInline = 0, PlaceLeft, PlaceRight }

Public Member Functions

 KoTextCustomItem (KoTextDocument *p)
virtual void draw (QPainter *p, int x, int y, int cx, int cy, int cw, int ch, const QColorGroup &cg, bool selected)
virtual void finalize ()
void move (int x, int y)
int x () const
int y () const
virtual void setFormat (KoTextFormat *)
virtual Placement placement () const
bool placeInline ()
virtual bool ownLine () const
virtual void resize (int nwidth)
virtual void invalidate ()
virtual bool isNested () const
virtual int minimumWidth () const
virtual int widthHint () const
virtual int ascent () const
virtual QString richText () const
QRect geometry () const
virtual bool enter (KoTextCursor *, KoTextDocument *&doc, KoTextParag *&parag, int &idx, int &ox, int &oy, bool atEnd=FALSE)
virtual bool enterAt (KoTextCursor *, KoTextDocument *&doc, KoTextParag *&parag, int &idx, int &ox, int &oy, const QPoint &)
virtual bool next (KoTextCursor *, KoTextDocument *&doc, KoTextParag *&parag, int &idx, int &ox, int &oy)
virtual bool prev (KoTextCursor *, KoTextDocument *&doc, KoTextParag *&parag, int &idx, int &ox, int &oy)
virtual bool down (KoTextCursor *, KoTextDocument *&doc, KoTextParag *&parag, int &idx, int &ox, int &oy)
virtual bool up (KoTextCursor *, KoTextDocument *&doc, KoTextParag *&parag, int &idx, int &ox, int &oy)
void setParagraph (KoTextParag *p)
KoTextParag * paragraph () const
virtual void pageBreak (int, KoTextFlow *)
KoTextDocument * textDocument () const
virtual void setDeleted (bool b)
bool isDeleted () const
virtual KCommandcreateCommand ()
virtual KCommanddeleteCommand ()
virtual void save (QDomElement &formatElem)=0
virtual void saveOasis (KoXmlWriter &writer, KoSavingContext &context) const =0
virtual int typeId () const =0
virtual void resize ()
virtual void recalc ()
int index () const
KoTextFormatformat () const
virtual void drawCustomItem (QPainter *p, int x, int y, int wpix, int hpix, int ascentpix, int cx, int cy, int cw, int ch, const QColorGroup &cg, bool selected, int offset, bool drawingShadow)=0

Public Attributes

int width
int height
KoTextDocument * parent

Protected Attributes

bool m_deleted
int xpos
int ypos

Member Function Documentation

KoTextDocument* KoTextCustomItem::textDocument (  )  const [inline]

The text document in which this customitem is.

Definition at line 91 of file KoTextCustomItem.h.

virtual void KoTextCustomItem::setDeleted ( bool  b  )  [inline, virtual]

When the user deletes a custom item, it isn't destroyed but moved into the undo/redo history - setDeleted( true ) and it can be then copied back from there into the real world - setDeleted( false ).

Definition at line 96 of file KoTextCustomItem.h.

virtual KCommand* KoTextCustomItem::createCommand (  )  [inline, virtual]

Called when the item is created or 'deleted' by the user Most custom items don't need to reimplement those, since the custom item is simply moved into the undo/redo history when deleting (or undoing a creation).

It is not deleted and re-created later.

Definition at line 105 of file KoTextCustomItem.h.

virtual void KoTextCustomItem::save ( QDomElement &  formatElem  )  [pure virtual]

Save to XML.

Implemented in KoVariable.

virtual void KoTextCustomItem::saveOasis ( KoXmlWriter writer,
KoSavingContext context 
) const [pure virtual]

virtual int KoTextCustomItem::typeId (  )  const [pure virtual]

Return type of custom item.

See DTD for VARIABLE.id docu.

Implemented in KoVariable.

virtual void KoTextCustomItem::resize (  )  [inline, virtual]

Reimplement this to calculate the item width It is important to start with "if ( m_deleted ) return;".

Reimplemented in KoVariable, KoDateVariable, and KoTimeVariable.

Definition at line 117 of file KoTextCustomItem.h.

virtual void KoTextCustomItem::recalc (  )  [inline, virtual]

Reimplemented by KoVariable to recalculate the value.

It exists at the KoTextCustomItem level so that KoTextParag::setCustomItem can call it to set the initial value. This should call always resize().

Reimplemented in KoDateVariable, KoTimeVariable, KoCustomVariable, KoFieldVariable, and KoPageVariable.

Definition at line 123 of file KoTextCustomItem.h.

int KoTextCustomItem::index (  )  const

The index in paragraph(), where this anchor is Slightly slow (does a linear search in the paragraph).

Definition at line 58 of file KoTextCustomItem.cpp.

KoTextFormat * KoTextCustomItem::format (  )  const

The formatting given to this 'special' character Slightly slow (does a linear search in the paragraph).

Definition at line 65 of file KoTextCustomItem.cpp.

virtual void KoTextCustomItem::drawCustomItem ( QPainter *  p,
int  x,
int  y,
int  wpix,
int  hpix,
int  ascentpix,
int  cx,
int  cy,
int  cw,
int  ch,
const QColorGroup &  cg,
bool  selected,
int  offset,
bool  drawingShadow 
) [pure virtual]

All coordinates are in pixels.

Implemented in KoVariable.


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