lib Library API Documentation

KoOasisStore Class Reference

Helper class around KoStore for writing out OASIS files. More...

#include <koOasisStore.h>

Collaboration diagram for KoOasisStore:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 KoOasisStore (KoStore *store)
KoStorestore () const
KoXmlWritercontentWriter ()
KoXmlWriterbodyWriter ()
bool closeContentWriter ()
KoXmlWritermanifestWriter (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)

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:

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.


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::contentWriter  ) 
 

Open contents.xml for writing and return the KoXmlWriter.

Definition at line 62 of file koOasisStore.cpp.

References KoDocument::createOasisXmlWriter(), and KoStore::open().

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.

References KoXmlWriter::addCompleteElement(), and KoStore::close().

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.

References KoXmlWriter::addAttribute(), KoXmlWriter::addManifestEntry(), KoXmlWriter::startDocument(), and KoXmlWriter::startElement().

Referenced by KoDocument::saveNativeFormat().

bool KoOasisStore::closeManifestWriter  ) 
 

Close the manifest writer, writing its contents to manifest.xml.

Definition at line 125 of file koOasisStore.cpp.

References KoStore::close(), KoXmlWriter::device(), KoXmlWriter::endDocument(), KoXmlWriter::endElement(), KoStore::open(), and KoStore::write().

Referenced by KoDocument::saveNativeFormat().

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.

References KoStore::close(), KoStore::device(), KoStore::open(), and KoDocument::setupXmlReader().

Referenced by KoOasisContext::KoOasisContext(), and KoDocument::loadOasisFromStore().

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.

Referenced by KoDocumentChild::loadOasisDocument().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for lib Library Version 1.4.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Mon Feb 13 09:41:06 2006 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003