tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / oox / source / drawingml / chart / typegroupcontext.cxx
blob39307326153326916ad995bad21deabe5dab4582
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/typegroupcontext.hxx>
22 #include <drawingml/chart/seriescontext.hxx>
23 #include <drawingml/chart/typegroupmodel.hxx>
24 #include <oox/core/xmlfilterbase.hxx>
25 #include <oox/helper/attributelist.hxx>
26 #include <oox/token/namespaces.hxx>
27 #include <oox/token/tokens.hxx>
29 namespace oox::drawingml::chart {
31 using ::oox::core::ContextHandler2Helper;
32 using ::oox::core::ContextHandlerRef;
34 UpDownBarsContext::UpDownBarsContext( ContextHandler2Helper& rParent, UpDownBarsModel& rModel ) :
35 ContextBase< UpDownBarsModel >( rParent, rModel )
39 UpDownBarsContext::~UpDownBarsContext()
43 ContextHandlerRef UpDownBarsContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
45 switch( getCurrentElement() )
47 case C_TOKEN( upDownBars ):
48 switch( nElement )
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() );
58 break;
60 return nullptr;
63 AreaTypeGroupContext::AreaTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
64 TypeGroupContextBase( rParent, rModel )
68 AreaTypeGroupContext::~AreaTypeGroupContext()
72 ContextHandlerRef AreaTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
74 bool bMSO2007Doc = getFilter().isMSO2007Document();
75 if( isRootElement() ) switch( nElement )
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;
96 return nullptr;
99 BarTypeGroupContext::BarTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
100 TypeGroupContextBase( rParent, rModel )
104 BarTypeGroupContext::~BarTypeGroupContext()
108 ContextHandlerRef BarTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
110 bool bMSO2007Doc = getFilter().isMSO2007Document();
111 if( isRootElement() ) switch( nElement )
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;
144 return nullptr;
147 BubbleTypeGroupContext::BubbleTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
148 TypeGroupContextBase( rParent, rModel )
152 BubbleTypeGroupContext::~BubbleTypeGroupContext()
156 ContextHandlerRef BubbleTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
158 bool bMSO2007Doc = getFilter().isMSO2007Document();
159 if( isRootElement() ) switch( nElement )
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;
184 return nullptr;
187 LineTypeGroupContext::LineTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
188 TypeGroupContextBase( rParent, rModel )
192 LineTypeGroupContext::~LineTypeGroupContext()
196 ContextHandlerRef LineTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
198 bool bMSO2007Doc = getFilter().isMSO2007Document();
199 if( isRootElement() ) switch( nElement )
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;
230 return nullptr;
233 PieTypeGroupContext::PieTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
234 TypeGroupContextBase( rParent, rModel )
238 PieTypeGroupContext::~PieTypeGroupContext()
242 ContextHandlerRef PieTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
244 bool bMSO2007Doc = getFilter().isMSO2007Document();
245 if( isRootElement() ) switch( nElement )
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( ser ):
259 return new PieSeriesContext( *this, mrModel.maSeries.create(bMSO2007Doc) );
260 case C_TOKEN( serLines ):
261 return new ShapePrWrapperContext( *this, mrModel.mxSerLines.create() );
262 case C_TOKEN( varyColors ):
263 mrModel.mbVaryColors = rAttribs.getBool( XML_val, !bMSO2007Doc );
264 return nullptr;
266 return nullptr;
269 OfPieTypeGroupContext::OfPieTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
270 TypeGroupContextBase( rParent, rModel )
274 OfPieTypeGroupContext::~OfPieTypeGroupContext()
278 ContextHandlerRef OfPieTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
280 bool bMSO2007Doc = getFilter().isMSO2007Document();
281 if( isRootElement() ) switch( nElement )
283 case C_TOKEN( dLbls ):
284 return new DataLabelsContext( *this, mrModel.mxLabels.create(bMSO2007Doc) );
285 case C_TOKEN( gapWidth ):
286 mrModel.mnGapWidth = rAttribs.getInteger( XML_val, 150 );
287 return nullptr;
288 case C_TOKEN( ofPieType ):
289 mrModel.mnOfPieType = rAttribs.getToken( XML_val, XML_pie );
290 return nullptr;
291 case C_TOKEN( secondPieSize ):
292 mrModel.mnSecondPieSize = rAttribs.getInteger( XML_val, 75 );
293 return nullptr;
294 case C_TOKEN( ser ):
295 return new PieSeriesContext( *this, mrModel.maSeries.create(bMSO2007Doc) );
296 case C_TOKEN( serLines ):
297 return new ShapePrWrapperContext( *this, mrModel.mxSerLines.create() );
298 case C_TOKEN( splitPos ):
299 mrModel.mfSplitPos = rAttribs.getDouble( XML_val, 2.0 );
300 return nullptr;
301 case C_TOKEN( splitType ):
302 mrModel.mnSplitType = rAttribs.getToken( XML_val, XML_auto );
303 return nullptr;
304 case C_TOKEN( varyColors ):
305 mrModel.mbVaryColors = rAttribs.getBool( XML_val, !bMSO2007Doc );
306 return nullptr;
308 return nullptr;
311 RadarTypeGroupContext::RadarTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
312 TypeGroupContextBase( rParent, rModel )
316 RadarTypeGroupContext::~RadarTypeGroupContext()
320 ContextHandlerRef RadarTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
322 bool bMSO2007Doc = getFilter().isMSO2007Document();
323 if( isRootElement() ) switch( nElement )
325 case C_TOKEN( axId ):
326 mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
327 return nullptr;
328 case C_TOKEN( dLbls ):
329 return new DataLabelsContext( *this, mrModel.mxLabels.create(bMSO2007Doc) );
330 case C_TOKEN( radarStyle ):
331 mrModel.mnRadarStyle = rAttribs.getToken( XML_val, XML_standard );
332 return nullptr;
333 case C_TOKEN( ser ):
334 return new RadarSeriesContext( *this, mrModel.maSeries.create(bMSO2007Doc) );
335 case C_TOKEN( varyColors ):
336 mrModel.mbVaryColors = rAttribs.getBool( XML_val, !bMSO2007Doc );
337 return nullptr;
339 return nullptr;
342 ScatterTypeGroupContext::ScatterTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
343 TypeGroupContextBase( rParent, rModel )
347 ScatterTypeGroupContext::~ScatterTypeGroupContext()
351 ContextHandlerRef ScatterTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
353 bool bMSO2007Doc = getFilter().isMSO2007Document();
354 if( isRootElement() ) switch( nElement )
356 case C_TOKEN( axId ):
357 mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
358 return nullptr;
359 case C_TOKEN( dLbls ):
360 return new DataLabelsContext( *this, mrModel.mxLabels.create(bMSO2007Doc) );
361 case C_TOKEN( scatterStyle ):
362 mrModel.mnScatterStyle = rAttribs.getInteger( XML_val, XML_marker );
363 return nullptr;
364 case C_TOKEN( ser ):
365 return new ScatterSeriesContext( *this, mrModel.maSeries.create(bMSO2007Doc) );
366 case C_TOKEN( varyColors ):
367 mrModel.mbVaryColors = rAttribs.getBool( XML_val, !bMSO2007Doc );
368 return nullptr;
370 return nullptr;
373 SurfaceTypeGroupContext::SurfaceTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
374 TypeGroupContextBase( rParent, rModel )
378 SurfaceTypeGroupContext::~SurfaceTypeGroupContext()
382 ContextHandlerRef SurfaceTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
384 bool bMSO2007Doc = getFilter().isMSO2007Document();
385 if( isRootElement() ) switch( nElement )
387 case C_TOKEN( axId ):
388 mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
389 return nullptr;
390 case C_TOKEN( ser ):
391 return new SurfaceSeriesContext( *this, mrModel.maSeries.create(bMSO2007Doc) );
392 case C_TOKEN( wireframe ):
393 mrModel.mbWireframe = rAttribs.getBool( XML_val, !bMSO2007Doc );
394 return nullptr;
396 return nullptr;
399 } // namespace oox::drawingml::chart
401 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */