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 0 : 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 : Fraction maFraction;
88 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxChartModel;
89 : com::sun::star::uno::Reference< com::sun::star::chart::XDiagram > mxDiagram;
90 : com::sun::star::uno::Reference< com::sun::star::chart2::XDiagram > mxNewDiagram;
91 :
92 : // members filled by InitRangeSegmentationProperties (retrieved from DataProvider)
93 : bool mbHasCategoryLabels; //if the categories are only automatically generated this will be false
94 : OUString msChartAddress;
95 : ::com::sun::star::uno::Sequence< sal_Int32 > maSequenceMapping;
96 :
97 : //::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > mxAdditionalShapes;
98 : ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > mxCategoriesValues;
99 :
100 : AxisVector maAxes;
101 : bool mbHasZAxis;
102 : bool mbIs3DChart;
103 :
104 :
105 : private:
106 : sal_Int32 getChartType();
107 :
108 : OUString parseFormula( const OUString& rRange );
109 : void InitPlotArea();
110 :
111 : void _ExportContent();
112 : void exportChartSpace( com::sun::star::uno::Reference<
113 : com::sun::star::chart::XChartDocument > rChartDoc,
114 : bool bIncludeTable );
115 : void exportChart( com::sun::star::uno::Reference<
116 : com::sun::star::chart::XChartDocument > rChartDoc );
117 : void exportExternalData( com::sun::star::uno::Reference<
118 : com::sun::star::chart::XChartDocument > rChartDoc );
119 : void exportLegend( com::sun::star::uno::Reference<
120 : com::sun::star::chart::XChartDocument > rChartDoc );
121 : void exportTitle( com::sun::star::uno::Reference<
122 : ::com::sun::star::drawing::XShape > xShape );
123 : void exportPlotArea( );
124 : void exportPlotAreaShapeProps( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropSet );
125 : void exportFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropSet );
126 : void exportGradientFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropSet );
127 : void exportBitmapFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropSet );
128 : void exportDataTable( );
129 :
130 : void exportAreaChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
131 : void exportBarChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
132 : void exportBubbleChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
133 : void exportDoughnutChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
134 : void exportLineChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
135 : void exportOfPieChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
136 : void exportPieChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
137 : void exportRadarChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
138 : void exportScatterChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
139 : void exportStockChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
140 : void exportSuffaceChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
141 : void exportHiLowLines();
142 : void exportUpDownBars(com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
143 :
144 : void exportSeries( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType, sal_Int32& nAttachedAxis );
145 : void exportCandleStickSeries(
146 : const ::com::sun::star::uno::Sequence<
147 : ::com::sun::star::uno::Reference<
148 : ::com::sun::star::chart2::XDataSeries > > & aSeriesSeq,
149 : bool bJapaneseCandleSticks, sal_Int32& nAttachedAxis );
150 : void exportSeriesText(
151 : const com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xValueSeq );
152 : void exportSeriesCategory(
153 : const com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xValueSeq );
154 : void exportSeriesValues(
155 : const com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xValueSeq, sal_Int32 nValueType = XML_val );
156 : void exportShapeProps( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropSet );
157 : void exportDataPoints(
158 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSeriesProperties,
159 : sal_Int32 nSeriesLength );
160 : void exportDataLabels(
161 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSeriesProperties,
162 : sal_Int32 nSeriesLength );
163 : void exportGrouping( bool isBar = false );
164 : void exportTrendlines( ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > xSeries );
165 : void exportMarker( ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > xSeries );
166 : void exportSmooth();
167 : void exportFirstSliceAng();
168 :
169 : void exportErrorBar(com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xErrorBarProps,
170 : bool bYError);
171 :
172 : void exportAxes( );
173 : void exportAxis( AxisIdPair aAxisIdPair );
174 : void _exportAxis(
175 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xAxisProp,
176 : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xAxisTitle,
177 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xMajorGrid,
178 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xMinorGrid,
179 : sal_Int32 nAxisType,
180 : const char* sAxisPos,
181 : AxisIdPair aAxisIdPair );
182 : void exportAxesId( sal_Int32 nAttachedAxis );
183 : void exportView3D();
184 : bool isDeep3dChart();
185 :
186 : public:
187 :
188 : 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 );
189 0 : virtual ~ChartExport() {}
190 :
191 : sal_Int32 GetChartID( );
192 0 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > getModel(){ return mxChartModel; }
193 :
194 : virtual ChartExport& WriteChartObj( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape, sal_Int32 nChartCount );
195 :
196 : void ExportContent();
197 : void InitRangeSegmentationProperties(
198 : const ::com::sun::star::uno::Reference<
199 : ::com::sun::star::chart2::XChartDocument > & xChartDoc );
200 : };
201 :
202 : }}
203 :
204 : #endif /* ndef INCLUDED_OOX_EXPORT_CHARTEXPORT_HXX */
205 :
206 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|