fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / oox / source / drawingml / chart / typegroupcontext.cxx
blob2dc3d35e30d417830dce7095e7de94c9351231a8
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "drawingml/chart/typegroupcontext.hxx"
22 #include "drawingml/chart/seriescontext.hxx"
23 #include "drawingml/chart/typegroupmodel.hxx"
25 namespace oox {
26 namespace drawingml {
27 namespace chart {
29 using ::oox::core::ContextHandler2Helper;
30 using ::oox::core::ContextHandlerRef;
32 UpDownBarsContext::UpDownBarsContext( ContextHandler2Helper& rParent, UpDownBarsModel& rModel ) :
33 ContextBase< UpDownBarsModel >( rParent, rModel )
37 UpDownBarsContext::~UpDownBarsContext()
41 ContextHandlerRef UpDownBarsContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
43 switch( getCurrentElement() )
45 case C_TOKEN( upDownBars ):
46 switch( nElement )
48 case C_TOKEN( downBars ):
49 return new ShapePrWrapperContext( *this, mrModel.mxDownBars.create() );
50 case C_TOKEN( gapWidth ):
51 mrModel.mnGapWidth = rAttribs.getInteger( XML_val, 150 );
52 return 0;
53 case C_TOKEN( upBars ):
54 return new ShapePrWrapperContext( *this, mrModel.mxUpBars.create() );
56 break;
58 return 0;
61 AreaTypeGroupContext::AreaTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
62 TypeGroupContextBase( rParent, rModel )
66 AreaTypeGroupContext::~AreaTypeGroupContext()
70 ContextHandlerRef AreaTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
72 bool bMSO2007Doc = getFilter().isMSO2007Document();
73 if( isRootElement() ) switch( nElement )
75 case C_TOKEN( axId ):
76 mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
77 return 0;
78 case C_TOKEN( dLbls ):
79 return new DataLabelsContext( *this, mrModel.mxLabels.create(bMSO2007Doc) );
80 case C_TOKEN( dropLines ):
81 return new ShapePrWrapperContext( *this, mrModel.mxDropLines.create() );
82 case C_TOKEN( gapDepth ):
83 mrModel.mnGapDepth = rAttribs.getInteger( XML_val, 150 );
84 return 0;
85 case C_TOKEN( grouping ):
86 mrModel.mnGrouping = rAttribs.getToken( XML_val, bMSO2007Doc ? XML_standard : XML_clustered );
87 return 0;
88 case C_TOKEN( ser ):
89 return new AreaSeriesContext( *this, mrModel.maSeries.create(bMSO2007Doc) );
90 case C_TOKEN( varyColors ):
91 mrModel.mbVaryColors = rAttribs.getBool( XML_val, !bMSO2007Doc );
92 return 0;
94 return 0;
97 BarTypeGroupContext::BarTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
98 TypeGroupContextBase( rParent, rModel )
102 BarTypeGroupContext::~BarTypeGroupContext()
106 ContextHandlerRef BarTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
108 bool bMSO2007Doc = getFilter().isMSO2007Document();
109 if( isRootElement() ) switch( nElement )
111 case C_TOKEN( axId ):
112 mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
113 return 0;
114 case C_TOKEN( barDir ):
115 mrModel.mnBarDir = rAttribs.getToken( XML_val, XML_col );
116 return 0;
117 case C_TOKEN( dLbls ):
118 return new DataLabelsContext( *this, mrModel.mxLabels.create(bMSO2007Doc) );
119 case C_TOKEN( gapDepth ):
120 mrModel.mnGapDepth = rAttribs.getInteger( XML_val, 150 );
121 return 0;
122 case C_TOKEN( gapWidth ):
123 mrModel.mnGapWidth = rAttribs.getInteger( XML_val, 150 );
124 return 0;
125 case C_TOKEN( grouping ):
126 mrModel.mnGrouping = rAttribs.getToken( XML_val, bMSO2007Doc ? XML_standard : XML_clustered );
127 return 0;
128 case C_TOKEN( overlap ):
129 mrModel.mnOverlap = rAttribs.getInteger( XML_val, 0 );
130 return 0;
131 case C_TOKEN( ser ):
132 return new BarSeriesContext( *this, mrModel.maSeries.create(bMSO2007Doc) );
133 case C_TOKEN( serLines ):
134 return new ShapePrWrapperContext( *this, mrModel.mxSerLines.create() );
135 case C_TOKEN( shape ):
136 mrModel.mnShape = rAttribs.getToken( XML_val, XML_box );
137 return 0;
138 case C_TOKEN( varyColors ):
139 mrModel.mbVaryColors = rAttribs.getBool( XML_val, !bMSO2007Doc );
140 return 0;
142 return 0;
145 BubbleTypeGroupContext::BubbleTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
146 TypeGroupContextBase( rParent, rModel )
150 BubbleTypeGroupContext::~BubbleTypeGroupContext()
154 ContextHandlerRef BubbleTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
156 bool bMSO2007Doc = getFilter().isMSO2007Document();
157 if( isRootElement() ) switch( nElement )
159 case C_TOKEN( axId ):
160 mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
161 return 0;
162 case C_TOKEN( bubble3D ):
163 mrModel.mbBubble3d = rAttribs.getBool( XML_val, !bMSO2007Doc );
164 return 0;
165 case C_TOKEN( bubbleScale ):
166 mrModel.mnBubbleScale = rAttribs.getInteger( XML_val, 100 );
167 return 0;
168 case C_TOKEN( dLbls ):
169 return new DataLabelsContext( *this, mrModel.mxLabels.create(bMSO2007Doc) );
170 case C_TOKEN( ser ):
171 return new BubbleSeriesContext( *this, mrModel.maSeries.create(bMSO2007Doc) );
172 case C_TOKEN( showNegBubbles ):
173 mrModel.mbShowNegBubbles = rAttribs.getBool( XML_val, !bMSO2007Doc );
174 return 0;
175 case C_TOKEN( sizeRepresents ):
176 mrModel.mnSizeRepresents = rAttribs.getToken( XML_val, XML_area );
177 return 0;
178 case C_TOKEN( varyColors ):
179 mrModel.mbVaryColors = rAttribs.getBool( XML_val, !bMSO2007Doc );
180 return 0;
182 return 0;
185 LineTypeGroupContext::LineTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
186 TypeGroupContextBase( rParent, rModel )
190 LineTypeGroupContext::~LineTypeGroupContext()
194 ContextHandlerRef LineTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
196 bool bMSO2007Doc = getFilter().isMSO2007Document();
197 if( isRootElement() ) switch( nElement )
199 case C_TOKEN( axId ):
200 mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
201 return 0;
202 case C_TOKEN( dLbls ):
203 return new DataLabelsContext( *this, mrModel.mxLabels.create(bMSO2007Doc) );
204 case C_TOKEN( dropLines ):
205 return new ShapePrWrapperContext( *this, mrModel.mxDropLines.create() );
206 case C_TOKEN( gapDepth ):
207 mrModel.mnGapDepth = rAttribs.getInteger( XML_val, 150 );
208 return 0;
209 case C_TOKEN( grouping ):
210 mrModel.mnGrouping = rAttribs.getToken( XML_val, bMSO2007Doc ? XML_standard : XML_clustered );
211 return 0;
212 case C_TOKEN( hiLowLines ):
213 return new ShapePrWrapperContext( *this, mrModel.mxHiLowLines.create() );
214 case C_TOKEN( marker ):
215 mrModel.mbShowMarker = rAttribs.getBool( XML_val, !bMSO2007Doc );
216 return 0;
217 case C_TOKEN( ser ):
218 return new LineSeriesContext( *this, mrModel.maSeries.create(bMSO2007Doc) );
219 case C_TOKEN( smooth ):
220 mrModel.mbSmooth = rAttribs.getBool( XML_val, !bMSO2007Doc );
221 return 0;
222 case C_TOKEN( upDownBars ):
223 return new UpDownBarsContext( *this, mrModel.mxUpDownBars.create() );
224 case C_TOKEN( varyColors ):
225 mrModel.mbVaryColors = rAttribs.getBool( XML_val, !bMSO2007Doc );
226 return 0;
228 return 0;
231 PieTypeGroupContext::PieTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
232 TypeGroupContextBase( rParent, rModel )
236 PieTypeGroupContext::~PieTypeGroupContext()
240 ContextHandlerRef PieTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
242 bool bMSO2007Doc = getFilter().isMSO2007Document();
243 if( isRootElement() ) switch( nElement )
245 case C_TOKEN( dLbls ):
246 return new DataLabelsContext( *this, mrModel.mxLabels.create(bMSO2007Doc) );
247 case C_TOKEN( firstSliceAng ):
248 mrModel.mnFirstAngle = rAttribs.getInteger( XML_val, 0 );
249 return 0;
250 case C_TOKEN( gapWidth ):
251 mrModel.mnGapWidth = rAttribs.getInteger( XML_val, 150 );
252 return 0;
253 case C_TOKEN( holeSize ):
254 mrModel.mnHoleSize = rAttribs.getInteger( XML_val, 10 );
255 return 0;
256 case C_TOKEN( ofPieType ):
257 mrModel.mnOfPieType = rAttribs.getToken( XML_val, XML_pie );
258 return 0;
259 case C_TOKEN( secondPieSize ):
260 mrModel.mnSecondPieSize = rAttribs.getInteger( XML_val, 75 );
261 return 0;
262 case C_TOKEN( ser ):
263 return new PieSeriesContext( *this, mrModel.maSeries.create(bMSO2007Doc) );
264 case C_TOKEN( serLines ):
265 return new ShapePrWrapperContext( *this, mrModel.mxSerLines.create() );
266 case C_TOKEN( splitPos ):
267 mrModel.mfSplitPos = rAttribs.getDouble( XML_val, 0.0 );
268 return 0;
269 case C_TOKEN( splitType ):
270 mrModel.mnSplitType = rAttribs.getToken( XML_val, XML_auto );
271 return 0;
272 case C_TOKEN( varyColors ):
273 mrModel.mbVaryColors = rAttribs.getBool( XML_val, !bMSO2007Doc );
274 return 0;
276 return 0;
279 RadarTypeGroupContext::RadarTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
280 TypeGroupContextBase( rParent, rModel )
284 RadarTypeGroupContext::~RadarTypeGroupContext()
288 ContextHandlerRef RadarTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
290 bool bMSO2007Doc = getFilter().isMSO2007Document();
291 if( isRootElement() ) switch( nElement )
293 case C_TOKEN( axId ):
294 mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
295 return 0;
296 case C_TOKEN( dLbls ):
297 return new DataLabelsContext( *this, mrModel.mxLabels.create(bMSO2007Doc) );
298 case C_TOKEN( radarStyle ):
299 mrModel.mnRadarStyle = rAttribs.getToken( XML_val, XML_standard );
300 return 0;
301 case C_TOKEN( ser ):
302 return new RadarSeriesContext( *this, mrModel.maSeries.create(bMSO2007Doc) );
303 case C_TOKEN( varyColors ):
304 mrModel.mbVaryColors = rAttribs.getBool( XML_val, !bMSO2007Doc );
305 return 0;
307 return 0;
310 ScatterTypeGroupContext::ScatterTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
311 TypeGroupContextBase( rParent, rModel )
315 ScatterTypeGroupContext::~ScatterTypeGroupContext()
319 ContextHandlerRef ScatterTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
321 bool bMSO2007Doc = getFilter().isMSO2007Document();
322 if( isRootElement() ) switch( nElement )
324 case C_TOKEN( axId ):
325 mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
326 return 0;
327 case C_TOKEN( dLbls ):
328 return new DataLabelsContext( *this, mrModel.mxLabels.create(bMSO2007Doc) );
329 case C_TOKEN( scatterStyle ):
330 mrModel.mnScatterStyle = rAttribs.getInteger( XML_val, XML_marker );
331 return 0;
332 case C_TOKEN( ser ):
333 return new ScatterSeriesContext( *this, mrModel.maSeries.create(bMSO2007Doc) );
334 case C_TOKEN( varyColors ):
335 mrModel.mbVaryColors = rAttribs.getBool( XML_val, !bMSO2007Doc );
336 return 0;
338 return 0;
341 SurfaceTypeGroupContext::SurfaceTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
342 TypeGroupContextBase( rParent, rModel )
346 SurfaceTypeGroupContext::~SurfaceTypeGroupContext()
350 ContextHandlerRef SurfaceTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
352 bool bMSO2007Doc = getFilter().isMSO2007Document();
353 if( isRootElement() ) switch( nElement )
355 case C_TOKEN( axId ):
356 mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
357 return 0;
358 case C_TOKEN( ser ):
359 return new SurfaceSeriesContext( *this, mrModel.maSeries.create(bMSO2007Doc) );
360 case C_TOKEN( wireframe ):
361 mrModel.mbWireframe = rAttribs.getBool( XML_val, !bMSO2007Doc );
362 return 0;
364 return 0;
367 } // namespace chart
368 } // namespace drawingml
369 } // namespace oox
371 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */