LibreOffice Module oox (master) 1
typegroupcontext.cxx
Go to the documentation of this file.
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
21
26#include <oox/token/namespaces.hxx>
27#include <oox/token/tokens.hxx>
28
29namespace oox::drawingml::chart {
30
31using ::oox::core::ContextHandler2Helper;
33
34UpDownBarsContext::UpDownBarsContext( ContextHandler2Helper& rParent, UpDownBarsModel& rModel ) :
35 ContextBase< UpDownBarsModel >( rParent, rModel )
36{
37}
38
40{
41}
42
44{
45 switch( getCurrentElement() )
46 {
47 case C_TOKEN( upDownBars ):
48 switch( nElement )
49 {
50 case C_TOKEN( downBars ):
51 return new ShapePrWrapperContext( *this, mrModel.mxDownBars.create() );
52 case C_TOKEN( gapWidth ):
53 mrModel.mnGapWidth = rAttribs.getInteger( XML_val, 150 );
54 return nullptr;
55 case C_TOKEN( upBars ):
56 return new ShapePrWrapperContext( *this, mrModel.mxUpBars.create() );
57 }
58 break;
59 }
60 return nullptr;
61}
62
63AreaTypeGroupContext::AreaTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
64 TypeGroupContextBase( rParent, rModel )
65{
66}
67
69{
70}
71
73{
74 bool bMSO2007Doc = getFilter().isMSO2007Document();
75 if( isRootElement() ) switch( nElement )
76 {
77 case C_TOKEN( axId ):
78 mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
79 return nullptr;
80 case C_TOKEN( dLbls ):
81 return new DataLabelsContext( *this, mrModel.mxLabels.create(bMSO2007Doc) );
82 case C_TOKEN( dropLines ):
83 return new ShapePrWrapperContext( *this, mrModel.mxDropLines.create() );
84 case C_TOKEN( gapDepth ):
85 mrModel.mnGapDepth = rAttribs.getInteger( XML_val, 150 );
86 return nullptr;
87 case C_TOKEN( grouping ):
88 mrModel.mnGrouping = rAttribs.getToken( XML_val, bMSO2007Doc ? XML_standard : XML_clustered );
89 return nullptr;
90 case C_TOKEN( ser ):
91 return new AreaSeriesContext( *this, mrModel.maSeries.create(bMSO2007Doc) );
92 case C_TOKEN( varyColors ):
93 mrModel.mbVaryColors = rAttribs.getBool( XML_val, !bMSO2007Doc );
94 return nullptr;
95 }
96 return nullptr;
97}
98
99BarTypeGroupContext::BarTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
100 TypeGroupContextBase( rParent, rModel )
101{
102}
103
105{
106}
107
109{
110 bool bMSO2007Doc = getFilter().isMSO2007Document();
111 if( isRootElement() ) switch( nElement )
112 {
113 case C_TOKEN( axId ):
114 mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
115 return nullptr;
116 case C_TOKEN( barDir ):
117 mrModel.mnBarDir = rAttribs.getToken( XML_val, XML_col );
118 return nullptr;
119 case C_TOKEN( dLbls ):
120 return new DataLabelsContext( *this, mrModel.mxLabels.create(bMSO2007Doc) );
121 case C_TOKEN( gapDepth ):
122 mrModel.mnGapDepth = rAttribs.getInteger( XML_val, 150 );
123 return nullptr;
124 case C_TOKEN( gapWidth ):
125 mrModel.mnGapWidth = rAttribs.getInteger( XML_val, 150 );
126 return nullptr;
127 case C_TOKEN( grouping ):
128 mrModel.mnGrouping = rAttribs.getToken( XML_val, bMSO2007Doc ? XML_standard : XML_clustered );
129 return nullptr;
130 case C_TOKEN( overlap ):
131 mrModel.mnOverlap = rAttribs.getInteger( XML_val, 0 );
132 return nullptr;
133 case C_TOKEN( ser ):
134 return new BarSeriesContext( *this, mrModel.maSeries.create(bMSO2007Doc) );
135 case C_TOKEN( serLines ):
136 return new ShapePrWrapperContext( *this, mrModel.mxSerLines.create() );
137 case C_TOKEN( shape ):
138 mrModel.mnShape = rAttribs.getToken( XML_val, XML_box );
139 return nullptr;
140 case C_TOKEN( varyColors ):
141 mrModel.mbVaryColors = rAttribs.getBool( XML_val, !bMSO2007Doc );
142 return nullptr;
143 }
144 return nullptr;
145}
146
147BubbleTypeGroupContext::BubbleTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
148 TypeGroupContextBase( rParent, rModel )
149{
150}
151
153{
154}
155
157{
158 bool bMSO2007Doc = getFilter().isMSO2007Document();
159 if( isRootElement() ) switch( nElement )
160 {
161 case C_TOKEN( axId ):
162 mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
163 return nullptr;
164 case C_TOKEN( bubble3D ):
165 mrModel.mbBubble3d = rAttribs.getBool( XML_val, !bMSO2007Doc );
166 return nullptr;
167 case C_TOKEN( bubbleScale ):
168 mrModel.mnBubbleScale = rAttribs.getInteger( XML_val, 100 );
169 return nullptr;
170 case C_TOKEN( dLbls ):
171 return new DataLabelsContext( *this, mrModel.mxLabels.create(bMSO2007Doc) );
172 case C_TOKEN( ser ):
173 return new BubbleSeriesContext( *this, mrModel.maSeries.create(bMSO2007Doc) );
174 case C_TOKEN( showNegBubbles ):
175 mrModel.mbShowNegBubbles = rAttribs.getBool( XML_val, !bMSO2007Doc );
176 return nullptr;
177 case C_TOKEN( sizeRepresents ):
178 mrModel.mnSizeRepresents = rAttribs.getToken( XML_val, XML_area );
179 return nullptr;
180 case C_TOKEN( varyColors ):
181 mrModel.mbVaryColors = rAttribs.getBool( XML_val, !bMSO2007Doc );
182 return nullptr;
183 }
184 return nullptr;
185}
186
187LineTypeGroupContext::LineTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
188 TypeGroupContextBase( rParent, rModel )
189{
190}
191
193{
194}
195
197{
198 bool bMSO2007Doc = getFilter().isMSO2007Document();
199 if( isRootElement() ) switch( nElement )
200 {
201 case C_TOKEN( axId ):
202 mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
203 return nullptr;
204 case C_TOKEN( dLbls ):
205 return new DataLabelsContext( *this, mrModel.mxLabels.create(bMSO2007Doc) );
206 case C_TOKEN( dropLines ):
207 return new ShapePrWrapperContext( *this, mrModel.mxDropLines.create() );
208 case C_TOKEN( gapDepth ):
209 mrModel.mnGapDepth = rAttribs.getInteger( XML_val, 150 );
210 return nullptr;
211 case C_TOKEN( grouping ):
212 mrModel.mnGrouping = rAttribs.getToken( XML_val, bMSO2007Doc ? XML_standard : XML_clustered );
213 return nullptr;
214 case C_TOKEN( hiLowLines ):
215 return new ShapePrWrapperContext( *this, mrModel.mxHiLowLines.create() );
216 case C_TOKEN( marker ):
217 mrModel.mbShowMarker = rAttribs.getBool( XML_val, !bMSO2007Doc );
218 return nullptr;
219 case C_TOKEN( ser ):
220 return new LineSeriesContext( *this, mrModel.maSeries.create(bMSO2007Doc) );
221 case C_TOKEN( smooth ):
222 mrModel.mbSmooth = rAttribs.getBool( XML_val, !bMSO2007Doc );
223 return nullptr;
224 case C_TOKEN( upDownBars ):
225 return new UpDownBarsContext( *this, mrModel.mxUpDownBars.create() );
226 case C_TOKEN( varyColors ):
227 mrModel.mbVaryColors = rAttribs.getBool( XML_val, !bMSO2007Doc );
228 return nullptr;
229 }
230 return nullptr;
231}
232
233PieTypeGroupContext::PieTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
234 TypeGroupContextBase( rParent, rModel )
235{
236}
237
239{
240}
241
243{
244 bool bMSO2007Doc = getFilter().isMSO2007Document();
245 if( isRootElement() ) switch( nElement )
246 {
247 case C_TOKEN( dLbls ):
248 return new DataLabelsContext( *this, mrModel.mxLabels.create(bMSO2007Doc) );
249 case C_TOKEN( firstSliceAng ):
250 mrModel.mnFirstAngle = rAttribs.getInteger( XML_val, 0 );
251 return nullptr;
252 case C_TOKEN( gapWidth ):
253 mrModel.mnGapWidth = rAttribs.getInteger( XML_val, 150 );
254 return nullptr;
255 case C_TOKEN( holeSize ):
256 mrModel.mnHoleSize = rAttribs.getInteger( XML_val, 10 );
257 return nullptr;
258 case C_TOKEN( ofPieType ):
259 mrModel.mnOfPieType = rAttribs.getToken( XML_val, XML_pie );
260 return nullptr;
261 case C_TOKEN( secondPieSize ):
262 mrModel.mnSecondPieSize = rAttribs.getInteger( XML_val, 75 );
263 return nullptr;
264 case C_TOKEN( ser ):
265 return new PieSeriesContext( *this, mrModel.maSeries.create(bMSO2007Doc) );
266 case C_TOKEN( serLines ):
267 return new ShapePrWrapperContext( *this, mrModel.mxSerLines.create() );
268 case C_TOKEN( splitPos ):
269 mrModel.mfSplitPos = rAttribs.getDouble( XML_val, 0.0 );
270 return nullptr;
271 case C_TOKEN( splitType ):
272 mrModel.mnSplitType = rAttribs.getToken( XML_val, XML_auto );
273 return nullptr;
274 case C_TOKEN( varyColors ):
275 mrModel.mbVaryColors = rAttribs.getBool( XML_val, !bMSO2007Doc );
276 return nullptr;
277 }
278 return nullptr;
279}
280
281RadarTypeGroupContext::RadarTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
282 TypeGroupContextBase( rParent, rModel )
283{
284}
285
287{
288}
289
291{
292 bool bMSO2007Doc = getFilter().isMSO2007Document();
293 if( isRootElement() ) switch( nElement )
294 {
295 case C_TOKEN( axId ):
296 mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
297 return nullptr;
298 case C_TOKEN( dLbls ):
299 return new DataLabelsContext( *this, mrModel.mxLabels.create(bMSO2007Doc) );
300 case C_TOKEN( radarStyle ):
301 mrModel.mnRadarStyle = rAttribs.getToken( XML_val, XML_standard );
302 return nullptr;
303 case C_TOKEN( ser ):
304 return new RadarSeriesContext( *this, mrModel.maSeries.create(bMSO2007Doc) );
305 case C_TOKEN( varyColors ):
306 mrModel.mbVaryColors = rAttribs.getBool( XML_val, !bMSO2007Doc );
307 return nullptr;
308 }
309 return nullptr;
310}
311
312ScatterTypeGroupContext::ScatterTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
313 TypeGroupContextBase( rParent, rModel )
314{
315}
316
318{
319}
320
322{
323 bool bMSO2007Doc = getFilter().isMSO2007Document();
324 if( isRootElement() ) switch( nElement )
325 {
326 case C_TOKEN( axId ):
327 mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
328 return nullptr;
329 case C_TOKEN( dLbls ):
330 return new DataLabelsContext( *this, mrModel.mxLabels.create(bMSO2007Doc) );
331 case C_TOKEN( scatterStyle ):
332 mrModel.mnScatterStyle = rAttribs.getInteger( XML_val, XML_marker );
333 return nullptr;
334 case C_TOKEN( ser ):
335 return new ScatterSeriesContext( *this, mrModel.maSeries.create(bMSO2007Doc) );
336 case C_TOKEN( varyColors ):
337 mrModel.mbVaryColors = rAttribs.getBool( XML_val, !bMSO2007Doc );
338 return nullptr;
339 }
340 return nullptr;
341}
342
343SurfaceTypeGroupContext::SurfaceTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
344 TypeGroupContextBase( rParent, rModel )
345{
346}
347
349{
350}
351
353{
354 bool bMSO2007Doc = getFilter().isMSO2007Document();
355 if( isRootElement() ) switch( nElement )
356 {
357 case C_TOKEN( axId ):
358 mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
359 return nullptr;
360 case C_TOKEN( ser ):
361 return new SurfaceSeriesContext( *this, mrModel.maSeries.create(bMSO2007Doc) );
362 case C_TOKEN( wireframe ):
363 mrModel.mbWireframe = rAttribs.getBool( XML_val, !bMSO2007Doc );
364 return nullptr;
365 }
366 return nullptr;
367}
368
369} // namespace oox::drawingml::chart
370
371/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Provides access to attribute values of an element.
std::optional< sal_Int32 > getInteger(sal_Int32 nAttrToken) const
Returns the 32-bit signed integer value of the specified attribute (decimal).
std::optional< bool > getBool(sal_Int32 nAttrToken) const
Returns the boolean value of the specified attribute.
std::optional< sal_Int32 > getToken(sal_Int32 nAttrToken) const
Returns the token identifier of the value of the specified attribute.
std::optional< double > getDouble(sal_Int32 nAttrToken) const
Returns the double value of the specified attribute.
XmlFilterBase & getFilter() const
Returns the filter instance.
Handler for a data series context for area chart types (c:ser element).
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
AreaTypeGroupContext(::oox::core::ContextHandler2Helper &rParent, TypeGroupModel &rModel)
Handler for a data series context for bar chart types (c:ser element).
BarTypeGroupContext(::oox::core::ContextHandler2Helper &rParent, TypeGroupModel &rModel)
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
Handler for a data series context for bubble chart types (c:ser element).
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
BubbleTypeGroupContext(::oox::core::ContextHandler2Helper &rParent, TypeGroupModel &rModel)
Handler for a chart data point label context (c:dLbls element).
Handler for a data series context for line and stock chart types (c:ser element).
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
LineTypeGroupContext(::oox::core::ContextHandler2Helper &rParent, TypeGroupModel &rModel)
Handler for a data series context for pie and doughnut chart types (c:ser element).
PieTypeGroupContext(::oox::core::ContextHandler2Helper &rParent, TypeGroupModel &rModel)
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
Handler for a data series context for radar chart types (c:ser element).
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
RadarTypeGroupContext(::oox::core::ContextHandler2Helper &rParent, TypeGroupModel &rModel)
Handler for a data series context for scatter chart types (c:ser element).
ScatterTypeGroupContext(::oox::core::ContextHandler2Helper &rParent, TypeGroupModel &rModel)
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
Help class for all contexts that have only the c:spPr child element.
Handler for a data series context for scatter chart types (c:ser element).
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
SurfaceTypeGroupContext(::oox::core::ContextHandler2Helper &rParent, TypeGroupModel &rModel)
Handler for an up/down bars context (c:upDownBars element).
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
UpDownBarsContext(::oox::core::ContextHandler2Helper &rParent, UpDownBarsModel &rModel)
::rtl::Reference< ContextHandler > ContextHandlerRef
ShapeRef mxUpBars
Formatting of down bars.
sal_Int32 mnGapWidth
Formatting of up bars.