Bump version to 6.4-15
[LibreOffice.git] / include / oox / export / chartexport.hxx
blob88e118fe7e609a860b5cc2f52ed0b5d6a20929e9
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;
54 class XLabeledDataSequence;
57 namespace drawing {
58 class XShape;
60 namespace frame {
61 class XModel;
63 }}}
65 namespace oox {
66 namespace core {
67 class XmlFilterBase;
70 namespace oox { namespace drawingml {
72 enum AxesType
74 AXIS_PRIMARY_X = 1,
75 AXIS_PRIMARY_Y = 2,
76 AXIS_PRIMARY_Z = 3,
77 AXIS_SECONDARY_X = 4,
78 AXIS_SECONDARY_Y = 5
81 struct AxisIdPair{
82 AxesType const nAxisType;
83 sal_Int32 const nAxisId;
84 sal_Int32 const nCrossAx;
86 AxisIdPair(AxesType nType, sal_Int32 nId, sal_Int32 nAx)
87 : nAxisType(nType)
88 , nAxisId(nId)
89 , nCrossAx(nAx)
93 class OOX_DLLPUBLIC ChartExport final : public DrawingML {
95 public:
96 // first: data sequence for label, second: data sequence for values.
97 typedef ::std::vector< AxisIdPair > AxisVector;
99 private:
100 sal_Int32 const mnXmlNamespace;
101 sal_Int32 mnSeriesCount;
102 css::uno::Reference< css::frame::XModel > mxChartModel;
103 css::uno::Reference< css::chart::XDiagram > mxDiagram;
104 css::uno::Reference< css::chart2::XDiagram > mxNewDiagram;
105 std::shared_ptr<URLTransformer> mpURLTransformer;
107 // members filled by InitRangeSegmentationProperties (retrieved from DataProvider)
108 bool mbHasCategoryLabels; //if the categories are only automatically generated this will be false
109 bool mbIsCategoryPositionShifted; //if the value axis crosses the category axis between tickmarks this will be true
111 //css::uno::Reference< css::drawing::XShapes > mxAdditionalShapes;
112 css::uno::Reference< css::chart2::data::XDataSequence > mxCategoriesValues;
114 AxisVector maAxes;
115 bool mbHasZAxis;
116 bool mbIs3DChart;
117 bool mbStacked;
118 bool mbPercent;
120 std::set<sal_Int32> maExportedAxis;
122 private:
123 sal_Int32 getChartType();
125 css::uno::Sequence< css::uno::Sequence< rtl::OUString > > getSplitCategoriesList(const OUString& rRange);
127 OUString parseFormula( const OUString& rRange );
128 void InitPlotArea();
130 void ExportContent_();
131 void exportChartSpace( const css::uno::Reference<
132 css::chart::XChartDocument >& rChartDoc,
133 bool bIncludeTable );
134 void exportChart( const css::uno::Reference<
135 css::chart::XChartDocument >& rChartDoc );
136 void exportExternalData( const css::uno::Reference<
137 css::chart::XChartDocument >& rChartDoc );
138 void exportLegend( const css::uno::Reference<
139 css::chart::XChartDocument >& rChartDoc );
140 void exportTitle( const css::uno::Reference< css::drawing::XShape >& xShape,
141 const OUString* pSubText = nullptr );
142 void exportPlotArea( const css::uno::Reference<
143 css::chart::XChartDocument >& rChartDoc );
144 void exportFill( const css::uno::Reference< css::beans::XPropertySet >& xPropSet );
145 void exportGradientFill( const css::uno::Reference< css::beans::XPropertySet >& xPropSet );
146 void exportBitmapFill( const css::uno::Reference< css::beans::XPropertySet >& xPropSet );
147 void exportHatch(const css::uno::Reference<css::beans::XPropertySet>& xPropSet);
148 void exportDataTable( );
150 void exportAreaChart( const css::uno::Reference< css::chart2::XChartType >& xChartType );
151 void exportBarChart( const css::uno::Reference< css::chart2::XChartType >& xChartType );
152 void exportBubbleChart( const css::uno::Reference< css::chart2::XChartType >& xChartType );
153 void exportDoughnutChart( const css::uno::Reference< css::chart2::XChartType >& xChartType );
154 void exportLineChart( const css::uno::Reference< css::chart2::XChartType >& xChartType );
155 void exportPieChart( const css::uno::Reference< css::chart2::XChartType >& xChartType );
156 void exportRadarChart( const css::uno::Reference< css::chart2::XChartType >& xChartType );
157 void exportScatterChart( const css::uno::Reference< css::chart2::XChartType >& xChartType );
158 void exportScatterChartSeries( const css::uno::Reference< css::chart2::XChartType >& xChartType,
159 css::uno::Sequence<css::uno::Reference<css::chart2::XDataSeries>>* pSeries);
160 void exportStockChart( const css::uno::Reference< css::chart2::XChartType >& xChartType );
161 void exportSurfaceChart( const css::uno::Reference< css::chart2::XChartType >& xChartType );
162 void exportHiLowLines();
163 void exportUpDownBars(const css::uno::Reference< css::chart2::XChartType >& xChartType );
165 void exportAllSeries(const css::uno::Reference<css::chart2::XChartType>& xChartType, bool& rPrimaryAxes);
166 void exportSeries(const css::uno::Reference< css::chart2::XChartType >& xChartType,
167 css::uno::Sequence<css::uno::Reference<css::chart2::XDataSeries> >& rSeriesSeq, bool& rPrimaryAxes);
169 void exportVaryColors(const css::uno::Reference<css::chart2::XChartType>& xChartType);
170 void exportCandleStickSeries(
171 const css::uno::Sequence<
172 css::uno::Reference<
173 css::chart2::XDataSeries > > & aSeriesSeq,
174 bool& rPrimaryAxes );
175 void exportSeriesText(
176 const css::uno::Reference< css::chart2::data::XDataSequence >& xValueSeq );
177 void exportSeriesCategory(
178 const css::uno::Reference< css::chart2::data::XDataSequence >& xValueSeq );
179 void exportSeriesValues(
180 const css::uno::Reference< css::chart2::data::XDataSequence >& xValueSeq, sal_Int32 nValueType = XML_val );
181 void exportShapeProps( const css::uno::Reference< css::beans::XPropertySet >& xPropSet );
182 void exportDataPoints(
183 const css::uno::Reference< css::beans::XPropertySet >& xSeriesProperties,
184 sal_Int32 nSeriesLength, sal_Int32 eChartType );
185 void exportDataLabels( const css::uno::Reference<css::chart2::XDataSeries>& xSeries, sal_Int32 nSeriesLength, sal_Int32 eChartType );
186 void exportGrouping( bool isBar = false );
187 void exportTrendlines( const css::uno::Reference< css::chart2::XDataSeries >& xSeries );
188 void exportMarker( const css::uno::Reference< css::beans::XPropertySet >& xPropSet );
189 void exportSmooth();
190 void exportFirstSliceAng();
192 void exportErrorBar(const css::uno::Reference< css::beans::XPropertySet >& xErrorBarProps,
193 bool bYError);
195 void exportManualLayout(const css::chart2::RelativePosition& rPos, const css::chart2::RelativeSize& rSize, const bool bIsExcludingDiagramPositioning);
197 void exportAxes( );
198 void exportAxis(const AxisIdPair& rAxisIdPair);
199 void _exportAxis(
200 const css::uno::Reference< css::beans::XPropertySet >& xAxisProp,
201 const css::uno::Reference< css::drawing::XShape >& xAxisTitle,
202 const css::uno::Reference< css::beans::XPropertySet >& xMajorGrid,
203 const css::uno::Reference< css::beans::XPropertySet >& xMinorGrid,
204 sal_Int32 nAxisType,
205 const char* sAxisPos,
206 const AxisIdPair& rAxisIdPair );
207 void exportAxesId(bool bPrimaryAxes, bool bCheckCombinedAxes = false);
208 void exportView3D();
209 bool isDeep3dChart();
211 void exportMissingValueTreatment(const css::uno::Reference<css::beans::XPropertySet>& xPropSet);
213 OUString getNumberFormatCode(sal_Int32 nKey) const;
215 public:
217 ChartExport( sal_Int32 nXmlNamespace, ::sax_fastparser::FSHelperPtr pFS, css::uno::Reference< css::frame::XModel > const & xModel,
218 ::oox::core::XmlFilterBase* pFB, DocumentType eDocumentType );
219 virtual ~ChartExport() {}
221 void SetURLTranslator(const std::shared_ptr<URLTransformer>& pTransformer);
223 const css::uno::Reference< css::frame::XModel >& getModel() const { return mxChartModel; }
225 void WriteChartObj( const css::uno::Reference< css::drawing::XShape >& xShape, sal_Int32 nID, sal_Int32 nChartCount );
226 void exportTextProps(const css::uno::Reference< css::beans::XPropertySet >& xPropSet);
228 void ExportContent();
229 void InitRangeSegmentationProperties(
230 const css::uno::Reference<
231 css::chart2::XChartDocument > & xChartDoc );
236 #endif // INCLUDED_OOX_EXPORT_CHARTEXPORT_HXX
238 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */