File indexing completed on 2025-01-12 10:34:38
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 ODTREADERBACKEND_H 0009 #define ODTREADERBACKEND_H 0010 0011 // Calligra 0012 #include <KoXmlStreamReader.h> 0013 #include <KoFilter.h> 0014 0015 // this library 0016 #include "koodfreader_export.h" 0017 #include "OdtReader.h" 0018 #include "OdfReaderBackend.h" 0019 #include "OdfReaderInternals.h" 0020 0021 0022 class OdfReaderContext; 0023 0024 0025 /** @brief A default backend for the OdtReader class. 0026 * 0027 * This class defines an interface and the default behaviour for the 0028 * backend to the ODT reader (@see OdtReader). When the 0029 * reader is called upon to traverse a certain XML tree, there will 0030 * be two parameters to the root traverse function: a pointer to a 0031 * backend object and a pointer to a context object. 0032 * 0033 * The reader will traverse (read) the XML tree and for every element 0034 * it comes across it will call a specific function in the backend and 0035 * every call will pass the pointer to the context object. 0036 * 0037 * Each supported XML tag has a corresponding callback function. This 0038 * callback function will be called twice: once when the tag is first 0039 * encountered anc once when the tag is closed. This means that an 0040 * element with no child elements will be called twice in succession. 0041 * 0042 * The callback function receives as parameter a reference to the XML 0043 * stream reader. From this parameter it can be deduced if the call is 0044 * for a start element or an end element and also access the 0045 * attributes of the element. 0046 * 0047 * This class defines a virtual function for every supported 0048 * element. It also implements a default behaviour for every element 0049 * which is to ignore the parameters and do nothing. 0050 * 0051 * When this class is used e.g. in a filter it is recommended to 0052 * inherit this class and only reimplement those functions that are 0053 * actually needed. 0054 */ 0055 class KOODFREADER_EXPORT OdtReaderBackend : public OdfReaderBackend 0056 { 0057 public: 0058 explicit OdtReaderBackend(); 0059 ~OdtReaderBackend() override; 0060 0061 // ---------------------------------------------------------------- 0062 // ODT document level functions 0063 0064 DECLARE_BACKEND_FUNCTION(OfficeText); 0065 0066 private: 0067 class Private; 0068 Private * const d; 0069 }; 0070 0071 0072 #endif // ODTREADERBACKEND_H