lib
KoOasisStore Class Reference
#include <KoOasisStore.h>
Detailed Description
Helper class around KoStore for writing out OASIS files.This class helps solving the problem that automatic styles must be before the body, but it's easier to iterate over the application's objects only once. So we open a KoXmlWriter into a memory buffer, write the body into it, collect automatic styles while doing that, write out automatic styles, and then copy the body XML from the buffer into the real KoXmlWriter.
The typical use of this class is therefore:
- write body into bodyWriter() and collect auto styles
- write auto styles into contentWriter()
- call closeContentWriter()
- write other files into the store (styles.xml, settings.xml etc.)
TODO: maybe we could encapsulate a bit more things, to e.g. handle adding manifest entries automatically.
- Author:
- : David Faure <faure@kde.org>
Definition at line 51 of file KoOasisStore.h.
Public Member Functions | |
KoOasisStore (KoStore *store) | |
~KoOasisStore () | |
KoStore * | store () const |
KoXmlWriter * | contentWriter () |
KoXmlWriter * | bodyWriter () |
bool | closeContentWriter () |
KoXmlWriter * | manifestWriter (const char *mimeType) |
bool | closeManifestWriter () |
bool | loadAndParse (const QString &fileName, QDomDocument &doc, QString &errorMessage) |
Static Public Member Functions | |
static QString | mimeForPath (const QDomDocument &doc, const QString &fullPath) |
Constructor & Destructor Documentation
KoOasisStore::KoOasisStore | ( | KoStore * | store | ) |
- Parameters:
-
store recontents the property of the caller
Definition at line 36 of file KoOasisStore.cpp.
Member Function Documentation
KoXmlWriter * KoOasisStore::bodyWriter | ( | ) |
Open another KoXmlWriter for writing out the contents into a temporary file, to collect automatic styles while doing that.
Definition at line 74 of file KoOasisStore.cpp.
bool KoOasisStore::closeContentWriter | ( | ) |
This will copy the body into the content writer, delete the bodyWriter and the contentWriter, and then close contents.xml.
Definition at line 86 of file KoOasisStore.cpp.
bool KoOasisStore::closeManifestWriter | ( | ) |
Close the manifest writer, writing its contents to manifest.xml.
Definition at line 125 of file KoOasisStore.cpp.
KoXmlWriter * KoOasisStore::contentWriter | ( | ) |
Open contents.xml for writing and return the KoXmlWriter.
Definition at line 62 of file KoOasisStore.cpp.
bool KoOasisStore::loadAndParse | ( | const QString & | fileName, | |
QDomDocument & | doc, | |||
QString & | errorMessage | |||
) |
A completely unrelated method, for loading a file from an oasis store.
Definition at line 141 of file KoOasisStore.cpp.
KoXmlWriter * KoOasisStore::manifestWriter | ( | const char * | mimeType | ) |
Create and return a manifest writer. It will write to a memory buffer.
Definition at line 109 of file KoOasisStore.cpp.
QString KoOasisStore::mimeForPath | ( | const QDomDocument & | doc, | |
const QString & | fullPath | |||
) | [static] |
Another method for loading: get mimetype from full path, using the manifest.
Definition at line 181 of file KoOasisStore.cpp.
The documentation for this class was generated from the following files: