Référence de la classe KoGenStyle

#include <KoGenStyle.h>

Liste de tous les membres

Types publics

enum  {
  STYLE_PAGELAYOUT = 0, STYLE_USER = 1, STYLE_AUTO = 2, STYLE_MASTER = 3,
  STYLE_LIST = 4, STYLE_AUTO_LIST = 5, STYLE_NUMERIC_NUMBER = 6, STYLE_NUMERIC_DATE = 7,
  STYLE_NUMERIC_TIME = 8, STYLE_NUMERIC_FRACTION = 9, STYLE_NUMERIC_PERCENTAGE = 10, STYLE_NUMERIC_SCIENTIFIC = 11,
  STYLE_NUMERIC_CURRENCY = 12, STYLE_NUMERIC_TEXT = 13, STYLE_HATCH = 14, STYLE_GRAPHICAUTO = 15
}
enum  PropertyType {
  DefaultType = 0, TextType, ParagraphType, GraphicType,
  Reserved1, Reserved2, ChildElement, N_NumTypes
}
 The types of properties. Plus de détails...

Fonctions membres publiques

 KoGenStyle (int type=0, const char *familyName=0, const QString &parentName=QString::null)
 ~KoGenStyle ()
void setAutoStyleInStylesDotXml (bool b)
bool autoStyleInStylesDotXml () const
 
Renvoie:
the value passed to setAutoStyleInStylesDotXml; false by default

void setDefaultStyle (bool b)
bool isDefaultStyle () const
 
Renvoie:
the value passed to setDefaultStyle; false by default

int type () const
 Return the type of this style, as set in the constructor.
const char * familyName () const
 Return the family name.
QString parentName () const
 Return the name of style's parent, if set.
void addProperty (const QString &propName, const QString &propValue, PropertyType type=DefaultType)
 Add a property to the style.
void addProperty (const QString &propName, const char *propValue, PropertyType type=DefaultType)
 Overloaded version of addProperty that takes a char*, usually for "...".
void addProperty (const QString &propName, int propValue, PropertyType type=DefaultType)
 Overloaded version of addProperty that converts an int to a string.
void addProperty (const QString &propName, bool propValue, PropertyType type=DefaultType)
 Overloaded version of addProperty that converts a bool to a string (false/true).
void addPropertyPt (const QString &propName, double propValue, PropertyType type=DefaultType)
void addAttribute (const QString &attrName, const QString &attrValue)
void addAttribute (const QString &attrName, const char *attrValue)
 Overloaded version of addAttribute that takes a char*, usually for "...".
void addAttribute (const QString &attrName, int attrValue)
 Overloaded version of addAttribute that converts an int to a string.
void addAttribute (const QString &attrName, bool attrValue)
 Overloaded version of addAttribute that converts a bool to a string.
void addAttributePt (const QString &attrName, double attrValue)
void addChildElement (const QString &elementName, const QString &elementContents)
 Add a child element to the style properties.
void addStyleMap (const QMap< QString, QString > &styleMap)
 Add a style:map to the style.
bool isEmpty () const
void writeStyle (KoXmlWriter *writer, KoGenStyles &styles, const char *elementName, const QString &name, const char *propertiesElementName, bool closeElement=true, bool drawElement=false) const
bool operator< (const KoGenStyle &other) const
bool operator== (const KoGenStyle &other) const
 Not needed for QMap, but can still be useful.

Types privés

typedef QMap< QString, QString > StyleMap

Fonctions membres privées

QString property (const QString &propName, PropertyType type) const
QString attribute (const QString &propName) const
void writeStyleProperties (KoXmlWriter *writer, PropertyType i, const char *elementName, const KoGenStyle *parentStyle) const
void printDebug () const

Attributs privés

int m_type
QByteArray m_familyName
QString m_parentName
QMap< QString, QString > m_properties [N_NumTypes]
 We use QMaps since they provide automatic sorting on the key (important for unicity!).
QMap< QString, QString > m_attributes
Q3ValueVector< StyleMapm_maps
bool m_autoStyleInStylesDotXml
bool m_defaultStyle
short m_unused2

Amis

class KoGenStyles


Description détaillée

A generic style, i.e. basically a collection of properties and a name. Instances of KoGenStyle can either be held in the KoGenStyles collection, or created (e.g. on the stack) and given to KoGenStyles::lookup.

Auteur:
David Faure <faure@kde.org>

Définition à la ligne 37 du fichier KoGenStyle.h.


Documentation des définition de type membres

typedef QMap<QString, QString> KoGenStyle::StyleMap [private]

Définition à la ligne 307 du fichier KoGenStyle.h.


Documentation des énumérations membres

anonymous enum

Possible values for the "type" argument of the KoGenStyle constructor. Those values can be extended by applications (starting at number 20), it's for their own consumption anyway. (The reason for having the very common ones here, is to make it possible to use them from libkotext).

Valeurs énumérées:
STYLE_PAGELAYOUT 
STYLE_USER 
STYLE_AUTO 
STYLE_MASTER 
STYLE_LIST 
STYLE_AUTO_LIST 
STYLE_NUMERIC_NUMBER 
STYLE_NUMERIC_DATE 
STYLE_NUMERIC_TIME 
STYLE_NUMERIC_FRACTION 
STYLE_NUMERIC_PERCENTAGE 
STYLE_NUMERIC_SCIENTIFIC 
STYLE_NUMERIC_CURRENCY 
STYLE_NUMERIC_TEXT 
STYLE_HATCH 
STYLE_GRAPHICAUTO 

Définition à la ligne 47 du fichier KoGenStyle.h.

enum KoGenStyle::PropertyType

The types of properties.

Simple styles only write one foo-properties tag, in which case they can just use DefaultType. However a given style might want to write several kinds of properties, in which case it would need to use other property types than the default one.

For instance this style:

  <style:style style:family="chart">
    <style:chart-properties .../>
    <style:graphic-properties .../>
    <style:text-properties .../>
  </style:style>
would use DefaultType for chart-properties (and would pass "style:chart-properties" to writeStyle(), and would use GraphicType and TextType.
Valeurs énumérées:
DefaultType  DefaultType depends on family: e.g. paragraph-properties if family=paragraph or on the type of style (e.g. page-layout -> page-layout-properties). (In fact that tag name is the one passed to writeStyle)
TextType  TextType is always text-properties.
ParagraphType  ParagraphType is always paragraph-properties.
GraphicType  GraphicType is always graphic-properties.
Reserved1 
Reserved2 
ChildElement 
N_NumTypes 

Définition à la ligne 128 du fichier KoGenStyle.h.


Documentation des contructeurs et destructeur

KoGenStyle::KoGenStyle ( int  type = 0,
const char *  familyName = 0,
const QString &  parentName = QString::null 
) [explicit]

Start the definition of a new style. Its name will be set later by KoGenStyles::lookup(), but first you must define its properties and attributes.

Paramètres:
type this is a hook for the application to categorize styles See the STYLE_* enum. Ignored when writing out the style.
familyName The value for style:family, e.g. text, paragraph, graphic etc. The family is for style:style elements only; number styles and list styles don't have one.
parentName If set, name of the parent style from which this one inherits.

Définition à la ligne 46 du fichier KoGenStyle.cpp.

KoGenStyle::~KoGenStyle (  ) 

Définition à la ligne 53 du fichier KoGenStyle.cpp.


Documentation des fonctions membres

void KoGenStyle::setAutoStyleInStylesDotXml ( bool  b  )  [inline]

Définition à la ligne 88 du fichier KoGenStyle.h.

Référencé par KoGenStyles::markStyleForStylesXml(), et testStylesDotXml().

Voici le graphe d'appel pour cette fonction :

bool KoGenStyle::autoStyleInStylesDotXml (  )  const [inline]

Renvoie:
the value passed to setAutoStyleInStylesDotXml; false by default

Définition à la ligne 90 du fichier KoGenStyle.h.

Référencé par KoGenStyles::dump(), et KoGenStyles::lookup().

Voici le graphe d'appel pour cette fonction :

void KoGenStyle::setDefaultStyle ( bool  b  )  [inline]

Définition à la ligne 97 du fichier KoGenStyle.h.

Référencé par testDefaultStyle().

Voici le graphe d'appel pour cette fonction :

bool KoGenStyle::isDefaultStyle (  )  const [inline]

Renvoie:
the value passed to setDefaultStyle; false by default

Définition à la ligne 99 du fichier KoGenStyle.h.

Référencé par testDefaultStyle().

Voici le graphe d'appel pour cette fonction :

int KoGenStyle::type (  )  const [inline]

Return the type of this style, as set in the constructor.

Définition à la ligne 102 du fichier KoGenStyle.h.

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

Voici le graphe d'appel pour cette fonction :

const char* KoGenStyle::familyName (  )  const [inline]

Return the family name.

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

QString KoGenStyle::parentName (  )  const [inline]

Return the name of style's parent, if set.

Définition à la ligne 108 du fichier KoGenStyle.h.

Référencé par KoGenStyles::lookup(), et testLookup().

Voici le graphe d'appel pour cette fonction :

void KoGenStyle::addProperty ( const QString &  propName,
const QString &  propValue,
PropertyType  type = DefaultType 
) [inline]

Add a property to the style.

Définition à la ligne 149 du fichier KoGenStyle.h.

Références Py::type().

Référencé par KoTextFormat::save(), KoTextParag::saveOasis(), KoParagLayout::saveOasis(), KoPageLayout::saveOasis(), KoOasisStyles::saveOasisFillStyle(), testDefaultStyle(), testLookup(), testStylesDotXml(), et testUserStyles().

Voici le graphe d'appel pour cette fonction :

Voici le graphe d'appel pour cette fonction :

void KoGenStyle::addProperty ( const QString &  propName,
const char *  propValue,
PropertyType  type = DefaultType 
) [inline]

Overloaded version of addProperty that takes a char*, usually for "...".

Définition à la ligne 153 du fichier KoGenStyle.h.

Références Py::type().

Voici le graphe d'appel pour cette fonction :

void KoGenStyle::addProperty ( const QString &  propName,
int  propValue,
PropertyType  type = DefaultType 
) [inline]

Overloaded version of addProperty that converts an int to a string.

Définition à la ligne 157 du fichier KoGenStyle.h.

Références Py::type().

Voici le graphe d'appel pour cette fonction :

void KoGenStyle::addProperty ( const QString &  propName,
bool  propValue,
PropertyType  type = DefaultType 
) [inline]

Overloaded version of addProperty that converts a bool to a string (false/true).

Définition à la ligne 161 du fichier KoGenStyle.h.

Références Py::type().

Voici le graphe d'appel pour cette fonction :

void KoGenStyle::addPropertyPt ( const QString &  propName,
double  propValue,
PropertyType  type = DefaultType 
)

Add a property which represents a distance, measured in pt The number is written out with the highest possible precision (unlike QString::number and setNum, which default to 6 digits), and the unit name ("pt") is appended to it.

Définition à la ligne 170 du fichier KoGenStyle.cpp.

Références m_properties.

Référencé par KoTextFormat::save(), KoParagLayout::saveOasis(), et KoPageLayout::saveOasis().

Voici le graphe d'appel pour cette fonction :

void KoGenStyle::addAttribute ( const QString &  attrName,
const QString &  attrValue 
) [inline]

Add an attribute to the style The difference between property and attributes is a bit oasis-format-specific: attributes are for the style element itself, and properties are in the style:properties child element

Définition à la ligne 178 du fichier KoGenStyle.h.

Référencé par KoTextParag::saveOasis(), KoStyleCollection::saveOasis(), KoOasisStyles::saveOasisHatchStyle(), KoParagStyle::saveStyle(), testDefaultStyle(), testLookup(), testStylesDotXml(), testUserStyles(), et writeStyle().

Voici le graphe d'appel pour cette fonction :

void KoGenStyle::addAttribute ( const QString &  attrName,
const char *  attrValue 
) [inline]

Overloaded version of addAttribute that takes a char*, usually for "...".

Définition à la ligne 182 du fichier KoGenStyle.h.

void KoGenStyle::addAttribute ( const QString &  attrName,
int  attrValue 
) [inline]

Overloaded version of addAttribute that converts an int to a string.

Définition à la ligne 186 du fichier KoGenStyle.h.

void KoGenStyle::addAttribute ( const QString &  attrName,
bool  attrValue 
) [inline]

Overloaded version of addAttribute that converts a bool to a string.

Définition à la ligne 191 du fichier KoGenStyle.h.

void KoGenStyle::addAttributePt ( const QString &  attrName,
double  attrValue 
)

Add an attribute which represents a distance, measured in pt The number is written out with the highest possible precision (unlike QString::number and setNum, which default to 6 digits), and the unit name ("pt") is appended to it.

Définition à la ligne 178 du fichier KoGenStyle.cpp.

Références m_attributes.

void KoGenStyle::addChildElement ( const QString &  elementName,
const QString &  elementContents 
) [inline]

Add a child element to the style properties.

What is meant here is that the contents of the QString will be written out literally. This means you should use KoXmlWriter to generate it:

 QBuffer buffer;
 buffer.open( QIODevice::WriteOnly );
 KoXmlWriter elementWriter( &buffer );  // TODO pass indentation level
 elementWriter.startElement( "..." );
 ...
 elementWriter.endElement();
 QString elementContents = QString::fromUtf8( buffer.buffer(), buffer.buffer().size() );
 gs.addChildElement( "...", elementContents );

The value of elementName isn't used, except that it must be unique.

Définition à la ligne 222 du fichier KoGenStyle.h.

Référencé par KoParagLayout::saveOasis(), KoParagCounter::saveOasis(), KoOasisStyles::saveOasisCurrencyStyle(), KoOasisStyles::saveOasisDateStyle(), KoOasisStyles::saveOasisFractionStyle(), KoOasisStyles::saveOasisNumberStyle(), KoOasisStyles::saveOasisPercentageStyle(), KoOasisStyles::saveOasisScientificStyle(), KoOasisStyles::saveOasisTextStyle(), et KoOasisStyles::saveOasisTimeStyle().

Voici le graphe d'appel pour cette fonction :

void KoGenStyle::addStyleMap ( const QMap< QString, QString > &  styleMap  )  [inline]

Add a style:map to the style.

Paramètres:
styleMap the attributes for the map, associated as (name,value).

Définition à la ligne 230 du fichier KoGenStyle.h.

Référencé par testLookup().

Voici le graphe d'appel pour cette fonction :

bool KoGenStyle::isEmpty (  )  const [inline]

Renvoie:
true if the style has no attributes, no properties, no style map etc. This can be used by applications which do not save all attributes unconditionally, but only those that differ from the parent. But note that lookup() can't find this out...

Définition à la ligne 239 du fichier KoGenStyle.h.

Référencé par testDefaultStyle(), writeStyle(), et writeStyleProperties().

Voici le graphe d'appel pour cette fonction :

void KoGenStyle::writeStyle ( KoXmlWriter writer,
KoGenStyles styles,
const char *  elementName,
const QString &  name,
const char *  propertiesElementName,
bool  closeElement = true,
bool  drawElement = false 
) const

Write the definition of this style to writer, using the OASIS format.

Paramètres:
writer the KoXmlWriter in which elementName will be created and filled in
styles the styles collection, used to look up the parent style
elementName the name of the XML element, e.g. "style:style". Don't forget to pass style:default-style if isDefaultStyle().
name must come from the collection. It will be ignored if isDefaultStyle() is true.
propertiesElementName the name of the XML element with the style properties, e.g. "style:text-properties". Can be 0 in special cases where there should be no such item, in which case the attributes and elements are added under the style itself.
closeElement set it to false to be able to add more child elements to the style element
drawElement set it to true to add "draw:name" (used for gradient/hatch style) otherwise add "style:name"

Définition à la ligne 72 du fichier KoGenStyle.cpp.

Références addAttribute(), KoXmlWriter::addAttribute(), KoXmlWriter::addCompleteElement(), attribute(), ChildElement, compareMap(), DefaultType, KoXmlWriter::endElement(), GraphicType, isEmpty(), m_attributes, m_defaultStyle, m_familyName, m_maps, m_parentName, m_properties, m_type, ParagraphType, printDebug(), property(), KoXmlWriter::startElement(), KoGenStyles::style(), TextType, et writeStyleProperties().

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

Voici le graphe d'appel pour cette fonction :

Voici le graphe d'appel pour cette fonction :

bool KoGenStyle::operator< ( const KoGenStyle other  )  const

QMap requires a complete sorting order. Another solution would have been a qdict and a key() here, a la KoTextFormat, but the key was difficult to generate. Solutions with only a hash value (not representative of the whole data) require us to write a hashtable by hand....

Définition à la ligne 224 du fichier KoGenStyle.cpp.

Références compareMap(), m_attributes, m_autoStyleInStylesDotXml, m_maps, m_parentName, m_properties, m_type, et N_NumTypes.

Voici le graphe d'appel pour cette fonction :

bool KoGenStyle::operator== ( const KoGenStyle other  )  const

Not needed for QMap, but can still be useful.

Définition à la ligne 251 du fichier KoGenStyle.cpp.

Références compareMap(), m_attributes, m_autoStyleInStylesDotXml, m_maps, m_parentName, m_properties, m_type, et N_NumTypes.

Voici le graphe d'appel pour cette fonction :

QString KoGenStyle::property ( const QString &  propName,
PropertyType  type 
) const [inline, private]

Définition à la ligne 277 du fichier KoGenStyle.h.

Référencé par writeStyle(), et writeStyleProperties().

Voici le graphe d'appel pour cette fonction :

QString KoGenStyle::attribute ( const QString &  propName  )  const [inline, private]

Définition à la ligne 284 du fichier KoGenStyle.h.

Référencé par writeStyle().

Voici le graphe d'appel pour cette fonction :

void KoGenStyle::writeStyleProperties ( KoXmlWriter writer,
PropertyType  i,
const char *  elementName,
const KoGenStyle parentStyle 
) const [private]

Définition à la ligne 57 du fichier KoGenStyle.cpp.

Références KoXmlWriter::addAttribute(), KoXmlWriter::endElement(), isEmpty(), m_properties, property(), et KoXmlWriter::startElement().

Référencé par writeStyle().

Voici le graphe d'appel pour cette fonction :

Voici le graphe d'appel pour cette fonction :

void KoGenStyle::printDebug (  )  const [private]

Définition à la ligne 187 du fichier KoGenStyle.cpp.

Références ChildElement, DefaultType, m_attributes, m_maps, m_properties, ParagraphType, et TextType.

Référencé par writeStyle().

Voici le graphe d'appel pour cette fonction :


Documentation des fonctions amies et associées

friend class KoGenStyles [friend]

Définition à la ligne 315 du fichier KoGenStyle.h.


Documentation des données membres

int KoGenStyle::m_type [private]

Définition à la ligne 301 du fichier KoGenStyle.h.

Référencé par KoGenStyles::lookup(), operator<(), operator==(), et writeStyle().

QByteArray KoGenStyle::m_familyName [private]

Définition à la ligne 302 du fichier KoGenStyle.h.

Référencé par KoGenStyles::lookup(), et writeStyle().

QString KoGenStyle::m_parentName [private]

Définition à la ligne 303 du fichier KoGenStyle.h.

Référencé par KoGenStyles::lookup(), operator<(), operator==(), et writeStyle().

QMap<QString, QString> KoGenStyle::m_properties[N_NumTypes] [private]

We use QMaps since they provide automatic sorting on the key (important for unicity!).

Définition à la ligne 305 du fichier KoGenStyle.h.

Référencé par addPropertyPt(), operator<(), operator==(), printDebug(), writeStyle(), et writeStyleProperties().

QMap<QString, QString> KoGenStyle::m_attributes [private]

Définition à la ligne 306 du fichier KoGenStyle.h.

Référencé par addAttributePt(), KoGenStyles::lookup(), operator<(), operator==(), printDebug(), et writeStyle().

Q3ValueVector<StyleMap> KoGenStyle::m_maps [private]

Définition à la ligne 308 du fichier KoGenStyle.h.

Référencé par operator<(), operator==(), printDebug(), et writeStyle().

bool KoGenStyle::m_autoStyleInStylesDotXml [private]

Définition à la ligne 310 du fichier KoGenStyle.h.

Référencé par operator<(), et operator==().

bool KoGenStyle::m_defaultStyle [private]

Définition à la ligne 311 du fichier KoGenStyle.h.

Référencé par writeStyle().

short KoGenStyle::m_unused2 [private]

Définition à la ligne 312 du fichier KoGenStyle.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:47 2006 pour KPlato par  doxygen 1.5.1-p1