lib
KoGenStyle Class Reference
#include <KoGenStyles.h>
Detailed Description
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.
- Author:
- David Faure <faure@kde.org>
Definition at line 182 of file KoGenStyles.h.
Public Types | |
enum | { STYLE_PAGELAYOUT = 0, STYLE_USER = 1, STYLE_AUTO = 2, STYLE_MASTER = 3, STYLE_LIST = 4, STYLE_AUTO_LIST = 5, 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 } |
Public Member Functions | |
KoGenStyle (int type=0, const char *familyName=0, const QString &parentName=QString::null) | |
~KoGenStyle () | |
void | setAutoStyleInStylesDotXml (bool b) |
bool | autoStyleInStylesDotXml () const |
void | setDefaultStyle (bool b) |
bool | isDefaultStyle () const |
int | type () const |
const char * | familyName () const |
QString | parentName () const |
void | addProperty (const QString &propName, const QString &propValue, PropertyType type=DefaultType) |
void | addProperty (const QString &propName, const char *propValue, PropertyType type=DefaultType) |
void | addProperty (const QString &propName, int propValue, PropertyType type=DefaultType) |
void | addProperty (const QString &propName, bool propValue, PropertyType type=DefaultType) |
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) |
void | addAttribute (const QString &attrName, int attrValue) |
void | addAttribute (const QString &attrName, bool attrValue) |
void | addAttributePt (const QString &attrName, double attrValue) |
void | addChildElement (const QString &elementName, const QString &elementContents) |
void | addStyleMap (const QMap< QString, QString > &styleMap) |
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 |
Friends | |
class | KoGenStyles |
Member Enumeration Documentation
|
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). Definition at line 192 of file KoGenStyles.h. |
|
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>
Definition at line 273 of file KoGenStyles.h. |
Constructor & Destructor Documentation
|
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.
Definition at line 175 of file KoGenStyles.cpp. |
Member Function Documentation
|
Overloaded version of addAttribute that converts a bool to a string.
Definition at line 336 of file KoGenStyles.h. |
|
Overloaded version of addAttribute that converts an int to a string.
Definition at line 331 of file KoGenStyles.h. |
|
Overloaded version of addAttribute that takes a char*, usually for "...".
Definition at line 327 of file KoGenStyles.h. |
|
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.
Definition at line 323 of file KoGenStyles.h. |
|
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.
Definition at line 307 of file KoGenStyles.cpp. |
|
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( IO_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 Definition at line 367 of file KoGenStyles.h. |
|
Overloaded version of addProperty that converts a bool to a string (false/true).
Definition at line 306 of file KoGenStyles.h. |
|
Overloaded version of addProperty that converts an int to a string.
Definition at line 302 of file KoGenStyles.h. |
|
Overloaded version of addProperty that takes a char*, usually for "...".
Definition at line 298 of file KoGenStyles.h. |
|
Add a property to the style.
Definition at line 294 of file KoGenStyles.h. |
|
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.
Definition at line 299 of file KoGenStyles.cpp. |
|
Add a style:map to the style.
Definition at line 375 of file KoGenStyles.h. |
|
Definition at line 235 of file KoGenStyles.h. |
|
Return the family name.
Definition at line 250 of file KoGenStyles.h. |
|
Definition at line 244 of file KoGenStyles.h. |
|
Definition at line 384 of file KoGenStyles.h. |
|
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.... Definition at line 353 of file KoGenStyles.cpp. |
|
Not needed for QMap, but can still be useful.
Definition at line 380 of file KoGenStyles.cpp. |
|
Return the name of style's parent, if set.
Definition at line 253 of file KoGenStyles.h. |
|
Return the type of this style, as set in the constructor.
Definition at line 247 of file KoGenStyles.h. |
|
Write the definition of this style to
Definition at line 201 of file KoGenStyles.cpp. |
The documentation for this class was generated from the following files: