bump product version to 4.1.6.2
[LibreOffice.git] / oox / source / drawingml / chart / seriescontext.cxx
bloba85f2a75e9094dfe2e6595f0cc603303ba7d8ac3
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/seriescontext.hxx"
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"
28 namespace oox {
29 namespace drawingml {
30 namespace chart {
32 // ============================================================================
34 using ::oox::core::ContextHandler2;
35 using ::oox::core::ContextHandler2Helper;
36 using ::oox::core::ContextHandlerRef;
38 // ============================================================================
40 namespace {
42 ContextHandlerRef lclDataLabelSharedCreateContext( ContextHandler2& rContext,
43 sal_Int32 nElement, const AttributeList& rAttribs, DataLabelModelBase& orModel )
45 if( rContext.isRootElement() ) switch( nElement )
47 case C_TOKEN( delete ):
48 // default is 'false', not 'true' as specified
49 orModel.mbDeleted = rAttribs.getBool( XML_val, false );
50 return 0;
51 case C_TOKEN( dLblPos ):
52 orModel.monLabelPos = rAttribs.getToken( XML_val, XML_TOKEN_INVALID );
53 return 0;
54 case C_TOKEN( numFmt ):
55 orModel.maNumberFormat.setAttributes( rAttribs );
56 return 0;
57 case C_TOKEN( showBubbleSize ):
58 orModel.mobShowBubbleSize = rAttribs.getBool( XML_val );
59 return 0;
60 case C_TOKEN( showCatName ):
61 orModel.mobShowCatName = rAttribs.getBool( XML_val );
62 return 0;
63 case C_TOKEN( showLegendKey ):
64 orModel.mobShowLegendKey = rAttribs.getBool( XML_val );
65 return 0;
66 case C_TOKEN( showPercent ):
67 orModel.mobShowPercent = rAttribs.getBool( XML_val );
68 return 0;
69 case C_TOKEN( showSerName ):
70 orModel.mobShowSerName = rAttribs.getBool( XML_val );
71 return 0;
72 case C_TOKEN( showVal ):
73 orModel.mobShowVal = rAttribs.getBool( XML_val );
74 return 0;
75 case C_TOKEN( separator ):
76 // collect separator text in onCharacters()
77 return &rContext;
78 case C_TOKEN( spPr ):
79 return new ShapePropertiesContext( rContext, orModel.mxShapeProp.create() );
80 case C_TOKEN( txPr ):
81 return new TextBodyContext( rContext, orModel.mxTextProp.create() );
83 return 0;
86 void lclDataLabelSharedCharacters( ContextHandler2& rContext, const OUString& rChars, DataLabelModelBase& orModel )
88 if( rContext.isCurrentElement( C_TOKEN( separator ) ) )
89 orModel.moaSeparator = rChars;
92 } // namespace
94 // ============================================================================
96 DataLabelContext::DataLabelContext( ContextHandler2Helper& rParent, DataLabelModel& rModel ) :
97 ContextBase< DataLabelModel >( rParent, rModel )
101 DataLabelContext::~DataLabelContext()
105 ContextHandlerRef DataLabelContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
107 if( isRootElement() ) switch( nElement )
109 case C_TOKEN( idx ):
110 mrModel.mnIndex = rAttribs.getInteger( XML_val, -1 );
111 return 0;
112 case C_TOKEN( layout ):
113 return new LayoutContext( *this, mrModel.mxLayout.create() );
114 case C_TOKEN( tx ):
115 return new TextContext( *this, mrModel.mxText.create() );
117 return lclDataLabelSharedCreateContext( *this, nElement, rAttribs, mrModel );
120 void DataLabelContext::onCharacters( const OUString& rChars )
122 lclDataLabelSharedCharacters( *this, rChars, mrModel );
125 // ============================================================================
127 DataLabelsContext::DataLabelsContext( ContextHandler2Helper& rParent, DataLabelsModel& rModel ) :
128 ContextBase< DataLabelsModel >( rParent, rModel )
132 DataLabelsContext::~DataLabelsContext()
136 ContextHandlerRef DataLabelsContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
138 if( isRootElement() ) switch( nElement )
140 case C_TOKEN( dLbl ):
141 return new DataLabelContext( *this, mrModel.maPointLabels.create() );
142 case C_TOKEN( leaderLines ):
143 return new ShapePrWrapperContext( *this, mrModel.mxLeaderLines.create() );
144 case C_TOKEN( showLeaderLines ):
145 // default is 'false', not 'true' as specified
146 mrModel.mbShowLeaderLines = rAttribs.getBool( XML_val, false );
147 return 0;
149 return lclDataLabelSharedCreateContext( *this, nElement, rAttribs, mrModel );
152 void DataLabelsContext::onCharacters( const OUString& rChars )
154 lclDataLabelSharedCharacters( *this, rChars, mrModel );
157 // ============================================================================
159 PictureOptionsContext::PictureOptionsContext( ContextHandler2Helper& rParent, PictureOptionsModel& rModel ) :
160 ContextBase< PictureOptionsModel >( rParent, rModel )
164 PictureOptionsContext::~PictureOptionsContext()
168 ContextHandlerRef PictureOptionsContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
170 if( isRootElement() ) switch( nElement )
172 case C_TOKEN( applyToEnd ):
173 // default is 'false', not 'true' as specified
174 mrModel.mbApplyToEnd = rAttribs.getBool( XML_val, false );
175 return 0;
176 case C_TOKEN( applyToFront ):
177 // default is 'false', not 'true' as specified
178 mrModel.mbApplyToFront = rAttribs.getBool( XML_val, false );
179 return 0;
180 case C_TOKEN( applyToSides ):
181 // default is 'false', not 'true' as specified
182 mrModel.mbApplyToSides = rAttribs.getBool( XML_val, false );
183 return 0;
184 case C_TOKEN( pictureFormat ):
185 mrModel.mnPictureFormat = rAttribs.getToken( XML_val, XML_stretch );
186 return 0;
187 case C_TOKEN( pictureStackUnit ):
188 mrModel.mfStackUnit = rAttribs.getDouble( XML_val, 1.0 );
189 return 0;
191 return 0;
194 // ============================================================================
196 ErrorBarContext::ErrorBarContext( ContextHandler2Helper& rParent, ErrorBarModel& rModel ) :
197 ContextBase< ErrorBarModel >( rParent, rModel )
201 ErrorBarContext::~ErrorBarContext()
205 ContextHandlerRef ErrorBarContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
207 if( isRootElement() ) switch( nElement )
209 case C_TOKEN( errBarType ):
210 mrModel.mnTypeId = rAttribs.getToken( XML_val, XML_both );
211 return 0;
212 case C_TOKEN( errDir ):
213 mrModel.mnDirection = rAttribs.getToken( XML_val, XML_TOKEN_INVALID );
214 return 0;
215 case C_TOKEN( errValType ):
216 mrModel.mnValueType = rAttribs.getToken( XML_val, XML_fixedVal );
217 return 0;
218 case C_TOKEN( minus ):
219 return new DataSourceContext( *this, mrModel.maSources.create( ErrorBarModel::MINUS ) );
220 case C_TOKEN( noEndCap ):
221 // default is 'false', not 'true' as specified
222 mrModel.mbNoEndCap = rAttribs.getBool( XML_val, false );
223 return 0;
224 case C_TOKEN( plus ):
225 return new DataSourceContext( *this, mrModel.maSources.create( ErrorBarModel::PLUS ) );
226 case C_TOKEN( spPr ):
227 return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
228 case C_TOKEN( val ):
229 mrModel.mfValue = rAttribs.getDouble( XML_val, 0.0 );
230 return 0;
232 return 0;
235 // ============================================================================
237 TrendlineLabelContext::TrendlineLabelContext( ContextHandler2Helper& rParent, TrendlineLabelModel& rModel ) :
238 ContextBase< TrendlineLabelModel >( rParent, rModel )
242 TrendlineLabelContext::~TrendlineLabelContext()
246 ContextHandlerRef TrendlineLabelContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
248 if( isRootElement() ) switch( nElement )
250 case C_TOKEN( layout ):
251 return new LayoutContext( *this, mrModel.mxLayout.create() );
252 case C_TOKEN( numFmt ):
253 mrModel.maNumberFormat.setAttributes( rAttribs );
254 return 0;
255 case C_TOKEN( spPr ):
256 return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
257 case C_TOKEN( tx ):
258 return new TextContext( *this, mrModel.mxText.create() );
259 case C_TOKEN( txPr ):
260 return new TextBodyContext( *this, mrModel.mxTextProp.create() );
262 return 0;
265 // ============================================================================
267 TrendlineContext::TrendlineContext( ContextHandler2Helper& rParent, TrendlineModel& rModel ) :
268 ContextBase< TrendlineModel >( rParent, rModel )
272 TrendlineContext::~TrendlineContext()
276 ContextHandlerRef TrendlineContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
278 if( isRootElement() ) switch( nElement )
280 case C_TOKEN( backward ):
281 mrModel.mfBackward = rAttribs.getDouble( XML_val, 0.0 );
282 return 0;
283 case C_TOKEN( dispEq ):
284 // default is 'false', not 'true' as specified
285 mrModel.mbDispEquation = rAttribs.getBool( XML_val, false );
286 return 0;
287 case C_TOKEN( dispRSqr ):
288 // default is 'false', not 'true' as specified
289 mrModel.mbDispRSquared = rAttribs.getBool( XML_val, false );
290 return 0;
291 case C_TOKEN( forward ):
292 mrModel.mfForward = rAttribs.getDouble( XML_val, 0.0 );
293 return 0;
294 case C_TOKEN( intercept ):
295 mrModel.mfIntercept = rAttribs.getDouble( XML_val, 0.0 );
296 return 0;
297 case C_TOKEN( name ):
298 return this; // collect name in onCharacters()
299 case C_TOKEN( order ):
300 mrModel.mnOrder = rAttribs.getInteger( XML_val, 2 );
301 return 0;
302 case C_TOKEN( period ):
303 mrModel.mnPeriod = rAttribs.getInteger( XML_val, 2 );
304 return 0;
305 case C_TOKEN( spPr ):
306 return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
307 case C_TOKEN( trendlineLbl ):
308 return new TrendlineLabelContext( *this, mrModel.mxLabel.create() );
309 case C_TOKEN( trendlineType ):
310 mrModel.mnTypeId = rAttribs.getToken( XML_val, XML_linear );
311 return 0;
313 return 0;
316 void TrendlineContext::onCharacters( const OUString& rChars )
318 if( isCurrentElement( C_TOKEN( name ) ) )
319 mrModel.maName = rChars;
322 // ============================================================================
324 DataPointContext::DataPointContext( ContextHandler2Helper& rParent, DataPointModel& rModel ) :
325 ContextBase< DataPointModel >( rParent, rModel )
329 DataPointContext::~DataPointContext()
333 ContextHandlerRef DataPointContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
335 switch( getCurrentElement() )
337 case C_TOKEN( dPt ):
338 switch( nElement )
340 case C_TOKEN( bubble3D ):
341 mrModel.mobBubble3d = rAttribs.getBool( XML_val );
342 return 0;
343 case C_TOKEN( explosion ):
344 // if the 'val' attribute is missing, series explosion remains unchanged
345 mrModel.monExplosion = rAttribs.getInteger( XML_val );
346 return 0;
347 case C_TOKEN( idx ):
348 mrModel.mnIndex = rAttribs.getInteger( XML_val, -1 );
349 return 0;
350 case C_TOKEN( invertIfNegative ):
351 // default is 'false', not 'true' as specified (value not derived from series!)
352 mrModel.mbInvertNeg = rAttribs.getBool( XML_val, false );
353 return 0;
354 case C_TOKEN( marker ):
355 return this;
356 case C_TOKEN( pictureOptions ):
357 return new PictureOptionsContext( *this, mrModel.mxPicOptions.create() );
358 case C_TOKEN( spPr ):
359 return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
361 break;
363 case C_TOKEN( marker ):
364 switch( nElement )
366 case C_TOKEN( size ):
367 mrModel.monMarkerSize = rAttribs.getInteger( XML_val, 5 );
368 return 0;
369 case C_TOKEN( spPr ):
370 return new ShapePropertiesContext( *this, mrModel.mxMarkerProp.create() );
371 case C_TOKEN( symbol ):
372 mrModel.monMarkerSymbol = rAttribs.getToken( XML_val, XML_none );
373 return 0;
375 break;
377 return 0;
380 // ============================================================================
382 SeriesContextBase::SeriesContextBase( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
383 ContextBase< SeriesModel >( rParent, rModel )
387 SeriesContextBase::~SeriesContextBase()
391 ContextHandlerRef SeriesContextBase::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
393 switch( getCurrentElement() )
395 case C_TOKEN( ser ):
396 switch( nElement )
398 case C_TOKEN( idx ):
399 mrModel.mnIndex = rAttribs.getInteger( XML_val, -1 );
400 return 0;
401 case C_TOKEN( order ):
402 mrModel.mnOrder = rAttribs.getInteger( XML_val, -1 );
403 return 0;
404 case C_TOKEN( spPr ):
405 return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
406 case C_TOKEN( tx ):
407 return new TextContext( *this, mrModel.mxText.create() );
409 break;
411 case C_TOKEN( marker ):
412 switch( nElement )
414 case C_TOKEN( size ):
415 mrModel.mnMarkerSize = rAttribs.getInteger( XML_val, 5 );
416 return 0;
417 case C_TOKEN( spPr ):
418 return new ShapePropertiesContext( *this, mrModel.mxMarkerProp.create() );
419 case C_TOKEN( symbol ):
420 mrModel.mnMarkerSymbol = rAttribs.getToken( XML_val, XML_none );
421 return 0;
423 break;
425 return 0;
428 // ============================================================================
430 AreaSeriesContext::AreaSeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
431 SeriesContextBase( rParent, rModel )
435 AreaSeriesContext::~AreaSeriesContext()
439 ContextHandlerRef AreaSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
441 switch( getCurrentElement() )
443 case C_TOKEN( ser ):
444 switch( nElement )
446 case C_TOKEN( cat ):
447 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::CATEGORIES ) );
448 case C_TOKEN( errBars ):
449 return new ErrorBarContext( *this, mrModel.maErrorBars.create() );
450 case C_TOKEN( dLbls ):
451 return new DataLabelsContext( *this, mrModel.mxLabels.create() );
452 case C_TOKEN( dPt ):
453 return new DataPointContext( *this, mrModel.maPoints.create() );
454 case C_TOKEN( trendline ):
455 return new TrendlineContext( *this, mrModel.maTrendlines.create() );
456 case C_TOKEN( val ):
457 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
459 break;
461 return SeriesContextBase::onCreateContext( nElement, rAttribs );
464 // ============================================================================
466 BarSeriesContext::BarSeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
467 SeriesContextBase( rParent, rModel )
471 BarSeriesContext::~BarSeriesContext()
475 ContextHandlerRef BarSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
477 switch( getCurrentElement() )
479 case C_TOKEN( ser ):
480 switch( nElement )
482 case C_TOKEN( cat ):
483 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::CATEGORIES ) );
484 case C_TOKEN( dLbls ):
485 return new DataLabelsContext( *this, mrModel.mxLabels.create() );
486 case C_TOKEN( dPt ):
487 return new DataPointContext( *this, mrModel.maPoints.create() );
488 case C_TOKEN( errBars ):
489 return new ErrorBarContext( *this, mrModel.maErrorBars.create() );
490 case C_TOKEN( invertIfNegative ):
491 // default is 'false', not 'true' as specified
492 mrModel.mbInvertNeg = rAttribs.getBool( XML_val, false );
493 return 0;
494 case C_TOKEN( pictureOptions ):
495 return new PictureOptionsContext( *this, mrModel.mxPicOptions.create() );
496 case C_TOKEN( shape ):
497 // missing attribute does not change shape type to 'box' as specified
498 mrModel.monShape = rAttribs.getToken( XML_val );
499 return 0;
500 case C_TOKEN( trendline ):
501 return new TrendlineContext( *this, mrModel.maTrendlines.create() );
502 case C_TOKEN( val ):
503 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
505 break;
507 return SeriesContextBase::onCreateContext( nElement, rAttribs );
510 // ============================================================================
512 BubbleSeriesContext::BubbleSeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
513 SeriesContextBase( rParent, rModel )
517 BubbleSeriesContext::~BubbleSeriesContext()
521 ContextHandlerRef BubbleSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
523 switch( getCurrentElement() )
525 case C_TOKEN( ser ):
526 switch( nElement )
528 case C_TOKEN( bubble3D ):
529 // default is 'false', not 'true' as specified
530 mrModel.mbBubble3d = rAttribs.getBool( XML_val, false );
531 return 0;
532 case C_TOKEN( bubbleSize ):
533 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::POINTS ) );
534 case C_TOKEN( dLbls ):
535 return new DataLabelsContext( *this, mrModel.mxLabels.create() );
536 case C_TOKEN( dPt ):
537 return new DataPointContext( *this, mrModel.maPoints.create() );
538 case C_TOKEN( errBars ):
539 return new ErrorBarContext( *this, mrModel.maErrorBars.create() );
540 case C_TOKEN( invertIfNegative ):
541 // default is 'false', not 'true' as specified
542 mrModel.mbInvertNeg = rAttribs.getBool( XML_val, false );
543 return 0;
544 case C_TOKEN( trendline ):
545 return new TrendlineContext( *this, mrModel.maTrendlines.create() );
546 case C_TOKEN( xVal ):
547 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::CATEGORIES ) );
548 case C_TOKEN( yVal ):
549 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
551 break;
553 return SeriesContextBase::onCreateContext( nElement, rAttribs );
556 // ============================================================================
558 LineSeriesContext::LineSeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
559 SeriesContextBase( rParent, rModel )
563 LineSeriesContext::~LineSeriesContext()
567 ContextHandlerRef LineSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
569 switch( getCurrentElement() )
571 case C_TOKEN( ser ):
572 switch( nElement )
574 case C_TOKEN( cat ):
575 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::CATEGORIES ) );
576 case C_TOKEN( dLbls ):
577 return new DataLabelsContext( *this, mrModel.mxLabels.create() );
578 case C_TOKEN( dPt ):
579 return new DataPointContext( *this, mrModel.maPoints.create() );
580 case C_TOKEN( errBars ):
581 return new ErrorBarContext( *this, mrModel.maErrorBars.create() );
582 case C_TOKEN( marker ):
583 return this;
584 case C_TOKEN( smooth ):
585 // default is 'false', not 'true' as specified
586 mrModel.mbSmooth = rAttribs.getBool( XML_val, false );
587 return 0;
588 case C_TOKEN( trendline ):
589 return new TrendlineContext( *this, mrModel.maTrendlines.create() );
590 case C_TOKEN( val ):
591 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
593 break;
595 return SeriesContextBase::onCreateContext( nElement, rAttribs );
598 // ============================================================================
600 PieSeriesContext::PieSeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
601 SeriesContextBase( rParent, rModel )
605 PieSeriesContext::~PieSeriesContext()
609 ContextHandlerRef PieSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
611 switch( getCurrentElement() )
613 case C_TOKEN( ser ):
614 switch( nElement )
616 case C_TOKEN( cat ):
617 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::CATEGORIES ) );
618 case C_TOKEN( dLbls ):
619 return new DataLabelsContext( *this, mrModel.mxLabels.create() );
620 case C_TOKEN( dPt ):
621 return new DataPointContext( *this, mrModel.maPoints.create() );
622 case C_TOKEN( explosion ):
623 mrModel.mnExplosion = rAttribs.getInteger( XML_val, 0 );
624 return 0;
625 case C_TOKEN( val ):
626 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
628 break;
630 return SeriesContextBase::onCreateContext( nElement, rAttribs );
633 // ============================================================================
635 RadarSeriesContext::RadarSeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
636 SeriesContextBase( rParent, rModel )
640 RadarSeriesContext::~RadarSeriesContext()
644 ContextHandlerRef RadarSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
646 switch( getCurrentElement() )
648 case C_TOKEN( ser ):
649 switch( nElement )
651 case C_TOKEN( cat ):
652 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::CATEGORIES ) );
653 case C_TOKEN( dLbls ):
654 return new DataLabelsContext( *this, mrModel.mxLabels.create() );
655 case C_TOKEN( dPt ):
656 return new DataPointContext( *this, mrModel.maPoints.create() );
657 case C_TOKEN( marker ):
658 return this;
659 case C_TOKEN( smooth ):
660 // default is 'false', not 'true' as specified
661 mrModel.mbSmooth = rAttribs.getBool( XML_val, false );
662 return 0;
663 case C_TOKEN( val ):
664 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
666 break;
668 return SeriesContextBase::onCreateContext( nElement, rAttribs );
671 // ============================================================================
673 ScatterSeriesContext::ScatterSeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
674 SeriesContextBase( rParent, rModel )
678 ScatterSeriesContext::~ScatterSeriesContext()
682 ContextHandlerRef ScatterSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
684 switch( getCurrentElement() )
686 case C_TOKEN( ser ):
687 switch( nElement )
689 case C_TOKEN( dLbls ):
690 return new DataLabelsContext( *this, mrModel.mxLabels.create() );
691 case C_TOKEN( dPt ):
692 return new DataPointContext( *this, mrModel.maPoints.create() );
693 case C_TOKEN( errBars ):
694 return new ErrorBarContext( *this, mrModel.maErrorBars.create() );
695 case C_TOKEN( marker ):
696 return this;
697 case C_TOKEN( smooth ):
698 // default is 'false', not 'true' as specified
699 mrModel.mbSmooth = rAttribs.getBool( XML_val, false );
700 return 0;
701 case C_TOKEN( trendline ):
702 return new TrendlineContext( *this, mrModel.maTrendlines.create() );
703 case C_TOKEN( xVal ):
704 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::CATEGORIES ) );
705 case C_TOKEN( yVal ):
706 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
708 break;
710 return SeriesContextBase::onCreateContext( nElement, rAttribs );
713 // ============================================================================
715 SurfaceSeriesContext::SurfaceSeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
716 SeriesContextBase( rParent, rModel )
720 SurfaceSeriesContext::~SurfaceSeriesContext()
724 ContextHandlerRef SurfaceSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
726 switch( getCurrentElement() )
728 case C_TOKEN( ser ):
729 switch( nElement )
731 case C_TOKEN( cat ):
732 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::CATEGORIES ) );
733 case C_TOKEN( val ):
734 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
736 break;
738 return SeriesContextBase::onCreateContext( nElement, rAttribs );
741 // ============================================================================
743 } // namespace chart
744 } // namespace drawingml
745 } // namespace oox
747 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */