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>

Collaboration diagram for KoParagCounter:

Collaboration graph
[legend]
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)
void loadOasis (KoOasisContext &context, int restartNumbering, bool orderedList, bool heading, int level, bool loadingStyle=false)
void loadOasisListStyle (const QDomElement &listStyle, const QDomElement &listStyleProperties, 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 KoTextFormatcounterFormat (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 &)

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.


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.cc.

Referenced by load(), and loadOasisListStyle().

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

References isBullet().

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

References prefix(), and KoTextZoomHandler::ptToLayoutUnitPt().

void KoParagCounter::load QDomElement element  ) 
 

KOffice-1.3 loading code.

Definition at line 115 of file koparagcounter.cc.

References invalidate().

Referenced by KoParagLayout::loadParagLayout().

void KoParagCounter::save QDomElement element  ) 
 

KOffice-1.3 saving code.

Definition at line 487 of file koparagcounter.cc.

Referenced by KoParagLayout::saveParagLayout().

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

Definition at line 179 of file koparagcounter.cc.

References KoOasisContext::listStyleStack(), and loadOasisListStyle().

void KoParagCounter::loadOasisListStyle const QDomElement listStyle,
const QDomElement listStyleProperties,
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 187 of file koparagcounter.cc.

References invalidate().

Referenced by loadOasis().

void KoParagCounter::saveOasis KoGenStyle listStyle,
bool  savingStyle = false
const
 

Save as OASIS XML.

Definition at line 252 of file koparagcounter.cc.

References KoGenStyle::addChildElement(), isBullet(), saveOasisListLevel(), and KoXmlWriter::startElement().

Referenced by KoParagStyle::saveStyle().

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

References isBullet(), and KoParagLayout::saveOasisAlignment().

Referenced by saveOasis().

KoParagCounter::Numbering KoParagCounter::numbering  )  const
 

Numbering type and style.

Definition at line 417 of file koparagcounter.cc.

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

bool KoParagCounter::restartCounter  )  const
 

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

Definition at line 607 of file koparagcounter.cc.

bool KoParagCounter::isBullet  )  const
 

Does this counter have a bullet style?

Definition at line 110 of file koparagcounter.cc.

Referenced by levelText(), saveOasis(), and saveOasisListLevel().

bool KoParagCounter::isBullet Style  style  )  [static]
 

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

Definition at line 95 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 81 of file koparagcounter.cc.

Referenced by KoParagStyle::saveStyle().

int KoParagCounter::displayLevels  )  const
 

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

Definition at line 587 of file koparagcounter.cc.

int KoParagCounter::startNumber  )  const
 

Starting number.

Definition at line 582 of file koparagcounter.cc.

QString KoParagCounter::prefix  )  const
 

Prefix and suffix strings.

Definition at line 482 of file koparagcounter.cc.

Referenced by bulletX().

QChar KoParagCounter::customBulletCharacter  )  const
 

The character and font for STYLE_CUSTOMBULLET.

Definition at line 71 of file koparagcounter.cc.

QString KoParagCounter::custom  )  const
 

The string STYLE_CUSTOM.

Definition at line 66 of file koparagcounter.cc.

int KoParagCounter::alignment  )  const
 

Counter alignment.

Definition at line 592 of file koparagcounter.cc.

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:
KDE Logo
This file is part of the documentation for lib Library Version 1.4.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Mon Feb 13 09:41:09 2006 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003