fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / oox / source / drawingml / chart / plotareacontext.cxx
blobf19adbd309a5b4da836e04135a9a5dc68c1adfc4
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "drawingml/chart/plotareacontext.hxx"
22 #include "drawingml/shapepropertiescontext.hxx"
23 #include "drawingml/chart/axiscontext.hxx"
24 #include "drawingml/chart/plotareamodel.hxx"
25 #include "drawingml/chart/seriescontext.hxx"
26 #include "drawingml/chart/titlecontext.hxx"
27 #include "drawingml/chart/typegroupcontext.hxx"
29 namespace oox {
30 namespace drawingml {
31 namespace chart {
33 using ::oox::core::ContextHandler2Helper;
34 using ::oox::core::ContextHandlerRef;
36 View3DContext::View3DContext( ContextHandler2Helper& rParent, View3DModel& rModel ) :
37 ContextBase< View3DModel >( rParent, rModel )
41 View3DContext::~View3DContext()
45 ContextHandlerRef View3DContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
47 bool bMSO2007Doc = getFilter().isMSO2007Document();
48 switch( getCurrentElement() )
50 case C_TOKEN( view3D ):
51 switch( nElement )
53 case C_TOKEN( depthPercent ):
54 mrModel.mnDepthPercent = rAttribs.getInteger( XML_val, 100 );
55 return 0;
56 case C_TOKEN( hPercent ):
57 mrModel.monHeightPercent = rAttribs.getInteger( XML_val, 100 );
58 return 0;
59 case C_TOKEN( perspective ):
60 mrModel.mnPerspective = rAttribs.getInteger( XML_val, 30 );
61 return 0;
62 case C_TOKEN( rAngAx ):
63 mrModel.mbRightAngled = rAttribs.getBool( XML_val, !bMSO2007Doc );
64 return 0;
65 case C_TOKEN( rotX ):
66 // default value dependent on chart type
67 mrModel.monRotationX = rAttribs.getInteger( XML_val );
68 return 0;
69 case C_TOKEN( rotY ):
70 // default value dependent on chart type
71 mrModel.monRotationY = rAttribs.getInteger( XML_val );
72 return 0;
74 break;
76 return 0;
79 WallFloorContext::WallFloorContext( ContextHandler2Helper& rParent, WallFloorModel& rModel ) :
80 ContextBase< WallFloorModel >( rParent, rModel )
84 WallFloorContext::~WallFloorContext()
88 ContextHandlerRef WallFloorContext::onCreateContext( sal_Int32 nElement, const AttributeList& )
90 bool bMSO2007Doc = getFilter().isMSO2007Document();
91 switch( getCurrentElement() )
93 case C_TOKEN( backWall ):
94 case C_TOKEN( floor ):
95 case C_TOKEN( sideWall ):
96 switch( nElement )
98 case C_TOKEN( pictureOptions ):
99 return new PictureOptionsContext( *this, mrModel.mxPicOptions.create(bMSO2007Doc) );
100 case C_TOKEN( spPr ):
101 return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
103 break;
105 return 0;
108 DataTableContext::DataTableContext( ContextHandler2Helper& rParent, DataTableModel& rModel ) :
109 ContextBase< DataTableModel >( rParent, rModel )
113 DataTableContext::~DataTableContext()
117 ContextHandlerRef DataTableContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs)
119 switch( getCurrentElement() )
121 case C_TOKEN( dTable ):
122 switch( nElement )
124 case C_TOKEN( showHorzBorder ):
125 mrModel.mbShowHBorder = rAttribs.getBool( XML_val, false );
126 break;
127 case C_TOKEN( showVertBorder ):
128 mrModel.mbShowVBorder = rAttribs.getBool( XML_val, false );
129 break;
130 case C_TOKEN( showOutline ):
131 mrModel.mbShowOutline = rAttribs.getBool( XML_val, false );
132 break;
134 break;
136 return 0;
139 PlotAreaContext::PlotAreaContext( ContextHandler2Helper& rParent, PlotAreaModel& rModel ) :
140 ContextBase< PlotAreaModel >( rParent, rModel )
144 PlotAreaContext::~PlotAreaContext()
148 ContextHandlerRef PlotAreaContext::onCreateContext( sal_Int32 nElement, const AttributeList& )
150 bool bMSO2007Doc = getFilter().isMSO2007Document();
151 switch( getCurrentElement() )
153 case C_TOKEN( plotArea ):
154 switch( nElement )
156 case C_TOKEN( area3DChart ):
157 case C_TOKEN( areaChart ):
158 return new AreaTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement, bMSO2007Doc ) );
159 case C_TOKEN( bar3DChart ):
160 case C_TOKEN( barChart ):
161 return new BarTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement, bMSO2007Doc ) );
162 case C_TOKEN( bubbleChart ):
163 return new BubbleTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement, bMSO2007Doc ) );
164 case C_TOKEN( line3DChart ):
165 case C_TOKEN( lineChart ):
166 case C_TOKEN( stockChart ):
167 return new LineTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement, bMSO2007Doc ) );
168 case C_TOKEN( doughnutChart ):
169 case C_TOKEN( ofPieChart ):
170 case C_TOKEN( pie3DChart ):
171 case C_TOKEN( pieChart ):
172 return new PieTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement, bMSO2007Doc ) );
173 case C_TOKEN( radarChart ):
174 return new RadarTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement, bMSO2007Doc ) );
175 case C_TOKEN( scatterChart ):
176 return new ScatterTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement, bMSO2007Doc ) );
177 case C_TOKEN( surface3DChart ):
178 case C_TOKEN( surfaceChart ):
179 return new SurfaceTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement, bMSO2007Doc ) );
181 case C_TOKEN( catAx ):
182 return new CatAxisContext( *this, mrModel.maAxes.create( nElement, bMSO2007Doc ) );
183 case C_TOKEN( dateAx ):
184 return new DateAxisContext( *this, mrModel.maAxes.create( nElement, bMSO2007Doc ) );
185 case C_TOKEN( serAx ):
186 return new SerAxisContext( *this, mrModel.maAxes.create( nElement, bMSO2007Doc ) );
187 case C_TOKEN( valAx ):
188 return new ValAxisContext( *this, mrModel.maAxes.create( nElement, bMSO2007Doc ) );
190 case C_TOKEN( layout ):
191 return new LayoutContext( *this, mrModel.mxLayout.create() );
192 case C_TOKEN( spPr ):
193 return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
194 case C_TOKEN(dTable):
195 return new DataTableContext( *this, mrModel.mxDataTable.create() );
197 break;
199 return 0;
202 } // namespace chart
203 } // namespace drawingml
204 } // namespace oox
206 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */