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

Detailed Description
A KoVariable is a custom item, i.e.considered as a single character. KoVariable is the abstract base class.
Definition at line 362 of file KoVariable.h.
Public Member Functions | |
KoVariable (KoTextDocument *fs, KoVariableFormat *varFormat, KoVariableCollection *varColl) | |
virtual | ~KoVariable () |
virtual VariableType | type () const =0 |
virtual short int | subType () const |
virtual Placement | placement () const |
virtual void | resize () |
virtual int | ascent () const |
virtual int | widthHint () const |
virtual int | minimumWidth () 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) |
void | drawCustomItemHelper (QPainter *p, int x, int y, int wpix, int hpix, int ascentpix, const QColorGroup &cg, bool selected, int offset, KoTextFormat *fmt, const QFont &font, QColor textColor, bool drawingShadow) |
void | setVariableFormat (KoVariableFormat *_varFormat) |
KoVariableFormat * | variableFormat () const |
KoVariableCollection * | variableColl () const |
virtual QString | text (bool realValue=false) |
virtual QString | fieldCode () |
QVariant | varValue () const |
void | recalcAndRepaint () |
virtual void | save (QDomElement &parentElem) |
virtual void | saveOasis (KoXmlWriter &writer, KoSavingContext &context) const |
virtual void | load (QDomElement &elem) |
virtual void | loadOasis (const QDomElement &elem, KoOasisContext &context) |
virtual int | typeId () const |
virtual QStringList | subTypeList () |
virtual void | setVariableSubType (short int) |
virtual short int | variableSubType (short int menuNumber) |
QString | convertKlocaleToQDateTimeFormat (const QString &_format) |
Protected Member Functions | |
virtual void | saveVariable (QDomElement &parentElem)=0 |
virtual int | correctValue () const |
Protected Attributes | |
KoVariableFormat * | m_varFormat |
KoVariableCollection * | m_varColl |
QVariant | m_varValue |
int | m_ascent |
Private * | d |
Member Function Documentation
void KoVariable::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 | |||
) | [virtual] |
All coordinates are in pixels.
Implements KoTextCustomItem.
Reimplemented in KoLinkVariable, and KoNoteVariable.
Definition at line 922 of file KoVariable.cpp.
void KoVariable::drawCustomItemHelper | ( | QPainter * | p, | |
int | x, | |||
int | y, | |||
int | wpix, | |||
int | hpix, | |||
int | ascentpix, | |||
const QColorGroup & | cg, | |||
bool | selected, | |||
int | offset, | |||
KoTextFormat * | fmt, | |||
const QFont & | font, | |||
QColor | textColor, | |||
bool | drawingShadow | |||
) |
Called by drawCustomItem.
Some special variables can reimplement drawCustomItem to change the parameters passed to drawCustomItemHelper
Definition at line 930 of file KoVariable.cpp.
void KoVariable::recalcAndRepaint | ( | ) |
Ask this variable to recalculate and to repaint itself Only use this if you're working on a single variable (e.g.
popupmenu). Otherwise, better do the repainting all at once.
Definition at line 892 of file KoVariable.cpp.
void KoVariable::resize | ( | ) | [virtual] |
Reimplement this to calculate the item width It is important to start with "if ( m_deleted ) return;".
Reimplemented from KoTextCustomItem.
Reimplemented in KoDateVariable, and KoTimeVariable.
Definition at line 873 of file KoVariable.cpp.
void KoVariable::save | ( | QDomElement & | parentElem | ) | [virtual] |
Save the variable.
Public API, does the common job and then calls saveVariable.
Implements KoTextCustomItem.
Definition at line 1000 of file KoVariable.cpp.
void KoVariable::saveOasis | ( | KoXmlWriter & | writer, | |
KoSavingContext & | context | |||
) | const [virtual] |
Save to Oasis XML.
Implements KoTextCustomItem.
Reimplemented in KoDateVariable, KoTimeVariable, KoCustomVariable, KoFieldVariable, KoMailMergeVariable, KoPageVariable, KoLinkVariable, KoNoteVariable, and KoStatisticVariable.
Definition at line 1028 of file KoVariable.cpp.
virtual void KoVariable::saveVariable | ( | QDomElement & | parentElem | ) | [protected, pure virtual] |
Variable should reimplement this to implement saving.
Implemented in KoDateVariable, KoTimeVariable, KoCustomVariable, KoFieldVariable, KoMailMergeVariable, KoPageVariable, KoLinkVariable, KoNoteVariable, and KoStatisticVariable.
virtual void KoVariable::setVariableSubType | ( | short int | ) | [inline, virtual] |
Set this variable's subtype.
Reimplemented in KoDateVariable, KoTimeVariable, KoFieldVariable, KoPageVariable, and KoStatisticVariable.
Definition at line 429 of file KoVariable.h.
QStringList KoVariable::subTypeList | ( | ) | [virtual] |
List of available subtypes (translated). Use variableSubType() to map index to ID.
Reimplemented in KoDateVariable, KoTimeVariable, KoFieldVariable, KoPageVariable, and KoStatisticVariable.
Definition at line 868 of file KoVariable.cpp.
QString KoVariable::text | ( | bool | realValue = false |
) | [virtual] |
Returns the text to be displayed for this variable It doesn't need to be cached, convert() is fast, and it's the actual value (date, time etc.
) that is cached in the variable already.
Reimplemented in KoCustomVariable, KoFieldVariable, KoMailMergeVariable, KoLinkVariable, and KoNoteVariable.
Definition at line 910 of file KoVariable.cpp.
virtual int KoVariable::typeId | ( | ) | const [inline, virtual] |
Part of the KoTextCustomItem interface.
Returns the code for a variable, see DTD. Do NOT reimplement in koVariable-derived classes.
Implements KoTextCustomItem.
Definition at line 423 of file KoVariable.h.
virtual short int KoVariable::variableSubType | ( | short int | menuNumber | ) | [inline, virtual] |
Converts the menuNumber
to variable subtype number (VST_x).
Reimplemented in KoFieldVariable.
Definition at line 434 of file KoVariable.h.
QVariant KoVariable::varValue | ( | ) | const [inline] |
Return the variable value, as a QVariant, before format conversion.
Definition at line 404 of file KoVariable.h.
The documentation for this class was generated from the following files: