KoGenStyles Class Reference
Repository of styles used during saving of OASIS/OOo file. More...
#include <koGenStyles.h>
Collaboration diagram for KoGenStyles:

Public Types | |
typedef QMap< KoGenStyle, QString > | StyleMap |
Public Member Functions | |
QString | lookup (const KoGenStyle &style, const QString &name=QString::null, bool forceNumbering=true) |
const StyleMap & | styles () const |
QValueList< NamedStyle > | styles (int type, bool markedForStylesXml=false) const |
const KoGenStyle * | style (const QString &name) const |
KoGenStyle * | styleForModification (const QString &name) |
void | markStyleForStylesXml (const QString &name) |
Detailed Description
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).
- Author:
- David Faure <faure@kde.org>
Definition at line 59 of file koGenStyles.h.
Member Function Documentation
|
Look up a style in the collection, inserting it if necessary. This assigns a name to the style and returns it.
Definition at line 32 of file koGenStyles.cpp. References KoGenStyle::m_parentName, KoGenStyle::parentName(), and style(). Referenced by KoOasisStyles::saveOasisTextStyle(). |
|
Return the entire collection of styles Use this for saving the styles.
Definition at line 89 of file koGenStyles.h. |
|
Return all styles of a given type Use this for saving the styles.
Definition at line 90 of file koGenStyles.cpp. References QValueVector::end(). |
|
Definition at line 106 of file koGenStyles.cpp. References QValueVector::end(). Referenced by lookup(), styleForModification(), and KoGenStyle::writeStyle(). |
|
Definition at line 117 of file koGenStyles.cpp. References style(). |
|
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. This isn't a KoGenStyle property since it doesn't make the style any different, it's only the file in which it gets saved which differs; it's still usable from content.xml of course. This operation can't be undone; once styles are promoted they can't go back to being content.xml-only.
Definition at line 80 of file koGenStyles.cpp. |
The documentation for this class was generated from the following files: