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

0001 /* This file is part of the KDE project
0002 
0003    SPDX-FileCopyrightText: 2013-2014 Inge Wallin <inge@lysator.liu.se>
0004 
0005    SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #ifndef ODFREADERBACKEND_H
0009 #define ODFREADERBACKEND_H
0010 
0011 // Calligra
0012 #include <KoXmlStreamReader.h>
0013 #include <KoFilter.h>
0014 
0015 // this library
0016 #include "koodfreader_export.h"
0017 #include "OdfReader.h"
0018 
0019 
0020 class QByteArray;
0021 class QSizeF;
0022 class QStringList;
0023 class KoStore;
0024 class OdfReaderContext;
0025 
0026 
0027 /** @brief A default backend for the OdfReader class.
0028  *
0029  * This class defines an interface and the default behaviour for the
0030  * backend to the ODF reader (@see OdfReader). When the
0031  * reader is called upon to traverse a certain XML tree, there will
0032  * be two parameters to the root traverse function: a pointer to a
0033  * backend object and a pointer to a context object.
0034  *
0035  * The reader will traverse (read) the XML tree and for every element
0036  * it comes across it will call a specific function in the backend and
0037  * every call will pass the pointer to the context object.
0038  *
0039  * Each supported XML tag has a corresponding callback function. This
0040  * callback function will be called twice: once when the tag is first
0041  * encountered anc once when the tag is closed.  This means that an
0042  * element with no child elements will be called twice in succession.
0043  *
0044  * The callback function receives as parameter a reference to the XML
0045  * stream reader. From this parameter it can be deduced if the call is
0046  * for a start element or an end element and also access the
0047  * attributes of the element.
0048  *
0049  * This class defines a virtual function for every supported
0050  * element. It also implements a default behaviour for every element
0051  * which is to ignore the parameters and do nothing.
0052  *
0053  * When this class is used e.g. in a filter it is recommended to
0054  * inherit this class and only reimplement those functions that are
0055  * actually needed.
0056  */
0057 class KOODFREADER_EXPORT OdfReaderBackend
0058 {
0059  public:
0060     explicit OdfReaderBackend();
0061     virtual ~OdfReaderBackend();
0062 
0063     // ----------------------------------------------------------------
0064     // ODF document level functions
0065 
0066     DECLARE_BACKEND_FUNCTION(OfficeDocumentcontent);
0067     DECLARE_BACKEND_FUNCTION(OfficeBody);
0068 
0069  private:
0070     class Private;
0071     Private * const d;
0072 };
0073 
0074 
0075 #endif // ODFREADERBACKEND_H