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