lib
KoParagCounter Class Reference
#include <KoParagCounter.h>
Detailed Description
This is the structure associated with a paragraph (KoTextParag), to define the bullet or numbering of the paragraph.
Definition at line 36 of file KoParagCounter.h.
Public Types | |
enum | Numbering { NUM_NONE = 2, NUM_LIST = 0, NUM_CHAPTER = 1, NUM_FOOTNOTE = 3 } |
enum | Style { STYLE_NONE = 0, STYLE_NUM = 1, STYLE_ALPHAB_L = 2, STYLE_ALPHAB_U = 3, STYLE_ROM_NUM_L = 4, STYLE_ROM_NUM_U = 5, STYLE_CUSTOMBULLET = 6, STYLE_CUSTOM = 7, STYLE_CIRCLEBULLET = 8, STYLE_SQUAREBULLET = 9, STYLE_DISCBULLET = 10, STYLE_BOXBULLET = 11 } |
Public Member Functions | |
KoParagCounter () | |
void | invalidate () |
int | number (const KoTextParag *paragraph) |
QString | levelText (const KoTextParag *paragraph) |
QString | text (const KoTextParag *paragraph) |
int | width (const KoTextParag *paragraph) |
int | bulletX () |
void | load (QDomElement &element) |
void | save (QDomElement &element) |
void | loadOasis (KoOasisContext &context, int restartNumbering, bool orderedList, bool heading, int level, bool loadingStyle=false) |
void | loadOasisListStyle (const QDomElement &listStyle, const QDomElement &listStyleProperties, const QDomElement &listStyleTextProperties, int restartNumbering, bool orderedList, bool heading, int level, bool loadingStyle) |
void | saveOasis (KoGenStyle &listStyle, bool savingStyle=false) const |
void | saveOasisListLevel (KoXmlWriter &listLevelWriter, bool includeLevelAndProperties, bool savingStyle=false) const |
bool | operator== (const KoParagCounter &c2) const |
bool | operator!= (const KoParagCounter &c2) const |
Numbering | numbering () const |
void | setNumbering (Numbering n) |
Style | style () const |
void | setStyle (Style s) |
bool | restartCounter () const |
void | setRestartCounter (bool restart) |
bool | isBullet () const |
unsigned int | depth () const |
void | setDepth (unsigned int d) |
int | displayLevels () const |
void | setDisplayLevels (int l) |
int | startNumber () const |
void | setStartNumber (int s) |
QString | prefix () const |
void | setPrefix (QString p) |
QString | suffix () const |
void | setSuffix (QString s) |
QChar | customBulletCharacter () const |
void | setCustomBulletCharacter (QChar c) |
QString | customBulletFont () const |
void | setCustomBulletFont (QString f) |
QString | custom () const |
void | setCustom (QString c) |
int | alignment () const |
void | setAlignment (int a) |
void | printRTDebug (KoTextParag *parag) |
Static Public Member Functions | |
static bool | isBullet (Style style) |
static KoTextFormat * | counterFormat (const KoTextParag *paragraph) |
static QString | makeRomanNumber (int n) |
static QString | makeAlphaUpperNumber (int n) |
static QString | makeAlphaLowerNumber (int n) |
static int | fromRomanNumber (const QString &) |
static int | fromAlphaUpperNumber (const QString &) |
static int | fromAlphaLowerNumber (const QString &) |
Member Function Documentation
void KoParagCounter::invalidate | ( | ) |
Invalidate the internal cache.
Use it whenever the number associated with this counter may have changed.
Definition at line 86 of file KoParagCounter.cpp.
int KoParagCounter::number | ( | const KoTextParag * | paragraph | ) |
Return the current value of the counter as a number.
QString KoParagCounter::levelText | ( | const KoTextParag * | paragraph | ) |
Return the current value of the counter as a text.
This returns only the current level, e.g. "1."
Definition at line 633 of file KoParagCounter.cpp.
QString KoParagCounter::text | ( | const KoTextParag * | paragraph | ) |
Return the current value of the counter as a text.
This returns the full text, all levels included (if displayLevels>1), e.g. "1.2.1." if displayLevels==3.
int KoParagCounter::width | ( | const KoTextParag * | paragraph | ) |
Work out the width of the text required for this counter.
Unit : LU pixels
int KoParagCounter::bulletX | ( | ) |
X position of the bullet ( i.e.
width of prefix ) Unit : LU pixels
Definition at line 808 of file KoParagCounter.cpp.
void KoParagCounter::load | ( | QDomElement & | element | ) |
void KoParagCounter::save | ( | QDomElement & | element | ) |
void KoParagCounter::loadOasis | ( | KoOasisContext & | context, | |
int | restartNumbering, | |||
bool | orderedList, | |||
bool | heading, | |||
int | level, | |||
bool | loadingStyle = false | |||
) |
Load from OASIS XML.
- Parameters:
-
heading true if heading, false if normal list level 1-based loadingStyle true if loading a style, false if loading a paragraph context the context restartNumbering if -1 then don't restart numbering, use the style value orderedList if true, make sure the parag will will be initialised as an ordered list otherwise it may be initialised as a unordered list.
Definition at line 179 of file KoParagCounter.cpp.
void KoParagCounter::loadOasisListStyle | ( | const QDomElement & | listStyle, | |
const QDomElement & | listStyleProperties, | |||
const QDomElement & | listStyleTextProperties, | |||
int | restartNumbering, | |||
bool | orderedList, | |||
bool | heading, | |||
int | level, | |||
bool | loadingStyle | |||
) |
Part of loadOasis that is shared with KWVariableSettings::loadOasis for footnotes/endnotes.
Definition at line 189 of file KoParagCounter.cpp.
void KoParagCounter::saveOasis | ( | KoGenStyle & | listStyle, | |
bool | savingStyle = false | |||
) | const |
void KoParagCounter::saveOasisListLevel | ( | KoXmlWriter & | listLevelWriter, | |
bool | includeLevelAndProperties, | |||
bool | savingStyle = false | |||
) | const |
Part of saveOasis that is shared with KoStyleCollection::saveOasisOutlineStyles and KWVariableSettings::saveOasis for footnotes/endnotes.
Definition at line 283 of file KoParagCounter.cpp.
KoParagCounter::Numbering KoParagCounter::numbering | ( | ) | const |
bool KoParagCounter::restartCounter | ( | ) | const |
Should this counter start at "startNumber" (instead of being the 'last counter of the same type + 1').
Definition at line 621 of file KoParagCounter.cpp.
bool KoParagCounter::isBullet | ( | ) | const |
bool KoParagCounter::isBullet | ( | Style | style | ) | [static] |
Helper function for finding out if a style is a bullet.
Definition at line 95 of file KoParagCounter.cpp.
unsigned int KoParagCounter::depth | ( | ) | const |
The level of the numbering.
Depth of 0 means the major numbering. (1, 2, 3...) Depth of 1 is 1.1, 1.2, 1.3 etc.
Definition at line 81 of file KoParagCounter.cpp.
int KoParagCounter::displayLevels | ( | ) | const |
Number of levels whose numbers are displayed at the current level.
Definition at line 601 of file KoParagCounter.cpp.
int KoParagCounter::startNumber | ( | ) | const |
QString KoParagCounter::prefix | ( | ) | const |
QChar KoParagCounter::customBulletCharacter | ( | ) | const |
QString KoParagCounter::custom | ( | ) | const |
int KoParagCounter::alignment | ( | ) | const |
static KoTextFormat* KoParagCounter::counterFormat | ( | const KoTextParag * | paragraph | ) | [static] |
Return the format to use for the counter.
This does no caching, it's merely to centralize code.
The documentation for this class was generated from the following files: