LibreOffice Module oox (master) 1
plotareacontext.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
30#include <oox/token/namespaces.hxx>
31#include <oox/token/tokens.hxx>
32
33namespace oox::drawingml::chart {
34
35using ::oox::core::ContextHandler2Helper;
37
38View3DContext::View3DContext( ContextHandler2Helper& rParent, View3DModel& rModel ) :
39 ContextBase< View3DModel >( rParent, rModel )
40{
41}
42
44{
45}
46
48{
49 bool bMSO2007Doc = getFilter().isMSO2007Document();
50 switch( getCurrentElement() )
51 {
52 case C_TOKEN( view3D ):
53 switch( nElement )
54 {
55 case C_TOKEN( depthPercent ):
56 mrModel.mnDepthPercent = rAttribs.getInteger( XML_val, 100 );
57 return nullptr;
58 case C_TOKEN( hPercent ):
59 mrModel.monHeightPercent = rAttribs.getInteger( XML_val, 100 );
60 return nullptr;
61 case C_TOKEN( perspective ):
62 mrModel.mnPerspective = rAttribs.getInteger( XML_val, 30 );
63 return nullptr;
64 case C_TOKEN( rAngAx ):
65 mrModel.mbRightAngled = rAttribs.getBool( XML_val, !bMSO2007Doc );
66 return nullptr;
67 case C_TOKEN( rotX ):
68 // default value dependent on chart type
69 mrModel.monRotationX = rAttribs.getInteger( XML_val );
70 return nullptr;
71 case C_TOKEN( rotY ):
72 // default value dependent on chart type
73 mrModel.monRotationY = rAttribs.getInteger( XML_val );
74 return nullptr;
75 }
76 break;
77 }
78 return nullptr;
79}
80
81WallFloorContext::WallFloorContext( ContextHandler2Helper& rParent, WallFloorModel& rModel ) :
82 ContextBase< WallFloorModel >( rParent, rModel )
83{
84}
85
87{
88}
89
91{
92 bool bMSO2007Doc = getFilter().isMSO2007Document();
93 switch( getCurrentElement() )
94 {
95 case C_TOKEN( backWall ):
96 case C_TOKEN( floor ):
97 case C_TOKEN( sideWall ):
98 switch( nElement )
99 {
100 case C_TOKEN( pictureOptions ):
101 return new PictureOptionsContext( *this, mrModel.mxPicOptions.create(bMSO2007Doc) );
102 case C_TOKEN( spPr ):
103 return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
104 }
105 break;
106 }
107 return nullptr;
108}
109
110PlotAreaContext::PlotAreaContext( ContextHandler2Helper& rParent, PlotAreaModel& rModel ) :
111 ContextBase< PlotAreaModel >( rParent, rModel )
112{
113}
114
116{
117}
118
120{
121 bool bMSO2007Doc = getFilter().isMSO2007Document();
122 switch( getCurrentElement() )
123 {
124 case C_TOKEN( plotArea ):
125 switch( nElement )
126 {
127 case C_TOKEN( area3DChart ):
128 case C_TOKEN( areaChart ):
129 return new AreaTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement, bMSO2007Doc ) );
130 case C_TOKEN( bar3DChart ):
131 case C_TOKEN( barChart ):
132 return new BarTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement, bMSO2007Doc ) );
133 case C_TOKEN( bubbleChart ):
134 return new BubbleTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement, bMSO2007Doc ) );
135 case C_TOKEN( line3DChart ):
136 case C_TOKEN( lineChart ):
137 case C_TOKEN( stockChart ):
138 return new LineTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement, bMSO2007Doc ) );
139 case C_TOKEN( doughnutChart ):
140 case C_TOKEN( ofPieChart ):
141 case C_TOKEN( pie3DChart ):
142 case C_TOKEN( pieChart ):
143 return new PieTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement, bMSO2007Doc ) );
144 case C_TOKEN( radarChart ):
145 return new RadarTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement, bMSO2007Doc ) );
146 case C_TOKEN( scatterChart ):
147 return new ScatterTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement, bMSO2007Doc ) );
148 case C_TOKEN( surface3DChart ):
149 case C_TOKEN( surfaceChart ):
150 return new SurfaceTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement, bMSO2007Doc ) );
151
152 case C_TOKEN( catAx ):
153 return new CatAxisContext( *this, mrModel.maAxes.create( nElement, bMSO2007Doc ) );
154 case C_TOKEN( dateAx ):
155 return new DateAxisContext( *this, mrModel.maAxes.create( nElement, bMSO2007Doc ) );
156 case C_TOKEN( serAx ):
157 return new SerAxisContext( *this, mrModel.maAxes.create( nElement, bMSO2007Doc ) );
158 case C_TOKEN( valAx ):
159 return new ValAxisContext( *this, mrModel.maAxes.create( nElement, bMSO2007Doc ) );
160
161 case C_TOKEN( layout ):
162 return new LayoutContext( *this, mrModel.mxLayout.create() );
163 case C_TOKEN( spPr ):
165 case C_TOKEN(dTable):
166 return new DataTableContext( *this, mrModel.mxDataTable.create() );
167 }
168 break;
169 }
170 return nullptr;
171}
172
173} // namespace oox::drawingml::chart
174
175/* 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.
XmlFilterBase & getFilter() const
Returns the filter instance.
Handler for area type group contexts (c:area3DChart, c:areaChart elements).
Handler for bar type group contexts (c:bar3DChart, c:barChart elements).
Handler for bubble type group context (c:bubbleChart element).
Handler for a category axis context (c:catAx element).
Definition: axiscontext.hxx:60
Handler for a data table context (c:dTable element).
Handler for a date axis context (c:dateAx element).
Definition: axiscontext.hxx:72
Handler for a chart layout context (c:layout element).
Handler for line type group contexts (c:line3DChart, c:lineChart, c:stockChart elements).
Handler for fill bitmap settings (c:pictureOptions element).
Handler for pie type group contexts (c:doughnutChart, c:ofPieChart, c:pie3DChart, c:pieChart elements...
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
PlotAreaContext(::oox::core::ContextHandler2Helper &rParent, PlotAreaModel &rModel)
Handler for radar type group context (c:radarChart element).
Handler for scatter type group context (c:scatterChart element).
Handler for a series axis context (c:serAx element).
Definition: axiscontext.hxx:84
Handler for surface type group contexts (c:surface3DChart, c:surfaceChart elements).
Handler for a value axis context (c:valAx element).
Definition: axiscontext.hxx:96
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
View3DContext(::oox::core::ContextHandler2Helper &rParent, View3DModel &rModel)
WallFloorContext(::oox::core::ContextHandler2Helper &rParent, WallFloorModel &rModel)
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
::rtl::Reference< ContextHandler > ContextHandlerRef
DataTableRef mxDataTable
Layout/position of the plot area.
ShapeRef mxShapeProp
All axes contained in the chart.
LayoutRef mxLayout
Plot area frame formatting.
AxisVector maAxes
All chart type groups contained in the chart.
sal_Int32 mnDepthPercent
Vertical rotation in degrees.
std::optional< sal_Int32 > monRotationY
Horizontal rotation in degrees.
bool mbRightAngled
Eye distance to the 3D objects.
sal_Int32 mnPerspective
Depth of the 3D view, relative to chart width.
std::optional< sal_Int32 > monHeightPercent
std::optional< sal_Int32 > monRotationX
Height of the 3D view, relative to chart width.
PictureOptionsRef mxPicOptions
Wall/floor frame formatting.