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 ODFCHARTREADER_H
0022 #define ODFCHARTREADER_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 OdfChartReaderBackend;
0040 class OdfReaderContext;
0041 
0042 
0043 /** @brief Read the XML tree of the content of an ODT file.
0044  *
0045  * The OdfChartReader is used to traverse (read) the chart 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 OdfChartReaderBackend.  The OdfChartReader
0049  * is used as a common way to read chart content and is called from all
0050  * readers for different ODF formats.  @see OdtReader, @see OdsReader,
0051  * @see OdpReader.
0052  */
0053 class KOODFREADER_EXPORT OdfChartReader
0054 {
0055  public:
0056     OdfChartReader();
0057     ~OdfChartReader();
0058 
0059     void setParent(OdfReader *parent);
0060     void setBackend(OdfChartReaderBackend *backend);
0061     void setContext(OdfReaderContext *context);
0062 
0063     // ----------------------------------------------------------------
0064     // element reader functions
0065 
0066     DECLARE_READER_FUNCTION(OfficeChart);
0067     DECLARE_READER_FUNCTION(ChartChart);           // ODF 1.2  11.1
0068 
0069     DECLARE_READER_FUNCTION(ChartFooter);      // ODF 1.2  11.2.3
0070     DECLARE_READER_FUNCTION(ChartSubtitle);    // ODF 1.2  11.2.2
0071     DECLARE_READER_FUNCTION(ChartTitle);       // ODF 1.2  11.2.1
0072     DECLARE_READER_FUNCTION(ChartLegend);      // ODF 1.2  11.3
0073     DECLARE_READER_FUNCTION(ChartPlotArea);    // ODF 1.2  11.4
0074     DECLARE_READER_FUNCTION(ChartWall);        // ODF 1.2  11.6
0075     DECLARE_READER_FUNCTION(ChartFloor);       // ODF 1.2  11.7
0076     DECLARE_READER_FUNCTION(ChartAxis);            // ODF 1.2  11.8
0077     DECLARE_READER_FUNCTION(ChartCategories);      // ODF 1.2  11.9
0078     DECLARE_READER_FUNCTION(ChartGrid);        // ODF 1.2  11.10
0079     DECLARE_READER_FUNCTION(ChartSeries);      // ODF 1.2  11.11
0080     DECLARE_READER_FUNCTION(ChartDomain);      // ODF 1.2  11.12
0081     DECLARE_READER_FUNCTION(ChartDataPoint);       // ODF 1.2  11.13
0082     DECLARE_READER_FUNCTION(ChartDataLabel);       // ODF 1.2  11.14
0083     DECLARE_READER_FUNCTION(ChartMeanValue);       // ODF 1.2  11.15
0084     DECLARE_READER_FUNCTION(ChartErrorIndicator);  // ODF 1.2  11.16
0085     DECLARE_READER_FUNCTION(ChartRegressionCurve); // ODF 1.2  11.17
0086     DECLARE_READER_FUNCTION(ChartEquation);        // ODF 1.2  11.18
0087     DECLARE_READER_FUNCTION(ChartStockGainMarker); // ODF 1.2  11.19
0088     DECLARE_READER_FUNCTION(ChartStockLossMarker); // ODF 1.2  11.20
0089     DECLARE_READER_FUNCTION(ChartStockRangeLine);  // ODF 1.2  11.21
0090 
0091  protected:
0092 
0093 
0094     // ----------------------------------------------------------------
0095     // Other functions
0096 
0097     // FIXME: Move this to a common file (OdfReaderUtils?)
0098     void readUnknownElement(KoXmlStreamReader &reader);
0099 
0100 
0101  private:
0102     OdfReader             *m_parent;  // The OdfReader controlling this one.
0103 
0104     OdfChartReaderBackend *m_backend;
0105     OdfReaderContext      *m_context;
0106 };
0107 
0108 #endif // ODFCHARTREADER_H