lib Library API Documentation

koparagcounter.h

00001 /* This file is part of the KDE project 00002 Copyright (C) 2001 Shaheed Haque <srhaque@iee.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 #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, // Unnumbered. Equivalent to there being 00076 // no counter structure associated with a 00077 // paragraph. 00078 NUM_LIST = 0, // Numbered as a list item. 00079 NUM_CHAPTER = 1, // Numbered as a heading. 00080 NUM_FOOTNOTE = 3 // Fixed text counter, set by the code. This is used by e.g. footnotes. 00081 }; 00082 enum Style // always add to the end, the numeric values are part of the DTD 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; // Numbering 00176 char m_style; // Style 00177 char m_displayLevels; // Number of levels to display (e.g. 3 => 1.2.1) 00178 char m_depth; 00179 00180 bool m_restartCounter; 00181 char unused; // padding, feel free to use 00182 short int padding; // padding, feel free to use 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; // define operator= and copy ctor when using this! 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
KDE Logo
This file is part of the documentation for lib Library Version 1.3.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Sep 24 18:22:24 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003