1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
|
/* This file is part of the KDE project
Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
Copyright (C) 2000-2005 David Faure <faure@kde.org>
Copyright (C) 2007 Thorsten Zachmann <zachmann@kde.org>
Copyright (C) 2009 Boudewijn Rempt <boud@valdyas.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KOODFDOCUMENT_H
#define KOODFDOCUMENT_H
#include <kurl.h>
class KoStore;
class KoOdfReadStore;
class KoOdfWriteStore;
class KoEmbeddedDocumentSaver;
#include "koodf_export.h"
/**
* Base class for documents that can load and save ODF. Most of the
* implementation is still in KoDocument, though that should probably
* change.
*/
class KOODF_EXPORT KoOdfDocument
{
public:
// context passed on saving to saveOdf
struct SavingContext {
SavingContext(KoOdfWriteStore &odfStore, KoEmbeddedDocumentSaver &embeddedSaver)
: odfStore(odfStore)
, embeddedSaver(embeddedSaver) {}
KoOdfWriteStore &odfStore;
KoEmbeddedDocumentSaver &embeddedSaver;
};
/**
* create a new KoOdfDocument
*/
KoOdfDocument();
/**
* delete this document
*/
virtual ~KoOdfDocument();
/**
* Saves all internal children (only!), to the store, using the OASIS format.
* This is called automatically during saveNativeFormat.
* @see saveExternalChildren if you have external children.
* Returns true on success.
*/
bool saveChildrenOdf(SavingContext &documentContext);
/**
* Return true if url() is a real filename, false if url() is
* an internal url in the store, like "tar:/..."
*/
virtual bool isStoredExtern() const = 0;
/**
* @return the current URL
*/
virtual KUrl getOdfUrl() const = 0; // TODO rename to not have get*
virtual void setOdfUrl(const KUrl &url) = 0;
/**
* Returns the OASIS OpenDocument mimetype of the document, if supported
* This comes from the X-KDE-NativeOasisMimeType key in the .desktop file
*/
virtual QByteArray nativeOasisMimeType() const = 0;
/**
* @brief Saves a document to a store.
*/
virtual bool saveToStore(KoStore *store, const QString &path) = 0;
/**
* Reimplement this method to load the contents of your %KOffice document,
* from the XML document ("content.xml"). The styles have been parsed already,
* you can find them in the odfStore.styles(). The store can be used
* to load images and embedded documents.
*/
virtual bool loadOdf(KoOdfReadStore &odfStore) = 0;
/**
* Reimplement this method to save the contents of your %KOffice document,
* using the ODF format.
*/
virtual bool saveOdf(SavingContext &documentContext) = 0;
private:
class Private;
Private *const d;
};
#endif
|