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