File indexing completed on 2024-12-01 13:11:45
0001 /* This file is part of the KDE project 0002 0003 Copyright (C) 2012-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 ODFDRAWREADER_H 0022 #define ODFDRAWREADER_H 0023 0024 // Qt 0025 #include <QHash> 0026 #include <QString> 0027 0028 // Calligra 0029 #include <KoXmlStreamReader.h> 0030 0031 // this library 0032 #include "koodfreader_export.h" 0033 #include "OdfReaderInternals.h" 0034 0035 0036 class QSizeF; 0037 0038 class OdfReader; 0039 class OdfDrawReaderBackend; 0040 class OdfReaderContext; 0041 0042 0043 /** @brief Read the XML tree of the content of an ODT file. 0044 * 0045 * The OdfDrawReader is used to traverse (read) the draw contents of 0046 * an ODF file using an XML stream reader. For every XML element that 0047 * the reading process comes across it will call a specific function 0048 * in a backend class: @see OdfDrawReaderBackend. The OdfDrawReader 0049 * is used as a common way to read draw content and is called from all 0050 * readers for different ODF formats. @see OdtReader, @see OdsReader, 0051 * @see OdpReader. 0052 */ 0053 class KOODFREADER_EXPORT OdfDrawReader 0054 { 0055 public: 0056 OdfDrawReader(); 0057 ~OdfDrawReader(); 0058 0059 void setParent(OdfReader *parent); 0060 void setBackend(OdfDrawReaderBackend *backend); 0061 void setContext(OdfReaderContext *context); 0062 0063 // ---------------------------------------------------------------- 0064 // Dr3d elements 0065 0066 DECLARE_READER_FUNCTION(Dr3dScene); // ODF 1.2 10.5.2 0067 DECLARE_READER_FUNCTION(Dr3dLight); // ODF 1.2 10.5.3 0068 DECLARE_READER_FUNCTION(Dr3dCube); // ODF 1.2 10.5.4 0069 DECLARE_READER_FUNCTION(Dr3dSphere); // ODF 1.2 10.5.5 0070 DECLARE_READER_FUNCTION(Dr3dExtrude); // ODF 1.2 10.5.6 0071 DECLARE_READER_FUNCTION(Dr3dRotate); // ODF 1.2 10.5.7 0072 0073 // ---------------------------------------------------------------- 0074 // Draw elements 0075 0076 // Read all common draw level elements like draw:p, draw:h, draw:frame, etc. 0077 // This is the main entry point for draw reading. 0078 void readCommonGraphicsElements(KoXmlStreamReader &reader); 0079 0080 protected: 0081 // ---------------------------------------------------------------- 0082 // Dr3d elements 0083 0084 0085 // ---------------------------------------------------------------- 0086 // Draw functions: circle, rectangle, etc 0087 0088 DECLARE_READER_FUNCTION(DrawA); 0089 0090 DECLARE_READER_FUNCTION(DrawRect); // ODF 1.2 10.3.2 0091 DECLARE_READER_FUNCTION(DrawLine); // ODF 1.2 10.3.3 0092 DECLARE_READER_FUNCTION(DrawPolyline); // ODF 1.2 10.3.4 0093 DECLARE_READER_FUNCTION(DrawPolygon); // ODF 1.2 10.3.5 0094 DECLARE_READER_FUNCTION(DrawRegularPolygon); // ODF 1.2 10.3.6 0095 DECLARE_READER_FUNCTION(DrawPath); // ODF 1.2 10.3.7 0096 DECLARE_READER_FUNCTION(DrawCircle); // ODF 1.2 10.3.8 0097 DECLARE_READER_FUNCTION(DrawEllipse); // ODF 1.2 10.3.9 0098 DECLARE_READER_FUNCTION(DrawConnector); // ODF 1.2 10.3.10 0099 DECLARE_READER_FUNCTION(DrawCaption); // ODF 1.2 10.3.11 0100 DECLARE_READER_FUNCTION(DrawMeasure); // ODF 1.2 10.3.12 0101 0102 void readGraphicsObjectChildren(KoXmlStreamReader &reader); 0103 0104 // ---------------------------------------------------------------- 0105 // Frames 0106 0107 DECLARE_READER_FUNCTION(DrawFrame); 0108 DECLARE_READER_FUNCTION(DrawObject); 0109 DECLARE_READER_FUNCTION(DrawObjectOle); 0110 0111 // ---------------------------------------------------------------- 0112 // Other functions 0113 0114 // FIXME: Move this to a common file (OdfReaderUtils?) 0115 void readUnknownElement(KoXmlStreamReader &reader); 0116 0117 0118 private: 0119 OdfReader *m_parent; // The OdfReader controlling this one. 0120 0121 OdfDrawReaderBackend *m_backend; 0122 OdfReaderContext *m_context; 0123 }; 0124 0125 #endif // ODFDRAWREADER_H