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 : #include "oox/drawingml/chart/typegroupcontext.hxx"
21 :
22 : #include "oox/drawingml/chart/seriescontext.hxx"
23 : #include "oox/drawingml/chart/typegroupmodel.hxx"
24 :
25 : namespace oox {
26 : namespace drawingml {
27 : namespace chart {
28 :
29 : // ============================================================================
30 :
31 : using ::oox::core::ContextHandler2Helper;
32 : using ::oox::core::ContextHandlerRef;
33 :
34 : // ============================================================================
35 :
36 0 : UpDownBarsContext::UpDownBarsContext( ContextHandler2Helper& rParent, UpDownBarsModel& rModel ) :
37 0 : ContextBase< UpDownBarsModel >( rParent, rModel )
38 : {
39 0 : }
40 :
41 0 : UpDownBarsContext::~UpDownBarsContext()
42 : {
43 0 : }
44 :
45 0 : ContextHandlerRef UpDownBarsContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
46 : {
47 0 : switch( getCurrentElement() )
48 : {
49 : case C_TOKEN( upDownBars ):
50 0 : switch( nElement )
51 : {
52 : case C_TOKEN( downBars ):
53 0 : return new ShapePrWrapperContext( *this, mrModel.mxDownBars.create() );
54 : case C_TOKEN( gapWidth ):
55 0 : mrModel.mnGapWidth = rAttribs.getInteger( XML_val, 150 );
56 0 : return 0;
57 : case C_TOKEN( upBars ):
58 0 : return new ShapePrWrapperContext( *this, mrModel.mxUpBars.create() );
59 : }
60 0 : break;
61 : }
62 0 : return 0;
63 : }
64 :
65 : // ============================================================================
66 :
67 0 : AreaTypeGroupContext::AreaTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
68 0 : TypeGroupContextBase( rParent, rModel )
69 : {
70 0 : }
71 :
72 0 : AreaTypeGroupContext::~AreaTypeGroupContext()
73 : {
74 0 : }
75 :
76 0 : ContextHandlerRef AreaTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
77 : {
78 0 : if( isRootElement() ) switch( nElement )
79 : {
80 : case C_TOKEN( axId ):
81 0 : mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
82 0 : return 0;
83 : case C_TOKEN( dLbls ):
84 0 : return new DataLabelsContext( *this, mrModel.mxLabels.create() );
85 : case C_TOKEN( dropLines ):
86 0 : return new ShapePrWrapperContext( *this, mrModel.mxDropLines.create() );
87 : case C_TOKEN( gapDepth ):
88 0 : mrModel.mnGapDepth = rAttribs.getInteger( XML_val, 150 );
89 0 : return 0;
90 : case C_TOKEN( grouping ):
91 0 : mrModel.mnGrouping = rAttribs.getToken( XML_val, XML_standard );
92 0 : return 0;
93 : case C_TOKEN( ser ):
94 0 : return new AreaSeriesContext( *this, mrModel.maSeries.create() );
95 : case C_TOKEN( varyColors ):
96 : // default is 'false', not 'true' as specified
97 0 : mrModel.mbVaryColors = rAttribs.getBool( XML_val, false );
98 0 : return 0;
99 : }
100 0 : return 0;
101 : }
102 :
103 : // ============================================================================
104 :
105 0 : BarTypeGroupContext::BarTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
106 0 : TypeGroupContextBase( rParent, rModel )
107 : {
108 0 : }
109 :
110 0 : BarTypeGroupContext::~BarTypeGroupContext()
111 : {
112 0 : }
113 :
114 0 : ContextHandlerRef BarTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
115 : {
116 0 : if( isRootElement() ) switch( nElement )
117 : {
118 : case C_TOKEN( axId ):
119 0 : mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
120 0 : return 0;
121 : case C_TOKEN( barDir ):
122 0 : mrModel.mnBarDir = rAttribs.getToken( XML_val, XML_col );
123 0 : return 0;
124 : case C_TOKEN( dLbls ):
125 0 : return new DataLabelsContext( *this, mrModel.mxLabels.create() );
126 : case C_TOKEN( gapDepth ):
127 0 : mrModel.mnGapDepth = rAttribs.getInteger( XML_val, 150 );
128 0 : return 0;
129 : case C_TOKEN( gapWidth ):
130 0 : mrModel.mnGapWidth = rAttribs.getInteger( XML_val, 150 );
131 0 : return 0;
132 : case C_TOKEN( grouping ):
133 : // default is 'standard', not 'clustered' as specified
134 0 : mrModel.mnGrouping = rAttribs.getToken( XML_val, XML_standard );
135 0 : return 0;
136 : case C_TOKEN( overlap ):
137 0 : mrModel.mnOverlap = rAttribs.getInteger( XML_val, 0 );
138 0 : return 0;
139 : case C_TOKEN( ser ):
140 0 : return new BarSeriesContext( *this, mrModel.maSeries.create() );
141 : case C_TOKEN( serLines ):
142 0 : return new ShapePrWrapperContext( *this, mrModel.mxSerLines.create() );
143 : case C_TOKEN( shape ):
144 0 : mrModel.mnShape = rAttribs.getToken( XML_val, XML_box );
145 0 : return 0;
146 : case C_TOKEN( varyColors ):
147 : // default is 'false', not 'true' as specified
148 0 : mrModel.mbVaryColors = rAttribs.getBool( XML_val, false );
149 0 : return 0;
150 : }
151 0 : return 0;
152 : }
153 :
154 : // ============================================================================
155 :
156 0 : BubbleTypeGroupContext::BubbleTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
157 0 : TypeGroupContextBase( rParent, rModel )
158 : {
159 0 : }
160 :
161 0 : BubbleTypeGroupContext::~BubbleTypeGroupContext()
162 : {
163 0 : }
164 :
165 0 : ContextHandlerRef BubbleTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
166 : {
167 0 : if( isRootElement() ) switch( nElement )
168 : {
169 : case C_TOKEN( axId ):
170 0 : mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
171 0 : return 0;
172 : case C_TOKEN( bubble3D ):
173 : // default is 'false', not 'true' as specified
174 0 : mrModel.mbBubble3d = rAttribs.getBool( XML_val, false );
175 0 : return 0;
176 : case C_TOKEN( bubbleScale ):
177 0 : mrModel.mnBubbleScale = rAttribs.getInteger( XML_val, 100 );
178 0 : return 0;
179 : case C_TOKEN( dLbls ):
180 0 : return new DataLabelsContext( *this, mrModel.mxLabels.create() );
181 : case C_TOKEN( ser ):
182 0 : return new BubbleSeriesContext( *this, mrModel.maSeries.create() );
183 : case C_TOKEN( showNegBubbles ):
184 : // default is 'false', not 'true' as specified
185 0 : mrModel.mbShowNegBubbles = rAttribs.getBool( XML_val, false );
186 0 : return 0;
187 : case C_TOKEN( sizeRepresents ):
188 0 : mrModel.mnSizeRepresents = rAttribs.getToken( XML_val, XML_area );
189 0 : return 0;
190 : case C_TOKEN( varyColors ):
191 : // default is 'false', not 'true' as specified
192 0 : mrModel.mbVaryColors = rAttribs.getBool( XML_val, false );
193 0 : return 0;
194 : }
195 0 : return 0;
196 : }
197 :
198 : // ============================================================================
199 :
200 0 : LineTypeGroupContext::LineTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
201 0 : TypeGroupContextBase( rParent, rModel )
202 : {
203 0 : }
204 :
205 0 : LineTypeGroupContext::~LineTypeGroupContext()
206 : {
207 0 : }
208 :
209 0 : ContextHandlerRef LineTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
210 : {
211 0 : if( isRootElement() ) switch( nElement )
212 : {
213 : case C_TOKEN( axId ):
214 0 : mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
215 0 : return 0;
216 : case C_TOKEN( dLbls ):
217 0 : return new DataLabelsContext( *this, mrModel.mxLabels.create() );
218 : case C_TOKEN( dropLines ):
219 0 : return new ShapePrWrapperContext( *this, mrModel.mxDropLines.create() );
220 : case C_TOKEN( gapDepth ):
221 0 : mrModel.mnGapDepth = rAttribs.getInteger( XML_val, 150 );
222 0 : return 0;
223 : case C_TOKEN( grouping ):
224 0 : mrModel.mnGrouping = rAttribs.getToken( XML_val, XML_standard );
225 0 : return 0;
226 : case C_TOKEN( hiLowLines ):
227 0 : return new ShapePrWrapperContext( *this, mrModel.mxHiLowLines.create() );
228 : case C_TOKEN( marker ):
229 : // default is 'false', not 'true' as specified
230 0 : mrModel.mbShowMarker = rAttribs.getBool( XML_val, false );
231 0 : return 0;
232 : case C_TOKEN( ser ):
233 0 : return new LineSeriesContext( *this, mrModel.maSeries.create() );
234 : case C_TOKEN( smooth ):
235 : // default is 'false', not 'true' as specified
236 0 : mrModel.mbSmooth = rAttribs.getBool( XML_val, false );
237 0 : return 0;
238 : case C_TOKEN( upDownBars ):
239 0 : return new UpDownBarsContext( *this, mrModel.mxUpDownBars.create() );
240 : case C_TOKEN( varyColors ):
241 : // default is 'false', not 'true' as specified
242 0 : mrModel.mbVaryColors = rAttribs.getBool( XML_val, false );
243 0 : return 0;
244 : }
245 0 : return 0;
246 : }
247 :
248 : // ============================================================================
249 :
250 0 : PieTypeGroupContext::PieTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
251 0 : TypeGroupContextBase( rParent, rModel )
252 : {
253 0 : }
254 :
255 0 : PieTypeGroupContext::~PieTypeGroupContext()
256 : {
257 0 : }
258 :
259 0 : ContextHandlerRef PieTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
260 : {
261 0 : if( isRootElement() ) switch( nElement )
262 : {
263 : case C_TOKEN( dLbls ):
264 0 : return new DataLabelsContext( *this, mrModel.mxLabels.create() );
265 : case C_TOKEN( firstSliceAng ):
266 0 : mrModel.mnFirstAngle = rAttribs.getInteger( XML_val, 0 );
267 0 : return 0;
268 : case C_TOKEN( gapWidth ):
269 0 : mrModel.mnGapWidth = rAttribs.getInteger( XML_val, 150 );
270 0 : return 0;
271 : case C_TOKEN( holeSize ):
272 0 : mrModel.mnHoleSize = rAttribs.getInteger( XML_val, 10 );
273 0 : return 0;
274 : case C_TOKEN( ofPieType ):
275 0 : mrModel.mnOfPieType = rAttribs.getToken( XML_val, XML_pie );
276 0 : return 0;
277 : case C_TOKEN( secondPieSize ):
278 0 : mrModel.mnSecondPieSize = rAttribs.getInteger( XML_val, 75 );
279 0 : return 0;
280 : case C_TOKEN( ser ):
281 0 : return new PieSeriesContext( *this, mrModel.maSeries.create() );
282 : case C_TOKEN( serLines ):
283 0 : return new ShapePrWrapperContext( *this, mrModel.mxSerLines.create() );
284 : case C_TOKEN( splitPos ):
285 0 : mrModel.mfSplitPos = rAttribs.getDouble( XML_val, 0.0 );
286 0 : return 0;
287 : case C_TOKEN( splitType ):
288 0 : mrModel.mnSplitType = rAttribs.getToken( XML_val, XML_auto );
289 0 : return 0;
290 : case C_TOKEN( varyColors ):
291 : // default is 'false', not 'true' as specified
292 0 : mrModel.mbVaryColors = rAttribs.getBool( XML_val, false );
293 0 : return 0;
294 : }
295 0 : return 0;
296 : }
297 :
298 : // ============================================================================
299 :
300 0 : RadarTypeGroupContext::RadarTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
301 0 : TypeGroupContextBase( rParent, rModel )
302 : {
303 0 : }
304 :
305 0 : RadarTypeGroupContext::~RadarTypeGroupContext()
306 : {
307 0 : }
308 :
309 0 : ContextHandlerRef RadarTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
310 : {
311 0 : if( isRootElement() ) switch( nElement )
312 : {
313 : case C_TOKEN( axId ):
314 0 : mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
315 0 : return 0;
316 : case C_TOKEN( dLbls ):
317 0 : return new DataLabelsContext( *this, mrModel.mxLabels.create() );
318 : case C_TOKEN( radarStyle ):
319 0 : mrModel.mnRadarStyle = rAttribs.getToken( XML_val, XML_standard );
320 0 : return 0;
321 : case C_TOKEN( ser ):
322 0 : return new RadarSeriesContext( *this, mrModel.maSeries.create() );
323 : case C_TOKEN( varyColors ):
324 : // default is 'false', not 'true' as specified
325 0 : mrModel.mbVaryColors = rAttribs.getBool( XML_val, false );
326 0 : return 0;
327 : }
328 0 : return 0;
329 : }
330 :
331 : // ============================================================================
332 :
333 0 : ScatterTypeGroupContext::ScatterTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
334 0 : TypeGroupContextBase( rParent, rModel )
335 : {
336 0 : }
337 :
338 0 : ScatterTypeGroupContext::~ScatterTypeGroupContext()
339 : {
340 0 : }
341 :
342 0 : ContextHandlerRef ScatterTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
343 : {
344 0 : if( isRootElement() ) switch( nElement )
345 : {
346 : case C_TOKEN( axId ):
347 0 : mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
348 0 : return 0;
349 : case C_TOKEN( dLbls ):
350 0 : return new DataLabelsContext( *this, mrModel.mxLabels.create() );
351 : case C_TOKEN( scatterStyle ):
352 0 : mrModel.mnScatterStyle = rAttribs.getInteger( XML_val, XML_marker );
353 0 : return 0;
354 : case C_TOKEN( ser ):
355 0 : return new ScatterSeriesContext( *this, mrModel.maSeries.create() );
356 : case C_TOKEN( varyColors ):
357 : // default is 'false', not 'true' as specified
358 0 : mrModel.mbVaryColors = rAttribs.getBool( XML_val, false );
359 0 : return 0;
360 : }
361 0 : return 0;
362 : }
363 :
364 : // ============================================================================
365 :
366 0 : SurfaceTypeGroupContext::SurfaceTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
367 0 : TypeGroupContextBase( rParent, rModel )
368 : {
369 0 : }
370 :
371 0 : SurfaceTypeGroupContext::~SurfaceTypeGroupContext()
372 : {
373 0 : }
374 :
375 0 : ContextHandlerRef SurfaceTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
376 : {
377 0 : if( isRootElement() ) switch( nElement )
378 : {
379 : case C_TOKEN( axId ):
380 0 : mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
381 0 : return 0;
382 : case C_TOKEN( ser ):
383 0 : return new SurfaceSeriesContext( *this, mrModel.maSeries.create() );
384 : case C_TOKEN( wireframe ):
385 : // default is 'false', not 'true' as specified
386 0 : mrModel.mbWireframe = rAttribs.getBool( XML_val, false );
387 0 : return 0;
388 : }
389 0 : return 0;
390 : }
391 :
392 : // ============================================================================
393 :
394 : } // namespace chart
395 : } // namespace drawingml
396 174 : } // namespace oox
397 :
398 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|