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 : #include <boost/unordered_map.hpp>
30 : #include <map>
31 :
32 : namespace com { namespace sun { namespace star {
33 : namespace chart {
34 : class XDiagram;
35 : class XChartDocument;
36 : class XChartDataArray;
37 : struct ChartSeriesAddress;
38 : }
39 : namespace chart2 {
40 : class XDiagram;
41 : class XChartDocument;
42 : class XDataSeries;
43 : class XChartType;
44 : namespace data
45 : {
46 : class XDataProvider;
47 : class XDataSequence;
48 : }
49 : }
50 : namespace drawing {
51 : class XShape;
52 : class XShapes;
53 : }
54 : namespace task {
55 : class XStatusIndicator;
56 : }
57 : namespace frame {
58 : class XModel;
59 : }
60 : }}}
61 :
62 : namespace oox { namespace drawingml {
63 :
64 : const sal_Int32 AXIS_PRIMARY_X = 1;
65 : const sal_Int32 AXIS_PRIMARY_Y = 2;
66 : const sal_Int32 AXIS_PRIMARY_Z = 3;
67 : const sal_Int32 AXIS_SECONDARY_X = 4;
68 : const sal_Int32 AXIS_SECONDARY_Y = 5;
69 :
70 : struct AxisIdPair{
71 : sal_Int32 nAxisType;
72 : sal_Int32 nAxisId;
73 : sal_Int32 nCrossAx;
74 :
75 156 : AxisIdPair( sal_Int32 nType, sal_Int32 nId, sal_Int32 nAx ): nAxisType( nType ),nAxisId( nId ),nCrossAx( nAx ) {}
76 : };
77 :
78 : class OOX_DLLPUBLIC ChartExport : public DrawingML {
79 :
80 : public:
81 : // first: data sequence for label, second: data sequence for values.
82 : typedef ::std::vector< AxisIdPair > AxisVector;
83 :
84 : private:
85 : sal_Int32 mnXmlNamespace;
86 : sal_Int32 mnSeriesCount;
87 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxChartModel;
88 : com::sun::star::uno::Reference< com::sun::star::chart::XDiagram > mxDiagram;
89 : com::sun::star::uno::Reference< com::sun::star::chart2::XDiagram > mxNewDiagram;
90 :
91 : // members filled by InitRangeSegmentationProperties (retrieved from DataProvider)
92 : bool mbHasCategoryLabels; //if the categories are only automatically generated this will be false
93 : OUString msChartAddress;
94 : ::com::sun::star::uno::Sequence< sal_Int32 > maSequenceMapping;
95 :
96 : //::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > mxAdditionalShapes;
97 : ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > mxCategoriesValues;
98 :
99 : AxisVector maAxes;
100 : bool mbHasZAxis;
101 : bool mbIs3DChart;
102 : bool mbStacked;
103 : bool mbPercent;
104 : bool mbClustered;
105 :
106 : private:
107 : sal_Int32 getChartType();
108 :
109 : OUString parseFormula( const OUString& rRange );
110 : void InitPlotArea();
111 :
112 : void _ExportContent();
113 : void exportChartSpace( com::sun::star::uno::Reference<
114 : com::sun::star::chart::XChartDocument > rChartDoc,
115 : bool bIncludeTable );
116 : void exportChart( com::sun::star::uno::Reference<
117 : com::sun::star::chart::XChartDocument > rChartDoc );
118 : void exportExternalData( com::sun::star::uno::Reference<
119 : com::sun::star::chart::XChartDocument > rChartDoc );
120 : void exportLegend( com::sun::star::uno::Reference<
121 : com::sun::star::chart::XChartDocument > rChartDoc );
122 : void exportTitle( com::sun::star::uno::Reference<
123 : ::com::sun::star::drawing::XShape > xShape );
124 : void exportPlotArea( );
125 : void exportPlotAreaShapeProps( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropSet );
126 : void exportFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropSet );
127 : void exportGradientFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropSet );
128 : void exportBitmapFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropSet );
129 : void exportDataTable( );
130 :
131 : void exportAreaChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
132 : void exportBarChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
133 : void exportBubbleChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
134 : void exportDoughnutChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
135 : void exportLineChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
136 : void exportOfPieChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
137 : void exportPieChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
138 : void exportRadarChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
139 : void exportScatterChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
140 : void exportStockChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
141 : void exportSurfaceChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
142 : void exportHiLowLines();
143 : void exportUpDownBars(com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
144 :
145 : void exportSeries( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType, sal_Int32& nAttachedAxis );
146 : void exportCandleStickSeries(
147 : const ::com::sun::star::uno::Sequence<
148 : ::com::sun::star::uno::Reference<
149 : ::com::sun::star::chart2::XDataSeries > > & aSeriesSeq,
150 : bool bJapaneseCandleSticks, sal_Int32& nAttachedAxis );
151 : void exportSeriesText(
152 : const com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xValueSeq );
153 : void exportSeriesCategory(
154 : const com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xValueSeq );
155 : void exportSeriesValues(
156 : const com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xValueSeq, sal_Int32 nValueType = XML_val );
157 : void exportShapeProps( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropSet );
158 : void exportDataPoints(
159 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSeriesProperties,
160 : sal_Int32 nSeriesLength );
161 : void exportDataLabels( const css::uno::Reference<css::chart2::XDataSeries>& xSeries, sal_Int32 nSeriesLength, sal_Int32 eChartType );
162 : void exportGrouping( bool isBar = false );
163 : void exportTrendlines( ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > xSeries );
164 : void exportMarker( ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > xSeries );
165 : void exportSmooth();
166 : void exportFirstSliceAng();
167 :
168 : void exportErrorBar(com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xErrorBarProps,
169 : bool bYError);
170 :
171 : void exportAxes( );
172 : void exportAxis( AxisIdPair aAxisIdPair );
173 : void _exportAxis(
174 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xAxisProp,
175 : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xAxisTitle,
176 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xMajorGrid,
177 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xMinorGrid,
178 : sal_Int32 nAxisType,
179 : const char* sAxisPos,
180 : AxisIdPair aAxisIdPair );
181 : void exportAxesId( sal_Int32 nAttachedAxis );
182 : void exportView3D();
183 : bool isDeep3dChart();
184 :
185 : public:
186 :
187 : ChartExport( sal_Int32 nXmlNamespace, ::sax_fastparser::FSHelperPtr pFS, ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel, ::oox::core::XmlFilterBase* pFB = NULL, DocumentType eDocumentType = DOCUMENT_PPTX );
188 84 : virtual ~ChartExport() {}
189 :
190 : sal_Int32 GetChartID( );
191 1072 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > getModel(){ return mxChartModel; }
192 :
193 : virtual ChartExport& WriteChartObj( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape, sal_Int32 nChartCount );
194 :
195 : void ExportContent();
196 : void InitRangeSegmentationProperties(
197 : const ::com::sun::star::uno::Reference<
198 : ::com::sun::star::chart2::XChartDocument > & xChartDoc );
199 : };
200 :
201 : }}
202 :
203 : #endif // INCLUDED_OOX_EXPORT_CHARTEXPORT_HXX
204 :
205 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|