1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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
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
{
45 struct RelativePosition
;
54 class XLabeledDataSequence
;
70 namespace oox
{ namespace drawingml
{
82 AxesType
const nAxisType
;
83 sal_Int32
const nAxisId
;
84 sal_Int32
const nCrossAx
;
86 AxisIdPair(AxesType nType
, sal_Int32 nId
, sal_Int32 nAx
)
93 class OOX_DLLPUBLIC ChartExport final
: public DrawingML
{
96 // first: data sequence for label, second: data sequence for values.
97 typedef ::std::vector
< AxisIdPair
> AxisVector
;
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
;
120 std::set
<sal_Int32
> maExportedAxis
;
123 sal_Int32
getChartType();
125 css::uno::Sequence
< css::uno::Sequence
< rtl::OUString
> > getSplitCategoriesList(const OUString
& rRange
);
127 OUString
parseFormula( const OUString
& rRange
);
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
<
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
);
190 void exportFirstSliceAng();
192 void exportErrorBar(const css::uno::Reference
< css::beans::XPropertySet
>& xErrorBarProps
,
195 void exportManualLayout(const css::chart2::RelativePosition
& rPos
, const css::chart2::RelativeSize
& rSize
, const bool bIsExcludingDiagramPositioning
);
198 void exportAxis(const AxisIdPair
& rAxisIdPair
);
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
,
205 const char* sAxisPos
,
206 const AxisIdPair
& rAxisIdPair
);
207 void exportAxesId(bool bPrimaryAxes
, bool bCheckCombinedAxes
= false);
209 bool isDeep3dChart();
211 void exportMissingValueTreatment(const css::uno::Reference
<css::beans::XPropertySet
>& xPropSet
);
213 OUString
getNumberFormatCode(sal_Int32 nKey
) const;
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: */