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