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 _OOX_EXPORT_CHART_HXX_
21 : #define _OOX_EXPORT_CHART_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 4 : 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 : Fraction maFraction;
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 : sal_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 : sal_Bool mbHasZAxis;
101 : sal_Bool mbIs3DChart;
102 :
103 :
104 : private:
105 : sal_Int32 getChartType();
106 :
107 : OUString parseFormula( const OUString& rRange );
108 : void InitPlotArea();
109 :
110 : void _ExportContent();
111 : void exportChartSpace( com::sun::star::uno::Reference<
112 : com::sun::star::chart::XChartDocument > rChartDoc,
113 : sal_Bool bIncludeTable );
114 : void exportChart( com::sun::star::uno::Reference<
115 : com::sun::star::chart::XChartDocument > rChartDoc );
116 : void exportLegend( com::sun::star::uno::Reference<
117 : com::sun::star::chart::XChartDocument > rChartDoc );
118 : void exportTitle( com::sun::star::uno::Reference<
119 : ::com::sun::star::drawing::XShape > xShape );
120 : void exportPlotArea( );
121 :
122 : void exportAreaChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
123 : void exportBarChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
124 : void exportBubbleChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
125 : void exportDoughnutChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
126 : void exportLineChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
127 : void exportOfPieChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
128 : void exportPieChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
129 : void exportRadarChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
130 : void exportScatterChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
131 : void exportStockChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
132 : void exportSuffaceChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
133 :
134 : void exportSeries( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType, sal_Int32& nAttachedAxis );
135 : void exportCandleStickSeries(
136 : const ::com::sun::star::uno::Sequence<
137 : ::com::sun::star::uno::Reference<
138 : ::com::sun::star::chart2::XDataSeries > > & aSeriesSeq,
139 : sal_Bool bJapaneseCandleSticks, sal_Int32& nAttachedAxis );
140 : void exportSeriesText(
141 : const com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xValueSeq );
142 : void exportSeriesCategory(
143 : const com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xValueSeq );
144 : void exportSeriesValues(
145 : const com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xValueSeq, sal_Int32 nValueType = XML_val );
146 : void exportShapeProps( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropSet );
147 : void exportDataPoints(
148 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSeriesProperties,
149 : sal_Int32 nSeriesLength );
150 : void exportDataLabels(
151 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSeriesProperties,
152 : sal_Int32 nSeriesLength );
153 : void exportGrouping( sal_Bool isBar = sal_False );
154 : void exportTrendlines( ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > xSeries );
155 : void exportMarker();
156 : void exportSmooth();
157 : void exportFirstSliceAng();
158 :
159 : void exportErrorBar(com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xErrorBarProps,
160 : bool bYError);
161 :
162 : void exportAxes( );
163 : void exportAxis( AxisIdPair aAxisIdPair );
164 : void _exportAxis(
165 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xAxisProp,
166 : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xAxisTitle,
167 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xMajorGrid,
168 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xMinorGrid,
169 : sal_Int32 nAxisType,
170 : const char* sAxisPos,
171 : AxisIdPair aAxisIdPair );
172 : void exportAxesId( sal_Int32 nAttachedAxis );
173 : void exportView3D();
174 : sal_Bool isDeep3dChart();
175 :
176 : public:
177 :
178 : 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 );
179 2 : virtual ~ChartExport() {}
180 :
181 : sal_Int32 GetChartID( );
182 14 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > getModel(){ return mxChartModel; }
183 :
184 : virtual ChartExport& WriteChartObj( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape, sal_Int32 nChartCount );
185 :
186 : void ExportContent();
187 : void InitRangeSegmentationProperties(
188 : const ::com::sun::star::uno::Reference<
189 : ::com::sun::star::chart2::XChartDocument > & xChartDoc );
190 : };
191 :
192 : }}
193 :
194 : #endif /* ndef _OOX_EXPORT_CHART_HXX_ */
195 :
196 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|