lib Library API Documentation

kovariable.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00017    Boston, MA 02111-1307, USA.
00018 */
00019 
00020 #ifndef kovariable_h
00021 #define kovariable_h
00022 
00023 #include <qstring.h>
00024 #include <qdatetime.h>
00025 #include <qasciidict.h>
00026 #include <qptrlist.h>
00027 #include <qmap.h>
00028 #include <qobject.h>
00029 #include <kaction.h>
00030 #include "korichtext.h"
00031 #include <qvariant.h>
00032 #include <koffice_export.h>
00033 
00034 class QDomElement;
00035 // Always add new types at the _end_ of this list (but before VT_ALL of course).
00036 // (and update KWView::setupActions)
00037 enum VariableType { VT_NONE = -1,
00038                     VT_DATE = 0, VT_DATE_VAR_KWORD10 = 1,
00039                     VT_TIME = 2, VT_TIME_VAR_KWORD10 = 3,
00040                     VT_PGNUM = 4,
00041                     VT_CUSTOM = 6, VT_MAILMERGE = 7, VT_FIELD = 8, VT_LINK = 9,
00042                     VT_NOTE = 10, VT_FOOTNOTE = 11, VT_STATISTIC = 12,
00043                     VT_ALL=256 };
00044 
00045 enum VariableFormat { VF_DATE = 0, VF_TIME = 1, VF_STRING = 2, VF_NUM = 3 };
00046 
00047 class KoVariable;
00048 class KoOasisSettings;
00049 
00050 class KOTEXT_EXPORT KoVariableSettings
00051 {
00052  public:
00053     KoVariableSettings();
00054     virtual ~KoVariableSettings();
00055 
00056     // don't remove startingPage or startingPageNumber! - Clarence
00057 
00058     int startingPage()const { return m_startingPageNumber; }
00059     void setStartingPage(int num) { m_startingPageNumber=num; }
00060 
00061     int startingPageNumber()const { return startingPage(); }
00062     void setStartingPageNumber(int num) { setStartingPage(num); }
00063 
00064     bool displayLink() const{ return m_displayLink; }
00065     void setDisplayLink( bool b) { m_displayLink=b; }
00066 
00067     bool underlineLink() const { return m_underlineLink; }
00068     void setUnderlineLink( bool b) { m_underlineLink=b; }
00069 
00070     bool displayComment() const { return m_displayComment; }
00071     void setDisplayComment( bool b) { m_displayComment=b; }
00072 
00073     bool displayFieldCode() const { return m_displayFieldCode; }
00074     void setDisplayFieldCode( bool b) { m_displayFieldCode=b; }
00075 
00076     virtual void save( QDomElement &parentElem );
00077     virtual void load( QDomElement &elem );
00078 
00079     QDateTime lastPrintingDate() const;
00080     void setLastPrintingDate( const QDateTime & _date);
00081 
00082     QDateTime creationDate() const;
00083     void setCreationDate( const QDateTime & _date);
00084 
00085     QDateTime modificationDate() const;
00086     void setModificationDate( const QDateTime & _date);
00087 
00088     virtual void saveOasis( KoXmlWriter &settingsWriter ) const;
00089     virtual void loadOasis(const KoOasisSettings&settingsDoc);
00090 
00091 
00092  private:
00093     int m_startingPageNumber;
00094     bool m_displayLink;
00095     bool m_displayComment;
00096     bool m_underlineLink;
00097     bool m_displayFieldCode;
00098     class KoVariableSettingPrivate;
00099     KoVariableSettingPrivate *d;
00100 };
00101 
00109 class KOTEXT_EXPORT KoVariableFormat
00110 {
00111 public:
00112     KoVariableFormat() {}
00113     virtual ~KoVariableFormat() {}
00118     virtual QCString key() const = 0;
00124     virtual QCString getKey( const QString& props ) const = 0;
00128     virtual void load( const QCString &key ) = 0;
00132     virtual QString convert(const QVariant& data ) const = 0;
00138     virtual void setFormatProperties( const QString& ) {}
00142     virtual QString formatProperties() const { return QString::null; }
00146     virtual QStringList formatPropsList() const { return QStringList(); }
00150     virtual QStringList translatedFormatPropsList() const { return QStringList(); }
00151 };
00152 
00157 class KOTEXT_EXPORT KoVariableDateFormat : public KoVariableFormat
00158 {
00159 public:
00160     KoVariableDateFormat();
00161     virtual QString convert(const QVariant& data ) const;
00162     virtual QCString key() const;
00163     virtual QCString getKey( const QString& props ) const;
00164     virtual void load( const QCString &key );
00165 
00167     virtual void setFormatProperties( const QString& props ) {
00168         m_strFormat = props;
00169     }
00171     virtual QString formatProperties() const { return m_strFormat; }
00172 
00174     virtual QStringList formatPropsList() const { return staticFormatPropsList(); }
00175 
00177     virtual QStringList translatedFormatPropsList() const { return staticTranslatedFormatPropsList(); }
00178 
00179     static QStringList staticFormatPropsList();
00180     static QStringList staticTranslatedFormatPropsList();
00181 
00182 private:
00183     QString m_strFormat;
00184 };
00185 
00189 class KOTEXT_EXPORT KoVariableTimeFormat : public KoVariableFormat
00190 {
00191 public:
00192     KoVariableTimeFormat();
00193     virtual QString convert(const QVariant& data ) const;
00194     virtual QCString key() const;
00195     virtual QCString getKey( const QString& props ) const;
00196     virtual void load( const QCString & /*key*/ );
00197 
00199     virtual void setFormatProperties( const QString& props ) {
00200         m_strFormat = props;
00201     }
00203     virtual QString formatProperties() const { return m_strFormat; }
00204 
00206     virtual QStringList formatPropsList() const { return staticFormatPropsList(); }
00207 
00209     virtual QStringList translatedFormatPropsList() const { return staticTranslatedFormatPropsList(); }
00210 
00211     static QStringList staticFormatPropsList();
00212     static QStringList staticTranslatedFormatPropsList();
00213 
00214 private:
00215     QString m_strFormat;
00216 };
00217 
00221 class KoVariableStringFormat : public KoVariableFormat
00222 {
00223 public:
00224     KoVariableStringFormat() : KoVariableFormat() {}
00225     virtual QString convert(const QVariant& data ) const;
00226     virtual QCString key() const;
00227     virtual QCString getKey( const QString& props ) const;
00228     virtual void load( const QCString & /*key*/ ) {}
00229 };
00230 
00231 class KOTEXT_EXPORT KoVariableNumberFormat : public KoVariableFormat
00232 {
00233 public:
00234     KoVariableNumberFormat() : KoVariableFormat() {}
00235     virtual QString convert(const QVariant& data ) const;
00236     virtual QCString key() const;
00237     virtual QCString getKey( const QString& props ) const;
00238     virtual void load( const QCString & /*key*/ ) {}
00239 };
00240 
00247 class KOTEXT_EXPORT KoVariableFormatCollection
00248 {
00249 public:
00250     KoVariableFormatCollection();
00251 
00255     void clear() { m_dict.clear(); }
00256 
00260     KoVariableFormat *format( const QCString &key );
00261 
00262     // TODO Refcounting and removing unused formats
00263     // Not critical, that we don't delete unused formats until closing the doc...
00264 protected:
00265     KoVariableFormat *createFormat( const QCString &key );
00266 
00267 private:
00268     QAsciiDict<KoVariableFormat> m_dict;
00269 };
00270 
00271 class KoVariable;
00272 class KoVariableFormat;
00273 class KoDocument;
00274 class KoVariableFormatCollection;
00275 class KoTextDocument;
00276 class KoVariableCollection;
00277 class KOTEXT_EXPORT KoVariableCollection : public QObject
00278 {
00279     Q_OBJECT
00280 public:
00281     // Note that the KoVariableSettings becomes owned by the collection;
00282     // we take it as argument so that it can be subclassed though.
00283     KoVariableCollection(KoVariableSettings *settings, KoVariableFormatCollection *formatCollection);
00284     ~KoVariableCollection();
00285     void registerVariable( KoVariable *var );
00286     void unregisterVariable( KoVariable *var );
00287     void recalcVariables(int type);
00288     void recalcVariables(KoVariable *var);
00289 
00290     // For custom variables
00291     void setVariableValue( const QString &name, const QString &value );
00292     QString getVariableValue( const QString &name ) const;
00293 
00294     const QPtrList<KoVariable>& getVariables() const {
00295         return variables;
00296     }
00297     void clear();
00298 
00299     bool customVariableExist(const QString &varname)const ;
00300 
00301     virtual KoVariable *createVariable( int type, short int subtype, KoVariableFormatCollection * coll, KoVariableFormat *varFormat,KoTextDocument *textdoc, KoDocument * doc, int _correct , bool _forceDefaultFormat=false, bool loadFootNote= true );
00302 
00304     virtual KoVariable* loadOasisField( KoTextDocument* textdoc, const QDomElement& tag, KoOasisContext& context );
00305     virtual KoVariable* loadOasisFieldCreateVariable( KoTextDocument* textdoc, const QDomElement& tag, KoOasisContext& context, const QString &key, int type );
00306 
00307     KoVariableSettings *variableSetting() const { return m_variableSettings; }
00308     KoVariableFormatCollection *formatCollection() const { return m_formatCollection; }
00309 
00311     void setVariableSelected(KoVariable * var);
00312     KoVariable *selectedVariable()const {return m_varSelected;}
00313 
00315     QPtrList<KAction> popupActionList() const;
00316 
00317  signals:
00318     void repaintVariable();
00319 
00320  protected slots:
00321     // This is here because variables and formats are not QObjects
00322     void slotChangeSubType();
00323     void slotChangeFormat();
00324 
00325  private:
00326     //typedef QMap<KAction *, int> VariableSubTextMap;
00327     //VariableSubTextMap m_variableSubTextMap;
00328 
00329     QPtrList<KoVariable> variables;
00330     QMap< QString, QString > varValues; // for custom variables
00331     KoVariableSettings *m_variableSettings;
00332     KoVariable *m_varSelected;
00333     KoVariableFormatCollection *m_formatCollection;
00334 };
00335 
00336 
00337 // ----------------------------------------------------------------------------------------------
00338 
00339 class KoDocument;
00340 class KoVariable;
00341 class QDomElement;
00342 class KoTextFormat;
00343 
00348 class KOTEXT_EXPORT KoVariable : public KoTextCustomItem
00349 {
00350 public:
00351     KoVariable( KoTextDocument *fs, KoVariableFormat *varFormat,KoVariableCollection *varColl );
00352     virtual ~KoVariable();
00353 
00354     virtual VariableType type() const = 0;
00355     virtual short int subType() const { return 0; }
00356 
00357     // KoTextCustomItem stuff
00358     virtual Placement placement() const { return PlaceInline; }
00359     virtual void resize();
00360     virtual int ascent() const { return m_ascent; } // for text, ascent != height!
00361     virtual int widthHint() const { return width; }
00362     virtual int minimumWidth() const { return width; }
00363     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);
00368     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 );
00369 
00370     void setVariableFormat( KoVariableFormat *_varFormat );
00371 
00372     KoVariableFormat *variableFormat() const
00373         { return m_varFormat; }
00374 
00375     KoVariableCollection *variableColl() const
00376         { return m_varColl; }
00377 
00383     virtual QString text(bool realValue=false);
00384 
00385     virtual QString fieldCode();
00386 
00388     QVariant varValue() const { return m_varValue; }
00389 
00396     void recalcAndRepaint();
00397 
00399     virtual void save( QDomElement &parentElem );
00400     virtual void saveOasis( KoXmlWriter& writer, KoSavingContext& context ) const;
00401     virtual void load( QDomElement &elem );
00402     virtual void loadOasis( const QDomElement &elem, KoOasisContext& context );
00403 
00407     virtual int typeId() const { return 4; }
00408 
00410     virtual QStringList subTypeList();
00411 
00413     virtual void setVariableSubType( short int /*subtype*/ ) {}
00414 
00418     virtual short int variableSubType(short int menuNumber){ return menuNumber; }
00419 
00420     QString convertKlocaleToQDateTimeFormat( const QString & _format );
00421 
00422 protected:
00424     virtual void saveVariable( QDomElement &parentElem ) = 0;
00425     virtual int correctValue() const { return 0;}
00426 
00427     KoVariableFormat *m_varFormat;
00428     KoVariableCollection *m_varColl;
00429     QVariant m_varValue;
00430     int m_ascent;
00431 
00432     //typedef QMap<KAction *, int> SubTextMap;
00433     //SubTextMap m_subTextMap;
00434     class Private;
00435     Private *d;
00436 };
00437 
00441 class KOTEXT_EXPORT KoDateVariable : public KoVariable
00442 {
00443 public:
00444     KoDateVariable( KoTextDocument *textdoc, short int subtype, KoVariableFormat *_varFormat,KoVariableCollection *_varColl , int _correctDate = 0);
00445 
00446     virtual VariableType type() const
00447     { return VT_DATE; }
00448 
00449     enum { VST_DATE_FIX = 0, VST_DATE_CURRENT = 1, VST_DATE_LAST_PRINTING = 2, VST_DATE_CREATE_FILE = 3, VST_DATE_MODIFY_FILE =4 };
00450     static QStringList actionTexts();
00451 
00452     virtual void recalc();
00453     virtual QString fieldCode();
00454     virtual void resize();
00455     void setDate( const QDate & _date ) { m_varValue = QVariant(_date); }
00456 
00457     virtual void saveVariable( QDomElement &parentElem );
00458     virtual int correctValue() const { return m_correctDate;}
00459     virtual void load( QDomElement &elem );
00460     virtual void loadOasis( const QDomElement &elem, KoOasisContext& context );
00461     virtual void saveOasis( KoXmlWriter& writer, KoSavingContext& context ) const;
00462 
00463     virtual QStringList subTypeList();
00465     virtual void setVariableSubType( short int subtype )
00466         { m_subtype = subtype; }
00467     virtual short int subType() const { return m_subtype; }
00471     static QCString formatStr( int & correct );
00475     static QCString defaultFormat();
00476 
00477 protected:
00478     short int m_subtype;
00479     int m_correctDate;
00480 };
00481 
00485 class KOTEXT_EXPORT KoTimeVariable : public KoVariable
00486 {
00487 public:
00488     KoTimeVariable( KoTextDocument *textdoc, short int subtype, KoVariableFormat *varFormat, KoVariableCollection *_varColl,  int _correct);
00489 
00490     virtual VariableType type() const
00491     { return VT_TIME; }
00492 
00493     enum { VST_TIME_FIX = 0, VST_TIME_CURRENT = 1 };
00494     static QStringList actionTexts();
00495 
00496     virtual void recalc();
00497     virtual void resize();
00498     virtual QString fieldCode();
00499 
00500     void setTime( const QTime & _time ) { m_varValue = QVariant(_time); }
00501 
00502     virtual void saveVariable( QDomElement &parentElem );
00503     virtual int correctValue() const { return m_correctTime;}
00504     virtual void load( QDomElement &elem );
00505     virtual void loadOasis( const QDomElement &elem, KoOasisContext& context );
00506     virtual void saveOasis( KoXmlWriter& writer, KoSavingContext& context ) const;
00507 
00508     virtual QStringList subTypeList();
00509     virtual void setVariableSubType( short int subtype )
00510         { m_subtype = subtype; }
00511     virtual short int subType() const { return m_subtype; }
00515     static QCString formatStr(int & _correct);
00519     static QCString defaultFormat();
00520 
00521 protected:
00522     short int m_subtype;
00523     int m_correctTime; // in minutes
00524 };
00525 
00526 
00531 class KOTEXT_EXPORT KoCustomVariable : public KoVariable
00532 {
00533 public:
00534     KoCustomVariable(KoTextDocument *textdoc , const QString &name, KoVariableFormat *varFormat,KoVariableCollection *_varcoll );
00535 
00536     virtual VariableType type() const
00537     { return VT_CUSTOM; }
00538     static QStringList actionTexts();
00539 
00540     virtual void saveVariable( QDomElement &parentElem );
00541     virtual void load( QDomElement &elem );
00542     virtual void loadOasis( const QDomElement &elem, KoOasisContext& context );
00543     virtual void saveOasis( KoXmlWriter& writer, KoSavingContext& context ) const;
00544 
00545     QString name() const { return m_varValue.toString(); }
00546     virtual void recalc();
00547     virtual QString fieldCode();
00548 
00549     virtual QString text(bool realValue=false);
00550 
00551     QString value() const;
00552     void setValue( const QString &v );
00553 
00554 protected:
00555 };
00556 
00557 
00563 class KOTEXT_EXPORT KoFieldVariable : public KoVariable
00564 {
00565 public:
00566     KoFieldVariable( KoTextDocument *textdoc, short int subtype, KoVariableFormat *varFormat,KoVariableCollection *_varColl, KoDocument *_doc );
00567 
00568     // Do not change existing values, they are saved in document files
00569     enum FieldSubType { VST_NONE = -1,
00570                         VST_FILENAME = 0, VST_DIRECTORYNAME = 1,
00571                         VST_AUTHORNAME = 2, VST_EMAIL = 3, VST_COMPANYNAME = 4,
00572             VST_PATHFILENAME = 5, VST_FILENAMEWITHOUTEXTENSION=6,
00573                         VST_TELEPHONE_WORK = 7, VST_FAX = 8, VST_COUNTRY = 9,
00574                         VST_TITLE = 10, VST_ABSTRACT = 11,
00575                         VST_POSTAL_CODE = 12, VST_CITY = 13, VST_STREET = 14,
00576                         VST_AUTHORTITLE = 15, VST_INITIAL = 16, VST_TELEPHONE_HOME = 17, VST_SUBJECT = 18, VST_KEYWORDS=19,VST_AUTHORPOSITION = 20 };
00577 
00578     virtual VariableType type() const
00579     { return VT_FIELD; }
00580 
00581     virtual void saveVariable( QDomElement &parentElem );
00582     virtual void load( QDomElement &elem );
00583     virtual void loadOasis( const QDomElement &elem, KoOasisContext& context );
00584     virtual void saveOasis( KoXmlWriter& writer, KoSavingContext& context ) const;
00585     virtual QString fieldCode();
00586 
00587     virtual void recalc();
00588     virtual QString text(bool realValue=false);
00589 
00590     QString value() const { return m_varValue.toString(); }
00591 
00592     static QStringList actionTexts();
00596     virtual short int variableSubType( short int menuNumber );
00600     static FieldSubType fieldSubType( short int menuNumber);
00601 
00602     virtual QStringList subTypeList();
00603     virtual void setVariableSubType( short int subtype )
00604         { m_subtype = subtype; }
00605     virtual short int subType() const { return m_subtype; }
00606 
00607 protected:
00608     short int m_subtype;
00609     KoDocument *m_doc;
00610 };
00611 
00612 class KOTEXT_EXPORT KoMailMergeVariable : public KoVariable
00613 {
00614 public:
00615     KoMailMergeVariable( KoTextDocument *textdoc, const QString &name, KoVariableFormat *varFormat, KoVariableCollection *_varColl );
00616 
00617     virtual VariableType type() const
00618     { return VT_MAILMERGE; }
00619     static QStringList actionTexts();
00620     virtual QString fieldCode();
00621 
00622     virtual void saveVariable( QDomElement &parentElem );
00623     virtual void load( QDomElement &elem );
00624     virtual void loadOasis( const QDomElement &elem, KoOasisContext& context );
00625     virtual void saveOasis( KoXmlWriter& writer, KoSavingContext& context ) const;
00626 
00627     virtual QString text(bool realValue=false);
00628     QString name() const { return m_varValue.toString(); }
00629     virtual QString value() const;
00630 
00631 protected:
00632 };
00633 
00639 class KOTEXT_EXPORT KoPageVariable : public KoVariable
00640 {
00641 public:
00642     KoPageVariable( KoTextDocument *textdoc, short int subtype, KoVariableFormat *varFormat ,KoVariableCollection *_varColl);
00643 
00644     virtual VariableType type() const
00645     { return VT_PGNUM; }
00646 
00647     enum { VST_PGNUM_CURRENT = 0, VST_PGNUM_TOTAL = 1, VST_CURRENT_SECTION = 2 , VST_PGNUM_PREVIOUS = 3, VST_PGNUM_NEXT = 4 };
00648     static QStringList actionTexts();
00649     virtual QString fieldCode();
00650 
00651     virtual QStringList subTypeList();
00652 
00653     virtual void setVariableSubType( short int subtype );
00654 
00655     // For the 'current page' variable. This is called by the app e.g. when painting
00656     // a given page (see KWTextFrameSet::drawFrame and KPTextObject::recalcPageNum)
00657     void setPgNum( int pgNum ) { m_varValue = QVariant( pgNum); }
00658     // For the 'current section title' variable. Same thing.
00659     void setSectionTitle( const QString& title );
00660 
00661     virtual short int subType() const { return m_subtype; }
00662 
00663     virtual void recalc() = 0;
00664 
00665     virtual void saveVariable( QDomElement &parentElem );
00666     virtual void load( QDomElement &elem );
00667     virtual void loadOasis( const QDomElement &elem, KoOasisContext& context );
00668     virtual void saveOasis( KoXmlWriter& writer, KoSavingContext& context ) const;
00669 protected:
00670     short int m_subtype;
00671 };
00672 
00673 class KOTEXT_EXPORT KoLinkVariable : public KoVariable
00674 {
00675 public:
00676     KoLinkVariable( KoTextDocument *textdoc, const QString & _linkName, const QString & _ulr,KoVariableFormat *varFormat, KoVariableCollection *_varColl );
00677     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 );
00678 
00679     virtual VariableType type() const
00680     { return VT_LINK; }
00681 
00682     static QStringList actionTexts();
00683     virtual QString fieldCode();
00684 
00685     virtual void saveVariable( QDomElement &parentElem );
00686     virtual void load( QDomElement &elem );
00687     virtual void loadOasis( const QDomElement &elem, KoOasisContext& context );
00688     virtual void saveOasis( KoXmlWriter& writer, KoSavingContext& context ) const;
00689 
00690     virtual QString text(bool realValue=false);
00691     QString value() const { return m_varValue.toString(); }
00692     QString url() const { return m_url;}
00693 
00694     virtual void recalc();
00695 
00696     void setLink(const QString & _linkName, const QString &_url)
00697     {
00698         m_varValue=QVariant(_linkName);
00699         m_url=_url;
00700     }
00701 
00702 protected:
00703     QString m_url;
00704 };
00705 
00706 // A custom item that display a small yellow rect. Right-clicking on it shows the comment.
00707 class KOTEXT_EXPORT KoNoteVariable : public KoVariable
00708 {
00709 public:
00710     KoNoteVariable( KoTextDocument *textdoc, const QString & _note,KoVariableFormat *varFormat, KoVariableCollection *_varColl );
00711     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 );
00712 
00713     virtual VariableType type() const
00714     { return VT_NOTE; }
00715 
00716     static QStringList actionTexts();
00717     virtual QString fieldCode();
00718 
00719     virtual void saveVariable( QDomElement &parentElem );
00720     virtual void load( QDomElement &elem );
00721     virtual void loadOasis( const QDomElement &elem, KoOasisContext& context );
00722     virtual void saveOasis( KoXmlWriter& writer, KoSavingContext& context ) const;
00723 
00724     virtual QString text(bool realValue=false);
00725     QString note() const { return m_varValue.toString(); }
00726     void setNote( const QString & _note) { m_varValue = QVariant(_note); }
00727     virtual void recalc();
00728 
00729     QString createdNote() const;
00730 protected:
00731     QDate m_createdNoteDate;
00732 };
00733 
00734 class KOTEXT_EXPORT KoStatisticVariable : public KoVariable
00735 {
00736 public:
00737     KoStatisticVariable( KoTextDocument *textdoc, short int subtype, KoVariableFormat *varFormat ,KoVariableCollection *_varColl);
00738 
00739     enum { VST_STATISTIC_NB_WORD = 0, VST_STATISTIC_NB_SENTENCE = 1, VST_STATISTIC_NB_LINES = 2, VST_STATISTIC_NB_CHARACTERE = 3,VST_STATISTIC_NB_NON_WHITESPACE_CHARACTERE = 4, VST_STATISTIC_NB_SYLLABLE = 5, VST_STATISTIC_NB_FRAME = 6, VST_STATISTIC_NB_EMBEDDED = 7,  VST_STATISTIC_NB_PICTURE = 8, VST_STATISTIC_NB_TABLE = 9 };
00740 
00741     virtual VariableType type() const
00742     { return VT_STATISTIC; }
00743     static QStringList actionTexts();
00744 
00745     virtual QStringList subTypeList();
00746 
00747     virtual void saveVariable( QDomElement &parentElem );
00748     virtual void load( QDomElement &elem );
00749     virtual void loadOasis( const QDomElement &elem, KoOasisContext& context );
00750     virtual void saveOasis( KoXmlWriter& writer, KoSavingContext& context ) const;
00751 
00752     virtual short int subType() const { return m_subtype; }
00753 
00754     virtual void setVariableSubType( short int subtype );
00755 
00756     QString name() const { return m_varValue.toString(); }
00757     virtual QString fieldCode();
00758 
00759     QString value() const;
00760     void setValue( const QString &v );
00761     static void setExtendedType( bool _b) { m_extendedType = _b; }
00762     static bool extendedType() { return m_extendedType; }
00763 protected:
00764     short int m_subtype;
00765     // extend type for kword.
00766     static bool m_extendedType;
00767 };
00768 
00769 
00770 #endif
KDE Logo
This file is part of the documentation for lib Library Version 1.4.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Mon Feb 13 09:40:14 2006 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003