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

0001 /* This file is part of the KDE project
0002 
0003    Copyright (C) 2013-2014 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 ODSREADERBACKEND_H
0022 #define ODSREADERBACKEND_H
0023 
0024 // Calligra
0025 #include <KoXmlStreamReader.h>
0026 #include <KoFilter.h>
0027 
0028 // this library
0029 #include "koodfreader_export.h"
0030 #include "OdsReader.h"
0031 #include "OdfReaderBackend.h"
0032 #include "OdfReaderInternals.h"
0033 
0034 
0035 class QByteArray;
0036 class QSizeF;
0037 class QStringList;
0038 class KoStore;
0039 class OdfReaderContext;
0040 
0041 
0042 /** @brief A default backend for the OdsReader class.
0043  *
0044  * This class defines an interface and the default behaviour for the
0045  * backend to the ODS reader (@see OdsReader). When the
0046  * reader is called upon to traverse a certain XML tree, there will
0047  * be two parameters to the root traverse function: a pointer to a
0048  * backend object and a pointer to a context object.
0049  *
0050  * The reader will traverse (read) the XML tree and for every element
0051  * it comes across it will call a specific function in the backend and
0052  * every call will pass the pointer to the context object.
0053  *
0054  * Each supported XML tag has a corresponding callback function. This
0055  * callback function will be called twice: once when the tag is first
0056  * encountered anc once when the tag is closed.  This means that an
0057  * element with no child elements will be called twice in succession.
0058  *
0059  * The callback function receives as parameter a reference to the XML
0060  * stream reader. From this parameter it can be deduced if the call is
0061  * for a start element or an end element and also access the
0062  * attributes of the element.
0063  *
0064  * This class defines a virtual function for every supported
0065  * element. It also implements a default behaviour for every element
0066  * which is to ignore the parameters and do nothing.
0067  *
0068  * When this class is used e.g. in a filter it is recommended to
0069  * inherit this class and only reimplement those functions that are
0070  * actually needed.
0071  */
0072 class KOODFREADER_EXPORT OdsReaderBackend : public OdfReaderBackend
0073 {
0074  public:
0075     explicit OdsReaderBackend();
0076     ~OdsReaderBackend() override;
0077 
0078     // ----------------------------------------------------------------
0079     // ODS document level functions
0080 
0081     DECLARE_BACKEND_FUNCTION(OfficeSpreadsheet);
0082 
0083  private:
0084     class Private;
0085     Private * const d;
0086 };
0087 
0088 
0089 #endif // ODSREADERBACKEND_H