Branch data 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 <sax/fshelper.hxx>
27 : : #include <vcl/mapmod.hxx>
28 : : #include <boost/unordered_map.hpp>
29 : : #include <map>
30 : :
31 : : namespace com { namespace sun { namespace star {
32 : : namespace chart {
33 : : class XDiagram;
34 : : class XChartDocument;
35 : : class XChartDataArray;
36 : : struct ChartSeriesAddress;
37 : : }
38 : : namespace chart2 {
39 : : class XDiagram;
40 : : class XChartDocument;
41 : : class XDataSeries;
42 : : class XChartType;
43 : : namespace data
44 : : {
45 : : class XDataProvider;
46 : : class XDataSequence;
47 : : }
48 : : }
49 : : namespace drawing {
50 : : class XShape;
51 : : class XShapes;
52 : : }
53 : : namespace task {
54 : : class XStatusIndicator;
55 : : }
56 : : namespace frame {
57 : : class XModel;
58 : : }
59 : : }}}
60 : :
61 : : namespace oox { namespace drawingml {
62 : :
63 : : const sal_Int32 AXIS_PRIMARY_X = 1;
64 : : const sal_Int32 AXIS_PRIMARY_Y = 2;
65 : : const sal_Int32 AXIS_PRIMARY_Z = 3;
66 : : const sal_Int32 AXIS_SECONDARY_X = 4;
67 : : const sal_Int32 AXIS_SECONDARY_Y = 5;
68 : :
69 : : struct AxisIdPair{
70 : : sal_Int32 nAxisType;
71 : : sal_Int32 nAxisId;
72 : : sal_Int32 nCrossAx;
73 : :
74 : 0 : AxisIdPair( sal_Int32 nType, sal_Int32 nId, sal_Int32 nAx ): nAxisType( nType ),nAxisId( nId ),nCrossAx( nAx ) {}
75 : : };
76 : :
77 : : class OOX_DLLPUBLIC ChartExport : public DrawingML {
78 : :
79 : : public:
80 : : // first: data sequence for label, second: data sequence for values.
81 : : typedef ::std::vector< AxisIdPair > AxisVector;
82 : :
83 : : private:
84 : : sal_Int32 mnXmlNamespace;
85 : : Fraction maFraction;
86 : : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxChartModel;
87 : : com::sun::star::uno::Reference< com::sun::star::chart::XDiagram > mxDiagram;
88 : : com::sun::star::uno::Reference< com::sun::star::chart2::XDiagram > mxNewDiagram;
89 : :
90 : : rtl::OUString msTableName;
91 : : rtl::OUStringBuffer msStringBuffer;
92 : : rtl::OUString msString;
93 : :
94 : : // members filled by InitRangeSegmentationProperties (retrieved from DataProvider)
95 : : sal_Bool mbHasSeriesLabels;
96 : : sal_Bool mbHasCategoryLabels; //if the categories are only automatically generated this will be false
97 : : sal_Bool mbRowSourceColumns;
98 : : rtl::OUString msChartAddress;
99 : : rtl::OUString msTableNumberList;
100 : : ::com::sun::star::uno::Sequence< sal_Int32 > maSequenceMapping;
101 : :
102 : : //::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > mxAdditionalShapes;
103 : : ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > mxCategoriesValues;
104 : :
105 : : AxisVector maAxes;
106 : : sal_Bool mbHasXAxis;
107 : : sal_Bool mbHasYAxis;
108 : : sal_Bool mbHasZAxis;
109 : : sal_Bool mbHasSecondaryXAxis;
110 : : sal_Bool mbHasSecondaryYAxis;
111 : : sal_Bool mbIs3DChart;
112 : :
113 : :
114 : : private:
115 : : sal_Int32 getChartType(
116 : : );
117 : :
118 : : rtl::OUString parseFormula( const rtl::OUString& rRange );
119 : : void InitPlotArea();
120 : :
121 : : void _ExportContent();
122 : : void exportChartSpace( com::sun::star::uno::Reference<
123 : : com::sun::star::chart::XChartDocument > rChartDoc,
124 : : sal_Bool bIncludeTable );
125 : : void exportChart( com::sun::star::uno::Reference<
126 : : com::sun::star::chart::XChartDocument > rChartDoc );
127 : : void exportLegend( com::sun::star::uno::Reference<
128 : : com::sun::star::chart::XChartDocument > rChartDoc );
129 : : void exportTitle( com::sun::star::uno::Reference<
130 : : ::com::sun::star::drawing::XShape > xShape );
131 : : void exportPlotArea( );
132 : :
133 : : void exportAreaChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
134 : : void exportBarChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
135 : : void exportBubbleChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
136 : : void exportDoughnutChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
137 : : void exportLineChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
138 : : void exportOfPieChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
139 : : void exportPieChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
140 : : void exportRadarChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
141 : : void exportScatterChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
142 : : void exportStockChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
143 : : void exportSuffaceChart( 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 : : sal_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 exportGrouping( sal_Bool isBar = sal_False );
162 : : void exportMarker();
163 : : void exportSmooth();
164 : : void exportFirstSliceAng();
165 : :
166 : : void exportAxes( );
167 : : void exportAxis( AxisIdPair aAxisIdPair );
168 : : void _exportAxis(
169 : : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xAxisProp,
170 : : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xAxisTitle,
171 : : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xMajorGrid,
172 : : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xMinorGrid,
173 : : sal_Int32 nAxisType,
174 : : const char* sAxisPos,
175 : : AxisIdPair aAxisIdPair );
176 : : void exportAxesId( sal_Int32 nAttachedAxis );
177 : : void exportView3D();
178 : : sal_Bool isDeep3dChart();
179 : :
180 : : public:
181 : :
182 : : 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 );
183 [ # # ][ # # ]: 0 : virtual ~ChartExport() {}
184 : :
185 : : sal_Int32 GetChartID( );
186 : 0 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > getModel(){ return mxChartModel; }
187 : :
188 : : virtual ChartExport& WriteChartObj( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape, sal_Int32 nChartCount );
189 : :
190 : : void ExportContent();
191 : : void InitRangeSegmentationProperties(
192 : : const ::com::sun::star::uno::Reference<
193 : : ::com::sun::star::chart2::XChartDocument > & xChartDoc );
194 : : };
195 : :
196 : : }}
197 : :
198 : : #endif /* ndef _OOX_EXPORT_CHART_HXX_ */
199 : :
200 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|