1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/typegroupcontext.hxx"
22 #include "drawingml/chart/seriescontext.hxx"
23 #include "drawingml/chart/typegroupmodel.hxx"
29 using ::oox::core::ContextHandler2Helper
;
30 using ::oox::core::ContextHandlerRef
;
32 UpDownBarsContext::UpDownBarsContext( ContextHandler2Helper
& rParent
, UpDownBarsModel
& rModel
) :
33 ContextBase
< UpDownBarsModel
>( rParent
, rModel
)
37 UpDownBarsContext::~UpDownBarsContext()
41 ContextHandlerRef
UpDownBarsContext::onCreateContext( sal_Int32 nElement
, const AttributeList
& rAttribs
)
43 switch( getCurrentElement() )
45 case C_TOKEN( upDownBars
):
48 case C_TOKEN( downBars
):
49 return new ShapePrWrapperContext( *this, mrModel
.mxDownBars
.create() );
50 case C_TOKEN( gapWidth
):
51 mrModel
.mnGapWidth
= rAttribs
.getInteger( XML_val
, 150 );
53 case C_TOKEN( upBars
):
54 return new ShapePrWrapperContext( *this, mrModel
.mxUpBars
.create() );
61 AreaTypeGroupContext::AreaTypeGroupContext( ContextHandler2Helper
& rParent
, TypeGroupModel
& rModel
) :
62 TypeGroupContextBase( rParent
, rModel
)
66 AreaTypeGroupContext::~AreaTypeGroupContext()
70 ContextHandlerRef
AreaTypeGroupContext::onCreateContext( sal_Int32 nElement
, const AttributeList
& rAttribs
)
72 bool bMSO2007Doc
= getFilter().isMSO2007Document();
73 if( isRootElement() ) switch( nElement
)
76 mrModel
.maAxisIds
.push_back( rAttribs
.getInteger( XML_val
, -1 ) );
78 case C_TOKEN( dLbls
):
79 return new DataLabelsContext( *this, mrModel
.mxLabels
.create(bMSO2007Doc
) );
80 case C_TOKEN( dropLines
):
81 return new ShapePrWrapperContext( *this, mrModel
.mxDropLines
.create() );
82 case C_TOKEN( gapDepth
):
83 mrModel
.mnGapDepth
= rAttribs
.getInteger( XML_val
, 150 );
85 case C_TOKEN( grouping
):
86 mrModel
.mnGrouping
= rAttribs
.getToken( XML_val
, bMSO2007Doc
? XML_standard
: XML_clustered
);
89 return new AreaSeriesContext( *this, mrModel
.maSeries
.create(bMSO2007Doc
) );
90 case C_TOKEN( varyColors
):
91 mrModel
.mbVaryColors
= rAttribs
.getBool( XML_val
, !bMSO2007Doc
);
97 BarTypeGroupContext::BarTypeGroupContext( ContextHandler2Helper
& rParent
, TypeGroupModel
& rModel
) :
98 TypeGroupContextBase( rParent
, rModel
)
102 BarTypeGroupContext::~BarTypeGroupContext()
106 ContextHandlerRef
BarTypeGroupContext::onCreateContext( sal_Int32 nElement
, const AttributeList
& rAttribs
)
108 bool bMSO2007Doc
= getFilter().isMSO2007Document();
109 if( isRootElement() ) switch( nElement
)
111 case C_TOKEN( axId
):
112 mrModel
.maAxisIds
.push_back( rAttribs
.getInteger( XML_val
, -1 ) );
114 case C_TOKEN( barDir
):
115 mrModel
.mnBarDir
= rAttribs
.getToken( XML_val
, XML_col
);
117 case C_TOKEN( dLbls
):
118 return new DataLabelsContext( *this, mrModel
.mxLabels
.create(bMSO2007Doc
) );
119 case C_TOKEN( gapDepth
):
120 mrModel
.mnGapDepth
= rAttribs
.getInteger( XML_val
, 150 );
122 case C_TOKEN( gapWidth
):
123 mrModel
.mnGapWidth
= rAttribs
.getInteger( XML_val
, 150 );
125 case C_TOKEN( grouping
):
126 mrModel
.mnGrouping
= rAttribs
.getToken( XML_val
, bMSO2007Doc
? XML_standard
: XML_clustered
);
128 case C_TOKEN( overlap
):
129 mrModel
.mnOverlap
= rAttribs
.getInteger( XML_val
, 0 );
132 return new BarSeriesContext( *this, mrModel
.maSeries
.create(bMSO2007Doc
) );
133 case C_TOKEN( serLines
):
134 return new ShapePrWrapperContext( *this, mrModel
.mxSerLines
.create() );
135 case C_TOKEN( shape
):
136 mrModel
.mnShape
= rAttribs
.getToken( XML_val
, XML_box
);
138 case C_TOKEN( varyColors
):
139 mrModel
.mbVaryColors
= rAttribs
.getBool( XML_val
, !bMSO2007Doc
);
145 BubbleTypeGroupContext::BubbleTypeGroupContext( ContextHandler2Helper
& rParent
, TypeGroupModel
& rModel
) :
146 TypeGroupContextBase( rParent
, rModel
)
150 BubbleTypeGroupContext::~BubbleTypeGroupContext()
154 ContextHandlerRef
BubbleTypeGroupContext::onCreateContext( sal_Int32 nElement
, const AttributeList
& rAttribs
)
156 bool bMSO2007Doc
= getFilter().isMSO2007Document();
157 if( isRootElement() ) switch( nElement
)
159 case C_TOKEN( axId
):
160 mrModel
.maAxisIds
.push_back( rAttribs
.getInteger( XML_val
, -1 ) );
162 case C_TOKEN( bubble3D
):
163 mrModel
.mbBubble3d
= rAttribs
.getBool( XML_val
, !bMSO2007Doc
);
165 case C_TOKEN( bubbleScale
):
166 mrModel
.mnBubbleScale
= rAttribs
.getInteger( XML_val
, 100 );
168 case C_TOKEN( dLbls
):
169 return new DataLabelsContext( *this, mrModel
.mxLabels
.create(bMSO2007Doc
) );
171 return new BubbleSeriesContext( *this, mrModel
.maSeries
.create(bMSO2007Doc
) );
172 case C_TOKEN( showNegBubbles
):
173 mrModel
.mbShowNegBubbles
= rAttribs
.getBool( XML_val
, !bMSO2007Doc
);
175 case C_TOKEN( sizeRepresents
):
176 mrModel
.mnSizeRepresents
= rAttribs
.getToken( XML_val
, XML_area
);
178 case C_TOKEN( varyColors
):
179 mrModel
.mbVaryColors
= rAttribs
.getBool( XML_val
, !bMSO2007Doc
);
185 LineTypeGroupContext::LineTypeGroupContext( ContextHandler2Helper
& rParent
, TypeGroupModel
& rModel
) :
186 TypeGroupContextBase( rParent
, rModel
)
190 LineTypeGroupContext::~LineTypeGroupContext()
194 ContextHandlerRef
LineTypeGroupContext::onCreateContext( sal_Int32 nElement
, const AttributeList
& rAttribs
)
196 bool bMSO2007Doc
= getFilter().isMSO2007Document();
197 if( isRootElement() ) switch( nElement
)
199 case C_TOKEN( axId
):
200 mrModel
.maAxisIds
.push_back( rAttribs
.getInteger( XML_val
, -1 ) );
202 case C_TOKEN( dLbls
):
203 return new DataLabelsContext( *this, mrModel
.mxLabels
.create(bMSO2007Doc
) );
204 case C_TOKEN( dropLines
):
205 return new ShapePrWrapperContext( *this, mrModel
.mxDropLines
.create() );
206 case C_TOKEN( gapDepth
):
207 mrModel
.mnGapDepth
= rAttribs
.getInteger( XML_val
, 150 );
209 case C_TOKEN( grouping
):
210 mrModel
.mnGrouping
= rAttribs
.getToken( XML_val
, bMSO2007Doc
? XML_standard
: XML_clustered
);
212 case C_TOKEN( hiLowLines
):
213 return new ShapePrWrapperContext( *this, mrModel
.mxHiLowLines
.create() );
214 case C_TOKEN( marker
):
215 mrModel
.mbShowMarker
= rAttribs
.getBool( XML_val
, !bMSO2007Doc
);
218 return new LineSeriesContext( *this, mrModel
.maSeries
.create(bMSO2007Doc
) );
219 case C_TOKEN( smooth
):
220 mrModel
.mbSmooth
= rAttribs
.getBool( XML_val
, !bMSO2007Doc
);
222 case C_TOKEN( upDownBars
):
223 return new UpDownBarsContext( *this, mrModel
.mxUpDownBars
.create() );
224 case C_TOKEN( varyColors
):
225 mrModel
.mbVaryColors
= rAttribs
.getBool( XML_val
, !bMSO2007Doc
);
231 PieTypeGroupContext::PieTypeGroupContext( ContextHandler2Helper
& rParent
, TypeGroupModel
& rModel
) :
232 TypeGroupContextBase( rParent
, rModel
)
236 PieTypeGroupContext::~PieTypeGroupContext()
240 ContextHandlerRef
PieTypeGroupContext::onCreateContext( sal_Int32 nElement
, const AttributeList
& rAttribs
)
242 bool bMSO2007Doc
= getFilter().isMSO2007Document();
243 if( isRootElement() ) switch( nElement
)
245 case C_TOKEN( dLbls
):
246 return new DataLabelsContext( *this, mrModel
.mxLabels
.create(bMSO2007Doc
) );
247 case C_TOKEN( firstSliceAng
):
248 mrModel
.mnFirstAngle
= rAttribs
.getInteger( XML_val
, 0 );
250 case C_TOKEN( gapWidth
):
251 mrModel
.mnGapWidth
= rAttribs
.getInteger( XML_val
, 150 );
253 case C_TOKEN( holeSize
):
254 mrModel
.mnHoleSize
= rAttribs
.getInteger( XML_val
, 10 );
256 case C_TOKEN( ofPieType
):
257 mrModel
.mnOfPieType
= rAttribs
.getToken( XML_val
, XML_pie
);
259 case C_TOKEN( secondPieSize
):
260 mrModel
.mnSecondPieSize
= rAttribs
.getInteger( XML_val
, 75 );
263 return new PieSeriesContext( *this, mrModel
.maSeries
.create(bMSO2007Doc
) );
264 case C_TOKEN( serLines
):
265 return new ShapePrWrapperContext( *this, mrModel
.mxSerLines
.create() );
266 case C_TOKEN( splitPos
):
267 mrModel
.mfSplitPos
= rAttribs
.getDouble( XML_val
, 0.0 );
269 case C_TOKEN( splitType
):
270 mrModel
.mnSplitType
= rAttribs
.getToken( XML_val
, XML_auto
);
272 case C_TOKEN( varyColors
):
273 mrModel
.mbVaryColors
= rAttribs
.getBool( XML_val
, !bMSO2007Doc
);
279 RadarTypeGroupContext::RadarTypeGroupContext( ContextHandler2Helper
& rParent
, TypeGroupModel
& rModel
) :
280 TypeGroupContextBase( rParent
, rModel
)
284 RadarTypeGroupContext::~RadarTypeGroupContext()
288 ContextHandlerRef
RadarTypeGroupContext::onCreateContext( sal_Int32 nElement
, const AttributeList
& rAttribs
)
290 bool bMSO2007Doc
= getFilter().isMSO2007Document();
291 if( isRootElement() ) switch( nElement
)
293 case C_TOKEN( axId
):
294 mrModel
.maAxisIds
.push_back( rAttribs
.getInteger( XML_val
, -1 ) );
296 case C_TOKEN( dLbls
):
297 return new DataLabelsContext( *this, mrModel
.mxLabels
.create(bMSO2007Doc
) );
298 case C_TOKEN( radarStyle
):
299 mrModel
.mnRadarStyle
= rAttribs
.getToken( XML_val
, XML_standard
);
302 return new RadarSeriesContext( *this, mrModel
.maSeries
.create(bMSO2007Doc
) );
303 case C_TOKEN( varyColors
):
304 mrModel
.mbVaryColors
= rAttribs
.getBool( XML_val
, !bMSO2007Doc
);
310 ScatterTypeGroupContext::ScatterTypeGroupContext( ContextHandler2Helper
& rParent
, TypeGroupModel
& rModel
) :
311 TypeGroupContextBase( rParent
, rModel
)
315 ScatterTypeGroupContext::~ScatterTypeGroupContext()
319 ContextHandlerRef
ScatterTypeGroupContext::onCreateContext( sal_Int32 nElement
, const AttributeList
& rAttribs
)
321 bool bMSO2007Doc
= getFilter().isMSO2007Document();
322 if( isRootElement() ) switch( nElement
)
324 case C_TOKEN( axId
):
325 mrModel
.maAxisIds
.push_back( rAttribs
.getInteger( XML_val
, -1 ) );
327 case C_TOKEN( dLbls
):
328 return new DataLabelsContext( *this, mrModel
.mxLabels
.create(bMSO2007Doc
) );
329 case C_TOKEN( scatterStyle
):
330 mrModel
.mnScatterStyle
= rAttribs
.getInteger( XML_val
, XML_marker
);
333 return new ScatterSeriesContext( *this, mrModel
.maSeries
.create(bMSO2007Doc
) );
334 case C_TOKEN( varyColors
):
335 mrModel
.mbVaryColors
= rAttribs
.getBool( XML_val
, !bMSO2007Doc
);
341 SurfaceTypeGroupContext::SurfaceTypeGroupContext( ContextHandler2Helper
& rParent
, TypeGroupModel
& rModel
) :
342 TypeGroupContextBase( rParent
, rModel
)
346 SurfaceTypeGroupContext::~SurfaceTypeGroupContext()
350 ContextHandlerRef
SurfaceTypeGroupContext::onCreateContext( sal_Int32 nElement
, const AttributeList
& rAttribs
)
352 bool bMSO2007Doc
= getFilter().isMSO2007Document();
353 if( isRootElement() ) switch( nElement
)
355 case C_TOKEN( axId
):
356 mrModel
.maAxisIds
.push_back( rAttribs
.getInteger( XML_val
, -1 ) );
359 return new SurfaceSeriesContext( *this, mrModel
.maSeries
.create(bMSO2007Doc
) );
360 case C_TOKEN( wireframe
):
361 mrModel
.mbWireframe
= rAttribs
.getBool( XML_val
, !bMSO2007Doc
);
368 } // namespace drawingml
371 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */