1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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"
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
):
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 );
57 case C_TOKEN( upBars
):
58 return new ShapePrWrapperContext( *this, mrModel
.mxUpBars
.create() );
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
)
81 mrModel
.maAxisIds
.push_back( rAttribs
.getInteger( XML_val
, -1 ) );
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 );
90 case C_TOKEN( grouping
):
91 mrModel
.mnGrouping
= rAttribs
.getToken( XML_val
, XML_standard
);
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 );
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 ) );
121 case C_TOKEN( barDir
):
122 mrModel
.mnBarDir
= rAttribs
.getToken( XML_val
, XML_col
);
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 );
129 case C_TOKEN( gapWidth
):
130 mrModel
.mnGapWidth
= rAttribs
.getInteger( XML_val
, 150 );
132 case C_TOKEN( grouping
):
133 // default is 'standard', not 'clustered' as specified
134 mrModel
.mnGrouping
= rAttribs
.getToken( XML_val
, XML_standard
);
136 case C_TOKEN( overlap
):
137 mrModel
.mnOverlap
= rAttribs
.getInteger( XML_val
, 0 );
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
);
146 case C_TOKEN( varyColors
):
147 // default is 'false', not 'true' as specified
148 mrModel
.mbVaryColors
= rAttribs
.getBool( XML_val
, false );
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 ) );
172 case C_TOKEN( bubble3D
):
173 // default is 'false', not 'true' as specified
174 mrModel
.mbBubble3d
= rAttribs
.getBool( XML_val
, false );
176 case C_TOKEN( bubbleScale
):
177 mrModel
.mnBubbleScale
= rAttribs
.getInteger( XML_val
, 100 );
179 case C_TOKEN( dLbls
):
180 return new DataLabelsContext( *this, mrModel
.mxLabels
.create() );
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 );
187 case C_TOKEN( sizeRepresents
):
188 mrModel
.mnSizeRepresents
= rAttribs
.getToken( XML_val
, XML_area
);
190 case C_TOKEN( varyColors
):
191 // default is 'false', not 'true' as specified
192 mrModel
.mbVaryColors
= rAttribs
.getBool( XML_val
, false );
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 ) );
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 );
223 case C_TOKEN( grouping
):
224 mrModel
.mnGrouping
= rAttribs
.getToken( XML_val
, XML_standard
);
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 );
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 );
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 );
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 );
268 case C_TOKEN( gapWidth
):
269 mrModel
.mnGapWidth
= rAttribs
.getInteger( XML_val
, 150 );
271 case C_TOKEN( holeSize
):
272 mrModel
.mnHoleSize
= rAttribs
.getInteger( XML_val
, 10 );
274 case C_TOKEN( ofPieType
):
275 mrModel
.mnOfPieType
= rAttribs
.getToken( XML_val
, XML_pie
);
277 case C_TOKEN( secondPieSize
):
278 mrModel
.mnSecondPieSize
= rAttribs
.getInteger( XML_val
, 75 );
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 );
287 case C_TOKEN( splitType
):
288 mrModel
.mnSplitType
= rAttribs
.getToken( XML_val
, XML_auto
);
290 case C_TOKEN( varyColors
):
291 // default is 'false', not 'true' as specified
292 mrModel
.mbVaryColors
= rAttribs
.getBool( XML_val
, false );
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 ) );
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
);
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 );
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 ) );
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
);
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 );
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 ) );
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 );
392 // ============================================================================
395 } // namespace drawingml
398 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */