Warning, file /office/calligra/libs/odf/KoOdfReadStore.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /* This file is part of the KDE project
0002    Copyright (C) 2005 David Faure <faure@kde.org>
0003    Copyright (C) 2007 Thorsten Zachmann <zachmann@kde.org>
0004 
0005    This library is free software; you can redistribute it and/or
0006    modify it under the terms of the GNU Library General Public
0007    License as published by the Free Software Foundation; either
0008    version 2 of the License, or (at your option) any later version.
0009 
0010    This library is distributed in the hope that it will be useful,
0011    but WITHOUT ANY WARRANTY; without even the implied warranty of
0012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013    Library General Public License for more details.
0014 
0015    You should have received a copy of the GNU Library General Public License
0016    along with this library; see the file COPYING.LIB.  If not, write to
0017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0018  * Boston, MA 02110-1301, USA.
0019 */
0020 #ifndef KOODFREADSTORE_H
0021 #define KOODFREADSTORE_H
0022 
0023 #include "KoXmlReaderForward.h"
0024 #include "koodf_export.h"
0025 
0026 class QString;
0027 class QIODevice;
0028 class KoStore;
0029 class KoOdfStylesReader;
0030 
0031 /**
0032  * Helper class around KoStore for reading out ODF files.
0033  *
0034  * The class loads and parses files from the KoStore.
0035  *
0036  * @author: David Faure <faure@kde.org>
0037  */
0038 class KOODF_EXPORT KoOdfReadStore
0039 {
0040 public:
0041     /// @param store recontents the property of the caller
0042     explicit KoOdfReadStore(KoStore* store);
0043 
0044     ~KoOdfReadStore();
0045 
0046     /**
0047      * Get the store
0048      */
0049     KoStore* store() const;
0050 
0051     /**
0052      * Get the styles
0053      *
0054      * To get a usable result loadAndParse( QString ) has to be called first.
0055      *
0056      * @return styles
0057      */
0058     KoOdfStylesReader &styles();
0059 
0060     /**
0061      * Get the content document
0062      *
0063      * To get a usable result loadAndParse( QString ) has to be called first.
0064      *
0065      * This gives you the content of the content.xml file
0066      */
0067     KoXmlDocument contentDoc() const;
0068 
0069     /**
0070      * Get the settings document
0071      *
0072      * To get a usable result loadAndParse( QString ) has to be called first.
0073      *
0074      * This gives you the content of the settings.xml file
0075      */
0076     KoXmlDocument settingsDoc() const;
0077 
0078     /**
0079      * Load and parse
0080      *
0081      * This function loads and parses the content.xml, styles.xml and the settings.xml
0082      * file in the store. The sytles are already parsed.
0083      *
0084      * After this function is called you can access the data via
0085      * styles()
0086      * contentDoc()
0087      * settingsDoc()
0088      *
0089      * @param errorMessage The errorMessage is set in case an error is encounted.
0090      * @return true if loading and parsing was successful, false otherwise. In case of an error
0091      * the errorMessage is updated accordingly.
0092      */
0093     bool loadAndParse(QString &errorMessage);
0094 
0095     /**
0096      * Load a file from an odf store
0097      */
0098     bool loadAndParse(const QString &fileName, KoXmlDocument &doc, QString &errorMessage);
0099 
0100     /**
0101      * Load a file and parse from a QIODevice
0102      * filename argument is just used for debug message
0103      */
0104     static bool loadAndParse(QIODevice *fileDevice, KoXmlDocument &doc, QString &errorMessage, const QString& fileName);
0105 
0106 private:
0107     class Private;
0108     Private * const d;
0109 };
0110 
0111 #endif /* KOODFREADSTORE_H */