Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_OOX_EXPORT_CHARTEXPORT_HXX
21 : #define INCLUDED_OOX_EXPORT_CHARTEXPORT_HXX
22 :
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>
29 :
30 : #include <com/sun/star/chart2/RelativePosition.hpp>
31 : #include <com/sun/star/chart2/RelativeSize.hpp>
32 :
33 : #include <set>
34 :
35 : namespace com { namespace sun { namespace star {
36 : namespace chart {
37 : class XDiagram;
38 : class XChartDocument;
39 : class XChartDataArray;
40 : struct ChartSeriesAddress;
41 : }
42 : namespace chart2 {
43 : class XDiagram;
44 : class XChartDocument;
45 : class XDataSeries;
46 : class XChartType;
47 : namespace data
48 : {
49 : class XDataProvider;
50 : class XDataSequence;
51 : }
52 : }
53 : namespace drawing {
54 : class XShape;
55 : class XShapes;
56 : }
57 : namespace task {
58 : class XStatusIndicator;
59 : }
60 : namespace frame {
61 : class XModel;
62 : }
63 : }}}
64 :
65 : namespace oox { namespace drawingml {
66 :
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;
72 :
73 : struct AxisIdPair{
74 : sal_Int32 nAxisType;
75 : sal_Int32 nAxisId;
76 : sal_Int32 nCrossAx;
77 :
78 116 : AxisIdPair( sal_Int32 nType, sal_Int32 nId, sal_Int32 nAx ): nAxisType( nType ),nAxisId( nId ),nCrossAx( nAx ) {}
79 : };
80 :
81 : class OOX_DLLPUBLIC ChartExport : public DrawingML {
82 :
83 : public:
84 : // first: data sequence for label, second: data sequence for values.
85 : typedef ::std::vector< AxisIdPair > AxisVector;
86 :
87 : private:
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;
93 :
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;
98 :
99 : //css::uno::Reference< css::drawing::XShapes > mxAdditionalShapes;
100 : css::uno::Reference< css::chart2::data::XDataSequence > mxCategoriesValues;
101 :
102 : AxisVector maAxes;
103 : bool mbHasZAxis;
104 : bool mbIs3DChart;
105 : bool mbStacked;
106 : bool mbPercent;
107 :
108 : std::set<sal_Int32> maExportedAxis;
109 :
110 : private:
111 : sal_Int32 getChartType();
112 :
113 : OUString parseFormula( const OUString& rRange );
114 : void InitPlotArea();
115 :
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( );
134 :
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 );
147 :
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<
153 : css::uno::Reference<
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 );
171 : void exportSmooth();
172 : void exportFirstSliceAng();
173 :
174 : void exportErrorBar(css::uno::Reference< css::beans::XPropertySet > xErrorBarProps,
175 : bool bYError);
176 :
177 : void exportManualLayout(const css::chart2::RelativePosition& rPos, const css::chart2::RelativeSize& rSize);
178 :
179 : void exportAxes( );
180 : void exportAxis(const AxisIdPair& rAxisIdPair);
181 : void _exportAxis(
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,
186 : sal_Int32 nAxisType,
187 : const char* sAxisPos,
188 : const AxisIdPair& rAxisIdPair );
189 : void exportAxesId( sal_Int32 nAttachedAxis );
190 : void exportView3D();
191 : bool isDeep3dChart();
192 :
193 : void exportMissingValueTreatment(css::uno::Reference<
194 : css::beans::XPropertySet> xPropSet);
195 :
196 : OUString getNumberFormatCode(sal_Int32 nKey) const;
197 :
198 : public:
199 :
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 60 : virtual ~ChartExport() {}
202 :
203 : sal_Int32 GetChartID( );
204 681 : css::uno::Reference< css::frame::XModel > getModel(){ return mxChartModel; }
205 :
206 : ChartExport& WriteChartObj( const css::uno::Reference< css::drawing::XShape >& xShape, sal_Int32 nChartCount );
207 :
208 : void ExportContent();
209 : void InitRangeSegmentationProperties(
210 : const css::uno::Reference<
211 : css::chart2::XChartDocument > & xChartDoc );
212 : };
213 :
214 : }}
215 :
216 : #endif // INCLUDED_OOX_EXPORT_CHARTEXPORT_HXX
217 :
218 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|