lib Library API Documentation

KoVariable Class Reference

A KoVariable is a custom item, i.e. More...

#include <kovariable.h>

Inheritance diagram for KoVariable:

Inheritance graph
[legend]
Collaboration diagram for KoVariable:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 KoVariable (KoTextDocument *fs, KoVariableFormat *varFormat, KoVariableCollection *varColl)
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)
KoVariableFormatvariableFormat () const
KoVariableCollection * variableColl () const
virtual QString text (bool realValue=false)
virtual QString fieldCode ()
QVariant varValue () const
void recalcAndRepaint ()
void save (QDomElement &parentElem)
virtual void load (QDomElement &elem)
virtual int typeId () const
virtual QStringList subTypeText ()
virtual void setVariableSubType (short int)
virtual short int variableSubType (short int menuNumber)

Protected Member Functions

virtual void saveVariable (QDomElement &parentElem)=0
virtual int correctValue () const

Protected Attributes

KoVariableFormatm_varFormat
KoVariableCollection * m_varColl
QVariant m_varValue
int m_ascent
Private * d

Detailed Description

A KoVariable is a custom item, i.e.

considered as a single character. KoVariable is the abstract base class.

Definition at line 338 of file kovariable.h.


Member Function Documentation

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 665 of file kovariable.cc.

References KoTextFormat::defaultTextColor(), KoTextFormat::offsetFromBaseLine(), KoTextFormat::shadowColor(), text(), KoTextFormat::textBackgroundColor(), and KoTextFormat::vAlign().

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, and KoFieldVariable.

Definition at line 645 of file kovariable.cc.

References KoVariableFormat::convert(), and KoTextFormat::displayedString().

Referenced by drawCustomItemHelper(), and save().

QVariant KoVariable::varValue  )  const [inline]
 

Return the variable value, as a QVariant, before format conversion.

Definition at line 378 of file kovariable.h.

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.

See also:
KoVariableCollection::recalcVariables()

Definition at line 627 of file kovariable.cc.

void KoVariable::save QDomElement parentElem  ) 
 

Save the variable.

Public API, does the common job and then calls saveVariable.

Definition at line 717 of file kovariable.cc.

References KoVariableFormat::key(), saveVariable(), and text().

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.

Definition at line 395 of file kovariable.h.

QStringList KoVariable::subTypeText  )  [virtual]
 

List of available subtypes (translated). Use variableSubType() to map index to ID.

Reimplemented in KoDateVariable, KoTimeVariable, KoFieldVariable, and KoPgNumVariable.

Definition at line 604 of file kovariable.cc.

virtual void KoVariable::setVariableSubType short  int  )  [inline, virtual]
 

Set this variable's subtype.

Reimplemented in KoDateVariable, KoTimeVariable, KoFieldVariable, and KoPgNumVariable.

Definition at line 401 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 406 of file kovariable.h.

virtual void KoVariable::saveVariable QDomElement parentElem  )  [protected, pure virtual]
 

Variable should reimplement this to implement saving.

Implemented in KoDateVariable, KoTimeVariable, KoCustomVariable, KoFieldVariable, and KoPgNumVariable.

Referenced by save().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for lib Library Version 1.3.5.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Mar 11 11:50:28 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003