File indexing completed on 2024-05-12 16:29:19

0001 /* This file is part of the KDE project
0002 
0003    Copyright (C) 2013 Inge Wallin <inge@lysator.liu.se>
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 
0021 #ifndef ODFPARSER_H
0022 #define ODFPARSER_H
0023 
0024 // Qt
0025 #include <QString>
0026 #include <QHash>
0027 
0028 // Calligra
0029 #include <KoFilter.h>           // For the return values.
0030                                 // If we ever move this out of filters/ we should move the
0031                                 // filterstatus return values to bools.
0032 
0033 class KoStore;
0034 
0035 
0036 /** @brief Provide a parser for some parts of an ODF file.
0037  *
0038  * The purpose of this class is to provide a parser for the
0039  * information in an ODF file outside of the actual content and
0040  * provide easy access to it.  This includes the manifest, the
0041  * metadata, settings and styles although not all of the above is
0042  * implemented yet.
0043  */
0044 class OdfParser
0045 {
0046 public:
0047     OdfParser();
0048     virtual ~OdfParser();
0049 
0050     /** Parse the metadata.
0051      *
0052      * Format is QHash<name, value>
0053      * where
0054      *   name  is the name of the metadata tag
0055      *   value is its value
0056      *
0057      * @param odfStore The store where the information is fetched
0058      * @param metadata The result
0059      * @return returns KoFilter::OK if everything went well.
0060      * @return returns an error status otherwise.
0061      */
0062     KoFilter::ConversionStatus parseMetadata(KoStore &odfStore,
0063                                              // Out parameter:
0064                                              QHash<QString, QString> *metadata);
0065 
0066     /*** Parse manifest
0067      *
0068      * Format is QHash<path, type>
0069      * where
0070      *   path  is the full path of the file stored in the manifest
0071      *   type  is the mimetype of the file.
0072      *
0073      * @param odfStore The store where the information is fetched
0074      * @param metadata The result
0075      * @return returns KoFilter::OK if everything went well.
0076      * @return returns an error status otherwise.
0077      */
0078     KoFilter::ConversionStatus parseManifest(KoStore &odfStore,
0079                                              // Out parameter:
0080                                              QHash<QString, QString> *manifest);
0081 
0082 private:
0083 };
0084 
0085 #endif // ODFPARSER_H