lib
KoTextCustomItem Class Reference
#include <KoTextCustomItem.h>
Inheritance diagram for KoTextCustomItem:

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 | |
PlaceInline = 0 | |
PlaceLeft | |
PlaceRight | |
enum | Placement { PlaceInline = 0, PlaceLeft, PlaceRight } |
Public Member Functions | |
KoTextCustomItem (KoTextDocument *p) | |
virtual | ~KoTextCustomItem () |
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 *¶g, int &idx, int &ox, int &oy, bool atEnd=FALSE) |
virtual bool | enterAt (KoTextCursor *, KoTextDocument *&doc, KoTextParag *¶g, int &idx, int &ox, int &oy, const QPoint &) |
virtual bool | next (KoTextCursor *, KoTextDocument *&doc, KoTextParag *¶g, int &idx, int &ox, int &oy) |
virtual bool | prev (KoTextCursor *, KoTextDocument *&doc, KoTextParag *¶g, int &idx, int &ox, int &oy) |
virtual bool | down (KoTextCursor *, KoTextDocument *&doc, KoTextParag *¶g, int &idx, int &ox, int &oy) |
virtual bool | up (KoTextCursor *, KoTextDocument *&doc, KoTextParag *¶g, 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 KCommand * | createCommand () |
virtual KCommand * | deleteCommand () |
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 |
KoTextFormat * | format () 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
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::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] |
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.
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.
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, KoPageVariable, KoLinkVariable, and KoNoteVariable.
Definition at line 123 of file KoTextCustomItem.h.
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::save | ( | QDomElement & | formatElem | ) | [pure virtual] |
virtual void KoTextCustomItem::saveOasis | ( | KoXmlWriter & | writer, | |
KoSavingContext & | context | |||
) | const [pure virtual] |
Save to Oasis XML.
Implemented in KoVariable, KoDateVariable, KoTimeVariable, KoCustomVariable, KoFieldVariable, KoMailMergeVariable, KoPageVariable, KoLinkVariable, KoNoteVariable, and KoStatisticVariable.
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.
KoTextDocument* KoTextCustomItem::textDocument | ( | ) | const [inline] |
virtual int KoTextCustomItem::typeId | ( | ) | const [pure virtual] |
The documentation for this class was generated from the following files: