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

0001 /* This file is part of the KDE project
0002 
0003    SPDX-FileCopyrightText: 2012-2014 Inge Wallin <inge@lysator.liu.se>
0004 
0005    SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #ifndef ODFCHARTREADER_H
0009 #define ODFCHARTREADER_H
0010 
0011 // Qt
0012 #include <QHash>
0013 #include <QString>
0014 
0015 // Calligra
0016 #include <KoXmlStreamReader.h>
0017 
0018 // this library
0019 #include "koodfreader_export.h"
0020 #include "OdfReaderInternals.h"
0021 
0022 
0023 class QSizeF;
0024 
0025 class OdfReader;
0026 class OdfChartReaderBackend;
0027 class OdfReaderContext;
0028 
0029 
0030 /** @brief Read the XML tree of the content of an ODT file.
0031  *
0032  * The OdfChartReader is used to traverse (read) the chart contents of
0033  * an ODF file using an XML stream reader.  For every XML element that
0034  * the reading process comes across it will call a specific function
0035  * in a backend class: @see OdfChartReaderBackend.  The OdfChartReader
0036  * is used as a common way to read chart content and is called from all
0037  * readers for different ODF formats.  @see OdtReader, @see OdsReader,
0038  * @see OdpReader.
0039  */
0040 class KOODFREADER_EXPORT OdfChartReader
0041 {
0042  public:
0043     OdfChartReader();
0044     ~OdfChartReader();
0045 
0046     void setParent(OdfReader *parent);
0047     void setBackend(OdfChartReaderBackend *backend);
0048     void setContext(OdfReaderContext *context);
0049 
0050     // ----------------------------------------------------------------
0051     // element reader functions
0052 
0053     DECLARE_READER_FUNCTION(OfficeChart);
0054     DECLARE_READER_FUNCTION(ChartChart);           // ODF 1.2  11.1
0055 
0056     DECLARE_READER_FUNCTION(ChartFooter);      // ODF 1.2  11.2.3
0057     DECLARE_READER_FUNCTION(ChartSubtitle);    // ODF 1.2  11.2.2
0058     DECLARE_READER_FUNCTION(ChartTitle);       // ODF 1.2  11.2.1
0059     DECLARE_READER_FUNCTION(ChartLegend);      // ODF 1.2  11.3
0060     DECLARE_READER_FUNCTION(ChartPlotArea);    // ODF 1.2  11.4
0061     DECLARE_READER_FUNCTION(ChartWall);        // ODF 1.2  11.6
0062     DECLARE_READER_FUNCTION(ChartFloor);       // ODF 1.2  11.7
0063     DECLARE_READER_FUNCTION(ChartAxis);            // ODF 1.2  11.8
0064     DECLARE_READER_FUNCTION(ChartCategories);      // ODF 1.2  11.9
0065     DECLARE_READER_FUNCTION(ChartGrid);        // ODF 1.2  11.10
0066     DECLARE_READER_FUNCTION(ChartSeries);      // ODF 1.2  11.11
0067     DECLARE_READER_FUNCTION(ChartDomain);      // ODF 1.2  11.12
0068     DECLARE_READER_FUNCTION(ChartDataPoint);       // ODF 1.2  11.13
0069     DECLARE_READER_FUNCTION(ChartDataLabel);       // ODF 1.2  11.14
0070     DECLARE_READER_FUNCTION(ChartMeanValue);       // ODF 1.2  11.15
0071     DECLARE_READER_FUNCTION(ChartErrorIndicator);  // ODF 1.2  11.16
0072     DECLARE_READER_FUNCTION(ChartRegressionCurve); // ODF 1.2  11.17
0073     DECLARE_READER_FUNCTION(ChartEquation);        // ODF 1.2  11.18
0074     DECLARE_READER_FUNCTION(ChartStockGainMarker); // ODF 1.2  11.19
0075     DECLARE_READER_FUNCTION(ChartStockLossMarker); // ODF 1.2  11.20
0076     DECLARE_READER_FUNCTION(ChartStockRangeLine);  // ODF 1.2  11.21
0077 
0078  protected:
0079 
0080 
0081     // ----------------------------------------------------------------
0082     // Other functions
0083 
0084     // FIXME: Move this to a common file (OdfReaderUtils?)
0085     void readUnknownElement(KoXmlStreamReader &reader);
0086 
0087 
0088  private:
0089     OdfReader             *m_parent;  // The OdfReader controlling this one.
0090 
0091     OdfChartReaderBackend *m_backend;
0092     OdfReaderContext      *m_context;
0093 };
0094 
0095 #endif // ODFCHARTREADER_H