koparagcounter.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <qstring.h>
00021 #include <koffice_export.h>
00022 class QDomElement;
00023 class KoXmlWriter;
00024 class KoGenStyle;
00025 class KoTextParag;
00026 class KoTextFormat;
00027 class KoOasisContext;
00028
00029 #ifndef koparagcounter_h
00030 #define koparagcounter_h
00031
00036 class KOTEXT_EXPORT KoParagCounter
00037 {
00038 public:
00039 KoParagCounter();
00040
00043 void invalidate();
00044
00047 int number( const KoTextParag *paragraph );
00051 QString levelText( const KoTextParag *paragraph );
00056 QString text( const KoTextParag *paragraph );
00057
00062 int width( const KoTextParag *paragraph );
00063
00068 int bulletX();
00069
00071 void load( QDomElement & element );
00073 void save( QDomElement & element );
00079 void loadOasis( KoOasisContext& context, int restartNumbering, bool orderedList, bool heading, int level, bool loadingStyle = false );
00081 void loadOasisListStyle( const QDomElement& listStyle,
00082 const QDomElement& listStyleProperties,
00083 int restartNumbering,
00084 bool orderedList, bool heading, int level, bool loadingStyle );
00086 void saveOasis( KoGenStyle& listStyle, bool savingStyle = false ) const;
00089 void saveOasisListLevel( KoXmlWriter& listLevelWriter, bool includeLevelAndProperties, bool savingStyle = false ) const;
00090
00091 bool operator==( const KoParagCounter & c2 ) const;
00092 bool operator!=( const KoParagCounter & c2 ) const { return !(*this == c2); }
00093
00094 enum Numbering
00095 {
00096 NUM_NONE = 2,
00097
00098
00099 NUM_LIST = 0,
00100 NUM_CHAPTER = 1,
00101 NUM_FOOTNOTE = 3
00102 };
00103 enum Style
00104 {
00105 STYLE_NONE = 0,
00106 STYLE_NUM = 1, STYLE_ALPHAB_L = 2, STYLE_ALPHAB_U = 3,
00107 STYLE_ROM_NUM_L = 4, STYLE_ROM_NUM_U = 5, STYLE_CUSTOMBULLET = 6,
00108 STYLE_CUSTOM = 7, STYLE_CIRCLEBULLET = 8, STYLE_SQUAREBULLET = 9,
00109 STYLE_DISCBULLET = 10, STYLE_BOXBULLET = 11
00110 };
00111
00114 Numbering numbering() const;
00115 void setNumbering( Numbering n );
00116
00117 Style style() const;
00118 void setStyle( Style s );
00119
00124 bool restartCounter() const;
00125 void setRestartCounter( bool restart );
00126
00129 bool isBullet() const;
00133 static bool isBullet( Style style );
00134
00138 unsigned int depth() const;
00139 void setDepth( unsigned int d );
00140
00143 int displayLevels() const;
00144 void setDisplayLevels( int l );
00145
00148 int startNumber() const;
00149 void setStartNumber( int s );
00150
00153 QString prefix() const;
00154 void setPrefix( QString p );
00155 QString suffix() const;
00156 void setSuffix( QString s );
00157
00160 QChar customBulletCharacter() const;
00161 void setCustomBulletCharacter( QChar c );
00162 QString customBulletFont() const;
00163 void setCustomBulletFont( QString f );
00164
00167 QString custom() const;
00168 void setCustom( QString c );
00169
00172 int alignment() const;
00173 void setAlignment( int a );
00174
00179 static KoTextFormat* counterFormat( const KoTextParag *paragraph );
00180
00181 static QString makeRomanNumber( int n );
00182 static QString makeAlphaUpperNumber( int n );
00183 static QString makeAlphaLowerNumber( int n );
00184
00185 static int fromRomanNumber( const QString & );
00186 static int fromAlphaUpperNumber( const QString & );
00187 static int fromAlphaLowerNumber( const QString & );
00188
00189 #ifndef NDEBUG
00190 void printRTDebug( KoTextParag* parag );
00191 #endif
00192
00193 private:
00194
00198 KoTextParag *parent( const KoTextParag *paragraph );
00199
00200 Numbering m_numbering:3;
00201 bool m_restartCounter:1;
00202 bool unused:4;
00203 Style m_style:8;
00204 char m_displayLevels;
00205 char m_depth;
00206
00207 short int m_startNumber;
00208 QChar m_customBulletChar;
00209
00210 QString m_customBulletFont;
00211 QString m_custom;
00212 QString m_prefix;
00213 QString m_suffix;
00214 int m_align;
00215
00216 class Private;
00217 Private *d;
00218
00228 struct
00229 {
00230 int number;
00231 QString text;
00232 int width;
00233 KoTextParag *parent;
00234 KoTextFormat * counterFormat;
00235 } m_cache;
00236 };
00237
00238 #endif
This file is part of the documentation for lib Library Version 1.4.2.