1*ca5ec200SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*ca5ec200SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*ca5ec200SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*ca5ec200SAndrew Rist  * distributed with this work for additional information
6*ca5ec200SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*ca5ec200SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*ca5ec200SAndrew Rist  * "License"); you may not use this file except in compliance
9*ca5ec200SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*ca5ec200SAndrew Rist  *
11*ca5ec200SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*ca5ec200SAndrew Rist  *
13*ca5ec200SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*ca5ec200SAndrew Rist  * software distributed under the License is distributed on an
15*ca5ec200SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*ca5ec200SAndrew Rist  * KIND, either express or implied.  See the License for the
17*ca5ec200SAndrew Rist  * specific language governing permissions and limitations
18*ca5ec200SAndrew Rist  * under the License.
19*ca5ec200SAndrew Rist  *
20*ca5ec200SAndrew Rist  *************************************************************/
21*ca5ec200SAndrew Rist 
22*ca5ec200SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #include "oox/drawingml/chart/plotareacontext.hxx"
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include "oox/drawingml/shapepropertiescontext.hxx"
27cdf0e10cSrcweir #include "oox/drawingml/chart/axiscontext.hxx"
28cdf0e10cSrcweir #include "oox/drawingml/chart/plotareamodel.hxx"
29cdf0e10cSrcweir #include "oox/drawingml/chart/seriescontext.hxx"
30cdf0e10cSrcweir #include "oox/drawingml/chart/titlecontext.hxx"
31cdf0e10cSrcweir #include "oox/drawingml/chart/typegroupcontext.hxx"
32cdf0e10cSrcweir 
33cdf0e10cSrcweir namespace oox {
34cdf0e10cSrcweir namespace drawingml {
35cdf0e10cSrcweir namespace chart {
36cdf0e10cSrcweir 
37cdf0e10cSrcweir // ============================================================================
38cdf0e10cSrcweir 
39cdf0e10cSrcweir using ::oox::core::ContextHandler2Helper;
40cdf0e10cSrcweir using ::oox::core::ContextHandlerRef;
41cdf0e10cSrcweir 
42cdf0e10cSrcweir // ============================================================================
43cdf0e10cSrcweir 
View3DContext(ContextHandler2Helper & rParent,View3DModel & rModel)44cdf0e10cSrcweir View3DContext::View3DContext( ContextHandler2Helper& rParent, View3DModel& rModel ) :
45cdf0e10cSrcweir     ContextBase< View3DModel >( rParent, rModel )
46cdf0e10cSrcweir {
47cdf0e10cSrcweir }
48cdf0e10cSrcweir 
~View3DContext()49cdf0e10cSrcweir View3DContext::~View3DContext()
50cdf0e10cSrcweir {
51cdf0e10cSrcweir }
52cdf0e10cSrcweir 
onCreateContext(sal_Int32 nElement,const AttributeList & rAttribs)53cdf0e10cSrcweir ContextHandlerRef View3DContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
54cdf0e10cSrcweir {
55cdf0e10cSrcweir     switch( getCurrentElement() )
56cdf0e10cSrcweir     {
57cdf0e10cSrcweir         case C_TOKEN( view3D ):
58cdf0e10cSrcweir             switch( nElement )
59cdf0e10cSrcweir             {
60cdf0e10cSrcweir                 case C_TOKEN( depthPercent ):
61cdf0e10cSrcweir                     mrModel.mnDepthPercent = rAttribs.getInteger( XML_val, 100 );
62cdf0e10cSrcweir                     return 0;
63cdf0e10cSrcweir                 case C_TOKEN( hPercent ):
64cdf0e10cSrcweir                     mrModel.monHeightPercent = rAttribs.getInteger( XML_val, 100 );
65cdf0e10cSrcweir                     return 0;
66cdf0e10cSrcweir                 case C_TOKEN( perspective ):
67cdf0e10cSrcweir                     mrModel.mnPerspective = rAttribs.getInteger( XML_val, 30 );
68cdf0e10cSrcweir                     return 0;
69cdf0e10cSrcweir                 case C_TOKEN( rAngAx ):
70cdf0e10cSrcweir                     // default is 'false', not 'true' as specified
71cdf0e10cSrcweir                     mrModel.mbRightAngled = rAttribs.getBool( XML_val, false );
72cdf0e10cSrcweir                     return 0;
73cdf0e10cSrcweir                 case C_TOKEN( rotX ):
74cdf0e10cSrcweir                     // default value dependent on chart type
75cdf0e10cSrcweir                     mrModel.monRotationX = rAttribs.getInteger( XML_val );
76cdf0e10cSrcweir                     return 0;
77cdf0e10cSrcweir                 case C_TOKEN( rotY ):
78cdf0e10cSrcweir                     // default value dependent on chart type
79cdf0e10cSrcweir                     mrModel.monRotationY = rAttribs.getInteger( XML_val );
80cdf0e10cSrcweir                     return 0;
81cdf0e10cSrcweir             }
82cdf0e10cSrcweir         break;
83cdf0e10cSrcweir     }
84cdf0e10cSrcweir     return 0;
85cdf0e10cSrcweir }
86cdf0e10cSrcweir 
87cdf0e10cSrcweir // ============================================================================
88cdf0e10cSrcweir 
WallFloorContext(ContextHandler2Helper & rParent,WallFloorModel & rModel)89cdf0e10cSrcweir WallFloorContext::WallFloorContext( ContextHandler2Helper& rParent, WallFloorModel& rModel ) :
90cdf0e10cSrcweir     ContextBase< WallFloorModel >( rParent, rModel )
91cdf0e10cSrcweir {
92cdf0e10cSrcweir }
93cdf0e10cSrcweir 
~WallFloorContext()94cdf0e10cSrcweir WallFloorContext::~WallFloorContext()
95cdf0e10cSrcweir {
96cdf0e10cSrcweir }
97cdf0e10cSrcweir 
onCreateContext(sal_Int32 nElement,const AttributeList &)98cdf0e10cSrcweir ContextHandlerRef WallFloorContext::onCreateContext( sal_Int32 nElement, const AttributeList& )
99cdf0e10cSrcweir {
100cdf0e10cSrcweir     switch( getCurrentElement() )
101cdf0e10cSrcweir     {
102cdf0e10cSrcweir         case C_TOKEN( backWall ):
103cdf0e10cSrcweir         case C_TOKEN( floor ):
104cdf0e10cSrcweir         case C_TOKEN( sideWall ):
105cdf0e10cSrcweir             switch( nElement )
106cdf0e10cSrcweir             {
107cdf0e10cSrcweir                 case C_TOKEN( pictureOptions ):
108cdf0e10cSrcweir                     return new PictureOptionsContext( *this, mrModel.mxPicOptions.create() );
109cdf0e10cSrcweir                 case C_TOKEN( spPr ):
110cdf0e10cSrcweir                     return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
111cdf0e10cSrcweir             }
112cdf0e10cSrcweir         break;
113cdf0e10cSrcweir     }
114cdf0e10cSrcweir     return 0;
115cdf0e10cSrcweir }
116cdf0e10cSrcweir 
117cdf0e10cSrcweir // ============================================================================
118cdf0e10cSrcweir 
PlotAreaContext(ContextHandler2Helper & rParent,PlotAreaModel & rModel)119cdf0e10cSrcweir PlotAreaContext::PlotAreaContext( ContextHandler2Helper& rParent, PlotAreaModel& rModel ) :
120cdf0e10cSrcweir     ContextBase< PlotAreaModel >( rParent, rModel )
121cdf0e10cSrcweir {
122cdf0e10cSrcweir }
123cdf0e10cSrcweir 
~PlotAreaContext()124cdf0e10cSrcweir PlotAreaContext::~PlotAreaContext()
125cdf0e10cSrcweir {
126cdf0e10cSrcweir }
127cdf0e10cSrcweir 
onCreateContext(sal_Int32 nElement,const AttributeList &)128cdf0e10cSrcweir ContextHandlerRef PlotAreaContext::onCreateContext( sal_Int32 nElement, const AttributeList& )
129cdf0e10cSrcweir {
130cdf0e10cSrcweir     switch( getCurrentElement() )
131cdf0e10cSrcweir     {
132cdf0e10cSrcweir         case C_TOKEN( plotArea ):
133cdf0e10cSrcweir             switch( nElement )
134cdf0e10cSrcweir             {
135cdf0e10cSrcweir                 case C_TOKEN( area3DChart ):
136cdf0e10cSrcweir                 case C_TOKEN( areaChart ):
137cdf0e10cSrcweir                     return new AreaTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement ) );
138cdf0e10cSrcweir                 case C_TOKEN( bar3DChart ):
139cdf0e10cSrcweir                 case C_TOKEN( barChart ):
140cdf0e10cSrcweir                     return new BarTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement ) );
141cdf0e10cSrcweir                 case C_TOKEN( bubbleChart ):
142cdf0e10cSrcweir                     return new BubbleTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement ) );
143cdf0e10cSrcweir                 case C_TOKEN( line3DChart ):
144cdf0e10cSrcweir                 case C_TOKEN( lineChart ):
145cdf0e10cSrcweir                 case C_TOKEN( stockChart ):
146cdf0e10cSrcweir                     return new LineTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement ) );
147cdf0e10cSrcweir                 case C_TOKEN( doughnutChart ):
148cdf0e10cSrcweir                 case C_TOKEN( ofPieChart ):
149cdf0e10cSrcweir                 case C_TOKEN( pie3DChart ):
150cdf0e10cSrcweir                 case C_TOKEN( pieChart ):
151cdf0e10cSrcweir                     return new PieTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement ) );
152cdf0e10cSrcweir                 case C_TOKEN( radarChart ):
153cdf0e10cSrcweir                     return new RadarTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement ) );
154cdf0e10cSrcweir                 case C_TOKEN( scatterChart ):
155cdf0e10cSrcweir                     return new ScatterTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement ) );
156cdf0e10cSrcweir                 case C_TOKEN( surface3DChart ):
157cdf0e10cSrcweir                 case C_TOKEN( surfaceChart ):
158cdf0e10cSrcweir                     return new SurfaceTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement ) );
159cdf0e10cSrcweir 
160cdf0e10cSrcweir                 case C_TOKEN( catAx ):
161cdf0e10cSrcweir                     return new CatAxisContext( *this, mrModel.maAxes.create( nElement ) );
162cdf0e10cSrcweir                 case C_TOKEN( dateAx ):
163cdf0e10cSrcweir                     return new DateAxisContext( *this, mrModel.maAxes.create( nElement ) );
164cdf0e10cSrcweir                 case C_TOKEN( serAx ):
165cdf0e10cSrcweir                     return new SerAxisContext( *this, mrModel.maAxes.create( nElement ) );
166cdf0e10cSrcweir                 case C_TOKEN( valAx ):
167cdf0e10cSrcweir                     return new ValAxisContext( *this, mrModel.maAxes.create( nElement ) );
168cdf0e10cSrcweir 
169cdf0e10cSrcweir                 case C_TOKEN( layout ):
170cdf0e10cSrcweir                     return new LayoutContext( *this, mrModel.mxLayout.create() );
171cdf0e10cSrcweir                 case C_TOKEN( spPr ):
172cdf0e10cSrcweir                     return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
173cdf0e10cSrcweir             }
174cdf0e10cSrcweir         break;
175cdf0e10cSrcweir     }
176cdf0e10cSrcweir     return 0;
177cdf0e10cSrcweir }
178cdf0e10cSrcweir 
179cdf0e10cSrcweir // ============================================================================
180cdf0e10cSrcweir 
181cdf0e10cSrcweir } // namespace chart
182cdf0e10cSrcweir } // namespace drawingml
183cdf0e10cSrcweir } // namespace oox
184