fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / oox / source / drawingml / chart / typegroupcontext.cxx
blobf3d29e58b886cde326b267db6be522f8422a67bf
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 "oox/drawingml/chart/typegroupcontext.hxx"
22 #include "oox/drawingml/chart/seriescontext.hxx"
23 #include "oox/drawingml/chart/typegroupmodel.hxx"
25 namespace oox {
26 namespace drawingml {
27 namespace chart {
29 // ============================================================================
31 using ::oox::core::ContextHandler2Helper;
32 using ::oox::core::ContextHandlerRef;
34 // ============================================================================
36 UpDownBarsContext::UpDownBarsContext( ContextHandler2Helper& rParent, UpDownBarsModel& rModel ) :
37 ContextBase< UpDownBarsModel >( rParent, rModel )
41 UpDownBarsContext::~UpDownBarsContext()
45 ContextHandlerRef UpDownBarsContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
47 switch( getCurrentElement() )
49 case C_TOKEN( upDownBars ):
50 switch( nElement )
52 case C_TOKEN( downBars ):
53 return new ShapePrWrapperContext( *this, mrModel.mxDownBars.create() );
54 case C_TOKEN( gapWidth ):
55 mrModel.mnGapWidth = rAttribs.getInteger( XML_val, 150 );
56 return 0;
57 case C_TOKEN( upBars ):
58 return new ShapePrWrapperContext( *this, mrModel.mxUpBars.create() );
60 break;
62 return 0;
65 // ============================================================================
67 AreaTypeGroupContext::AreaTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
68 TypeGroupContextBase( rParent, rModel )
72 AreaTypeGroupContext::~AreaTypeGroupContext()
76 ContextHandlerRef AreaTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
78 if( isRootElement() ) switch( nElement )
80 case C_TOKEN( axId ):
81 mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
82 return 0;
83 case C_TOKEN( dLbls ):
84 return new DataLabelsContext( *this, mrModel.mxLabels.create() );
85 case C_TOKEN( dropLines ):
86 return new ShapePrWrapperContext( *this, mrModel.mxDropLines.create() );
87 case C_TOKEN( gapDepth ):
88 mrModel.mnGapDepth = rAttribs.getInteger( XML_val, 150 );
89 return 0;
90 case C_TOKEN( grouping ):
91 mrModel.mnGrouping = rAttribs.getToken( XML_val, XML_standard );
92 return 0;
93 case C_TOKEN( ser ):
94 return new AreaSeriesContext( *this, mrModel.maSeries.create() );
95 case C_TOKEN( varyColors ):
96 // default is 'false', not 'true' as specified
97 mrModel.mbVaryColors = rAttribs.getBool( XML_val, false );
98 return 0;
100 return 0;
103 // ============================================================================
105 BarTypeGroupContext::BarTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
106 TypeGroupContextBase( rParent, rModel )
110 BarTypeGroupContext::~BarTypeGroupContext()
114 ContextHandlerRef BarTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
116 if( isRootElement() ) switch( nElement )
118 case C_TOKEN( axId ):
119 mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
120 return 0;
121 case C_TOKEN( barDir ):
122 mrModel.mnBarDir = rAttribs.getToken( XML_val, XML_col );
123 return 0;
124 case C_TOKEN( dLbls ):
125 return new DataLabelsContext( *this, mrModel.mxLabels.create() );
126 case C_TOKEN( gapDepth ):
127 mrModel.mnGapDepth = rAttribs.getInteger( XML_val, 150 );
128 return 0;
129 case C_TOKEN( gapWidth ):
130 mrModel.mnGapWidth = rAttribs.getInteger( XML_val, 150 );
131 return 0;
132 case C_TOKEN( grouping ):
133 // default is 'standard', not 'clustered' as specified
134 mrModel.mnGrouping = rAttribs.getToken( XML_val, XML_standard );
135 return 0;
136 case C_TOKEN( overlap ):
137 mrModel.mnOverlap = rAttribs.getInteger( XML_val, 0 );
138 return 0;
139 case C_TOKEN( ser ):
140 return new BarSeriesContext( *this, mrModel.maSeries.create() );
141 case C_TOKEN( serLines ):
142 return new ShapePrWrapperContext( *this, mrModel.mxSerLines.create() );
143 case C_TOKEN( shape ):
144 mrModel.mnShape = rAttribs.getToken( XML_val, XML_box );
145 return 0;
146 case C_TOKEN( varyColors ):
147 // default is 'false', not 'true' as specified
148 mrModel.mbVaryColors = rAttribs.getBool( XML_val, false );
149 return 0;
151 return 0;
154 // ============================================================================
156 BubbleTypeGroupContext::BubbleTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
157 TypeGroupContextBase( rParent, rModel )
161 BubbleTypeGroupContext::~BubbleTypeGroupContext()
165 ContextHandlerRef BubbleTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
167 if( isRootElement() ) switch( nElement )
169 case C_TOKEN( axId ):
170 mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
171 return 0;
172 case C_TOKEN( bubble3D ):
173 // default is 'false', not 'true' as specified
174 mrModel.mbBubble3d = rAttribs.getBool( XML_val, false );
175 return 0;
176 case C_TOKEN( bubbleScale ):
177 mrModel.mnBubbleScale = rAttribs.getInteger( XML_val, 100 );
178 return 0;
179 case C_TOKEN( dLbls ):
180 return new DataLabelsContext( *this, mrModel.mxLabels.create() );
181 case C_TOKEN( ser ):
182 return new BubbleSeriesContext( *this, mrModel.maSeries.create() );
183 case C_TOKEN( showNegBubbles ):
184 // default is 'false', not 'true' as specified
185 mrModel.mbShowNegBubbles = rAttribs.getBool( XML_val, false );
186 return 0;
187 case C_TOKEN( sizeRepresents ):
188 mrModel.mnSizeRepresents = rAttribs.getToken( XML_val, XML_area );
189 return 0;
190 case C_TOKEN( varyColors ):
191 // default is 'false', not 'true' as specified
192 mrModel.mbVaryColors = rAttribs.getBool( XML_val, false );
193 return 0;
195 return 0;
198 // ============================================================================
200 LineTypeGroupContext::LineTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
201 TypeGroupContextBase( rParent, rModel )
205 LineTypeGroupContext::~LineTypeGroupContext()
209 ContextHandlerRef LineTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
211 if( isRootElement() ) switch( nElement )
213 case C_TOKEN( axId ):
214 mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
215 return 0;
216 case C_TOKEN( dLbls ):
217 return new DataLabelsContext( *this, mrModel.mxLabels.create() );
218 case C_TOKEN( dropLines ):
219 return new ShapePrWrapperContext( *this, mrModel.mxDropLines.create() );
220 case C_TOKEN( gapDepth ):
221 mrModel.mnGapDepth = rAttribs.getInteger( XML_val, 150 );
222 return 0;
223 case C_TOKEN( grouping ):
224 mrModel.mnGrouping = rAttribs.getToken( XML_val, XML_standard );
225 return 0;
226 case C_TOKEN( hiLowLines ):
227 return new ShapePrWrapperContext( *this, mrModel.mxHiLowLines.create() );
228 case C_TOKEN( marker ):
229 // default is 'false', not 'true' as specified
230 mrModel.mbShowMarker = rAttribs.getBool( XML_val, false );
231 return 0;
232 case C_TOKEN( ser ):
233 return new LineSeriesContext( *this, mrModel.maSeries.create() );
234 case C_TOKEN( smooth ):
235 // default is 'false', not 'true' as specified
236 mrModel.mbSmooth = rAttribs.getBool( XML_val, false );
237 return 0;
238 case C_TOKEN( upDownBars ):
239 return new UpDownBarsContext( *this, mrModel.mxUpDownBars.create() );
240 case C_TOKEN( varyColors ):
241 // default is 'false', not 'true' as specified
242 mrModel.mbVaryColors = rAttribs.getBool( XML_val, false );
243 return 0;
245 return 0;
248 // ============================================================================
250 PieTypeGroupContext::PieTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
251 TypeGroupContextBase( rParent, rModel )
255 PieTypeGroupContext::~PieTypeGroupContext()
259 ContextHandlerRef PieTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
261 if( isRootElement() ) switch( nElement )
263 case C_TOKEN( dLbls ):
264 return new DataLabelsContext( *this, mrModel.mxLabels.create() );
265 case C_TOKEN( firstSliceAng ):
266 mrModel.mnFirstAngle = rAttribs.getInteger( XML_val, 0 );
267 return 0;
268 case C_TOKEN( gapWidth ):
269 mrModel.mnGapWidth = rAttribs.getInteger( XML_val, 150 );
270 return 0;
271 case C_TOKEN( holeSize ):
272 mrModel.mnHoleSize = rAttribs.getInteger( XML_val, 10 );
273 return 0;
274 case C_TOKEN( ofPieType ):
275 mrModel.mnOfPieType = rAttribs.getToken( XML_val, XML_pie );
276 return 0;
277 case C_TOKEN( secondPieSize ):
278 mrModel.mnSecondPieSize = rAttribs.getInteger( XML_val, 75 );
279 return 0;
280 case C_TOKEN( ser ):
281 return new PieSeriesContext( *this, mrModel.maSeries.create() );
282 case C_TOKEN( serLines ):
283 return new ShapePrWrapperContext( *this, mrModel.mxSerLines.create() );
284 case C_TOKEN( splitPos ):
285 mrModel.mfSplitPos = rAttribs.getDouble( XML_val, 0.0 );
286 return 0;
287 case C_TOKEN( splitType ):
288 mrModel.mnSplitType = rAttribs.getToken( XML_val, XML_auto );
289 return 0;
290 case C_TOKEN( varyColors ):
291 // default is 'false', not 'true' as specified
292 mrModel.mbVaryColors = rAttribs.getBool( XML_val, false );
293 return 0;
295 return 0;
298 // ============================================================================
300 RadarTypeGroupContext::RadarTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
301 TypeGroupContextBase( rParent, rModel )
305 RadarTypeGroupContext::~RadarTypeGroupContext()
309 ContextHandlerRef RadarTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
311 if( isRootElement() ) switch( nElement )
313 case C_TOKEN( axId ):
314 mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
315 return 0;
316 case C_TOKEN( dLbls ):
317 return new DataLabelsContext( *this, mrModel.mxLabels.create() );
318 case C_TOKEN( radarStyle ):
319 mrModel.mnRadarStyle = rAttribs.getToken( XML_val, XML_standard );
320 return 0;
321 case C_TOKEN( ser ):
322 return new RadarSeriesContext( *this, mrModel.maSeries.create() );
323 case C_TOKEN( varyColors ):
324 // default is 'false', not 'true' as specified
325 mrModel.mbVaryColors = rAttribs.getBool( XML_val, false );
326 return 0;
328 return 0;
331 // ============================================================================
333 ScatterTypeGroupContext::ScatterTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
334 TypeGroupContextBase( rParent, rModel )
338 ScatterTypeGroupContext::~ScatterTypeGroupContext()
342 ContextHandlerRef ScatterTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
344 if( isRootElement() ) switch( nElement )
346 case C_TOKEN( axId ):
347 mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
348 return 0;
349 case C_TOKEN( dLbls ):
350 return new DataLabelsContext( *this, mrModel.mxLabels.create() );
351 case C_TOKEN( scatterStyle ):
352 mrModel.mnScatterStyle = rAttribs.getInteger( XML_val, XML_marker );
353 return 0;
354 case C_TOKEN( ser ):
355 return new ScatterSeriesContext( *this, mrModel.maSeries.create() );
356 case C_TOKEN( varyColors ):
357 // default is 'false', not 'true' as specified
358 mrModel.mbVaryColors = rAttribs.getBool( XML_val, false );
359 return 0;
361 return 0;
364 // ============================================================================
366 SurfaceTypeGroupContext::SurfaceTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
367 TypeGroupContextBase( rParent, rModel )
371 SurfaceTypeGroupContext::~SurfaceTypeGroupContext()
375 ContextHandlerRef SurfaceTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
377 if( isRootElement() ) switch( nElement )
379 case C_TOKEN( axId ):
380 mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
381 return 0;
382 case C_TOKEN( ser ):
383 return new SurfaceSeriesContext( *this, mrModel.maSeries.create() );
384 case C_TOKEN( wireframe ):
385 // default is 'false', not 'true' as specified
386 mrModel.mbWireframe = rAttribs.getBool( XML_val, false );
387 return 0;
389 return 0;
392 // ============================================================================
394 } // namespace chart
395 } // namespace drawingml
396 } // namespace oox
398 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */