File indexing completed on 2025-01-19 10:49:27

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