Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / oox / source / drawingml / chart / seriescontext.cxx
blob10e3af70108ffd51e86ef1ac143efc3c7c5512b4
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 <drawingml/chart/seriescontext.hxx>
22 #include <drawingml/shapepropertiescontext.hxx>
23 #include <drawingml/textbodycontext.hxx>
24 #include <drawingml/chart/datasourcecontext.hxx>
25 #include <drawingml/chart/seriesmodel.hxx>
26 #include <drawingml/chart/titlecontext.hxx>
27 #include <oox/core/xmlfilterbase.hxx>
28 #include <oox/helper/attributelist.hxx>
29 #include <oox/token/namespaces.hxx>
30 #include <oox/token/tokens.hxx>
32 namespace oox {
33 namespace drawingml {
34 namespace chart {
36 using ::oox::core::ContextHandler2;
37 using ::oox::core::ContextHandler2Helper;
38 using ::oox::core::ContextHandlerRef;
40 namespace {
42 ContextHandlerRef lclDataLabelSharedCreateContext( ContextHandler2& rContext,
43 sal_Int32 nElement, const AttributeList& rAttribs, DataLabelModelBase& orModel, bool bMSO2007 )
45 if( rContext.isRootElement() ) switch( nElement )
47 case C_TOKEN( delete ):
48 orModel.mbDeleted = rAttribs.getBool( XML_val, !bMSO2007 );
49 return nullptr;
50 case C_TOKEN( dLblPos ):
51 orModel.monLabelPos = rAttribs.getToken( XML_val, XML_TOKEN_INVALID );
52 return nullptr;
53 case C_TOKEN( numFmt ):
54 orModel.maNumberFormat.setAttributes( rAttribs );
55 return nullptr;
56 case C_TOKEN( showBubbleSize ):
57 orModel.mobShowBubbleSize = rAttribs.getBool( XML_val );
58 return nullptr;
59 case C_TOKEN( showCatName ):
60 orModel.mobShowCatName = rAttribs.getBool( XML_val );
61 return nullptr;
62 case C_TOKEN( showLegendKey ):
63 orModel.mobShowLegendKey = rAttribs.getBool( XML_val );
64 return nullptr;
65 case C_TOKEN( showPercent ):
66 orModel.mobShowPercent = rAttribs.getBool( XML_val );
67 return nullptr;
68 case C_TOKEN( showSerName ):
69 orModel.mobShowSerName = rAttribs.getBool( XML_val );
70 return nullptr;
71 case C_TOKEN( showVal ):
72 orModel.mobShowVal = rAttribs.getBool( XML_val );
73 return nullptr;
74 case C_TOKEN( separator ):
75 // collect separator text in onCharacters()
76 return &rContext;
77 case C_TOKEN( spPr ):
78 return new ShapePropertiesContext( rContext, orModel.mxShapeProp.create() );
79 case C_TOKEN( txPr ):
80 return new TextBodyContext( rContext, orModel.mxTextProp.create() );
82 return nullptr;
85 void lclDataLabelSharedCharacters( ContextHandler2 const & rContext, const OUString& rChars, DataLabelModelBase& orModel )
87 if( rContext.isCurrentElement( C_TOKEN( separator ) ) )
88 orModel.moaSeparator = rChars;
91 } // namespace
93 DataLabelContext::DataLabelContext( ContextHandler2Helper& rParent, DataLabelModel& rModel ) :
94 ContextBase< DataLabelModel >( rParent, rModel )
96 mrModel.mbDeleted = false;
99 DataLabelContext::~DataLabelContext()
103 ContextHandlerRef DataLabelContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
105 if( isRootElement() ) switch( nElement )
107 case C_TOKEN( idx ):
108 mrModel.mnIndex = rAttribs.getInteger( XML_val, -1 );
109 return nullptr;
110 case C_TOKEN( layout ):
111 return new LayoutContext( *this, mrModel.mxLayout.create() );
112 case C_TOKEN( tx ):
113 return new TextContext( *this, mrModel.mxText.create() );
115 bool bMSO2007 = getFilter().isMSO2007Document();
116 return lclDataLabelSharedCreateContext( *this, nElement, rAttribs, mrModel, bMSO2007 );
119 void DataLabelContext::onCharacters( const OUString& rChars )
121 lclDataLabelSharedCharacters( *this, rChars, mrModel );
124 DataLabelsContext::DataLabelsContext( ContextHandler2Helper& rParent, DataLabelsModel& rModel ) :
125 ContextBase< DataLabelsModel >( rParent, rModel )
127 mrModel.mbDeleted = false;
130 DataLabelsContext::~DataLabelsContext()
134 ContextHandlerRef DataLabelsContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
136 bool bMSO2007Doc = getFilter().isMSO2007Document();
137 if( isRootElement() ) switch( nElement )
139 case C_TOKEN( dLbl ):
140 return new DataLabelContext( *this, mrModel.maPointLabels.create(bMSO2007Doc) );
141 case C_TOKEN( leaderLines ):
142 return new ShapePrWrapperContext( *this, mrModel.mxLeaderLines.create() );
143 case C_TOKEN( showLeaderLines ):
144 mrModel.mbShowLeaderLines = rAttribs.getBool( XML_val, !bMSO2007Doc );
145 return nullptr;
147 return lclDataLabelSharedCreateContext( *this, nElement, rAttribs, mrModel, bMSO2007Doc );
150 void DataLabelsContext::onCharacters( const OUString& rChars )
152 lclDataLabelSharedCharacters( *this, rChars, mrModel );
155 PictureOptionsContext::PictureOptionsContext( ContextHandler2Helper& rParent, PictureOptionsModel& rModel ) :
156 ContextBase< PictureOptionsModel >( rParent, rModel )
160 PictureOptionsContext::~PictureOptionsContext()
164 ContextHandlerRef PictureOptionsContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
166 bool bMSO2007Doc = getFilter().isMSO2007Document();
167 if( isRootElement() ) switch( nElement )
169 case C_TOKEN( applyToEnd ):
170 mrModel.mbApplyToEnd = rAttribs.getBool( XML_val, !bMSO2007Doc );
171 return nullptr;
172 case C_TOKEN( applyToFront ):
173 mrModel.mbApplyToFront = rAttribs.getBool( XML_val, !bMSO2007Doc );
174 return nullptr;
175 case C_TOKEN( applyToSides ):
176 mrModel.mbApplyToSides = rAttribs.getBool( XML_val, !bMSO2007Doc );
177 return nullptr;
178 case C_TOKEN( pictureFormat ):
179 mrModel.mnPictureFormat = rAttribs.getToken( XML_val, XML_stretch );
180 return nullptr;
181 case C_TOKEN( pictureStackUnit ):
182 mrModel.mfStackUnit = rAttribs.getDouble( XML_val, 1.0 );
183 return nullptr;
185 return nullptr;
188 ErrorBarContext::ErrorBarContext( ContextHandler2Helper& rParent, ErrorBarModel& rModel ) :
189 ContextBase< ErrorBarModel >( rParent, rModel )
193 ErrorBarContext::~ErrorBarContext()
197 ContextHandlerRef ErrorBarContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
199 bool bMSO2007Doc = getFilter().isMSO2007Document();
200 if( isRootElement() ) switch( nElement )
202 case C_TOKEN( errBarType ):
203 mrModel.mnTypeId = rAttribs.getToken( XML_val, XML_both );
204 return nullptr;
205 case C_TOKEN( errDir ):
206 mrModel.mnDirection = rAttribs.getToken( XML_val, XML_TOKEN_INVALID );
207 return nullptr;
208 case C_TOKEN( errValType ):
209 mrModel.mnValueType = rAttribs.getToken( XML_val, XML_fixedVal );
210 return nullptr;
211 case C_TOKEN( minus ):
212 return new DataSourceContext( *this, mrModel.maSources.create( ErrorBarModel::MINUS ) );
213 case C_TOKEN( noEndCap ):
214 mrModel.mbNoEndCap = rAttribs.getBool( XML_val, !bMSO2007Doc );
215 return nullptr;
216 case C_TOKEN( plus ):
217 return new DataSourceContext( *this, mrModel.maSources.create( ErrorBarModel::PLUS ) );
218 case C_TOKEN( spPr ):
219 return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
220 case C_TOKEN( val ):
221 mrModel.mfValue = rAttribs.getDouble( XML_val, 0.0 );
222 return nullptr;
224 return nullptr;
227 TrendlineLabelContext::TrendlineLabelContext( ContextHandler2Helper& rParent, TrendlineLabelModel& rModel ) :
228 ContextBase< TrendlineLabelModel >( rParent, rModel )
232 TrendlineLabelContext::~TrendlineLabelContext()
236 ContextHandlerRef TrendlineLabelContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
238 if( isRootElement() ) switch( nElement )
240 case C_TOKEN( layout ):
241 return new LayoutContext( *this, mrModel.mxLayout.create() );
242 case C_TOKEN( numFmt ):
243 mrModel.maNumberFormat.setAttributes( rAttribs );
244 return nullptr;
245 case C_TOKEN( spPr ):
246 return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
247 case C_TOKEN( tx ):
248 return new TextContext( *this, mrModel.mxText.create() );
249 case C_TOKEN( txPr ):
250 return new TextBodyContext( *this, mrModel.mxTextProp.create() );
252 return nullptr;
255 TrendlineContext::TrendlineContext( ContextHandler2Helper& rParent, TrendlineModel& rModel ) :
256 ContextBase< TrendlineModel >( rParent, rModel )
260 TrendlineContext::~TrendlineContext()
264 ContextHandlerRef TrendlineContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
266 bool bMSO2007Doc = getFilter().isMSO2007Document();
267 if( isRootElement() ) switch( nElement )
269 case C_TOKEN( backward ):
270 mrModel.mfBackward = rAttribs.getDouble( XML_val, 0.0 );
271 return nullptr;
272 case C_TOKEN( dispEq ):
273 mrModel.mbDispEquation = rAttribs.getBool( XML_val, !bMSO2007Doc );
274 return nullptr;
275 case C_TOKEN( dispRSqr ):
276 mrModel.mbDispRSquared = rAttribs.getBool( XML_val, !bMSO2007Doc );
277 return nullptr;
278 case C_TOKEN( forward ):
279 mrModel.mfForward = rAttribs.getDouble( XML_val, 0.0 );
280 return nullptr;
281 case C_TOKEN( intercept ):
282 mrModel.mfIntercept = rAttribs.getDouble( XML_val, 0.0 );
283 return nullptr;
284 case C_TOKEN( name ):
285 return this; // collect name in onCharacters()
286 case C_TOKEN( order ):
287 mrModel.mnOrder = rAttribs.getInteger( XML_val, 2 );
288 return nullptr;
289 case C_TOKEN( period ):
290 mrModel.mnPeriod = rAttribs.getInteger( XML_val, 2 );
291 return nullptr;
292 case C_TOKEN( spPr ):
293 return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
294 case C_TOKEN( trendlineLbl ):
295 return new TrendlineLabelContext( *this, mrModel.mxLabel.create() );
296 case C_TOKEN( trendlineType ):
297 mrModel.mnTypeId = rAttribs.getToken( XML_val, XML_linear );
298 return nullptr;
300 return nullptr;
303 void TrendlineContext::onCharacters( const OUString& rChars )
305 if( isCurrentElement( C_TOKEN( name ) ) )
306 mrModel.maName = rChars;
309 DataPointContext::DataPointContext( ContextHandler2Helper& rParent, DataPointModel& rModel ) :
310 ContextBase< DataPointModel >( rParent, rModel )
314 DataPointContext::~DataPointContext()
318 ContextHandlerRef DataPointContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
320 bool bMSO2007Doc = getFilter().isMSO2007Document();
321 switch( getCurrentElement() )
323 case C_TOKEN( dPt ):
324 switch( nElement )
326 case C_TOKEN( bubble3D ):
327 mrModel.mobBubble3d = rAttribs.getBool( XML_val );
328 return nullptr;
329 case C_TOKEN( explosion ):
330 // if the 'val' attribute is missing, series explosion remains unchanged
331 mrModel.monExplosion = rAttribs.getInteger( XML_val );
332 return nullptr;
333 case C_TOKEN( idx ):
334 mrModel.mnIndex = rAttribs.getInteger( XML_val, -1 );
335 return nullptr;
336 case C_TOKEN( invertIfNegative ):
337 mrModel.mbInvertNeg = rAttribs.getBool( XML_val, !bMSO2007Doc );
338 return nullptr;
339 case C_TOKEN( marker ):
340 return this;
341 case C_TOKEN( pictureOptions ):
342 return new PictureOptionsContext( *this, mrModel.mxPicOptions.create(bMSO2007Doc) );
343 case C_TOKEN( spPr ):
344 return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
346 break;
348 case C_TOKEN( marker ):
349 switch( nElement )
351 case C_TOKEN( size ):
352 mrModel.monMarkerSize = rAttribs.getInteger( XML_val, 5 );
353 return nullptr;
354 case C_TOKEN( spPr ):
355 return new ShapePropertiesContext( *this, mrModel.mxMarkerProp.create() );
356 case C_TOKEN( symbol ):
357 mrModel.monMarkerSymbol = rAttribs.getToken( XML_val, XML_none );
358 return nullptr;
360 break;
362 return nullptr;
365 SeriesContextBase::SeriesContextBase( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
366 ContextBase< SeriesModel >( rParent, rModel )
370 SeriesContextBase::~SeriesContextBase()
374 ContextHandlerRef SeriesContextBase::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
376 switch( getCurrentElement() )
378 case C_TOKEN( ser ):
379 switch( nElement )
381 case C_TOKEN( idx ):
382 mrModel.mnIndex = rAttribs.getInteger( XML_val, -1 );
383 return nullptr;
384 case C_TOKEN( order ):
385 mrModel.mnOrder = rAttribs.getInteger( XML_val, -1 );
386 return nullptr;
387 case C_TOKEN( spPr ):
388 return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
389 case C_TOKEN( tx ):
390 return new TextContext( *this, mrModel.mxText.create() );
392 break;
394 case C_TOKEN( marker ):
395 switch( nElement )
397 case C_TOKEN( size ):
398 mrModel.mnMarkerSize = rAttribs.getInteger( XML_val, 5 );
399 return nullptr;
400 case C_TOKEN( spPr ):
401 return new ShapePropertiesContext( *this, mrModel.mxMarkerProp.create() );
402 case C_TOKEN( symbol ):
403 mrModel.mnMarkerSymbol = rAttribs.getToken( XML_val, XML_none );
404 return nullptr;
406 break;
408 return nullptr;
411 AreaSeriesContext::AreaSeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
412 SeriesContextBase( rParent, rModel )
416 AreaSeriesContext::~AreaSeriesContext()
420 ContextHandlerRef AreaSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
422 bool bMSO2007Doc = getFilter().isMSO2007Document();
423 switch( getCurrentElement() )
425 case C_TOKEN( ser ):
426 switch( nElement )
428 case C_TOKEN( cat ):
429 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::CATEGORIES ) );
430 case C_TOKEN( errBars ):
431 return new ErrorBarContext( *this, mrModel.maErrorBars.create(bMSO2007Doc) );
432 case C_TOKEN( dLbls ):
433 return new DataLabelsContext( *this, mrModel.mxLabels.create(bMSO2007Doc) );
434 case C_TOKEN( dPt ):
435 return new DataPointContext( *this, mrModel.maPoints.create(bMSO2007Doc) );
436 case C_TOKEN( trendline ):
437 return new TrendlineContext( *this, mrModel.maTrendlines.create(bMSO2007Doc) );
438 case C_TOKEN( val ):
439 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
441 break;
443 return SeriesContextBase::onCreateContext( nElement, rAttribs );
446 BarSeriesContext::BarSeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
447 SeriesContextBase( rParent, rModel )
451 BarSeriesContext::~BarSeriesContext()
455 ContextHandlerRef BarSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
457 bool bMSO2007Doc = getFilter().isMSO2007Document();
458 switch( getCurrentElement() )
460 case C_TOKEN( ser ):
461 switch( nElement )
463 case C_TOKEN( cat ):
464 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::CATEGORIES ) );
465 case C_TOKEN( dLbls ):
466 return new DataLabelsContext( *this, mrModel.mxLabels.create(bMSO2007Doc) );
467 case C_TOKEN( dPt ):
468 return new DataPointContext( *this, mrModel.maPoints.create(bMSO2007Doc) );
469 case C_TOKEN( errBars ):
470 return new ErrorBarContext( *this, mrModel.maErrorBars.create(bMSO2007Doc) );
471 case C_TOKEN( invertIfNegative ):
472 mrModel.mbInvertNeg = rAttribs.getBool( XML_val, !bMSO2007Doc );
473 return nullptr;
474 case C_TOKEN( pictureOptions ):
475 return new PictureOptionsContext( *this, mrModel.mxPicOptions.create(bMSO2007Doc) );
476 case C_TOKEN( shape ):
477 mrModel.monShape = rAttribs.getToken(XML_val);
478 return nullptr;
479 case C_TOKEN( trendline ):
480 return new TrendlineContext( *this, mrModel.maTrendlines.create(bMSO2007Doc) );
481 case C_TOKEN( val ):
482 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
484 break;
486 return SeriesContextBase::onCreateContext( nElement, rAttribs );
489 BubbleSeriesContext::BubbleSeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
490 SeriesContextBase( rParent, rModel )
494 BubbleSeriesContext::~BubbleSeriesContext()
498 ContextHandlerRef BubbleSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
500 bool bMSO2007Doc = getFilter().isMSO2007Document();
501 switch( getCurrentElement() )
503 case C_TOKEN( ser ):
504 switch( nElement )
506 case C_TOKEN( bubble3D ):
507 mrModel.mbBubble3d = rAttribs.getBool( XML_val, !bMSO2007Doc );
508 return nullptr;
509 case C_TOKEN( bubbleSize ):
510 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::POINTS ) );
511 case C_TOKEN( dLbls ):
512 return new DataLabelsContext( *this, mrModel.mxLabels.create(bMSO2007Doc) );
513 case C_TOKEN( dPt ):
514 return new DataPointContext( *this, mrModel.maPoints.create(bMSO2007Doc) );
515 case C_TOKEN( errBars ):
516 return new ErrorBarContext( *this, mrModel.maErrorBars.create(bMSO2007Doc) );
517 case C_TOKEN( invertIfNegative ):
518 mrModel.mbInvertNeg = rAttribs.getBool( XML_val, !bMSO2007Doc );
519 return nullptr;
520 case C_TOKEN( trendline ):
521 return new TrendlineContext( *this, mrModel.maTrendlines.create(bMSO2007Doc) );
522 case C_TOKEN( xVal ):
523 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::CATEGORIES ) );
524 case C_TOKEN( yVal ):
525 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
527 break;
529 return SeriesContextBase::onCreateContext( nElement, rAttribs );
532 LineSeriesContext::LineSeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
533 SeriesContextBase( rParent, rModel )
537 LineSeriesContext::~LineSeriesContext()
541 ContextHandlerRef LineSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
543 bool bMSO2007Doc = getFilter().isMSO2007Document();
544 switch( getCurrentElement() )
546 case C_TOKEN( ser ):
547 switch( nElement )
549 case C_TOKEN( cat ):
550 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::CATEGORIES ) );
551 case C_TOKEN( dLbls ):
552 return new DataLabelsContext( *this, mrModel.mxLabels.create(bMSO2007Doc) );
553 case C_TOKEN( dPt ):
554 return new DataPointContext( *this, mrModel.maPoints.create(bMSO2007Doc) );
555 case C_TOKEN( errBars ):
556 return new ErrorBarContext( *this, mrModel.maErrorBars.create(bMSO2007Doc) );
557 case C_TOKEN( marker ):
558 return this;
559 case C_TOKEN( smooth ):
560 mrModel.mbSmooth = rAttribs.getBool( XML_val, !bMSO2007Doc );
561 return nullptr;
562 case C_TOKEN( trendline ):
563 return new TrendlineContext( *this, mrModel.maTrendlines.create(bMSO2007Doc) );
564 case C_TOKEN( val ):
565 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
567 break;
569 return SeriesContextBase::onCreateContext( nElement, rAttribs );
572 PieSeriesContext::PieSeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
573 SeriesContextBase( rParent, rModel )
577 PieSeriesContext::~PieSeriesContext()
581 ContextHandlerRef PieSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
583 bool bMSO2007Doc = getFilter().isMSO2007Document();
584 switch( getCurrentElement() )
586 case C_TOKEN( ser ):
587 switch( nElement )
589 case C_TOKEN( cat ):
590 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::CATEGORIES ) );
591 case C_TOKEN( dLbls ):
592 return new DataLabelsContext( *this, mrModel.mxLabels.create(bMSO2007Doc) );
593 case C_TOKEN( dPt ):
594 return new DataPointContext( *this, mrModel.maPoints.create(bMSO2007Doc) );
595 case C_TOKEN( explosion ):
596 mrModel.mnExplosion = rAttribs.getInteger( XML_val, 0 );
597 return nullptr;
598 case C_TOKEN( val ):
599 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
601 break;
603 return SeriesContextBase::onCreateContext( nElement, rAttribs );
606 RadarSeriesContext::RadarSeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
607 SeriesContextBase( rParent, rModel )
611 RadarSeriesContext::~RadarSeriesContext()
615 ContextHandlerRef RadarSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
617 bool bMSO2007Doc = getFilter().isMSO2007Document();
618 switch( getCurrentElement() )
620 case C_TOKEN( ser ):
621 switch( nElement )
623 case C_TOKEN( cat ):
624 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::CATEGORIES ) );
625 case C_TOKEN( dLbls ):
626 return new DataLabelsContext( *this, mrModel.mxLabels.create(bMSO2007Doc) );
627 case C_TOKEN( dPt ):
628 return new DataPointContext( *this, mrModel.maPoints.create(bMSO2007Doc) );
629 case C_TOKEN( marker ):
630 return this;
631 case C_TOKEN( smooth ):
632 mrModel.mbSmooth = rAttribs.getBool( XML_val, bMSO2007Doc );
633 return nullptr;
634 case C_TOKEN( val ):
635 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
637 break;
639 return SeriesContextBase::onCreateContext( nElement, rAttribs );
642 ScatterSeriesContext::ScatterSeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
643 SeriesContextBase( rParent, rModel )
647 ScatterSeriesContext::~ScatterSeriesContext()
651 ContextHandlerRef ScatterSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
653 bool bMSO2007Doc = getFilter().isMSO2007Document();
654 switch( getCurrentElement() )
656 case C_TOKEN( ser ):
657 switch( nElement )
659 case C_TOKEN( dLbls ):
660 return new DataLabelsContext( *this, mrModel.mxLabels.create(bMSO2007Doc) );
661 case C_TOKEN( dPt ):
662 return new DataPointContext( *this, mrModel.maPoints.create(bMSO2007Doc) );
663 case C_TOKEN( errBars ):
664 return new ErrorBarContext( *this, mrModel.maErrorBars.create(bMSO2007Doc) );
665 case C_TOKEN( marker ):
666 return this;
667 case C_TOKEN( smooth ):
668 mrModel.mbSmooth = rAttribs.getBool( XML_val, !bMSO2007Doc );
669 return nullptr;
670 case C_TOKEN( trendline ):
671 return new TrendlineContext( *this, mrModel.maTrendlines.create(bMSO2007Doc) );
672 case C_TOKEN( xVal ):
673 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::CATEGORIES ) );
674 case C_TOKEN( yVal ):
675 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
677 break;
679 return SeriesContextBase::onCreateContext( nElement, rAttribs );
682 SurfaceSeriesContext::SurfaceSeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
683 SeriesContextBase( rParent, rModel )
687 SurfaceSeriesContext::~SurfaceSeriesContext()
691 ContextHandlerRef SurfaceSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
693 switch( getCurrentElement() )
695 case C_TOKEN( ser ):
696 switch( nElement )
698 case C_TOKEN( cat ):
699 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::CATEGORIES ) );
700 case C_TOKEN( val ):
701 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
703 break;
705 return SeriesContextBase::onCreateContext( nElement, rAttribs );
708 } // namespace chart
709 } // namespace drawingml
710 } // namespace oox
712 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */