Update ooo320-m1
[ooovba.git] / oox / source / drawingml / chart / typegroupcontext.cxx
blobb2367dc87b8b3838ffa2bf48c413cf23f973b081
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: typegroupcontext.cxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include "oox/drawingml/chart/typegroupcontext.hxx"
32 #include "oox/drawingml/chart/seriescontext.hxx"
33 #include "oox/drawingml/chart/typegroupmodel.hxx"
35 using ::oox::core::ContextHandler2Helper;
36 using ::oox::core::ContextHandlerRef;
38 namespace oox {
39 namespace drawingml {
40 namespace chart {
42 // ============================================================================
44 UpDownBarsContext::UpDownBarsContext( ContextHandler2Helper& rParent, UpDownBarsModel& rModel ) :
45 ContextBase< UpDownBarsModel >( rParent, rModel )
49 UpDownBarsContext::~UpDownBarsContext()
53 ContextHandlerRef UpDownBarsContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
55 switch( getCurrentElement() )
57 case C_TOKEN( upDownBars ):
58 switch( nElement )
60 case C_TOKEN( downBars ):
61 return new ShapePrWrapperContext( *this, mrModel.mxDownBars.create() );
62 case C_TOKEN( gapWidth ):
63 mrModel.mnGapWidth = rAttribs.getInteger( XML_val, 150 );
64 return 0;
65 case C_TOKEN( upBars ):
66 return new ShapePrWrapperContext( *this, mrModel.mxUpBars.create() );
68 break;
70 return 0;
73 // ============================================================================
75 AreaTypeGroupContext::AreaTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
76 TypeGroupContextBase( rParent, rModel )
80 AreaTypeGroupContext::~AreaTypeGroupContext()
84 ContextHandlerRef AreaTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
86 if( isRootElement() ) switch( nElement )
88 case C_TOKEN( axId ):
89 mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
90 return 0;
91 case C_TOKEN( dLbls ):
92 return new DataLabelsContext( *this, mrModel.mxLabels.create() );
93 case C_TOKEN( dropLines ):
94 return new ShapePrWrapperContext( *this, mrModel.mxDropLines.create() );
95 case C_TOKEN( gapDepth ):
96 mrModel.mnGapDepth = rAttribs.getInteger( XML_val, 150 );
97 return 0;
98 case C_TOKEN( grouping ):
99 mrModel.mnGrouping = rAttribs.getToken( XML_val, XML_standard );
100 return 0;
101 case C_TOKEN( ser ):
102 return new AreaSeriesContext( *this, mrModel.maSeries.create() );
103 case C_TOKEN( varyColors ):
104 // default is 'false', not 'true' as specified
105 mrModel.mbVaryColors = rAttribs.getBool( XML_val, false );
106 return 0;
108 return 0;
111 // ============================================================================
113 BarTypeGroupContext::BarTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
114 TypeGroupContextBase( rParent, rModel )
118 BarTypeGroupContext::~BarTypeGroupContext()
122 ContextHandlerRef BarTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
124 if( isRootElement() ) switch( nElement )
126 case C_TOKEN( axId ):
127 mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
128 return 0;
129 case C_TOKEN( barDir ):
130 mrModel.mnBarDir = rAttribs.getToken( XML_val, XML_col );
131 return 0;
132 case C_TOKEN( dLbls ):
133 return new DataLabelsContext( *this, mrModel.mxLabels.create() );
134 case C_TOKEN( gapDepth ):
135 mrModel.mnGapDepth = rAttribs.getInteger( XML_val, 150 );
136 return 0;
137 case C_TOKEN( gapWidth ):
138 mrModel.mnGapWidth = rAttribs.getInteger( XML_val, 150 );
139 return 0;
140 case C_TOKEN( grouping ):
141 // default is 'standard', not 'clustered' as specified
142 mrModel.mnGrouping = rAttribs.getToken( XML_val, XML_standard );
143 return 0;
144 case C_TOKEN( overlap ):
145 mrModel.mnOverlap = rAttribs.getInteger( XML_val, 0 );
146 return 0;
147 case C_TOKEN( ser ):
148 return new BarSeriesContext( *this, mrModel.maSeries.create() );
149 case C_TOKEN( serLines ):
150 return new ShapePrWrapperContext( *this, mrModel.mxSerLines.create() );
151 case C_TOKEN( shape ):
152 mrModel.mnShape = rAttribs.getToken( XML_val, XML_box );
153 return 0;
154 case C_TOKEN( varyColors ):
155 // default is 'false', not 'true' as specified
156 mrModel.mbVaryColors = rAttribs.getBool( XML_val, false );
157 return 0;
159 return 0;
162 // ============================================================================
164 BubbleTypeGroupContext::BubbleTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
165 TypeGroupContextBase( rParent, rModel )
169 BubbleTypeGroupContext::~BubbleTypeGroupContext()
173 ContextHandlerRef BubbleTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
175 if( isRootElement() ) switch( nElement )
177 case C_TOKEN( axId ):
178 mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
179 return 0;
180 case C_TOKEN( bubble3D ):
181 // default is 'false', not 'true' as specified
182 mrModel.mbBubble3d = rAttribs.getBool( XML_val, false );
183 return 0;
184 case C_TOKEN( bubbleScale ):
185 mrModel.mnBubbleScale = rAttribs.getInteger( XML_val, 100 );
186 return 0;
187 case C_TOKEN( dLbls ):
188 return new DataLabelsContext( *this, mrModel.mxLabels.create() );
189 case C_TOKEN( ser ):
190 return new BubbleSeriesContext( *this, mrModel.maSeries.create() );
191 case C_TOKEN( showNegBubbles ):
192 // default is 'false', not 'true' as specified
193 mrModel.mbShowNegBubbles = rAttribs.getBool( XML_val, false );
194 return 0;
195 case C_TOKEN( sizeRepresents ):
196 mrModel.mnSizeRepresents = rAttribs.getToken( XML_val, XML_area );
197 return 0;
198 case C_TOKEN( varyColors ):
199 // default is 'false', not 'true' as specified
200 mrModel.mbVaryColors = rAttribs.getBool( XML_val, false );
201 return 0;
203 return 0;
206 // ============================================================================
208 LineTypeGroupContext::LineTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
209 TypeGroupContextBase( rParent, rModel )
213 LineTypeGroupContext::~LineTypeGroupContext()
217 ContextHandlerRef LineTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
219 if( isRootElement() ) switch( nElement )
221 case C_TOKEN( axId ):
222 mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
223 return 0;
224 case C_TOKEN( dLbls ):
225 return new DataLabelsContext( *this, mrModel.mxLabels.create() );
226 case C_TOKEN( dropLines ):
227 return new ShapePrWrapperContext( *this, mrModel.mxDropLines.create() );
228 case C_TOKEN( gapDepth ):
229 mrModel.mnGapDepth = rAttribs.getInteger( XML_val, 150 );
230 return 0;
231 case C_TOKEN( grouping ):
232 mrModel.mnGrouping = rAttribs.getToken( XML_val, XML_standard );
233 return 0;
234 case C_TOKEN( hiLowLines ):
235 return new ShapePrWrapperContext( *this, mrModel.mxHiLowLines.create() );
236 case C_TOKEN( marker ):
237 // default is 'false', not 'true' as specified
238 mrModel.mbShowMarker = rAttribs.getBool( XML_val, false );
239 return 0;
240 case C_TOKEN( ser ):
241 return new LineSeriesContext( *this, mrModel.maSeries.create() );
242 case C_TOKEN( smooth ):
243 // default is 'false', not 'true' as specified
244 mrModel.mbSmooth = rAttribs.getBool( XML_val, false );
245 return 0;
246 case C_TOKEN( upDownBars ):
247 return new UpDownBarsContext( *this, mrModel.mxUpDownBars.create() );
248 case C_TOKEN( varyColors ):
249 // default is 'false', not 'true' as specified
250 mrModel.mbVaryColors = rAttribs.getBool( XML_val, false );
251 return 0;
253 return 0;
256 // ============================================================================
258 PieTypeGroupContext::PieTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
259 TypeGroupContextBase( rParent, rModel )
263 PieTypeGroupContext::~PieTypeGroupContext()
267 ContextHandlerRef PieTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
269 if( isRootElement() ) switch( nElement )
271 case C_TOKEN( dLbls ):
272 return new DataLabelsContext( *this, mrModel.mxLabels.create() );
273 case C_TOKEN( firstSliceAng ):
274 mrModel.mnFirstAngle = rAttribs.getInteger( XML_val, 0 );
275 return 0;
276 case C_TOKEN( gapWidth ):
277 mrModel.mnGapWidth = rAttribs.getInteger( XML_val, 150 );
278 return 0;
279 case C_TOKEN( holeSize ):
280 mrModel.mnHoleSize = rAttribs.getInteger( XML_val, 10 );
281 return 0;
282 case C_TOKEN( ofPieType ):
283 mrModel.mnOfPieType = rAttribs.getToken( XML_val, XML_pie );
284 return 0;
285 case C_TOKEN( secondPieSize ):
286 mrModel.mnSecondPieSize = rAttribs.getInteger( XML_val, 75 );
287 return 0;
288 case C_TOKEN( ser ):
289 return new PieSeriesContext( *this, mrModel.maSeries.create() );
290 case C_TOKEN( serLines ):
291 return new ShapePrWrapperContext( *this, mrModel.mxSerLines.create() );
292 case C_TOKEN( splitPos ):
293 mrModel.mfSplitPos = rAttribs.getDouble( XML_val, 0.0 );
294 return 0;
295 case C_TOKEN( splitType ):
296 mrModel.mnSplitType = rAttribs.getToken( XML_val, XML_auto );
297 return 0;
298 case C_TOKEN( varyColors ):
299 // default is 'false', not 'true' as specified
300 mrModel.mbVaryColors = rAttribs.getBool( XML_val, false );
301 return 0;
303 return 0;
306 // ============================================================================
308 RadarTypeGroupContext::RadarTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
309 TypeGroupContextBase( rParent, rModel )
313 RadarTypeGroupContext::~RadarTypeGroupContext()
317 ContextHandlerRef RadarTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
319 if( isRootElement() ) switch( nElement )
321 case C_TOKEN( axId ):
322 mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
323 return 0;
324 case C_TOKEN( dLbls ):
325 return new DataLabelsContext( *this, mrModel.mxLabels.create() );
326 case C_TOKEN( radarStyle ):
327 mrModel.mnRadarStyle = rAttribs.getToken( XML_val, XML_standard );
328 return 0;
329 case C_TOKEN( ser ):
330 return new RadarSeriesContext( *this, mrModel.maSeries.create() );
331 case C_TOKEN( varyColors ):
332 // default is 'false', not 'true' as specified
333 mrModel.mbVaryColors = rAttribs.getBool( XML_val, false );
334 return 0;
336 return 0;
339 // ============================================================================
341 ScatterTypeGroupContext::ScatterTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
342 TypeGroupContextBase( rParent, rModel )
346 ScatterTypeGroupContext::~ScatterTypeGroupContext()
350 ContextHandlerRef ScatterTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
352 if( isRootElement() ) switch( nElement )
354 case C_TOKEN( axId ):
355 mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
356 return 0;
357 case C_TOKEN( dLbls ):
358 return new DataLabelsContext( *this, mrModel.mxLabels.create() );
359 case C_TOKEN( scatterStyle ):
360 mrModel.mnScatterStyle = rAttribs.getInteger( XML_val, XML_marker );
361 return 0;
362 case C_TOKEN( ser ):
363 return new ScatterSeriesContext( *this, mrModel.maSeries.create() );
364 case C_TOKEN( varyColors ):
365 // default is 'false', not 'true' as specified
366 mrModel.mbVaryColors = rAttribs.getBool( XML_val, false );
367 return 0;
369 return 0;
372 // ============================================================================
374 SurfaceTypeGroupContext::SurfaceTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
375 TypeGroupContextBase( rParent, rModel )
379 SurfaceTypeGroupContext::~SurfaceTypeGroupContext()
383 ContextHandlerRef SurfaceTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
385 if( isRootElement() ) switch( nElement )
387 case C_TOKEN( axId ):
388 mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
389 return 0;
390 case C_TOKEN( ser ):
391 return new SurfaceSeriesContext( *this, mrModel.maSeries.create() );
392 case C_TOKEN( wireframe ):
393 // default is 'false', not 'true' as specified
394 mrModel.mbWireframe = rAttribs.getBool( XML_val, false );
395 return 0;
397 return 0;
400 // ============================================================================
402 } // namespace chart
403 } // namespace drawingml
404 } // namespace oox