Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / oox / export / chartexport.hxx
blobf8c055c3be9227c254c451098465c94ce5809245
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_OOX_EXPORT_CHARTEXPORT_HXX
21 #define INCLUDED_OOX_EXPORT_CHARTEXPORT_HXX
23 #include <set>
24 #include <vector>
26 #include <com/sun/star/uno/Reference.hxx>
27 #include <com/sun/star/uno/Sequence.hxx>
28 #include <oox/dllapi.h>
29 #include <oox/export/drawingml.hxx>
30 #include <oox/export/utils.hxx>
31 #include <oox/token/tokens.hxx>
32 #include <rtl/ustring.hxx>
33 #include <sal/types.h>
34 #include <sax/fshelper.hxx>
36 namespace com { namespace sun { namespace star {
37 namespace beans {
38 class XPropertySet;
40 namespace chart {
41 class XDiagram;
42 class XChartDocument;
44 namespace chart2 {
45 struct RelativePosition;
46 struct RelativeSize;
47 class XDiagram;
48 class XChartDocument;
49 class XDataSeries;
50 class XChartType;
51 namespace data
53 class XDataSequence;
56 namespace drawing {
57 class XShape;
59 namespace frame {
60 class XModel;
62 }}}
64 namespace oox {
65 namespace core {
66 class XmlFilterBase;
69 namespace oox { namespace drawingml {
71 enum AxesType
73 AXIS_PRIMARY_X = 1,
74 AXIS_PRIMARY_Y = 2,
75 AXIS_PRIMARY_Z = 3,
76 AXIS_SECONDARY_X = 4,
77 AXIS_SECONDARY_Y = 5
80 struct AxisIdPair{
81 AxesType nAxisType;
82 sal_Int32 nAxisId;
83 sal_Int32 nCrossAx;
85 AxisIdPair(AxesType nType, sal_Int32 nId, sal_Int32 nAx)
86 : nAxisType(nType)
87 , nAxisId(nId)
88 , nCrossAx(nAx)
92 class OOX_DLLPUBLIC ChartExport : public DrawingML {
94 public:
95 // first: data sequence for label, second: data sequence for values.
96 typedef ::std::vector< AxisIdPair > AxisVector;
98 private:
99 sal_Int32 mnXmlNamespace;
100 sal_Int32 mnSeriesCount;
101 css::uno::Reference< css::frame::XModel > mxChartModel;
102 css::uno::Reference< css::chart::XDiagram > mxDiagram;
103 css::uno::Reference< css::chart2::XDiagram > mxNewDiagram;
105 // members filled by InitRangeSegmentationProperties (retrieved from DataProvider)
106 bool mbHasCategoryLabels; //if the categories are only automatically generated this will be false
107 OUString msChartAddress;
109 //css::uno::Reference< css::drawing::XShapes > mxAdditionalShapes;
110 css::uno::Reference< css::chart2::data::XDataSequence > mxCategoriesValues;
112 AxisVector maAxes;
113 bool mbHasZAxis;
114 bool mbIs3DChart;
115 bool mbStacked;
116 bool mbPercent;
118 std::set<sal_Int32> maExportedAxis;
120 private:
121 sal_Int32 getChartType();
123 OUString parseFormula( const OUString& rRange );
124 void InitPlotArea();
126 void ExportContent_();
127 void exportChartSpace( const css::uno::Reference<
128 css::chart::XChartDocument >& rChartDoc,
129 bool bIncludeTable );
130 void exportChart( const css::uno::Reference<
131 css::chart::XChartDocument >& rChartDoc );
132 void exportExternalData( const css::uno::Reference<
133 css::chart::XChartDocument >& rChartDoc );
134 void exportLegend( const css::uno::Reference<
135 css::chart::XChartDocument >& rChartDoc );
136 void exportTitle( const css::uno::Reference<
137 css::drawing::XShape >& xShape );
138 void exportPlotArea( );
139 void exportPlotAreaShapeProps( const css::uno::Reference< css::beans::XPropertySet >& xPropSet );
140 void exportFill( const css::uno::Reference< css::beans::XPropertySet >& xPropSet );
141 void exportGradientFill( const css::uno::Reference< css::beans::XPropertySet >& xPropSet );
142 void exportBitmapFill( const css::uno::Reference< css::beans::XPropertySet >& xPropSet );
143 void exportDataTable( );
145 void exportAreaChart( const css::uno::Reference< css::chart2::XChartType >& xChartType );
146 void exportBarChart( const css::uno::Reference< css::chart2::XChartType >& xChartType );
147 void exportBubbleChart( const css::uno::Reference< css::chart2::XChartType >& xChartType );
148 void exportDoughnutChart( const css::uno::Reference< css::chart2::XChartType >& xChartType );
149 void exportLineChart( const css::uno::Reference< css::chart2::XChartType >& xChartType );
150 void exportPieChart( const css::uno::Reference< css::chart2::XChartType >& xChartType );
151 void exportRadarChart( const css::uno::Reference< css::chart2::XChartType >& xChartType );
152 void exportScatterChart( const css::uno::Reference< css::chart2::XChartType >& xChartType );
153 void exportStockChart( const css::uno::Reference< css::chart2::XChartType >& xChartType );
154 void exportSurfaceChart( const css::uno::Reference< css::chart2::XChartType >& xChartType );
155 void exportHiLowLines();
156 void exportUpDownBars(const css::uno::Reference< css::chart2::XChartType >& xChartType );
158 void exportAllSeries(const css::uno::Reference<css::chart2::XChartType>& xChartType, bool& rPrimaryAxes);
159 void exportSeries(const css::uno::Reference< css::chart2::XChartType >& xChartType,
160 css::uno::Sequence<css::uno::Reference<css::chart2::XDataSeries> >& rSeriesSeq, bool& rPrimaryAxes);
162 void exportVaryColors(const css::uno::Reference<css::chart2::XChartType>& xChartType);
163 void exportCandleStickSeries(
164 const css::uno::Sequence<
165 css::uno::Reference<
166 css::chart2::XDataSeries > > & aSeriesSeq,
167 bool& rPrimaryAxes );
168 void exportSeriesText(
169 const css::uno::Reference< css::chart2::data::XDataSequence >& xValueSeq );
170 void exportSeriesCategory(
171 const css::uno::Reference< css::chart2::data::XDataSequence >& xValueSeq );
172 void exportSeriesValues(
173 const css::uno::Reference< css::chart2::data::XDataSequence >& xValueSeq, sal_Int32 nValueType = XML_val );
174 void exportShapeProps( const css::uno::Reference< css::beans::XPropertySet >& xPropSet );
175 void exportTextProps(const css::uno::Reference< css::beans::XPropertySet >& xPropSet);
176 void exportDataPoints(
177 const css::uno::Reference< css::beans::XPropertySet >& xSeriesProperties,
178 sal_Int32 nSeriesLength );
179 void exportDataLabels( const css::uno::Reference<css::chart2::XDataSeries>& xSeries, sal_Int32 nSeriesLength, sal_Int32 eChartType );
180 void exportGrouping( bool isBar = false );
181 void exportTrendlines( const css::uno::Reference< css::chart2::XDataSeries >& xSeries );
182 void exportMarker( const css::uno::Reference< css::chart2::XDataSeries >& xSeries );
183 void exportSmooth();
184 void exportFirstSliceAng();
186 void exportErrorBar(const css::uno::Reference< css::beans::XPropertySet >& xErrorBarProps,
187 bool bYError);
189 void exportManualLayout(const css::chart2::RelativePosition& rPos, const css::chart2::RelativeSize& rSize);
191 void exportAxes( );
192 void exportAxis(const AxisIdPair& rAxisIdPair);
193 void _exportAxis(
194 const css::uno::Reference< css::beans::XPropertySet >& xAxisProp,
195 const css::uno::Reference< css::drawing::XShape >& xAxisTitle,
196 const css::uno::Reference< css::beans::XPropertySet >& xMajorGrid,
197 const css::uno::Reference< css::beans::XPropertySet >& xMinorGrid,
198 sal_Int32 nAxisType,
199 const char* sAxisPos,
200 const AxisIdPair& rAxisIdPair );
201 void exportAxesId(bool bPrimaryAxes);
202 void exportView3D();
203 bool isDeep3dChart();
205 void exportMissingValueTreatment(const css::uno::Reference<css::beans::XPropertySet>& xPropSet);
207 OUString getNumberFormatCode(sal_Int32 nKey) const;
209 public:
211 ChartExport( sal_Int32 nXmlNamespace, ::sax_fastparser::FSHelperPtr pFS, css::uno::Reference< css::frame::XModel >& xModel,
212 ::oox::core::XmlFilterBase* pFB, DocumentType eDocumentType );
213 virtual ~ChartExport() {}
215 sal_Int32 GetChartID( );
216 const css::uno::Reference< css::frame::XModel >& getModel(){ return mxChartModel; }
218 void WriteChartObj( const css::uno::Reference< css::drawing::XShape >& xShape, sal_Int32 nChartCount );
220 void ExportContent();
221 void InitRangeSegmentationProperties(
222 const css::uno::Reference<
223 css::chart2::XChartDocument > & xChartDoc );
228 #endif // INCLUDED_OOX_EXPORT_CHARTEXPORT_HXX
230 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */