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 
29 #include <oox/token/namespaces.hxx>
30 #include <oox/token/tokens.hxx>
31 
32 namespace oox::drawingml::chart {
33 
34 using ::oox::core::ContextHandler2Helper;
36 
38  ContextBase< View3DModel >( rParent, rModel )
39 {
40 }
41 
43 {
44 }
45 
46 ContextHandlerRef View3DContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
47 {
48  bool bMSO2007Doc = getFilter().isMSO2007Document();
49  switch( getCurrentElement() )
50  {
51  case C_TOKEN( view3D ):
52  switch( nElement )
53  {
54  case C_TOKEN( depthPercent ):
55  mrModel.mnDepthPercent = rAttribs.getInteger( XML_val, 100 );
56  return nullptr;
57  case C_TOKEN( hPercent ):
58  mrModel.monHeightPercent = rAttribs.getInteger( XML_val, 100 );
59  return nullptr;
60  case C_TOKEN( perspective ):
61  mrModel.mnPerspective = rAttribs.getInteger( XML_val, 30 );
62  return nullptr;
63  case C_TOKEN( rAngAx ):
64  mrModel.mbRightAngled = rAttribs.getBool( XML_val, !bMSO2007Doc );
65  return nullptr;
66  case C_TOKEN( rotX ):
67  // default value dependent on chart type
68  mrModel.monRotationX = rAttribs.getInteger( XML_val );
69  return nullptr;
70  case C_TOKEN( rotY ):
71  // default value dependent on chart type
72  mrModel.monRotationY = rAttribs.getInteger( XML_val );
73  return nullptr;
74  }
75  break;
76  }
77  return nullptr;
78 }
79 
81  ContextBase< WallFloorModel >( rParent, rModel )
82 {
83 }
84 
86 {
87 }
88 
90 {
91  bool bMSO2007Doc = getFilter().isMSO2007Document();
92  switch( getCurrentElement() )
93  {
94  case C_TOKEN( backWall ):
95  case C_TOKEN( floor ):
96  case C_TOKEN( sideWall ):
97  switch( nElement )
98  {
99  case C_TOKEN( pictureOptions ):
100  return new PictureOptionsContext( *this, mrModel.mxPicOptions.create(bMSO2007Doc) );
101  case C_TOKEN( spPr ):
102  return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
103  }
104  break;
105  }
106  return nullptr;
107 }
108 
110  ContextBase< DataTableModel >( rParent, rModel )
111 {
112 }
113 
115 {
116 }
117 
119 {
120  switch( getCurrentElement() )
121  {
122  case C_TOKEN( dTable ):
123  switch( nElement )
124  {
125  case C_TOKEN( showHorzBorder ):
126  mrModel.mbShowHBorder = rAttribs.getBool( XML_val, false );
127  break;
128  case C_TOKEN( showVertBorder ):
129  mrModel.mbShowVBorder = rAttribs.getBool( XML_val, false );
130  break;
131  case C_TOKEN( showOutline ):
132  mrModel.mbShowOutline = rAttribs.getBool( XML_val, false );
133  break;
134  }
135  break;
136  }
137  return nullptr;
138 }
139 
141  ContextBase< PlotAreaModel >( rParent, rModel )
142 {
143 }
144 
146 {
147 }
148 
150 {
151  bool bMSO2007Doc = getFilter().isMSO2007Document();
152  switch( getCurrentElement() )
153  {
154  case C_TOKEN( plotArea ):
155  switch( nElement )
156  {
157  case C_TOKEN( area3DChart ):
158  case C_TOKEN( areaChart ):
159  return new AreaTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement, bMSO2007Doc ) );
160  case C_TOKEN( bar3DChart ):
161  case C_TOKEN( barChart ):
162  return new BarTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement, bMSO2007Doc ) );
163  case C_TOKEN( bubbleChart ):
164  return new BubbleTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement, bMSO2007Doc ) );
165  case C_TOKEN( line3DChart ):
166  case C_TOKEN( lineChart ):
167  case C_TOKEN( stockChart ):
168  return new LineTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement, bMSO2007Doc ) );
169  case C_TOKEN( doughnutChart ):
170  case C_TOKEN( ofPieChart ):
171  case C_TOKEN( pie3DChart ):
172  case C_TOKEN( pieChart ):
173  return new PieTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement, bMSO2007Doc ) );
174  case C_TOKEN( radarChart ):
175  return new RadarTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement, bMSO2007Doc ) );
176  case C_TOKEN( scatterChart ):
177  return new ScatterTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement, bMSO2007Doc ) );
178  case C_TOKEN( surface3DChart ):
179  case C_TOKEN( surfaceChart ):
180  return new SurfaceTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement, bMSO2007Doc ) );
181 
182  case C_TOKEN( catAx ):
183  return new CatAxisContext( *this, mrModel.maAxes.create( nElement, bMSO2007Doc ) );
184  case C_TOKEN( dateAx ):
185  return new DateAxisContext( *this, mrModel.maAxes.create( nElement, bMSO2007Doc ) );
186  case C_TOKEN( serAx ):
187  return new SerAxisContext( *this, mrModel.maAxes.create( nElement, bMSO2007Doc ) );
188  case C_TOKEN( valAx ):
189  return new ValAxisContext( *this, mrModel.maAxes.create( nElement, bMSO2007Doc ) );
190 
191  case C_TOKEN( layout ):
192  return new LayoutContext( *this, mrModel.mxLayout.create() );
193  case C_TOKEN( spPr ):
194  return new ShapePropertiesContext( *this, mrModel.mxShapeProp.getOrCreate() );
195  case C_TOKEN(dTable):
196  return new DataTableContext( *this, mrModel.mxDataTable.create() );
197  }
198  break;
199  }
200  return nullptr;
201 }
202 
203 } // namespace oox::drawingml::chart
204 
205 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OptValue< sal_Int32 > monHeightPercent
sal_Int32 mnDepthPercent
Vertical rotation in degrees.
OptValue< sal_Int32 > monRotationX
Height of the 3D view, relative to chart width.
OptValue< bool > getBool(sal_Int32 nAttrToken) const
Returns the boolean value of the specified attribute.
Handler for bar type group contexts (c:bar3DChart, c:barChart elements).
Handler for scatter type group context (c:scatterChart element).
OptValue< sal_Int32 > getInteger(sal_Int32 nAttrToken) const
Returns the 32-bit signed integer value of the specified attribute (decimal).
PictureOptionsRef mxPicOptions
Wall/floor frame formatting.
Handler for radar type group context (c:radarChart element).
sal_Int32 mnPerspective
Depth of the 3D view, relative to chart width.
Handler for a date axis context (c:dateAx element).
Definition: axiscontext.hxx:71
bool mbShowVBorder
Show Horizontal Border.
Handler for a category axis context (c:catAx element).
Definition: axiscontext.hxx:59
AxisVector maAxes
All chart type groups contained in the chart.
Handler for bubble type group context (c:bubbleChart element).
Handler for line type group contexts (c:line3DChart, c:lineChart, c:stockChart elements).
sal_Int32 getCurrentElement() const
Returns the identifier of the currently processed element.
View3DContext(::oox::core::ContextHandler2Helper &rParent, View3DModel &rModel)
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
Will be called to create a context handler for the passed element.
Handler for a data table context (c:dTable element).
Handler for fill bitmap settings (c:pictureOptions element).
Provides access to attribute values of an element.
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
Will be called to create a context handler for the passed element.
OptValue< sal_Int32 > monRotationY
Horizontal rotation in degrees.
PlotAreaContext(::oox::core::ContextHandler2Helper &rParent, PlotAreaModel &rModel)
DataTableRef mxDataTable
Layout/position of the plot area.
Handler for a chart layout context (c:layout element).
bool mbShowOutline
Show Vertical Border.
DataTableContext(::oox::core::ContextHandler2Helper &rParent, DataTableModel &rModel)
XmlFilterBase & getFilter() const
Returns the filter instance.
Handler for a value axis context (c:valAx element).
Definition: axiscontext.hxx:95
::rtl::Reference< ContextHandler > ContextHandlerRef
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
Will be called to create a context handler for the passed element.
WallFloorContext(::oox::core::ContextHandler2Helper &rParent, WallFloorModel &rModel)
bool mbRightAngled
Eye distance to the 3D objects.
Handler for pie type group contexts (c:doughnutChart, c:ofPieChart, c:pie3DChart, c:pieChart elements...
LayoutRef mxLayout
Plot area frame formatting.
Helper class that provides a context stack.
Handler for area type group contexts (c:area3DChart, c:areaChart elements).
Handler for surface type group contexts (c:surface3DChart, c:surfaceChart elements).
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
Will be called to create a context handler for the passed element.
Handler for a series axis context (c:serAx element).
Definition: axiscontext.hxx:83
ShapeRef mxShapeProp
All axes contained in the chart.