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
23 #include <oox/dllapi.h>
24 #include <com/sun/star/uno/XReference.hpp>
25 #include <oox/export/drawingml.hxx>
26 #include <oox/token/tokens.hxx>
27 #include <sax/fshelper.hxx>
28 #include <vcl/mapmod.hxx>
30 #include <com/sun/star/chart2/RelativePosition.hpp>
31 #include <com/sun/star/chart2/RelativeSize.hpp>
35 namespace com
{ namespace sun
{ namespace star
{
39 class XChartDataArray
;
40 struct ChartSeriesAddress
;
58 class XStatusIndicator
;
65 namespace oox
{ namespace drawingml
{
67 const sal_Int32 AXIS_PRIMARY_X
= 1;
68 const sal_Int32 AXIS_PRIMARY_Y
= 2;
69 const sal_Int32 AXIS_PRIMARY_Z
= 3;
70 const sal_Int32 AXIS_SECONDARY_X
= 4;
71 const sal_Int32 AXIS_SECONDARY_Y
= 5;
78 AxisIdPair( sal_Int32 nType
, sal_Int32 nId
, sal_Int32 nAx
): nAxisType( nType
),nAxisId( nId
),nCrossAx( nAx
) {}
81 class OOX_DLLPUBLIC ChartExport
: public DrawingML
{
84 // first: data sequence for label, second: data sequence for values.
85 typedef ::std::vector
< AxisIdPair
> AxisVector
;
88 sal_Int32 mnXmlNamespace
;
89 sal_Int32 mnSeriesCount
;
90 css::uno::Reference
< css::frame::XModel
> mxChartModel
;
91 css::uno::Reference
< css::chart::XDiagram
> mxDiagram
;
92 css::uno::Reference
< css::chart2::XDiagram
> mxNewDiagram
;
94 // members filled by InitRangeSegmentationProperties (retrieved from DataProvider)
95 bool mbHasCategoryLabels
; //if the categories are only automatically generated this will be false
96 OUString msChartAddress
;
97 css::uno::Sequence
< sal_Int32
> maSequenceMapping
;
99 //css::uno::Reference< css::drawing::XShapes > mxAdditionalShapes;
100 css::uno::Reference
< css::chart2::data::XDataSequence
> mxCategoriesValues
;
108 std::set
<sal_Int32
> maExportedAxis
;
111 sal_Int32
getChartType();
113 OUString
parseFormula( const OUString
& rRange
);
116 void _ExportContent();
117 void exportChartSpace( css::uno::Reference
<
118 css::chart::XChartDocument
> rChartDoc
,
119 bool bIncludeTable
);
120 void exportChart( css::uno::Reference
<
121 css::chart::XChartDocument
> rChartDoc
);
122 void exportExternalData( css::uno::Reference
<
123 css::chart::XChartDocument
> rChartDoc
);
124 void exportLegend( css::uno::Reference
<
125 css::chart::XChartDocument
> rChartDoc
);
126 void exportTitle( css::uno::Reference
<
127 css::drawing::XShape
> xShape
);
128 void exportPlotArea( );
129 void exportPlotAreaShapeProps( css::uno::Reference
< css::beans::XPropertySet
> xPropSet
);
130 void exportFill( css::uno::Reference
< css::beans::XPropertySet
> xPropSet
);
131 void exportGradientFill( css::uno::Reference
< css::beans::XPropertySet
> xPropSet
);
132 void exportBitmapFill( css::uno::Reference
< css::beans::XPropertySet
> xPropSet
);
133 void exportDataTable( );
135 void exportAreaChart( css::uno::Reference
< css::chart2::XChartType
> xChartType
);
136 void exportBarChart( css::uno::Reference
< css::chart2::XChartType
> xChartType
);
137 void exportBubbleChart( css::uno::Reference
< css::chart2::XChartType
> xChartType
);
138 void exportDoughnutChart( css::uno::Reference
< css::chart2::XChartType
> xChartType
);
139 void exportLineChart( css::uno::Reference
< css::chart2::XChartType
> xChartType
);
140 void exportPieChart( css::uno::Reference
< css::chart2::XChartType
> xChartType
);
141 void exportRadarChart( css::uno::Reference
< css::chart2::XChartType
> xChartType
);
142 void exportScatterChart( css::uno::Reference
< css::chart2::XChartType
> xChartType
);
143 void exportStockChart( css::uno::Reference
< css::chart2::XChartType
> xChartType
);
144 void exportSurfaceChart( css::uno::Reference
< css::chart2::XChartType
> xChartType
);
145 void exportHiLowLines();
146 void exportUpDownBars(css::uno::Reference
< css::chart2::XChartType
> xChartType
);
148 void exportAllSeries(css::uno::Reference
<css::chart2::XChartType
> xChartType
, sal_Int32
& nAttachedAxis
);
149 void exportSeries(css::uno::Reference
< css::chart2::XChartType
> xChartType
,
150 css::uno::Sequence
<css::uno::Reference
<css::chart2::XDataSeries
> >& rSeriesSeq
, sal_Int32
& nAttachedAxis
);
151 void exportCandleStickSeries(
152 const css::uno::Sequence
<
154 css::chart2::XDataSeries
> > & aSeriesSeq
,
155 bool bJapaneseCandleSticks
, sal_Int32
& nAttachedAxis
);
156 void exportSeriesText(
157 const css::uno::Reference
< css::chart2::data::XDataSequence
>& xValueSeq
);
158 void exportSeriesCategory(
159 const css::uno::Reference
< css::chart2::data::XDataSequence
>& xValueSeq
);
160 void exportSeriesValues(
161 const css::uno::Reference
< css::chart2::data::XDataSequence
>& xValueSeq
, sal_Int32 nValueType
= XML_val
);
162 void exportShapeProps( css::uno::Reference
< css::beans::XPropertySet
> xPropSet
);
163 void exportTextProps(css::uno::Reference
< css::beans::XPropertySet
> xPropSet
);
164 void exportDataPoints(
165 const css::uno::Reference
< css::beans::XPropertySet
>& xSeriesProperties
,
166 sal_Int32 nSeriesLength
);
167 void exportDataLabels( const css::uno::Reference
<css::chart2::XDataSeries
>& xSeries
, sal_Int32 nSeriesLength
, sal_Int32 eChartType
);
168 void exportGrouping( bool isBar
= false );
169 void exportTrendlines( css::uno::Reference
< css::chart2::XDataSeries
> xSeries
);
170 void exportMarker( css::uno::Reference
< css::chart2::XDataSeries
> xSeries
);
172 void exportFirstSliceAng();
174 void exportErrorBar(css::uno::Reference
< css::beans::XPropertySet
> xErrorBarProps
,
177 void exportManualLayout(const css::chart2::RelativePosition
& rPos
, const css::chart2::RelativeSize
& rSize
);
180 void exportAxis(const AxisIdPair
& rAxisIdPair
);
182 const css::uno::Reference
< css::beans::XPropertySet
>& xAxisProp
,
183 const css::uno::Reference
< css::drawing::XShape
>& xAxisTitle
,
184 const css::uno::Reference
< css::beans::XPropertySet
>& xMajorGrid
,
185 const css::uno::Reference
< css::beans::XPropertySet
>& xMinorGrid
,
187 const char* sAxisPos
,
188 const AxisIdPair
& rAxisIdPair
);
189 void exportAxesId( sal_Int32 nAttachedAxis
);
191 bool isDeep3dChart();
193 void exportMissingValueTreatment(css::uno::Reference
<
194 css::beans::XPropertySet
> xPropSet
);
196 OUString
getNumberFormatCode(sal_Int32 nKey
) const;
200 ChartExport( sal_Int32 nXmlNamespace
, ::sax_fastparser::FSHelperPtr pFS
, css::uno::Reference
< css::frame::XModel
>& xModel
, ::oox::core::XmlFilterBase
* pFB
= NULL
, DocumentType eDocumentType
= DOCUMENT_PPTX
);
201 virtual ~ChartExport() {}
203 sal_Int32
GetChartID( );
204 css::uno::Reference
< css::frame::XModel
> getModel(){ return mxChartModel
; }
206 ChartExport
& WriteChartObj( const css::uno::Reference
< css::drawing::XShape
>& xShape
, sal_Int32 nChartCount
);
208 void ExportContent();
209 void InitRangeSegmentationProperties(
210 const css::uno::Reference
<
211 css::chart2::XChartDocument
> & xChartDoc
);
216 #endif // INCLUDED_OOX_EXPORT_CHARTEXPORT_HXX
218 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */