tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / oox / source / drawingml / chart / seriescontext.cxx
blobbfbc28304ab329ecfc1830c25d162a38455c4f4c
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::drawingml::chart {
34 using ::oox::core::ContextHandler2;
35 using ::oox::core::ContextHandler2Helper;
36 using ::oox::core::ContextHandlerRef;
38 namespace {
40 ContextHandlerRef lclDataLabelSharedCreateContext( ContextHandler2& rContext,
41 sal_Int32 nElement, const AttributeList& rAttribs, DataLabelModelBase& orModel, bool bMSO2007 )
43 if( rContext.isRootElement() ) switch( nElement )
45 case C_TOKEN( delete ):
46 orModel.mbDeleted = rAttribs.getBool( XML_val, !bMSO2007 );
47 return nullptr;
48 case C_TOKEN( dLblPos ):
49 orModel.monLabelPos = rAttribs.getToken( XML_val, XML_TOKEN_INVALID );
50 return nullptr;
51 case C_TOKEN( numFmt ):
52 orModel.maNumberFormat.setAttributes( rAttribs );
53 return nullptr;
54 case C_TOKEN( showBubbleSize ):
55 orModel.mobShowBubbleSize = rAttribs.getBool( XML_val );
56 return nullptr;
57 case C_TOKEN( showCatName ):
58 orModel.mobShowCatName = rAttribs.getBool( XML_val );
59 return nullptr;
60 case C_TOKEN( showLegendKey ):
61 orModel.mobShowLegendKey = rAttribs.getBool( XML_val );
62 return nullptr;
63 case C_TOKEN( showPercent ):
64 orModel.mobShowPercent = rAttribs.getBool( XML_val );
65 return nullptr;
66 case C_TOKEN( showSerName ):
67 orModel.mobShowSerName = rAttribs.getBool( XML_val );
68 return nullptr;
69 case C_TOKEN( showVal ):
70 orModel.mobShowVal = rAttribs.getBool( XML_val );
71 return nullptr;
72 case C_TOKEN( separator ):
73 // collect separator text in onCharacters()
74 return &rContext;
75 case C_TOKEN( spPr ):
76 return new ShapePropertiesContext( rContext, orModel.mxShapeProp.create() );
77 case C_TOKEN( txPr ):
78 return new TextBodyContext( rContext, orModel.mxTextProp.create() );
80 return nullptr;
83 void lclDataLabelSharedCharacters( ContextHandler2 const & rContext, const OUString& rChars, DataLabelModelBase& orModel )
85 if( rContext.isCurrentElement( C_TOKEN( separator ) ) )
86 orModel.moaSeparator = rChars;
89 } // namespace
91 DataLabelContext::DataLabelContext( ContextHandler2Helper& rParent, DataLabelModel& rModel ) :
92 ContextBase< DataLabelModel >( rParent, rModel )
94 mrModel.mbDeleted = false;
97 DataLabelContext::~DataLabelContext()
101 ContextHandlerRef DataLabelContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
103 if( isRootElement() )
105 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() );
114 case C_TOKEN( extLst ):
115 return this;
118 else
120 switch( getCurrentElement() )
122 case C_TOKEN( extLst ):
123 if ( nElement == C_TOKEN( ext ) )
124 return this;
125 break;
126 case C_TOKEN( ext ):
127 if ( nElement == C15_TOKEN( showDataLabelsRange ) )
129 mrModel.mobShowDataLabelsRange = rAttribs.getBool( XML_val );
130 return nullptr;
132 else if (nElement == C15_TOKEN(layout))
133 return new LayoutContext(*this, mrModel.mxLayout.getOrCreate());
134 break;
137 bool bMSO2007 = getFilter().isMSO2007Document();
138 return lclDataLabelSharedCreateContext( *this, nElement, rAttribs, mrModel, bMSO2007 );
141 void DataLabelContext::onCharacters( const OUString& rChars )
143 lclDataLabelSharedCharacters( *this, rChars, mrModel );
146 DataLabelsContext::DataLabelsContext( ContextHandler2Helper& rParent, DataLabelsModel& rModel ) :
147 ContextBase< DataLabelsModel >( rParent, rModel )
149 mrModel.mbDeleted = false;
152 DataLabelsContext::~DataLabelsContext()
156 ContextHandlerRef DataLabelsContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
158 bool bMSO2007Doc = getFilter().isMSO2007Document();
159 if( isRootElement() ) switch( nElement )
161 case C_TOKEN( dLbl ):
162 return new DataLabelContext( *this, mrModel.maPointLabels.create(mrModel, bMSO2007Doc) );
163 case C_TOKEN( leaderLines ):
164 return new ShapePrWrapperContext( *this, mrModel.mxLeaderLines.create() );
165 case C_TOKEN( showLeaderLines ):
166 case C15_TOKEN( showLeaderLines ):
167 mrModel.mbShowLeaderLines = rAttribs.getBool( XML_val, true );
168 return nullptr;
169 case C_TOKEN( extLst ):
170 case C_TOKEN( ext ):
171 return new DataLabelsContext( *this, mrModel );
173 return lclDataLabelSharedCreateContext( *this, nElement, rAttribs, mrModel, bMSO2007Doc );
176 void DataLabelsContext::onCharacters( const OUString& rChars )
178 lclDataLabelSharedCharacters( *this, rChars, mrModel );
181 PictureOptionsContext::PictureOptionsContext( ContextHandler2Helper& rParent, PictureOptionsModel& rModel ) :
182 ContextBase< PictureOptionsModel >( rParent, rModel )
186 PictureOptionsContext::~PictureOptionsContext()
190 ContextHandlerRef PictureOptionsContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
192 bool bMSO2007Doc = getFilter().isMSO2007Document();
193 if( isRootElement() ) switch( nElement )
195 case C_TOKEN( applyToEnd ):
196 mrModel.mbApplyToEnd = rAttribs.getBool( XML_val, !bMSO2007Doc );
197 return nullptr;
198 case C_TOKEN( applyToFront ):
199 mrModel.mbApplyToFront = rAttribs.getBool( XML_val, !bMSO2007Doc );
200 return nullptr;
201 case C_TOKEN( applyToSides ):
202 mrModel.mbApplyToSides = rAttribs.getBool( XML_val, !bMSO2007Doc );
203 return nullptr;
204 case C_TOKEN( pictureFormat ):
205 mrModel.mnPictureFormat = rAttribs.getToken( XML_val, XML_stretch );
206 return nullptr;
207 case C_TOKEN( pictureStackUnit ):
208 mrModel.mfStackUnit = rAttribs.getDouble( XML_val, 1.0 );
209 return nullptr;
211 return nullptr;
214 ErrorBarContext::ErrorBarContext( ContextHandler2Helper& rParent, ErrorBarModel& rModel ) :
215 ContextBase< ErrorBarModel >( rParent, rModel )
219 ErrorBarContext::~ErrorBarContext()
223 ContextHandlerRef ErrorBarContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
225 bool bMSO2007Doc = getFilter().isMSO2007Document();
226 if( isRootElement() ) switch( nElement )
228 case C_TOKEN( errBarType ):
229 mrModel.mnTypeId = rAttribs.getToken( XML_val, XML_both );
230 return nullptr;
231 case C_TOKEN( errDir ):
232 mrModel.mnDirection = rAttribs.getToken( XML_val, XML_TOKEN_INVALID );
233 return nullptr;
234 case C_TOKEN( errValType ):
235 mrModel.mnValueType = rAttribs.getToken( XML_val, XML_fixedVal );
236 return nullptr;
237 case C_TOKEN( minus ):
238 return new DataSourceContext( *this, mrModel.maSources.create( ErrorBarModel::MINUS ) );
239 case C_TOKEN( noEndCap ):
240 mrModel.mbNoEndCap = rAttribs.getBool( XML_val, !bMSO2007Doc );
241 return nullptr;
242 case C_TOKEN( plus ):
243 return new DataSourceContext( *this, mrModel.maSources.create( ErrorBarModel::PLUS ) );
244 case C_TOKEN( spPr ):
245 return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
246 case C_TOKEN( val ):
247 mrModel.mfValue = rAttribs.getDouble( XML_val, 0.0 );
248 return nullptr;
250 return nullptr;
253 TrendlineLabelContext::TrendlineLabelContext( ContextHandler2Helper& rParent, TrendlineLabelModel& rModel ) :
254 ContextBase< TrendlineLabelModel >( rParent, rModel )
258 TrendlineLabelContext::~TrendlineLabelContext()
262 ContextHandlerRef TrendlineLabelContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
264 if( isRootElement() ) switch( nElement )
266 case C_TOKEN( layout ):
267 return new LayoutContext( *this, mrModel.mxLayout.create() );
268 case C_TOKEN( numFmt ):
269 mrModel.maNumberFormat.setAttributes( rAttribs );
270 return nullptr;
271 case C_TOKEN( spPr ):
272 return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
273 case C_TOKEN( tx ):
274 return new TextContext( *this, mrModel.mxText.create() );
275 case C_TOKEN( txPr ):
276 return new TextBodyContext( *this, mrModel.mxTextProp.create() );
278 return nullptr;
281 TrendlineContext::TrendlineContext( ContextHandler2Helper& rParent, TrendlineModel& rModel ) :
282 ContextBase< TrendlineModel >( rParent, rModel )
286 TrendlineContext::~TrendlineContext()
290 ContextHandlerRef TrendlineContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
292 bool bMSO2007Doc = getFilter().isMSO2007Document();
293 if( isRootElement() ) switch( nElement )
295 case C_TOKEN( backward ):
296 mrModel.mfBackward = rAttribs.getDouble( XML_val, 0.0 );
297 return nullptr;
298 case C_TOKEN( dispEq ):
299 mrModel.mbDispEquation = rAttribs.getBool( XML_val, !bMSO2007Doc );
300 return nullptr;
301 case C_TOKEN( dispRSqr ):
302 mrModel.mbDispRSquared = rAttribs.getBool( XML_val, !bMSO2007Doc );
303 return nullptr;
304 case C_TOKEN( forward ):
305 mrModel.mfForward = rAttribs.getDouble( XML_val, 0.0 );
306 return nullptr;
307 case C_TOKEN( intercept ):
308 mrModel.mfIntercept = rAttribs.getDouble( XML_val, 0.0 );
309 return nullptr;
310 case C_TOKEN( name ):
311 return this; // collect name in onCharacters()
312 case C_TOKEN( order ):
313 mrModel.mnOrder = rAttribs.getInteger( XML_val, 2 );
314 return nullptr;
315 case C_TOKEN( period ):
316 mrModel.mnPeriod = rAttribs.getInteger( XML_val, 2 );
317 return nullptr;
318 case C_TOKEN( spPr ):
319 return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
320 case C_TOKEN( trendlineLbl ):
321 return new TrendlineLabelContext( *this, mrModel.mxLabel.create() );
322 case C_TOKEN( trendlineType ):
323 mrModel.mnTypeId = rAttribs.getToken( XML_val, XML_linear );
324 return nullptr;
326 return nullptr;
329 void TrendlineContext::onCharacters( const OUString& rChars )
331 if( isCurrentElement( C_TOKEN( name ) ) )
332 mrModel.maName = rChars;
335 DataPointContext::DataPointContext( ContextHandler2Helper& rParent, DataPointModel& rModel ) :
336 ContextBase< DataPointModel >( rParent, rModel )
340 DataPointContext::~DataPointContext()
344 ContextHandlerRef DataPointContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
346 bool bMSO2007Doc = getFilter().isMSO2007Document();
347 switch( getCurrentElement() )
349 case C_TOKEN( dPt ):
350 switch( nElement )
352 case C_TOKEN( bubble3D ):
353 mrModel.mobBubble3d = rAttribs.getBool( XML_val );
354 return nullptr;
355 case C_TOKEN( explosion ):
356 // if the 'val' attribute is missing, series explosion remains unchanged
357 mrModel.monExplosion = rAttribs.getInteger( XML_val );
358 return nullptr;
359 case C_TOKEN( idx ):
360 mrModel.mnIndex = rAttribs.getInteger( XML_val, -1 );
361 return nullptr;
362 case C_TOKEN( invertIfNegative ):
363 mrModel.mbInvertNeg = rAttribs.getBool( XML_val, !bMSO2007Doc );
364 return nullptr;
365 case C_TOKEN( marker ):
366 return this;
367 case C_TOKEN( pictureOptions ):
368 return new PictureOptionsContext( *this, mrModel.mxPicOptions.create(bMSO2007Doc) );
369 case C_TOKEN( spPr ):
370 return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
372 break;
374 case C_TOKEN( marker ):
375 switch( nElement )
377 case C_TOKEN( size ):
378 mrModel.monMarkerSize = rAttribs.getInteger( XML_val, 5 );
379 return nullptr;
380 case C_TOKEN( spPr ):
381 return new ShapePropertiesContext( *this, mrModel.mxMarkerProp.create() );
382 case C_TOKEN( symbol ):
383 mrModel.monMarkerSymbol = rAttribs.getToken( XML_val, XML_none );
384 return nullptr;
386 break;
388 return nullptr;
391 SeriesContextBase::SeriesContextBase( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
392 ContextBase< SeriesModel >( rParent, rModel )
396 SeriesContextBase::~SeriesContextBase()
400 ContextHandlerRef SeriesContextBase::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
402 switch( getCurrentElement() )
404 case C_TOKEN( ser ):
405 switch( nElement )
407 case C_TOKEN( idx ):
408 mrModel.mnIndex = rAttribs.getInteger( XML_val, -1 );
409 return nullptr;
410 case C_TOKEN( order ):
411 mrModel.mnOrder = rAttribs.getInteger( XML_val, -1 );
412 return nullptr;
413 case C_TOKEN( spPr ):
414 return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
415 case C_TOKEN( tx ):
416 return new TextContext( *this, mrModel.mxText.create() );
417 case C_TOKEN( extLst ):
418 return this;
420 break;
422 case C_TOKEN( marker ):
423 switch( nElement )
425 case C_TOKEN( size ):
426 mrModel.mnMarkerSize = rAttribs.getInteger( XML_val, 5 );
427 return nullptr;
428 case C_TOKEN( spPr ):
429 return new ShapePropertiesContext( *this, mrModel.mxMarkerProp.create() );
430 case C_TOKEN( symbol ):
431 mrModel.mnMarkerSymbol = rAttribs.getToken( XML_val, XML_none );
432 return nullptr;
434 break;
436 case C_TOKEN( extLst ):
437 switch( nElement )
439 case C_TOKEN( ext ):
440 if (mrModel.maSources.has( SeriesModel::DATALABELS ))
441 break;
443 DataSourceModel& rLabelsSource = mrModel.maSources.create( SeriesModel::DATALABELS );
444 if (mrModel.mxLabels.is())
445 mrModel.mxLabels->mpLabelsSource = &rLabelsSource;
446 return new DataSourceContext( *this, rLabelsSource );
449 return nullptr;
452 AreaSeriesContext::AreaSeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
453 SeriesContextBase( rParent, rModel )
457 AreaSeriesContext::~AreaSeriesContext()
461 ContextHandlerRef AreaSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
463 bool bMSO2007Doc = getFilter().isMSO2007Document();
464 switch( getCurrentElement() )
466 case C_TOKEN( ser ):
467 switch( nElement )
469 case C_TOKEN( cat ):
470 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::CATEGORIES ) );
471 case C_TOKEN( errBars ):
472 return new ErrorBarContext( *this, mrModel.maErrorBars.create(bMSO2007Doc) );
473 case C_TOKEN( dLbls ):
474 return new DataLabelsContext( *this, mrModel.mxLabels.create(bMSO2007Doc) );
475 case C_TOKEN( dPt ):
476 return new DataPointContext( *this, mrModel.maPoints.create(bMSO2007Doc) );
477 case C_TOKEN( trendline ):
478 return new TrendlineContext( *this, mrModel.maTrendlines.create(bMSO2007Doc) );
479 case C_TOKEN( val ):
480 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
482 break;
484 return SeriesContextBase::onCreateContext( nElement, rAttribs );
487 BarSeriesContext::BarSeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
488 SeriesContextBase( rParent, rModel )
492 BarSeriesContext::~BarSeriesContext()
496 ContextHandlerRef BarSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
498 bool bMSO2007Doc = getFilter().isMSO2007Document();
499 switch( getCurrentElement() )
501 case C_TOKEN( ser ):
502 switch( nElement )
504 case C_TOKEN( cat ):
505 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::CATEGORIES ) );
506 case C_TOKEN( dLbls ):
507 return new DataLabelsContext( *this, mrModel.mxLabels.create(bMSO2007Doc) );
508 case C_TOKEN( dPt ):
509 return new DataPointContext( *this, mrModel.maPoints.create(bMSO2007Doc) );
510 case C_TOKEN( errBars ):
511 return new ErrorBarContext( *this, mrModel.maErrorBars.create(bMSO2007Doc) );
512 case C_TOKEN( invertIfNegative ):
513 mrModel.mbInvertNeg = rAttribs.getBool( XML_val, !bMSO2007Doc );
514 return nullptr;
515 case C_TOKEN( pictureOptions ):
516 return new PictureOptionsContext( *this, mrModel.mxPicOptions.create(bMSO2007Doc) );
517 case C_TOKEN( shape ):
518 mrModel.monShape = rAttribs.getToken(XML_val);
519 return nullptr;
520 case C_TOKEN( trendline ):
521 return new TrendlineContext( *this, mrModel.maTrendlines.create(bMSO2007Doc) );
522 case C_TOKEN( val ):
523 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
525 break;
527 return SeriesContextBase::onCreateContext( nElement, rAttribs );
530 BubbleSeriesContext::BubbleSeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
531 SeriesContextBase( rParent, rModel )
535 BubbleSeriesContext::~BubbleSeriesContext()
539 ContextHandlerRef BubbleSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
541 bool bMSO2007Doc = getFilter().isMSO2007Document();
542 switch( getCurrentElement() )
544 case C_TOKEN( ser ):
545 switch( nElement )
547 case C_TOKEN( bubble3D ):
548 mrModel.mbBubble3d = rAttribs.getBool( XML_val, !bMSO2007Doc );
549 return nullptr;
550 case C_TOKEN( bubbleSize ):
551 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::POINTS ) );
552 case C_TOKEN( dLbls ):
553 return new DataLabelsContext( *this, mrModel.mxLabels.create(bMSO2007Doc) );
554 case C_TOKEN( dPt ):
555 return new DataPointContext( *this, mrModel.maPoints.create(bMSO2007Doc) );
556 case C_TOKEN( errBars ):
557 return new ErrorBarContext( *this, mrModel.maErrorBars.create(bMSO2007Doc) );
558 case C_TOKEN( invertIfNegative ):
559 mrModel.mbInvertNeg = rAttribs.getBool( XML_val, !bMSO2007Doc );
560 return nullptr;
561 case C_TOKEN( trendline ):
562 return new TrendlineContext( *this, mrModel.maTrendlines.create(bMSO2007Doc) );
563 case C_TOKEN( xVal ):
564 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::CATEGORIES ) );
565 case C_TOKEN( yVal ):
566 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
568 break;
570 return SeriesContextBase::onCreateContext( nElement, rAttribs );
573 LineSeriesContext::LineSeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
574 SeriesContextBase( rParent, rModel )
578 LineSeriesContext::~LineSeriesContext()
582 ContextHandlerRef LineSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
584 bool bMSO2007Doc = getFilter().isMSO2007Document();
585 switch( getCurrentElement() )
587 case C_TOKEN( ser ):
588 switch( nElement )
590 case C_TOKEN( cat ):
591 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::CATEGORIES ) );
592 case C_TOKEN( dLbls ):
593 return new DataLabelsContext( *this, mrModel.mxLabels.create(bMSO2007Doc) );
594 case C_TOKEN( dPt ):
595 return new DataPointContext( *this, mrModel.maPoints.create(bMSO2007Doc) );
596 case C_TOKEN( errBars ):
597 return new ErrorBarContext( *this, mrModel.maErrorBars.create(bMSO2007Doc) );
598 case C_TOKEN( marker ):
599 return this;
600 case C_TOKEN( smooth ):
601 mrModel.mbSmooth = rAttribs.getBool( XML_val, !bMSO2007Doc );
602 return nullptr;
603 case C_TOKEN( trendline ):
604 return new TrendlineContext( *this, mrModel.maTrendlines.create(bMSO2007Doc) );
605 case C_TOKEN( val ):
606 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
608 break;
610 return SeriesContextBase::onCreateContext( nElement, rAttribs );
613 PieSeriesContext::PieSeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
614 SeriesContextBase( rParent, rModel )
618 PieSeriesContext::~PieSeriesContext()
622 ContextHandlerRef PieSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
624 bool bMSO2007Doc = getFilter().isMSO2007Document();
625 switch( getCurrentElement() )
627 case C_TOKEN( ser ):
628 switch( nElement )
630 case C_TOKEN( cat ):
631 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::CATEGORIES ) );
632 case C_TOKEN( dLbls ):
633 return new DataLabelsContext( *this, mrModel.mxLabels.create(bMSO2007Doc) );
634 case C_TOKEN( dPt ):
635 return new DataPointContext( *this, mrModel.maPoints.create(bMSO2007Doc) );
636 case C_TOKEN( explosion ):
637 mrModel.mnExplosion = rAttribs.getInteger( XML_val, 0 );
638 return nullptr;
639 case C_TOKEN( val ):
640 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
642 break;
644 return SeriesContextBase::onCreateContext( nElement, rAttribs );
647 RadarSeriesContext::RadarSeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
648 SeriesContextBase( rParent, rModel )
652 RadarSeriesContext::~RadarSeriesContext()
656 ContextHandlerRef RadarSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
658 bool bMSO2007Doc = getFilter().isMSO2007Document();
659 switch( getCurrentElement() )
661 case C_TOKEN( ser ):
662 switch( nElement )
664 case C_TOKEN( cat ):
665 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::CATEGORIES ) );
666 case C_TOKEN( dLbls ):
667 return new DataLabelsContext( *this, mrModel.mxLabels.create(bMSO2007Doc) );
668 case C_TOKEN( dPt ):
669 return new DataPointContext( *this, mrModel.maPoints.create(bMSO2007Doc) );
670 case C_TOKEN( marker ):
671 return this;
672 case C_TOKEN( smooth ):
673 mrModel.mbSmooth = rAttribs.getBool( XML_val, bMSO2007Doc );
674 return nullptr;
675 case C_TOKEN( val ):
676 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
678 break;
680 return SeriesContextBase::onCreateContext( nElement, rAttribs );
683 ScatterSeriesContext::ScatterSeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
684 SeriesContextBase( rParent, rModel )
688 ScatterSeriesContext::~ScatterSeriesContext()
692 ContextHandlerRef ScatterSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
694 bool bMSO2007Doc = getFilter().isMSO2007Document();
695 switch( getCurrentElement() )
697 case C_TOKEN( ser ):
698 switch( nElement )
700 case C_TOKEN( dLbls ):
701 return new DataLabelsContext( *this, mrModel.mxLabels.create(bMSO2007Doc) );
702 case C_TOKEN( dPt ):
703 return new DataPointContext( *this, mrModel.maPoints.create(bMSO2007Doc) );
704 case C_TOKEN( errBars ):
705 return new ErrorBarContext( *this, mrModel.maErrorBars.create(bMSO2007Doc) );
706 case C_TOKEN( marker ):
707 return this;
708 case C_TOKEN( smooth ):
709 mrModel.mbSmooth = rAttribs.getBool( XML_val, !bMSO2007Doc );
710 return nullptr;
711 case C_TOKEN( trendline ):
712 return new TrendlineContext( *this, mrModel.maTrendlines.create(bMSO2007Doc) );
713 case C_TOKEN( xVal ):
714 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::CATEGORIES ) );
715 case C_TOKEN( yVal ):
716 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
718 break;
720 return SeriesContextBase::onCreateContext( nElement, rAttribs );
723 SurfaceSeriesContext::SurfaceSeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
724 SeriesContextBase( rParent, rModel )
728 SurfaceSeriesContext::~SurfaceSeriesContext()
732 ContextHandlerRef SurfaceSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
734 switch( getCurrentElement() )
736 case C_TOKEN( ser ):
737 switch( nElement )
739 case C_TOKEN( cat ):
740 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::CATEGORIES ) );
741 case C_TOKEN( val ):
742 return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
744 break;
746 return SeriesContextBase::onCreateContext( nElement, rAttribs );
749 } // namespace oox
751 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */