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