File indexing completed on 2024-12-08 12:56:12

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