lib

#include <KoVariable.h>

Inheritance diagram for KoVariable:
KoTextCustomItem KoCustomVariable KoDateVariable KoFieldVariable KoPageVariable KoTimeVariable

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 (TQPainter *p, int x, int y, int wpix, int hpix, int ascentpix, int cx, int cy, int cw, int ch, const TQColorGroup &cg, bool selected, int offset, bool drawingShadow)
 
void drawCustomItemHelper (TQPainter *p, int x, int y, int wpix, int hpix, int ascentpix, const TQColorGroup &cg, bool selected, int offset, KoTextFormat *fmt, const TQFont &font, TQColor textColor, bool drawingShadow)
 
void setVariableFormat (KoVariableFormat *_varFormat)
 
KoVariableFormat * variableFormat () const
 
KoVariableCollection * variableColl () const
 
virtual TQString text (bool realValue=false)
 
virtual TQString fieldCode ()
 
TQVariant varValue () const
 
void recalcAndRepaint ()
 
virtual void save (TQDomElement &parentElem)
 
virtual void saveOasis (KoXmlWriter &writer, KoSavingContext &context) const
 
virtual void load (TQDomElement &elem)
 
virtual void loadOasis (const TQDomElement &elem, KoOasisContext &context)
 
virtual int typeId () const
 
virtual TQStringList subTypeList ()
 
virtual void setVariableSubType (short int)
 
virtual short int variableSubType (short int menuNumber)
 
TQString convertKlocaleToTQDateTimeFormat (const TQString &_format)
 
- Public Member Functions inherited from KoTextCustomItem
 KoTextCustomItem (KoTextDocument *p)
 
virtual void draw (TQPainter *p, int x, int y, int cx, int cy, int cw, int ch, const TQColorGroup &cg, bool selected)
 
virtual void finalize ()
 
void move (int x, int y)
 
int x () const
 
int y () const
 
virtual void setFormat (KoTextFormat *)
 
bool placeInline ()
 
virtual bool ownLine () const
 
virtual void resize (int nwidth)
 
virtual void invalidate ()
 
virtual bool isNested () const
 
virtual TQString richText () const
 
TQRect 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 TQPoint &)
 
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 KCommand * createCommand ()
 
virtual KCommand * deleteCommand ()
 
virtual void recalc ()
 
int index () const
 
KoTextFormat * format () const
 

Protected Member Functions

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

Protected Attributes

KoVariableFormat * m_varFormat
 
KoVariableCollection * m_varColl
 
TQVariant m_varValue
 
int m_ascent
 
Private * d
 
- Protected Attributes inherited from KoTextCustomItem
bool m_deleted
 
int xpos
 
int ypos
 

Additional Inherited Members

- Public Types inherited from KoTextCustomItem
enum  Placement { PlaceInline = 0 , PlaceLeft , PlaceRight }
 
- Public Attributes inherited from KoTextCustomItem
int width
 
int height
 
KoTextDocument * parent
 

Detailed Description

A KoVariable is a custom item, i.e.

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

Definition at line 363 of file KoVariable.h.

Constructor & Destructor Documentation

◆ KoVariable()

KoVariable::KoVariable ( KoTextDocument *  fs,
KoVariableFormat *  varFormat,
KoVariableCollection *  varColl 
)

Definition at line 851 of file KoVariable.cpp.

◆ ~KoVariable()

KoVariable::~KoVariable ( )
virtual

Definition at line 861 of file KoVariable.cpp.

Member Function Documentation

◆ ascent()

virtual int KoVariable::ascent ( ) const
inlinevirtual

Reimplemented from KoTextCustomItem.

Definition at line 375 of file KoVariable.h.

◆ convertKlocaleToTQDateTimeFormat()

TQString KoVariable::convertKlocaleToTQDateTimeFormat ( const TQString &  _format)

Definition at line 1047 of file KoVariable.cpp.

◆ correctValue()

virtual int KoVariable::correctValue ( ) const
inlineprotectedvirtual

Definition at line 442 of file KoVariable.h.

◆ drawCustomItem()

void KoVariable::drawCustomItem ( TQPainter *  p,
int  x,
int  y,
int  wpix,
int  hpix,
int  ascentpix,
int  cx,
int  cy,
int  cw,
int  ch,
const TQColorGroup &  cg,
bool  selected,
int  offset,
bool  drawingShadow 
)
virtual

All coordinates are in pixels.

Implements KoTextCustomItem.

Definition at line 922 of file KoVariable.cpp.

◆ drawCustomItemHelper()

void KoVariable::drawCustomItemHelper ( TQPainter *  p,
int  x,
int  y,
int  wpix,
int  hpix,
int  ascentpix,
const TQColorGroup &  cg,
bool  selected,
int  offset,
KoTextFormat *  fmt,
const TQFont &  font,
TQColor  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.

◆ fieldCode()

TQString KoVariable::fieldCode ( )
virtual

Definition at line 905 of file KoVariable.cpp.

◆ load()

void KoVariable::load ( TQDomElement &  elem)
virtual

Definition at line 1018 of file KoVariable.cpp.

◆ loadOasis()

void KoVariable::loadOasis ( const TQDomElement &  elem,
KoOasisContext &  context 
)
virtual

Definition at line 1023 of file KoVariable.cpp.

◆ minimumWidth()

virtual int KoVariable::minimumWidth ( ) const
inlinevirtual

Reimplemented from KoTextCustomItem.

Definition at line 377 of file KoVariable.h.

◆ placement()

virtual Placement KoVariable::placement ( ) const
inlinevirtual

Reimplemented from KoTextCustomItem.

Definition at line 373 of file KoVariable.h.

◆ recalcAndRepaint()

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 892 of file KoVariable.cpp.

◆ resize()

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.

◆ save()

void KoVariable::save ( TQDomElement &  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.

◆ saveOasis()

void KoVariable::saveOasis ( KoXmlWriter &  writer,
KoSavingContext &  context 
) const
virtual

Save to Oasis XML.

Implements KoTextCustomItem.

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

Definition at line 1028 of file KoVariable.cpp.

◆ saveVariable()

virtual void KoVariable::saveVariable ( TQDomElement &  parentElem)
protectedpure virtual

Variable should reimplement this to implement saving.

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

◆ setVariableFormat()

void KoVariable::setVariableFormat ( KoVariableFormat *  _varFormat)

Definition at line 1032 of file KoVariable.cpp.

◆ setVariableSubType()

virtual void KoVariable::setVariableSubType ( short int  )
inlinevirtual

Set this variable's subtype.

Reimplemented in KoDateVariable, KoTimeVariable, KoFieldVariable, and KoPageVariable.

Definition at line 430 of file KoVariable.h.

◆ subType()

virtual short int KoVariable::subType ( ) const
inlinevirtual

Definition at line 370 of file KoVariable.h.

◆ subTypeList()

TQStringList KoVariable::subTypeList ( )
virtual

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

Reimplemented in KoDateVariable, KoTimeVariable, KoFieldVariable, and KoPageVariable.

Definition at line 868 of file KoVariable.cpp.

◆ text()

TQString 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 910 of file KoVariable.cpp.

◆ typeId()

virtual int KoVariable::typeId ( ) const
inlinevirtual

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 424 of file KoVariable.h.

◆ variableColl()

KoVariableCollection * KoVariable::variableColl ( ) const
inline

Definition at line 392 of file KoVariable.h.

◆ variableFormat()

KoVariableFormat * KoVariable::variableFormat ( ) const
inline

Definition at line 389 of file KoVariable.h.

◆ variableSubType()

virtual short int KoVariable::variableSubType ( short int  menuNumber)
inlinevirtual

Converts the menuNumber to variable subtype number (VST_x)

Reimplemented in KoFieldVariable.

Definition at line 435 of file KoVariable.h.

◆ varValue()

TQVariant KoVariable::varValue ( ) const
inline

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

Definition at line 405 of file KoVariable.h.

◆ widthHint()

virtual int KoVariable::widthHint ( ) const
inlinevirtual

Reimplemented from KoTextCustomItem.

Definition at line 376 of file KoVariable.h.

Member Data Documentation

◆ d

Private* KoVariable::d
protected

Definition at line 452 of file KoVariable.h.

◆ m_ascent

int KoVariable::m_ascent
protected

Definition at line 447 of file KoVariable.h.

◆ m_varColl

KoVariableCollection* KoVariable::m_varColl
protected

Definition at line 445 of file KoVariable.h.

◆ m_varFormat

KoVariableFormat* KoVariable::m_varFormat
protected

Definition at line 444 of file KoVariable.h.

◆ m_varValue

TQVariant KoVariable::m_varValue
protected

Definition at line 446 of file KoVariable.h.


The documentation for this class was generated from the following files: