KoGenStyle Class Reference
A generic style, i.e. More...
#include <koGenStyles.h>
Collaboration diagram for KoGenStyle:

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, ChildElement, ParagraphType, N_NumTypes } |
Public Member Functions | |
KoGenStyle (int type=0, const char *familyName=0, const QString &parentName=QString::null) | |
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) |
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 |
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 163 of file koGenStyles.h.
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 173 of file koGenStyles.h. |
|
The types of properties.
Definition at line 218 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 202 of file koGenStyles.h. |
Member Function Documentation
|
Return the type of this style, as set in the constructor.
Definition at line 207 of file koGenStyles.h. |
|
Return the family name.
Definition at line 210 of file koGenStyles.h. |
|
Return the name of style's parent, if set.
Definition at line 213 of file koGenStyles.h. Referenced by KoGenStyles::lookup(). |
|
Add a property to the style.
Definition at line 235 of file koGenStyles.h. Referenced by KoTextFormat::save(), KoParagLayout::saveOasis(), and KoPageLayout::saveOasis(). |
|
Overloaded version of addProperty that takes a char*, usually for "...".
Definition at line 239 of file koGenStyles.h. |
|
Overloaded version of addProperty that converts an int to a string.
Definition at line 243 of file koGenStyles.h. |
|
Overloaded version of addProperty that converts a bool to a string (false/true).
Definition at line 247 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 246 of file koGenStyles.cpp. Referenced by KoTextFormat::save(), KoParagLayout::saveOasis(), and KoPageLayout::saveOasis(). |
|
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 264 of file koGenStyles.h. Referenced by KoParagStyle::saveStyle(), and writeStyle(). |
|
Overloaded version of addAttribute that takes a char*, usually for "...".
Definition at line 268 of file koGenStyles.h. |
|
Overloaded version of addAttribute that converts an int to a string.
Definition at line 272 of file koGenStyles.h. |
|
Overloaded version of addAttribute that converts a bool to a string.
Definition at line 277 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 254 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 308 of file koGenStyles.h. Referenced by KoParagLayout::saveOasis(), KoParagCounter::saveOasis(), and KoOasisStyles::saveOasisTextStyle(). |
|
Add a style:map to the style.
Definition at line 316 of file koGenStyles.h. |
|
Write the definition of this style to
Definition at line 138 of file koGenStyles.cpp. References addAttribute(), KoXmlWriter::addAttribute(), KoXmlWriter::addCompleteElement(), attribute(), DefaultType, KoXmlWriter::endElement(), m_maps, ParagraphType, printDebug(), property(), KoXmlWriter::startElement(), KoGenStyles::style(), and TextType. |
|
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 300 of file koGenStyles.cpp. References m_attributes, m_maps, m_parentName, m_properties, and m_type. |
|
Not needed for QMap, but can still be useful.
Definition at line 326 of file koGenStyles.cpp. References m_attributes, m_maps, m_parentName, m_properties, and m_type. |
The documentation for this class was generated from the following files: