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
;
69 namespace oox
{ namespace drawingml
{
81 AxesType
const nAxisType
;
82 sal_Int32
const nAxisId
;
83 sal_Int32
const nCrossAx
;
85 AxisIdPair(AxesType nType
, sal_Int32 nId
, sal_Int32 nAx
)
92 class OOX_DLLPUBLIC ChartExport
: public DrawingML
{
95 // first: data sequence for label, second: data sequence for values.
96 typedef ::std::vector
< AxisIdPair
> AxisVector
;
99 sal_Int32
const 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
;
104 std::shared_ptr
<URLTransformer
> mpURLTransformer
;
106 // members filled by InitRangeSegmentationProperties (retrieved from DataProvider)
107 bool mbHasCategoryLabels
; //if the categories are only automatically generated this will be false
109 //css::uno::Reference< css::drawing::XShapes > mxAdditionalShapes;
110 css::uno::Reference
< css::chart2::data::XDataSequence
> mxCategoriesValues
;
118 std::set
<sal_Int32
> maExportedAxis
;
121 sal_Int32
getChartType();
123 OUString
parseFormula( const OUString
& rRange
);
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( const css::uno::Reference
<
139 css::chart::XChartDocument
>& rChartDoc
);
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 exportHatch(const css::uno::Reference
<css::beans::XPropertySet
>& xPropSet
);
144 void exportDataTable( );
146 void exportAreaChart( const css::uno::Reference
< css::chart2::XChartType
>& xChartType
);
147 void exportBarChart( const css::uno::Reference
< css::chart2::XChartType
>& xChartType
);
148 void exportBubbleChart( const css::uno::Reference
< css::chart2::XChartType
>& xChartType
);
149 void exportDoughnutChart( const css::uno::Reference
< css::chart2::XChartType
>& xChartType
);
150 void exportLineChart( const css::uno::Reference
< css::chart2::XChartType
>& xChartType
);
151 void exportPieChart( const css::uno::Reference
< css::chart2::XChartType
>& xChartType
);
152 void exportRadarChart( const css::uno::Reference
< css::chart2::XChartType
>& xChartType
);
153 void exportScatterChart( const css::uno::Reference
< css::chart2::XChartType
>& xChartType
);
154 void exportScatterChartSeries( const css::uno::Reference
< css::chart2::XChartType
>& xChartType
,
155 css::uno::Sequence
<css::uno::Reference
<css::chart2::XDataSeries
>>* pSeries
);
156 void exportStockChart( const css::uno::Reference
< css::chart2::XChartType
>& xChartType
);
157 void exportSurfaceChart( const css::uno::Reference
< css::chart2::XChartType
>& xChartType
);
158 void exportHiLowLines();
159 void exportUpDownBars(const css::uno::Reference
< css::chart2::XChartType
>& xChartType
);
161 void exportAllSeries(const css::uno::Reference
<css::chart2::XChartType
>& xChartType
, bool& rPrimaryAxes
);
162 void exportSeries(const css::uno::Reference
< css::chart2::XChartType
>& xChartType
,
163 css::uno::Sequence
<css::uno::Reference
<css::chart2::XDataSeries
> >& rSeriesSeq
, bool& rPrimaryAxes
);
165 void exportVaryColors(const css::uno::Reference
<css::chart2::XChartType
>& xChartType
);
166 void exportCandleStickSeries(
167 const css::uno::Sequence
<
169 css::chart2::XDataSeries
> > & aSeriesSeq
,
170 bool& rPrimaryAxes
);
171 void exportSeriesText(
172 const css::uno::Reference
< css::chart2::data::XDataSequence
>& xValueSeq
);
173 void exportSeriesCategory(
174 const css::uno::Reference
< css::chart2::data::XDataSequence
>& xValueSeq
);
175 void exportSeriesValues(
176 const css::uno::Reference
< css::chart2::data::XDataSequence
>& xValueSeq
, sal_Int32 nValueType
= XML_val
);
177 void exportShapeProps( const css::uno::Reference
< css::beans::XPropertySet
>& xPropSet
);
178 void exportTextProps(const css::uno::Reference
< css::beans::XPropertySet
>& xPropSet
);
179 void exportDataPoints(
180 const css::uno::Reference
< css::beans::XPropertySet
>& xSeriesProperties
,
181 sal_Int32 nSeriesLength
, sal_Int32 eChartType
);
182 void exportDataLabels( const css::uno::Reference
<css::chart2::XDataSeries
>& xSeries
, sal_Int32 nSeriesLength
, sal_Int32 eChartType
);
183 void exportGrouping( bool isBar
= false );
184 void exportTrendlines( const css::uno::Reference
< css::chart2::XDataSeries
>& xSeries
);
185 void exportMarker( const css::uno::Reference
< css::chart2::XDataSeries
>& xSeries
);
187 void exportFirstSliceAng();
189 void exportErrorBar(const css::uno::Reference
< css::beans::XPropertySet
>& xErrorBarProps
,
192 void exportManualLayout(const css::chart2::RelativePosition
& rPos
, const css::chart2::RelativeSize
& rSize
, const bool bIsExcludingDiagramPositioning
);
195 void exportAxis(const AxisIdPair
& rAxisIdPair
);
197 const css::uno::Reference
< css::beans::XPropertySet
>& xAxisProp
,
198 const css::uno::Reference
< css::drawing::XShape
>& xAxisTitle
,
199 const css::uno::Reference
< css::beans::XPropertySet
>& xMajorGrid
,
200 const css::uno::Reference
< css::beans::XPropertySet
>& xMinorGrid
,
202 const char* sAxisPos
,
203 const AxisIdPair
& rAxisIdPair
);
204 void exportAxesId(bool bPrimaryAxes
, bool bCheckCombinedAxes
= false);
206 bool isDeep3dChart();
208 void exportMissingValueTreatment(const css::uno::Reference
<css::beans::XPropertySet
>& xPropSet
);
210 OUString
getNumberFormatCode(sal_Int32 nKey
) const;
214 ChartExport( sal_Int32 nXmlNamespace
, ::sax_fastparser::FSHelperPtr pFS
, css::uno::Reference
< css::frame::XModel
> const & xModel
,
215 ::oox::core::XmlFilterBase
* pFB
, DocumentType eDocumentType
);
216 virtual ~ChartExport() {}
218 void SetURLTranslator(const std::shared_ptr
<URLTransformer
>& pTransformer
);
220 const css::uno::Reference
< css::frame::XModel
>& getModel(){ return mxChartModel
; }
222 void WriteChartObj( const css::uno::Reference
< css::drawing::XShape
>& xShape
, sal_Int32 nID
, sal_Int32 nChartCount
);
224 void ExportContent();
225 void InitRangeSegmentationProperties(
226 const css::uno::Reference
<
227 css::chart2::XChartDocument
> & xChartDoc
);
232 #endif // INCLUDED_OOX_EXPORT_CHARTEXPORT_HXX
234 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */