lib Library API Documentation

KoParagCounter Class Reference

This is the structure associated with a paragraph (KoTextParag), to define the bullet or numbering of the paragraph. More...

#include <koparagcounter.h>

List of all members.

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

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)
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)

Static Public Member Functions

bool isBullet (Style style)
KoTextFormatcounterFormat (const KoTextParag *paragraph)
QString makeRomanNumber (int n)
QString makeAlphaUpperNumber (int n)
QString makeAlphaLowerNumber (int n)
int fromRomanNumber (const QString &)
int fromAlphaUpperNumber (const QString &)
int fromAlphaLowerNumber (const QString &)


Detailed Description

This is the structure associated with a paragraph (KoTextParag), to define the bullet or numbering of the paragraph.

Definition at line 32 of file koparagcounter.h.


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 81 of file koparagcounter.cc.

Referenced by load().

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 442 of file koparagcounter.cc.

References isBullet(), and levelText().

Referenced by levelText().

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 611 of file koparagcounter.cc.

References prefix().

void KoParagCounter::load QDomElement element  ) 
 

XML support.

Definition at line 110 of file koparagcounter.cc.

References invalidate(), and load().

Referenced by load(), and KoParagLayout::loadParagLayout().

KoParagCounter::Numbering KoParagCounter::numbering  )  const
 

Numbering type and style.

Definition at line 240 of file koparagcounter.cc.

Referenced by KoParagLayout::compare(), and KoParagLayout::saveParagLayout().

bool KoParagCounter::restartCounter  )  const
 

Should this counter start at "startNumber" (instead of being the 'last counter of the same type + 1').

Definition at line 430 of file koparagcounter.cc.

bool KoParagCounter::isBullet  )  const
 

Does this counter have a bullet style?

Definition at line 105 of file koparagcounter.cc.

Referenced by levelText().

bool KoParagCounter::isBullet Style  style  )  [static]
 

Helper function for finding out if a style is a bullet.

Definition at line 90 of file koparagcounter.cc.

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 76 of file koparagcounter.cc.

int KoParagCounter::displayLevels  )  const
 

Number of levels whose numbers are displayed at the current level.

Definition at line 410 of file koparagcounter.cc.

int KoParagCounter::startNumber  )  const
 

Starting number.

Definition at line 405 of file koparagcounter.cc.

QString KoParagCounter::prefix  )  const
 

Prefix and suffix strings.

Definition at line 305 of file koparagcounter.cc.

Referenced by bulletX().

QChar KoParagCounter::customBulletCharacter  )  const
 

The character and font for STYLE_CUSTOMBULLET.

Definition at line 66 of file koparagcounter.cc.

QString KoParagCounter::custom  )  const
 

The string STYLE_CUSTOM.

Definition at line 61 of file koparagcounter.cc.

int KoParagCounter::alignment  )  const
 

Counter alignment.

Definition at line 415 of file koparagcounter.cc.

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:
KDE Logo
This file is part of the documentation for lib Library Version 1.3.5.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Nov 17 06:54:22 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003