1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #include "oox/drawingml/chart/plotareacontext.hxx"
29*cdf0e10cSrcweir 
30*cdf0e10cSrcweir #include "oox/drawingml/shapepropertiescontext.hxx"
31*cdf0e10cSrcweir #include "oox/drawingml/chart/axiscontext.hxx"
32*cdf0e10cSrcweir #include "oox/drawingml/chart/plotareamodel.hxx"
33*cdf0e10cSrcweir #include "oox/drawingml/chart/seriescontext.hxx"
34*cdf0e10cSrcweir #include "oox/drawingml/chart/titlecontext.hxx"
35*cdf0e10cSrcweir #include "oox/drawingml/chart/typegroupcontext.hxx"
36*cdf0e10cSrcweir 
37*cdf0e10cSrcweir namespace oox {
38*cdf0e10cSrcweir namespace drawingml {
39*cdf0e10cSrcweir namespace chart {
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir // ============================================================================
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir using ::oox::core::ContextHandler2Helper;
44*cdf0e10cSrcweir using ::oox::core::ContextHandlerRef;
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir // ============================================================================
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir View3DContext::View3DContext( ContextHandler2Helper& rParent, View3DModel& rModel ) :
49*cdf0e10cSrcweir     ContextBase< View3DModel >( rParent, rModel )
50*cdf0e10cSrcweir {
51*cdf0e10cSrcweir }
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir View3DContext::~View3DContext()
54*cdf0e10cSrcweir {
55*cdf0e10cSrcweir }
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir ContextHandlerRef View3DContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
58*cdf0e10cSrcweir {
59*cdf0e10cSrcweir     switch( getCurrentElement() )
60*cdf0e10cSrcweir     {
61*cdf0e10cSrcweir         case C_TOKEN( view3D ):
62*cdf0e10cSrcweir             switch( nElement )
63*cdf0e10cSrcweir             {
64*cdf0e10cSrcweir                 case C_TOKEN( depthPercent ):
65*cdf0e10cSrcweir                     mrModel.mnDepthPercent = rAttribs.getInteger( XML_val, 100 );
66*cdf0e10cSrcweir                     return 0;
67*cdf0e10cSrcweir                 case C_TOKEN( hPercent ):
68*cdf0e10cSrcweir                     mrModel.monHeightPercent = rAttribs.getInteger( XML_val, 100 );
69*cdf0e10cSrcweir                     return 0;
70*cdf0e10cSrcweir                 case C_TOKEN( perspective ):
71*cdf0e10cSrcweir                     mrModel.mnPerspective = rAttribs.getInteger( XML_val, 30 );
72*cdf0e10cSrcweir                     return 0;
73*cdf0e10cSrcweir                 case C_TOKEN( rAngAx ):
74*cdf0e10cSrcweir                     // default is 'false', not 'true' as specified
75*cdf0e10cSrcweir                     mrModel.mbRightAngled = rAttribs.getBool( XML_val, false );
76*cdf0e10cSrcweir                     return 0;
77*cdf0e10cSrcweir                 case C_TOKEN( rotX ):
78*cdf0e10cSrcweir                     // default value dependent on chart type
79*cdf0e10cSrcweir                     mrModel.monRotationX = rAttribs.getInteger( XML_val );
80*cdf0e10cSrcweir                     return 0;
81*cdf0e10cSrcweir                 case C_TOKEN( rotY ):
82*cdf0e10cSrcweir                     // default value dependent on chart type
83*cdf0e10cSrcweir                     mrModel.monRotationY = rAttribs.getInteger( XML_val );
84*cdf0e10cSrcweir                     return 0;
85*cdf0e10cSrcweir             }
86*cdf0e10cSrcweir         break;
87*cdf0e10cSrcweir     }
88*cdf0e10cSrcweir     return 0;
89*cdf0e10cSrcweir }
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir // ============================================================================
92*cdf0e10cSrcweir 
93*cdf0e10cSrcweir WallFloorContext::WallFloorContext( ContextHandler2Helper& rParent, WallFloorModel& rModel ) :
94*cdf0e10cSrcweir     ContextBase< WallFloorModel >( rParent, rModel )
95*cdf0e10cSrcweir {
96*cdf0e10cSrcweir }
97*cdf0e10cSrcweir 
98*cdf0e10cSrcweir WallFloorContext::~WallFloorContext()
99*cdf0e10cSrcweir {
100*cdf0e10cSrcweir }
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir ContextHandlerRef WallFloorContext::onCreateContext( sal_Int32 nElement, const AttributeList& )
103*cdf0e10cSrcweir {
104*cdf0e10cSrcweir     switch( getCurrentElement() )
105*cdf0e10cSrcweir     {
106*cdf0e10cSrcweir         case C_TOKEN( backWall ):
107*cdf0e10cSrcweir         case C_TOKEN( floor ):
108*cdf0e10cSrcweir         case C_TOKEN( sideWall ):
109*cdf0e10cSrcweir             switch( nElement )
110*cdf0e10cSrcweir             {
111*cdf0e10cSrcweir                 case C_TOKEN( pictureOptions ):
112*cdf0e10cSrcweir                     return new PictureOptionsContext( *this, mrModel.mxPicOptions.create() );
113*cdf0e10cSrcweir                 case C_TOKEN( spPr ):
114*cdf0e10cSrcweir                     return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
115*cdf0e10cSrcweir             }
116*cdf0e10cSrcweir         break;
117*cdf0e10cSrcweir     }
118*cdf0e10cSrcweir     return 0;
119*cdf0e10cSrcweir }
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir // ============================================================================
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir PlotAreaContext::PlotAreaContext( ContextHandler2Helper& rParent, PlotAreaModel& rModel ) :
124*cdf0e10cSrcweir     ContextBase< PlotAreaModel >( rParent, rModel )
125*cdf0e10cSrcweir {
126*cdf0e10cSrcweir }
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir PlotAreaContext::~PlotAreaContext()
129*cdf0e10cSrcweir {
130*cdf0e10cSrcweir }
131*cdf0e10cSrcweir 
132*cdf0e10cSrcweir ContextHandlerRef PlotAreaContext::onCreateContext( sal_Int32 nElement, const AttributeList& )
133*cdf0e10cSrcweir {
134*cdf0e10cSrcweir     switch( getCurrentElement() )
135*cdf0e10cSrcweir     {
136*cdf0e10cSrcweir         case C_TOKEN( plotArea ):
137*cdf0e10cSrcweir             switch( nElement )
138*cdf0e10cSrcweir             {
139*cdf0e10cSrcweir                 case C_TOKEN( area3DChart ):
140*cdf0e10cSrcweir                 case C_TOKEN( areaChart ):
141*cdf0e10cSrcweir                     return new AreaTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement ) );
142*cdf0e10cSrcweir                 case C_TOKEN( bar3DChart ):
143*cdf0e10cSrcweir                 case C_TOKEN( barChart ):
144*cdf0e10cSrcweir                     return new BarTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement ) );
145*cdf0e10cSrcweir                 case C_TOKEN( bubbleChart ):
146*cdf0e10cSrcweir                     return new BubbleTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement ) );
147*cdf0e10cSrcweir                 case C_TOKEN( line3DChart ):
148*cdf0e10cSrcweir                 case C_TOKEN( lineChart ):
149*cdf0e10cSrcweir                 case C_TOKEN( stockChart ):
150*cdf0e10cSrcweir                     return new LineTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement ) );
151*cdf0e10cSrcweir                 case C_TOKEN( doughnutChart ):
152*cdf0e10cSrcweir                 case C_TOKEN( ofPieChart ):
153*cdf0e10cSrcweir                 case C_TOKEN( pie3DChart ):
154*cdf0e10cSrcweir                 case C_TOKEN( pieChart ):
155*cdf0e10cSrcweir                     return new PieTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement ) );
156*cdf0e10cSrcweir                 case C_TOKEN( radarChart ):
157*cdf0e10cSrcweir                     return new RadarTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement ) );
158*cdf0e10cSrcweir                 case C_TOKEN( scatterChart ):
159*cdf0e10cSrcweir                     return new ScatterTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement ) );
160*cdf0e10cSrcweir                 case C_TOKEN( surface3DChart ):
161*cdf0e10cSrcweir                 case C_TOKEN( surfaceChart ):
162*cdf0e10cSrcweir                     return new SurfaceTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement ) );
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir                 case C_TOKEN( catAx ):
165*cdf0e10cSrcweir                     return new CatAxisContext( *this, mrModel.maAxes.create( nElement ) );
166*cdf0e10cSrcweir                 case C_TOKEN( dateAx ):
167*cdf0e10cSrcweir                     return new DateAxisContext( *this, mrModel.maAxes.create( nElement ) );
168*cdf0e10cSrcweir                 case C_TOKEN( serAx ):
169*cdf0e10cSrcweir                     return new SerAxisContext( *this, mrModel.maAxes.create( nElement ) );
170*cdf0e10cSrcweir                 case C_TOKEN( valAx ):
171*cdf0e10cSrcweir                     return new ValAxisContext( *this, mrModel.maAxes.create( nElement ) );
172*cdf0e10cSrcweir 
173*cdf0e10cSrcweir                 case C_TOKEN( layout ):
174*cdf0e10cSrcweir                     return new LayoutContext( *this, mrModel.mxLayout.create() );
175*cdf0e10cSrcweir                 case C_TOKEN( spPr ):
176*cdf0e10cSrcweir                     return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
177*cdf0e10cSrcweir             }
178*cdf0e10cSrcweir         break;
179*cdf0e10cSrcweir     }
180*cdf0e10cSrcweir     return 0;
181*cdf0e10cSrcweir }
182*cdf0e10cSrcweir 
183*cdf0e10cSrcweir // ============================================================================
184*cdf0e10cSrcweir 
185*cdf0e10cSrcweir } // namespace chart
186*cdf0e10cSrcweir } // namespace drawingml
187*cdf0e10cSrcweir } // namespace oox
188