Référence de la classe KoGenStyles

Repository of styles used during saving of OASIS/OOo file. Plus de détails...

#include <KoGenStyles.h>

Liste de tous les membres

Types publics

enum  Flags { NoFlag = 0, ForceNumbering = 0, DontForceNumbering = 1 }
typedef QMap< KoGenStyle,
QString > 
StyleMap

Fonctions membres publiques

 KoGenStyles ()
 ~KoGenStyles ()
QString lookup (const KoGenStyle &style, const QString &name=QString::null, int flags=NoFlag)
const StyleMapstyles () const
Q3ValueList< NamedStylestyles (int type, bool markedForStylesXml=false) const
const KoGenStylestyle (const QString &name) const
KoGenStylestyleForModification (const QString &name)
void markStyleForStylesXml (const QString &name)
void dump ()

Types privés

typedef QMap< QString, bool > NameMap
typedef Q3ValueVector< NamedStyleStyleArray
 List of styles (used to preserve ordering).

Fonctions membres privées

QString makeUniqueName (const QString &base, int flags) const

Attributs privés

StyleMap m_styleMap
 style definition -> name
NameMap m_styleNames
NameMap m_autoStylesInStylesDotXml
StyleArray m_styleArray
Private * d

Classes

struct  NamedStyle


Description détaillée

Repository of styles used during saving of OASIS/OOo file.

Each instance of KoGenStyles is a collection of styles whose names are in the same "namespace". This means there should be one instance for all styles in <office:styles>, and automatic-styles, another instance for number formats, another one for draw styles, and another one for list styles.

"Style" in this context only means "a collection of properties". The "Gen" means both "Generic" and "Generated" :)

The basic design principle is the flyweight pattern: if you need a style with the same properties from two different places, you get the same object. Here it means rather you get the same name for the style, and it will get saved only once to the file.

KoGenStyles features sharing, creation on demand, and name generation. Since this is used for saving only, it doesn't feature refcounting, nor removal of individual styles.

NOTE: the use of KoGenStyles isn't mandatory, of course. If the application is already designed with user and automatic styles in mind for a given set of properties, it can go ahead and save all styles directly (after ensuring they have unique names).

Auteur:
David Faure <faure@kde.org>

Définition à la ligne 60 du fichier KoGenStyles.h.


Documentation des définition de type membres

typedef QMap<KoGenStyle, QString> KoGenStyles::StyleMap

Définition à la ligne 100 du fichier KoGenStyles.h.

typedef QMap<QString, bool> KoGenStyles::NameMap [private]

Map with the style name as key. This map is mainly used to check for name uniqueness The value of the bool doesn't matter.

Définition à la ligne 164 du fichier KoGenStyles.h.

typedef Q3ValueVector<NamedStyle> KoGenStyles::StyleArray [private]

List of styles (used to preserve ordering).

Définition à la ligne 169 du fichier KoGenStyles.h.


Documentation des énumérations membres

enum KoGenStyles::Flags

Those are flags for the lookup() call.

By default, the generated style names will look like "name1", "name2". If DontForceNumbering is set, the first name that will be tried is "name", and only if that one exists, then "name1" is tried. Set DontForceNumbering if the name given as argument is supposed to be the full style name.

Valeurs énumérées:
NoFlag 
ForceNumbering 
DontForceNumbering 

Définition à la ligne 75 du fichier KoGenStyles.h.


Documentation des contructeurs et destructeur

KoGenStyles::KoGenStyles (  ) 

Définition à la ligne 26 du fichier KoGenStyles.cpp.

KoGenStyles::~KoGenStyles (  ) 

Définition à la ligne 30 du fichier KoGenStyles.cpp.


Documentation des fonctions membres

QString KoGenStyles::lookup ( const KoGenStyle style,
const QString &  name = QString::null,
int  flags = NoFlag 
)

Look up a style in the collection, inserting it if necessary. This assigns a name to the style and returns it.

Paramètres:
style the style to look up.
name proposed (base) name for the style. Note that with the OASIS format, the style name is never shown to the user (there's a separate display-name attribute for that). So there are little reasons to use named styles anyway. But this attribute can be used for clarity of the files. If this name is already in use (for another style), then a number is appended to it until unique.
flags see Flags
Renvoie:
the name for this style
À faire:
### rename lookup to insert

Définition à la ligne 34 du fichier KoGenStyles.cpp.

Références KoGenStyle::autoStyleInStylesDotXml(), DontForceNumbering, KoGenStyle::m_attributes, m_autoStylesInStylesDotXml, KoGenStyle::m_familyName, KoGenStyle::m_parentName, m_styleArray, m_styleMap, m_styleNames, KoGenStyle::m_type, makeUniqueName(), KoGenStyles::NamedStyle::name, KoGenStyle::parentName(), KoGenStyles::NamedStyle::style, et style().

Référencé par KoTextParag::saveOasis(), KoOasisStyles::saveOasisCurrencyStyle(), KoOasisStyles::saveOasisDateStyle(), KoOasisStyles::saveOasisFractionStyle(), KoOasisStyles::saveOasisHatchStyle(), KoOasisStyles::saveOasisNumberStyle(), KoOasisStyles::saveOasisPercentageStyle(), KoOasisStyles::saveOasisScientificStyle(), KoOasisStyles::saveOasisTextStyle(), KoOasisStyles::saveOasisTimeStyle(), KoParagStyle::saveStyle(), testDefaultStyle(), testLookup(), testStylesDotXml(), et testUserStyles().

Voici le graphe d'appel pour cette fonction :

Voici le graphe d'appel pour cette fonction :

const StyleMap& KoGenStyles::styles (  )  const [inline]

Return the entire collection of styles Use this for saving the styles

Définition à la ligne 105 du fichier KoGenStyles.h.

Référencé par testDefaultStyle(), testLookup(), et testUserStyles().

Voici le graphe d'appel pour cette fonction :

Q3ValueList< KoGenStyles::NamedStyle > KoGenStyles::styles ( int  type,
bool  markedForStylesXml = false 
) const

Return all styles of a given type Use this for saving the styles

Paramètres:
type the style type, see the KoGenStyle constructor
markedForStylesXml if true, return only style marked for styles.xml, otherwise only those NOT marked for styles.xml.
Voir également:
lookup

Définition à la ligne 102 du fichier KoGenStyles.cpp.

Références m_autoStylesInStylesDotXml, m_styleArray, et m_styleNames.

const KoGenStyle * KoGenStyles::style ( const QString &  name  )  const

Renvoie:
an existing style by name

Définition à la ligne 117 du fichier KoGenStyles.cpp.

Références m_styleArray.

Référencé par dump(), lookup(), styleForModification(), testLookup(), et KoGenStyle::writeStyle().

Voici le graphe d'appel pour cette fonction :

KoGenStyle * KoGenStyles::styleForModification ( const QString &  name  ) 

Renvoie:
an existing style by name, which can be modified.
Avertissement:
This is DANGEROUS. It basically defeats the purpose of lookup()! Only do this if you know for sure no other 'user' of that style will be affected.

Définition à la ligne 128 du fichier KoGenStyles.cpp.

Références style().

Référencé par markStyleForStylesXml(), et KoStyleCollection::saveOasis().

Voici le graphe d'appel pour cette fonction :

Voici le graphe d'appel pour cette fonction :

void KoGenStyles::markStyleForStylesXml ( const QString &  name  ) 

Mark a given automatic style as being needed in styles.xml. For instance styles used by headers and footers need to go there, since they are saved in styles.xml, and styles.xml must be independent from content.xml.

Equivalent to using KoGenStyle::setAutoStyleInStylesDotXml() but this can be done after lookup.

This operation can't be undone; once styles are promoted they can't go back to being content.xml-only.

Voir également:
styles, KoGenStyle::setAutoStyleInStylesDotXml

Définition à la ligne 133 du fichier KoGenStyles.cpp.

Références m_autoStylesInStylesDotXml, m_styleNames, KoGenStyle::setAutoStyleInStylesDotXml(), et styleForModification().

Référencé par testLookup().

Voici le graphe d'appel pour cette fonction :

Voici le graphe d'appel pour cette fonction :

void KoGenStyles::dump (  ) 

Outputs debug information

Définition à la ligne 141 du fichier KoGenStyles.cpp.

Références KoGenStyle::autoStyleInStylesDotXml(), m_autoStylesInStylesDotXml, m_styleArray, m_styleNames, et style().

Voici le graphe d'appel pour cette fonction :

QString KoGenStyles::makeUniqueName ( const QString &  base,
int  flags 
) const [private]

Définition à la ligne 85 du fichier KoGenStyles.cpp.

Références DontForceNumbering, m_autoStylesInStylesDotXml, m_styleNames, et KoPageFormat::name().

Référencé par lookup().

Voici le graphe d'appel pour cette fonction :

Voici le graphe d'appel pour cette fonction :


Documentation des données membres

StyleMap KoGenStyles::m_styleMap [private]

style definition -> name

Définition à la ligne 159 du fichier KoGenStyles.h.

Référencé par lookup().

NameMap KoGenStyles::m_styleNames [private]

Définition à la ligne 165 du fichier KoGenStyles.h.

Référencé par dump(), lookup(), makeUniqueName(), markStyleForStylesXml(), et styles().

NameMap KoGenStyles::m_autoStylesInStylesDotXml [private]

Définition à la ligne 166 du fichier KoGenStyles.h.

Référencé par dump(), lookup(), makeUniqueName(), markStyleForStylesXml(), et styles().

StyleArray KoGenStyles::m_styleArray [private]

Définition à la ligne 170 du fichier KoGenStyles.h.

Référencé par dump(), lookup(), style(), et styles().

Private* KoGenStyles::d [private]

Définition à la ligne 172 du fichier KoGenStyles.h.


La documentation de cette classe a été générée à partir des fichiers suivants :
Généré le Wed Nov 22 23:45:48 2006 pour KPlato par  doxygen 1.5.1-p1