Branch data 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/seriescontext.hxx"
21 : :
22 : : #include "oox/drawingml/shapepropertiescontext.hxx"
23 : : #include "oox/drawingml/textbodycontext.hxx"
24 : : #include "oox/drawingml/chart/datasourcecontext.hxx"
25 : : #include "oox/drawingml/chart/seriesmodel.hxx"
26 : : #include "oox/drawingml/chart/titlecontext.hxx"
27 : :
28 : : namespace oox {
29 : : namespace drawingml {
30 : : namespace chart {
31 : :
32 : : // ============================================================================
33 : :
34 : : using ::oox::core::ContextHandler2;
35 : : using ::oox::core::ContextHandler2Helper;
36 : : using ::oox::core::ContextHandlerRef;
37 : : using ::rtl::OUString;
38 : :
39 : : // ============================================================================
40 : :
41 : : namespace {
42 : :
43 : 0 : ContextHandlerRef lclDataLabelSharedCreateContext( ContextHandler2& rContext,
44 : : sal_Int32 nElement, const AttributeList& rAttribs, DataLabelModelBase& orModel )
45 : : {
46 [ # # ][ # # : 0 : if( rContext.isRootElement() ) switch( nElement )
# # # # #
# # # # #
# ]
47 : : {
48 : : case C_TOKEN( delete ):
49 : : // default is 'false', not 'true' as specified
50 : 0 : orModel.mbDeleted = rAttribs.getBool( XML_val, false );
51 : 0 : return 0;
52 : : case C_TOKEN( dLblPos ):
53 [ # # ]: 0 : orModel.monLabelPos = rAttribs.getToken( XML_val, XML_TOKEN_INVALID );
54 : 0 : return 0;
55 : : case C_TOKEN( numFmt ):
56 : 0 : orModel.maNumberFormat.setAttributes( rAttribs );
57 : 0 : return 0;
58 : : case C_TOKEN( showBubbleSize ):
59 : 0 : orModel.mobShowBubbleSize = rAttribs.getBool( XML_val );
60 : 0 : return 0;
61 : : case C_TOKEN( showCatName ):
62 : 0 : orModel.mobShowCatName = rAttribs.getBool( XML_val );
63 : 0 : return 0;
64 : : case C_TOKEN( showLegendKey ):
65 : 0 : orModel.mobShowLegendKey = rAttribs.getBool( XML_val );
66 : 0 : return 0;
67 : : case C_TOKEN( showPercent ):
68 : 0 : orModel.mobShowPercent = rAttribs.getBool( XML_val );
69 : 0 : return 0;
70 : : case C_TOKEN( showSerName ):
71 : 0 : orModel.mobShowSerName = rAttribs.getBool( XML_val );
72 : 0 : return 0;
73 : : case C_TOKEN( showVal ):
74 : 0 : orModel.mobShowVal = rAttribs.getBool( XML_val );
75 : 0 : return 0;
76 : : case C_TOKEN( separator ):
77 : : // collect separator text in onCharacters()
78 : 0 : return &rContext;
79 : : case C_TOKEN( spPr ):
80 [ # # ]: 0 : return new ShapePropertiesContext( rContext, orModel.mxShapeProp.create() );
81 : : case C_TOKEN( txPr ):
82 [ # # ]: 0 : return new TextBodyContext( rContext, orModel.mxTextProp.create() );
83 : : }
84 : 0 : return 0;
85 : : }
86 : :
87 : 0 : void lclDataLabelSharedCharacters( ContextHandler2& rContext, const OUString& rChars, DataLabelModelBase& orModel )
88 : : {
89 [ # # ]: 0 : if( rContext.isCurrentElement( C_TOKEN( separator ) ) )
90 : 0 : orModel.moaSeparator = rChars;
91 : 0 : }
92 : :
93 : : } // namespace
94 : :
95 : : // ============================================================================
96 : :
97 : 0 : DataLabelContext::DataLabelContext( ContextHandler2Helper& rParent, DataLabelModel& rModel ) :
98 : 0 : ContextBase< DataLabelModel >( rParent, rModel )
99 : : {
100 : 0 : }
101 : :
102 : 0 : DataLabelContext::~DataLabelContext()
103 : : {
104 [ # # ]: 0 : }
105 : :
106 : 0 : ContextHandlerRef DataLabelContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
107 : : {
108 [ # # ]: 0 : if( isRootElement() ) switch( nElement )
[ # # # # ]
109 : : {
110 : : case C_TOKEN( idx ):
111 : 0 : mrModel.mnIndex = rAttribs.getInteger( XML_val, -1 );
112 : 0 : return 0;
113 : : case C_TOKEN( layout ):
114 [ # # ]: 0 : return new LayoutContext( *this, mrModel.mxLayout.create() );
115 : : case C_TOKEN( tx ):
116 [ # # ]: 0 : return new TextContext( *this, mrModel.mxText.create() );
117 : : }
118 : 0 : return lclDataLabelSharedCreateContext( *this, nElement, rAttribs, mrModel );
119 : : }
120 : :
121 : 0 : void DataLabelContext::onCharacters( const OUString& rChars )
122 : : {
123 : 0 : lclDataLabelSharedCharacters( *this, rChars, mrModel );
124 : 0 : }
125 : :
126 : : // ============================================================================
127 : :
128 : 0 : DataLabelsContext::DataLabelsContext( ContextHandler2Helper& rParent, DataLabelsModel& rModel ) :
129 : 0 : ContextBase< DataLabelsModel >( rParent, rModel )
130 : : {
131 : 0 : }
132 : :
133 : 0 : DataLabelsContext::~DataLabelsContext()
134 : : {
135 [ # # ]: 0 : }
136 : :
137 : 0 : ContextHandlerRef DataLabelsContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
138 : : {
139 [ # # ]: 0 : if( isRootElement() ) switch( nElement )
[ # # # # ]
140 : : {
141 : : case C_TOKEN( dLbl ):
142 [ # # ]: 0 : return new DataLabelContext( *this, mrModel.maPointLabels.create() );
143 : : case C_TOKEN( leaderLines ):
144 [ # # ]: 0 : return new ShapePrWrapperContext( *this, mrModel.mxLeaderLines.create() );
145 : : case C_TOKEN( showLeaderLines ):
146 : : // default is 'false', not 'true' as specified
147 : 0 : mrModel.mbShowLeaderLines = rAttribs.getBool( XML_val, false );
148 : 0 : return 0;
149 : : }
150 : 0 : return lclDataLabelSharedCreateContext( *this, nElement, rAttribs, mrModel );
151 : : }
152 : :
153 : 0 : void DataLabelsContext::onCharacters( const OUString& rChars )
154 : : {
155 : 0 : lclDataLabelSharedCharacters( *this, rChars, mrModel );
156 : 0 : }
157 : :
158 : : // ============================================================================
159 : :
160 : 0 : PictureOptionsContext::PictureOptionsContext( ContextHandler2Helper& rParent, PictureOptionsModel& rModel ) :
161 : 0 : ContextBase< PictureOptionsModel >( rParent, rModel )
162 : : {
163 : 0 : }
164 : :
165 : 0 : PictureOptionsContext::~PictureOptionsContext()
166 : : {
167 [ # # ]: 0 : }
168 : :
169 : 0 : ContextHandlerRef PictureOptionsContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
170 : : {
171 [ # # ][ # # : 0 : if( isRootElement() ) switch( nElement )
# # # # ]
172 : : {
173 : : case C_TOKEN( applyToEnd ):
174 : : // default is 'false', not 'true' as specified
175 : 0 : mrModel.mbApplyToEnd = rAttribs.getBool( XML_val, false );
176 : 0 : return 0;
177 : : case C_TOKEN( applyToFront ):
178 : : // default is 'false', not 'true' as specified
179 : 0 : mrModel.mbApplyToFront = rAttribs.getBool( XML_val, false );
180 : 0 : return 0;
181 : : case C_TOKEN( applyToSides ):
182 : : // default is 'false', not 'true' as specified
183 : 0 : mrModel.mbApplyToSides = rAttribs.getBool( XML_val, false );
184 : 0 : return 0;
185 : : case C_TOKEN( pictureFormat ):
186 : 0 : mrModel.mnPictureFormat = rAttribs.getToken( XML_val, XML_stretch );
187 : 0 : return 0;
188 : : case C_TOKEN( pictureStackUnit ):
189 : 0 : mrModel.mfStackUnit = rAttribs.getDouble( XML_val, 1.0 );
190 : 0 : return 0;
191 : : }
192 : 0 : return 0;
193 : : }
194 : :
195 : : // ============================================================================
196 : :
197 : 0 : ErrorBarContext::ErrorBarContext( ContextHandler2Helper& rParent, ErrorBarModel& rModel ) :
198 : 0 : ContextBase< ErrorBarModel >( rParent, rModel )
199 : : {
200 : 0 : }
201 : :
202 : 0 : ErrorBarContext::~ErrorBarContext()
203 : : {
204 [ # # ]: 0 : }
205 : :
206 : 0 : ContextHandlerRef ErrorBarContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
207 : : {
208 [ # # ][ # # : 0 : if( isRootElement() ) switch( nElement )
# # # # #
# # ]
209 : : {
210 : : case C_TOKEN( errBarType ):
211 : 0 : mrModel.mnTypeId = rAttribs.getToken( XML_val, XML_both );
212 : 0 : return 0;
213 : : case C_TOKEN( errDir ):
214 : 0 : mrModel.mnDirection = rAttribs.getToken( XML_val, XML_TOKEN_INVALID );
215 : 0 : return 0;
216 : : case C_TOKEN( errValType ):
217 : 0 : mrModel.mnValueType = rAttribs.getToken( XML_val, XML_fixedVal );
218 : 0 : return 0;
219 : : case C_TOKEN( minus ):
220 [ # # ]: 0 : return new DataSourceContext( *this, mrModel.maSources.create( ErrorBarModel::MINUS ) );
221 : : case C_TOKEN( noEndCap ):
222 : : // default is 'false', not 'true' as specified
223 : 0 : mrModel.mbNoEndCap = rAttribs.getBool( XML_val, false );
224 : 0 : return 0;
225 : : case C_TOKEN( plus ):
226 [ # # ]: 0 : return new DataSourceContext( *this, mrModel.maSources.create( ErrorBarModel::PLUS ) );
227 : : case C_TOKEN( spPr ):
228 [ # # ]: 0 : return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
229 : : case C_TOKEN( val ):
230 : 0 : mrModel.mfValue = rAttribs.getDouble( XML_val, 0.0 );
231 : 0 : return 0;
232 : : }
233 : 0 : return 0;
234 : : }
235 : :
236 : : // ============================================================================
237 : :
238 : 0 : TrendlineLabelContext::TrendlineLabelContext( ContextHandler2Helper& rParent, TrendlineLabelModel& rModel ) :
239 : 0 : ContextBase< TrendlineLabelModel >( rParent, rModel )
240 : : {
241 : 0 : }
242 : :
243 : 0 : TrendlineLabelContext::~TrendlineLabelContext()
244 : : {
245 [ # # ]: 0 : }
246 : :
247 : 0 : ContextHandlerRef TrendlineLabelContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
248 : : {
249 [ # # ][ # # : 0 : if( isRootElement() ) switch( nElement )
# # # # ]
250 : : {
251 : : case C_TOKEN( layout ):
252 [ # # ]: 0 : return new LayoutContext( *this, mrModel.mxLayout.create() );
253 : : case C_TOKEN( numFmt ):
254 : 0 : mrModel.maNumberFormat.setAttributes( rAttribs );
255 : 0 : return 0;
256 : : case C_TOKEN( spPr ):
257 [ # # ]: 0 : return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
258 : : case C_TOKEN( tx ):
259 [ # # ]: 0 : return new TextContext( *this, mrModel.mxText.create() );
260 : : case C_TOKEN( txPr ):
261 [ # # ]: 0 : return new TextBodyContext( *this, mrModel.mxTextProp.create() );
262 : : }
263 : 0 : return 0;
264 : : }
265 : :
266 : : // ============================================================================
267 : :
268 : 0 : TrendlineContext::TrendlineContext( ContextHandler2Helper& rParent, TrendlineModel& rModel ) :
269 : 0 : ContextBase< TrendlineModel >( rParent, rModel )
270 : : {
271 : 0 : }
272 : :
273 : 0 : TrendlineContext::~TrendlineContext()
274 : : {
275 [ # # ]: 0 : }
276 : :
277 : 0 : ContextHandlerRef TrendlineContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
278 : : {
279 [ # # ][ # # : 0 : if( isRootElement() ) switch( nElement )
# # # # #
# # # #
# ]
280 : : {
281 : : case C_TOKEN( backward ):
282 [ # # ]: 0 : mrModel.mfBackward = rAttribs.getDouble( XML_val, 0.0 );
283 : 0 : return 0;
284 : : case C_TOKEN( dispEq ):
285 : : // default is 'false', not 'true' as specified
286 : 0 : mrModel.mbDispEquation = rAttribs.getBool( XML_val, false );
287 : 0 : return 0;
288 : : case C_TOKEN( dispRSqr ):
289 : : // default is 'false', not 'true' as specified
290 : 0 : mrModel.mbDispRSquared = rAttribs.getBool( XML_val, false );
291 : 0 : return 0;
292 : : case C_TOKEN( forward ):
293 [ # # ]: 0 : mrModel.mfForward = rAttribs.getDouble( XML_val, 0.0 );
294 : 0 : return 0;
295 : : case C_TOKEN( intercept ):
296 [ # # ]: 0 : mrModel.mfIntercept = rAttribs.getDouble( XML_val, 0.0 );
297 : 0 : return 0;
298 : : case C_TOKEN( name ):
299 : 0 : return this; // collect name in onCharacters()
300 : : case C_TOKEN( order ):
301 : 0 : mrModel.mnOrder = rAttribs.getInteger( XML_val, 2 );
302 : 0 : return 0;
303 : : case C_TOKEN( period ):
304 : 0 : mrModel.mnPeriod = rAttribs.getInteger( XML_val, 2 );
305 : 0 : return 0;
306 : : case C_TOKEN( spPr ):
307 [ # # ]: 0 : return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
308 : : case C_TOKEN( trendlineLbl ):
309 [ # # ]: 0 : return new TrendlineLabelContext( *this, mrModel.mxLabel.create() );
310 : : case C_TOKEN( trendlineType ):
311 : 0 : mrModel.mnTypeId = rAttribs.getToken( XML_val, XML_linear );
312 : 0 : return 0;
313 : : }
314 : 0 : return 0;
315 : : }
316 : :
317 : 0 : void TrendlineContext::onCharacters( const OUString& rChars )
318 : : {
319 [ # # ]: 0 : if( isCurrentElement( C_TOKEN( name ) ) )
320 : 0 : mrModel.maName = rChars;
321 : 0 : }
322 : :
323 : : // ============================================================================
324 : :
325 : 0 : DataPointContext::DataPointContext( ContextHandler2Helper& rParent, DataPointModel& rModel ) :
326 : 0 : ContextBase< DataPointModel >( rParent, rModel )
327 : : {
328 : 0 : }
329 : :
330 : 0 : DataPointContext::~DataPointContext()
331 : : {
332 [ # # ]: 0 : }
333 : :
334 : 0 : ContextHandlerRef DataPointContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
335 : : {
336 [ # # # ]: 0 : switch( getCurrentElement() )
337 : : {
338 : : case C_TOKEN( dPt ):
339 [ # # # # : 0 : switch( nElement )
# # # # ]
340 : : {
341 : : case C_TOKEN( bubble3D ):
342 : 0 : mrModel.mobBubble3d = rAttribs.getBool( XML_val );
343 : 0 : return 0;
344 : : case C_TOKEN( explosion ):
345 : : // if the 'val' attribute is missing, series explosion remains unchanged
346 : 0 : mrModel.monExplosion = rAttribs.getInteger( XML_val );
347 : 0 : return 0;
348 : : case C_TOKEN( idx ):
349 : 0 : mrModel.mnIndex = rAttribs.getInteger( XML_val, -1 );
350 : 0 : return 0;
351 : : case C_TOKEN( invertIfNegative ):
352 : : // default is 'false', not 'true' as specified (value not derived from series!)
353 : 0 : mrModel.mbInvertNeg = rAttribs.getBool( XML_val, false );
354 : 0 : return 0;
355 : : case C_TOKEN( marker ):
356 : 0 : return this;
357 : : case C_TOKEN( pictureOptions ):
358 [ # # ]: 0 : return new PictureOptionsContext( *this, mrModel.mxPicOptions.create() );
359 : : case C_TOKEN( spPr ):
360 [ # # ]: 0 : return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
361 : : }
362 : 0 : break;
363 : :
364 : : case C_TOKEN( marker ):
365 [ # # # # ]: 0 : switch( nElement )
366 : : {
367 : : case C_TOKEN( size ):
368 [ # # ]: 0 : mrModel.monMarkerSize = rAttribs.getInteger( XML_val, 5 );
369 : 0 : return 0;
370 : : case C_TOKEN( spPr ):
371 [ # # ]: 0 : return new ShapePropertiesContext( *this, mrModel.mxMarkerProp.create() );
372 : : case C_TOKEN( symbol ):
373 [ # # ]: 0 : mrModel.monMarkerSymbol = rAttribs.getToken( XML_val, XML_none );
374 : 0 : return 0;
375 : : }
376 : 0 : break;
377 : : }
378 : 0 : return 0;
379 : : }
380 : :
381 : : // ============================================================================
382 : :
383 : 0 : SeriesContextBase::SeriesContextBase( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
384 : 0 : ContextBase< SeriesModel >( rParent, rModel )
385 : : {
386 : 0 : }
387 : :
388 : 0 : SeriesContextBase::~SeriesContextBase()
389 : : {
390 [ # # ]: 0 : }
391 : :
392 : 0 : ContextHandlerRef SeriesContextBase::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
393 : : {
394 [ # # # ]: 0 : switch( getCurrentElement() )
395 : : {
396 : : case C_TOKEN( ser ):
397 [ # # # # : 0 : switch( nElement )
# ]
398 : : {
399 : : case C_TOKEN( idx ):
400 : 0 : mrModel.mnIndex = rAttribs.getInteger( XML_val, -1 );
401 : 0 : return 0;
402 : : case C_TOKEN( order ):
403 : 0 : mrModel.mnOrder = rAttribs.getInteger( XML_val, -1 );
404 : 0 : return 0;
405 : : case C_TOKEN( spPr ):
406 [ # # ]: 0 : return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
407 : : case C_TOKEN( tx ):
408 [ # # ]: 0 : return new TextContext( *this, mrModel.mxText.create() );
409 : : }
410 : 0 : break;
411 : :
412 : : case C_TOKEN( marker ):
413 [ # # # # ]: 0 : switch( nElement )
414 : : {
415 : : case C_TOKEN( size ):
416 : 0 : mrModel.mnMarkerSize = rAttribs.getInteger( XML_val, 5 );
417 : 0 : return 0;
418 : : case C_TOKEN( spPr ):
419 [ # # ]: 0 : return new ShapePropertiesContext( *this, mrModel.mxMarkerProp.create() );
420 : : case C_TOKEN( symbol ):
421 : 0 : mrModel.mnMarkerSymbol = rAttribs.getToken( XML_val, XML_none );
422 : 0 : return 0;
423 : : }
424 : 0 : break;
425 : : }
426 : 0 : return 0;
427 : : }
428 : :
429 : : // ============================================================================
430 : :
431 : 0 : AreaSeriesContext::AreaSeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
432 : 0 : SeriesContextBase( rParent, rModel )
433 : : {
434 : 0 : }
435 : :
436 : 0 : AreaSeriesContext::~AreaSeriesContext()
437 : : {
438 [ # # ]: 0 : }
439 : :
440 : 0 : ContextHandlerRef AreaSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
441 : : {
442 [ # # ]: 0 : switch( getCurrentElement() )
443 : : {
444 : : case C_TOKEN( ser ):
445 [ # # # # : 0 : switch( nElement )
# # # ]
446 : : {
447 : : case C_TOKEN( cat ):
448 [ # # ]: 0 : return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::CATEGORIES ) );
449 : : case C_TOKEN( errBars ):
450 [ # # ]: 0 : return new ErrorBarContext( *this, mrModel.maErrorBars.create() );
451 : : case C_TOKEN( dLbls ):
452 [ # # ]: 0 : return new DataLabelsContext( *this, mrModel.mxLabels.create() );
453 : : case C_TOKEN( dPt ):
454 [ # # ]: 0 : return new DataPointContext( *this, mrModel.maPoints.create() );
455 : : case C_TOKEN( trendline ):
456 [ # # ]: 0 : return new TrendlineContext( *this, mrModel.maTrendlines.create() );
457 : : case C_TOKEN( val ):
458 [ # # ]: 0 : return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
459 : : }
460 : 0 : break;
461 : : }
462 : 0 : return SeriesContextBase::onCreateContext( nElement, rAttribs );
463 : : }
464 : :
465 : : // ============================================================================
466 : :
467 : 0 : BarSeriesContext::BarSeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
468 : 0 : SeriesContextBase( rParent, rModel )
469 : : {
470 : 0 : }
471 : :
472 : 0 : BarSeriesContext::~BarSeriesContext()
473 : : {
474 [ # # ]: 0 : }
475 : :
476 : 0 : ContextHandlerRef BarSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
477 : : {
478 [ # # ]: 0 : switch( getCurrentElement() )
479 : : {
480 : : case C_TOKEN( ser ):
481 [ # # # # : 0 : switch( nElement )
# # # # #
# ]
482 : : {
483 : : case C_TOKEN( cat ):
484 [ # # ]: 0 : return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::CATEGORIES ) );
485 : : case C_TOKEN( dLbls ):
486 [ # # ]: 0 : return new DataLabelsContext( *this, mrModel.mxLabels.create() );
487 : : case C_TOKEN( dPt ):
488 [ # # ]: 0 : return new DataPointContext( *this, mrModel.maPoints.create() );
489 : : case C_TOKEN( errBars ):
490 [ # # ]: 0 : return new ErrorBarContext( *this, mrModel.maErrorBars.create() );
491 : : case C_TOKEN( invertIfNegative ):
492 : : // default is 'false', not 'true' as specified
493 : 0 : mrModel.mbInvertNeg = rAttribs.getBool( XML_val, false );
494 : 0 : return 0;
495 : : case C_TOKEN( pictureOptions ):
496 [ # # ]: 0 : return new PictureOptionsContext( *this, mrModel.mxPicOptions.create() );
497 : : case C_TOKEN( shape ):
498 : : // missing attribute does not change shape type to 'box' as specified
499 : 0 : mrModel.monShape = rAttribs.getToken( XML_val );
500 : 0 : return 0;
501 : : case C_TOKEN( trendline ):
502 [ # # ]: 0 : return new TrendlineContext( *this, mrModel.maTrendlines.create() );
503 : : case C_TOKEN( val ):
504 [ # # ]: 0 : return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
505 : : }
506 : 0 : break;
507 : : }
508 : 0 : return SeriesContextBase::onCreateContext( nElement, rAttribs );
509 : : }
510 : :
511 : : // ============================================================================
512 : :
513 : 0 : BubbleSeriesContext::BubbleSeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
514 : 0 : SeriesContextBase( rParent, rModel )
515 : : {
516 : 0 : }
517 : :
518 : 0 : BubbleSeriesContext::~BubbleSeriesContext()
519 : : {
520 [ # # ]: 0 : }
521 : :
522 : 0 : ContextHandlerRef BubbleSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
523 : : {
524 [ # # ]: 0 : switch( getCurrentElement() )
525 : : {
526 : : case C_TOKEN( ser ):
527 [ # # # # : 0 : switch( nElement )
# # # # #
# ]
528 : : {
529 : : case C_TOKEN( bubble3D ):
530 : : // default is 'false', not 'true' as specified
531 : 0 : mrModel.mbBubble3d = rAttribs.getBool( XML_val, false );
532 : 0 : return 0;
533 : : case C_TOKEN( bubbleSize ):
534 [ # # ]: 0 : return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::POINTS ) );
535 : : case C_TOKEN( dLbls ):
536 [ # # ]: 0 : return new DataLabelsContext( *this, mrModel.mxLabels.create() );
537 : : case C_TOKEN( dPt ):
538 [ # # ]: 0 : return new DataPointContext( *this, mrModel.maPoints.create() );
539 : : case C_TOKEN( errBars ):
540 [ # # ]: 0 : return new ErrorBarContext( *this, mrModel.maErrorBars.create() );
541 : : case C_TOKEN( invertIfNegative ):
542 : : // default is 'false', not 'true' as specified
543 : 0 : mrModel.mbInvertNeg = rAttribs.getBool( XML_val, false );
544 : 0 : return 0;
545 : : case C_TOKEN( trendline ):
546 [ # # ]: 0 : return new TrendlineContext( *this, mrModel.maTrendlines.create() );
547 : : case C_TOKEN( xVal ):
548 [ # # ]: 0 : return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::CATEGORIES ) );
549 : : case C_TOKEN( yVal ):
550 [ # # ]: 0 : return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
551 : : }
552 : 0 : break;
553 : : }
554 : 0 : return SeriesContextBase::onCreateContext( nElement, rAttribs );
555 : : }
556 : :
557 : : // ============================================================================
558 : :
559 : 0 : LineSeriesContext::LineSeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
560 : 0 : SeriesContextBase( rParent, rModel )
561 : : {
562 : 0 : }
563 : :
564 : 0 : LineSeriesContext::~LineSeriesContext()
565 : : {
566 [ # # ]: 0 : }
567 : :
568 : 0 : ContextHandlerRef LineSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
569 : : {
570 [ # # ]: 0 : switch( getCurrentElement() )
571 : : {
572 : : case C_TOKEN( ser ):
573 [ # # # # : 0 : switch( nElement )
# # # #
# ]
574 : : {
575 : : case C_TOKEN( cat ):
576 [ # # ]: 0 : return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::CATEGORIES ) );
577 : : case C_TOKEN( dLbls ):
578 [ # # ]: 0 : return new DataLabelsContext( *this, mrModel.mxLabels.create() );
579 : : case C_TOKEN( dPt ):
580 [ # # ]: 0 : return new DataPointContext( *this, mrModel.maPoints.create() );
581 : : case C_TOKEN( errBars ):
582 [ # # ]: 0 : return new ErrorBarContext( *this, mrModel.maErrorBars.create() );
583 : : case C_TOKEN( marker ):
584 : 0 : return this;
585 : : case C_TOKEN( smooth ):
586 : : // default is 'false', not 'true' as specified
587 : 0 : mrModel.mbSmooth = rAttribs.getBool( XML_val, false );
588 : 0 : return 0;
589 : : case C_TOKEN( trendline ):
590 [ # # ]: 0 : return new TrendlineContext( *this, mrModel.maTrendlines.create() );
591 : : case C_TOKEN( val ):
592 [ # # ]: 0 : return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
593 : : }
594 : 0 : break;
595 : : }
596 : 0 : return SeriesContextBase::onCreateContext( nElement, rAttribs );
597 : : }
598 : :
599 : : // ============================================================================
600 : :
601 : 0 : PieSeriesContext::PieSeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
602 : 0 : SeriesContextBase( rParent, rModel )
603 : : {
604 : 0 : }
605 : :
606 : 0 : PieSeriesContext::~PieSeriesContext()
607 : : {
608 [ # # ]: 0 : }
609 : :
610 : 0 : ContextHandlerRef PieSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
611 : : {
612 [ # # ]: 0 : switch( getCurrentElement() )
613 : : {
614 : : case C_TOKEN( ser ):
615 [ # # # # : 0 : switch( nElement )
# # ]
616 : : {
617 : : case C_TOKEN( cat ):
618 [ # # ]: 0 : return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::CATEGORIES ) );
619 : : case C_TOKEN( dLbls ):
620 [ # # ]: 0 : return new DataLabelsContext( *this, mrModel.mxLabels.create() );
621 : : case C_TOKEN( dPt ):
622 [ # # ]: 0 : return new DataPointContext( *this, mrModel.maPoints.create() );
623 : : case C_TOKEN( explosion ):
624 : 0 : mrModel.mnExplosion = rAttribs.getInteger( XML_val, 0 );
625 : 0 : return 0;
626 : : case C_TOKEN( val ):
627 [ # # ]: 0 : return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
628 : : }
629 : 0 : break;
630 : : }
631 : 0 : return SeriesContextBase::onCreateContext( nElement, rAttribs );
632 : : }
633 : :
634 : : // ============================================================================
635 : :
636 : 0 : RadarSeriesContext::RadarSeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
637 : 0 : SeriesContextBase( rParent, rModel )
638 : : {
639 : 0 : }
640 : :
641 : 0 : RadarSeriesContext::~RadarSeriesContext()
642 : : {
643 [ # # ]: 0 : }
644 : :
645 : 0 : ContextHandlerRef RadarSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
646 : : {
647 [ # # ]: 0 : switch( getCurrentElement() )
648 : : {
649 : : case C_TOKEN( ser ):
650 [ # # # # : 0 : switch( nElement )
# # # ]
651 : : {
652 : : case C_TOKEN( cat ):
653 [ # # ]: 0 : return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::CATEGORIES ) );
654 : : case C_TOKEN( dLbls ):
655 [ # # ]: 0 : return new DataLabelsContext( *this, mrModel.mxLabels.create() );
656 : : case C_TOKEN( dPt ):
657 [ # # ]: 0 : return new DataPointContext( *this, mrModel.maPoints.create() );
658 : : case C_TOKEN( marker ):
659 : 0 : return this;
660 : : case C_TOKEN( smooth ):
661 : : // default is 'false', not 'true' as specified
662 : 0 : mrModel.mbSmooth = rAttribs.getBool( XML_val, false );
663 : 0 : return 0;
664 : : case C_TOKEN( val ):
665 [ # # ]: 0 : return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
666 : : }
667 : 0 : break;
668 : : }
669 : 0 : return SeriesContextBase::onCreateContext( nElement, rAttribs );
670 : : }
671 : :
672 : : // ============================================================================
673 : :
674 : 0 : ScatterSeriesContext::ScatterSeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
675 : 0 : SeriesContextBase( rParent, rModel )
676 : : {
677 : 0 : }
678 : :
679 : 0 : ScatterSeriesContext::~ScatterSeriesContext()
680 : : {
681 [ # # ]: 0 : }
682 : :
683 : 0 : ContextHandlerRef ScatterSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
684 : : {
685 [ # # ]: 0 : switch( getCurrentElement() )
686 : : {
687 : : case C_TOKEN( ser ):
688 [ # # # # : 0 : switch( nElement )
# # # #
# ]
689 : : {
690 : : case C_TOKEN( dLbls ):
691 [ # # ]: 0 : return new DataLabelsContext( *this, mrModel.mxLabels.create() );
692 : : case C_TOKEN( dPt ):
693 [ # # ]: 0 : return new DataPointContext( *this, mrModel.maPoints.create() );
694 : : case C_TOKEN( errBars ):
695 [ # # ]: 0 : return new ErrorBarContext( *this, mrModel.maErrorBars.create() );
696 : : case C_TOKEN( marker ):
697 : 0 : return this;
698 : : case C_TOKEN( smooth ):
699 : : // default is 'false', not 'true' as specified
700 : 0 : mrModel.mbSmooth = rAttribs.getBool( XML_val, false );
701 : 0 : return 0;
702 : : case C_TOKEN( trendline ):
703 [ # # ]: 0 : return new TrendlineContext( *this, mrModel.maTrendlines.create() );
704 : : case C_TOKEN( xVal ):
705 [ # # ]: 0 : return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::CATEGORIES ) );
706 : : case C_TOKEN( yVal ):
707 [ # # ]: 0 : return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
708 : : }
709 : 0 : break;
710 : : }
711 : 0 : return SeriesContextBase::onCreateContext( nElement, rAttribs );
712 : : }
713 : :
714 : : // ============================================================================
715 : :
716 : 0 : SurfaceSeriesContext::SurfaceSeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
717 : 0 : SeriesContextBase( rParent, rModel )
718 : : {
719 : 0 : }
720 : :
721 : 0 : SurfaceSeriesContext::~SurfaceSeriesContext()
722 : : {
723 [ # # ]: 0 : }
724 : :
725 : 0 : ContextHandlerRef SurfaceSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
726 : : {
727 [ # # ]: 0 : switch( getCurrentElement() )
728 : : {
729 : : case C_TOKEN( ser ):
730 [ # # # ]: 0 : switch( nElement )
731 : : {
732 : : case C_TOKEN( cat ):
733 [ # # ]: 0 : return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::CATEGORIES ) );
734 : : case C_TOKEN( val ):
735 [ # # ]: 0 : return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
736 : : }
737 : 0 : break;
738 : : }
739 : 0 : return SeriesContextBase::onCreateContext( nElement, rAttribs );
740 : : }
741 : :
742 : : // ============================================================================
743 : :
744 : : } // namespace chart
745 : : } // namespace drawingml
746 [ + - ][ + - ]: 285 : } // namespace oox
747 : :
748 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|