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 class KoTextParag;
00022 class QDomElement;
00023 class KoTextFormat;
00024
00025 #ifndef koparagcounter_h
00026 #define koparagcounter_h
00027
00032 class KoParagCounter
00033 {
00034 public:
00035 KoParagCounter();
00036
00039 void invalidate();
00040
00043 int number( const KoTextParag *paragraph );
00047 QString levelText( const KoTextParag *paragraph );
00052 QString text( const KoTextParag *paragraph );
00053
00058 int width( const KoTextParag *paragraph );
00059
00064 int bulletX();
00065
00067 void load( QDomElement & element );
00068 void save( QDomElement & element );
00069
00070 bool operator==( const KoParagCounter & c2 ) const;
00071 bool operator!=( const KoParagCounter & c2 ) const { return !(*this == c2); }
00072
00073 enum Numbering
00074 {
00075 NUM_NONE = 2,
00076
00077
00078 NUM_LIST = 0,
00079 NUM_CHAPTER = 1,
00080 NUM_FOOTNOTE = 3
00081 };
00082 enum Style
00083 {
00084 STYLE_NONE = 0,
00085 STYLE_NUM = 1, STYLE_ALPHAB_L = 2, STYLE_ALPHAB_U = 3,
00086 STYLE_ROM_NUM_L = 4, STYLE_ROM_NUM_U = 5, STYLE_CUSTOMBULLET = 6,
00087 STYLE_CUSTOM = 7, STYLE_CIRCLEBULLET = 8, STYLE_SQUAREBULLET = 9,
00088 STYLE_DISCBULLET = 10, STYLE_BOXBULLET = 11
00089 };
00090
00093 Numbering numbering() const;
00094 void setNumbering( Numbering n );
00095
00096 Style style() const;
00097 void setStyle( Style s );
00098
00103 bool restartCounter() const;
00104 void setRestartCounter( bool restart );
00105
00108 bool isBullet() const;
00112 static bool isBullet( Style style );
00113
00117 unsigned int depth() const;
00118 void setDepth( unsigned int d );
00119
00122 int displayLevels() const;
00123 void setDisplayLevels( int l );
00124
00127 int startNumber() const;
00128 void setStartNumber( int s );
00129
00132 QString prefix() const;
00133 void setPrefix( QString p );
00134 QString suffix() const;
00135 void setSuffix( QString s );
00136
00139 QChar customBulletCharacter() const;
00140 void setCustomBulletCharacter( QChar c );
00141 QString customBulletFont() const;
00142 void setCustomBulletFont( QString f );
00143
00146 QString custom() const;
00147 void setCustom( QString c );
00148
00151 int alignment() const;
00152 void setAlignment( int a );
00153
00158 static KoTextFormat* counterFormat( const KoTextParag *paragraph );
00159
00160 static QString makeRomanNumber( int n );
00161 static QString makeAlphaUpperNumber( int n );
00162 static QString makeAlphaLowerNumber( int n );
00163
00164 static int fromRomanNumber( const QString & );
00165 static int fromAlphaUpperNumber( const QString & );
00166 static int fromAlphaLowerNumber( const QString & );
00167
00168 private:
00169
00173 KoTextParag *parent( const KoTextParag *paragraph );
00174
00175 char m_numbering;
00176 char m_style;
00177 char m_displayLevels;
00178 char m_depth;
00179
00180 bool m_restartCounter;
00181 char unused;
00182 short int padding;
00183
00184 short int m_startNumber;
00185 QChar m_customBulletChar;
00186
00187 QString m_customBulletFont;
00188 QString m_custom;
00189 QString m_prefix;
00190 QString m_suffix;
00191 int m_align;
00192
00193 class Private;
00194 Private *d;
00195
00205 struct
00206 {
00207 int number;
00208 QString text;
00209 int width;
00210 KoTextParag *parent;
00211 KoTextFormat * counterFormat;
00212 } m_cache;
00213 };
00214
00215 #endif
This file is part of the documentation for lib Library Version 1.3.5.