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 
33 namespace oox::drawingml::chart {
34 
35 using ::oox::core::ContextHandler2Helper;
37 
39  ContextBase< View3DModel >( rParent, rModel )
40 {
41 }
42 
44 {
45 }
46 
47 ContextHandlerRef View3DContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
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 
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 
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 ):
164  return new ShapePropertiesContext( *this, mrModel.mxShapeProp.getOrCreate() );
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: */
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
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)
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).
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.