Line data Source code
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 :
20 : #include "oox/drawingml/chart/plotareacontext.hxx"
21 :
22 : #include "oox/drawingml/shapepropertiescontext.hxx"
23 : #include "oox/drawingml/chart/axiscontext.hxx"
24 : #include "oox/drawingml/chart/plotareamodel.hxx"
25 : #include "oox/drawingml/chart/seriescontext.hxx"
26 : #include "oox/drawingml/chart/titlecontext.hxx"
27 : #include "oox/drawingml/chart/typegroupcontext.hxx"
28 :
29 : namespace oox {
30 : namespace drawingml {
31 : namespace chart {
32 :
33 :
34 :
35 : using ::oox::core::ContextHandler2Helper;
36 : using ::oox::core::ContextHandlerRef;
37 :
38 :
39 :
40 0 : View3DContext::View3DContext( ContextHandler2Helper& rParent, View3DModel& rModel ) :
41 0 : ContextBase< View3DModel >( rParent, rModel )
42 : {
43 0 : }
44 :
45 0 : View3DContext::~View3DContext()
46 : {
47 0 : }
48 :
49 0 : ContextHandlerRef View3DContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
50 : {
51 0 : switch( getCurrentElement() )
52 : {
53 : case C_TOKEN( view3D ):
54 0 : switch( nElement )
55 : {
56 : case C_TOKEN( depthPercent ):
57 0 : mrModel.mnDepthPercent = rAttribs.getInteger( XML_val, 100 );
58 0 : return 0;
59 : case C_TOKEN( hPercent ):
60 0 : mrModel.monHeightPercent = rAttribs.getInteger( XML_val, 100 );
61 0 : return 0;
62 : case C_TOKEN( perspective ):
63 0 : mrModel.mnPerspective = rAttribs.getInteger( XML_val, 30 );
64 0 : return 0;
65 : case C_TOKEN( rAngAx ):
66 : // default is 'false', not 'true' as specified
67 0 : mrModel.mbRightAngled = rAttribs.getBool( XML_val, false );
68 0 : return 0;
69 : case C_TOKEN( rotX ):
70 : // default value dependent on chart type
71 0 : mrModel.monRotationX = rAttribs.getInteger( XML_val );
72 0 : return 0;
73 : case C_TOKEN( rotY ):
74 : // default value dependent on chart type
75 0 : mrModel.monRotationY = rAttribs.getInteger( XML_val );
76 0 : return 0;
77 : }
78 0 : break;
79 : }
80 0 : return 0;
81 : }
82 :
83 :
84 :
85 0 : WallFloorContext::WallFloorContext( ContextHandler2Helper& rParent, WallFloorModel& rModel ) :
86 0 : ContextBase< WallFloorModel >( rParent, rModel )
87 : {
88 0 : }
89 :
90 0 : WallFloorContext::~WallFloorContext()
91 : {
92 0 : }
93 :
94 0 : ContextHandlerRef WallFloorContext::onCreateContext( sal_Int32 nElement, const AttributeList& )
95 : {
96 0 : switch( getCurrentElement() )
97 : {
98 : case C_TOKEN( backWall ):
99 : case C_TOKEN( floor ):
100 : case C_TOKEN( sideWall ):
101 0 : switch( nElement )
102 : {
103 : case C_TOKEN( pictureOptions ):
104 0 : return new PictureOptionsContext( *this, mrModel.mxPicOptions.create() );
105 : case C_TOKEN( spPr ):
106 0 : return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
107 : }
108 0 : break;
109 : }
110 0 : return 0;
111 : }
112 :
113 :
114 :
115 :
116 0 : DataTableContext::DataTableContext( ContextHandler2Helper& rParent, DataTableModel& rModel ) :
117 0 : ContextBase< DataTableModel >( rParent, rModel )
118 : {
119 0 : }
120 :
121 0 : DataTableContext::~DataTableContext()
122 : {
123 0 : }
124 :
125 0 : ContextHandlerRef DataTableContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs)
126 : {
127 0 : switch( getCurrentElement() )
128 : {
129 : case C_TOKEN( dTable ):
130 0 : switch( nElement )
131 : {
132 : case C_TOKEN( showHorzBorder ):
133 0 : mrModel.mbShowHBorder = rAttribs.getBool( XML_val, false );
134 0 : break;
135 : case C_TOKEN( showVertBorder ):
136 0 : mrModel.mbShowVBorder = rAttribs.getBool( XML_val, false );
137 0 : break;
138 : case C_TOKEN( showOutline ):
139 0 : mrModel.mbShowOutline = rAttribs.getBool( XML_val, false );
140 0 : break;
141 : }
142 0 : break;
143 : }
144 0 : return 0;
145 : }
146 :
147 :
148 :
149 :
150 0 : PlotAreaContext::PlotAreaContext( ContextHandler2Helper& rParent, PlotAreaModel& rModel ) :
151 0 : ContextBase< PlotAreaModel >( rParent, rModel )
152 : {
153 0 : }
154 :
155 0 : PlotAreaContext::~PlotAreaContext()
156 : {
157 0 : }
158 :
159 0 : ContextHandlerRef PlotAreaContext::onCreateContext( sal_Int32 nElement, const AttributeList& )
160 : {
161 0 : switch( getCurrentElement() )
162 : {
163 : case C_TOKEN( plotArea ):
164 0 : switch( nElement )
165 : {
166 : case C_TOKEN( area3DChart ):
167 : case C_TOKEN( areaChart ):
168 0 : return new AreaTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement ) );
169 : case C_TOKEN( bar3DChart ):
170 : case C_TOKEN( barChart ):
171 0 : return new BarTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement ) );
172 : case C_TOKEN( bubbleChart ):
173 0 : return new BubbleTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement ) );
174 : case C_TOKEN( line3DChart ):
175 : case C_TOKEN( lineChart ):
176 : case C_TOKEN( stockChart ):
177 0 : return new LineTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement ) );
178 : case C_TOKEN( doughnutChart ):
179 : case C_TOKEN( ofPieChart ):
180 : case C_TOKEN( pie3DChart ):
181 : case C_TOKEN( pieChart ):
182 0 : return new PieTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement ) );
183 : case C_TOKEN( radarChart ):
184 0 : return new RadarTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement ) );
185 : case C_TOKEN( scatterChart ):
186 0 : return new ScatterTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement ) );
187 : case C_TOKEN( surface3DChart ):
188 : case C_TOKEN( surfaceChart ):
189 0 : return new SurfaceTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement ) );
190 :
191 : case C_TOKEN( catAx ):
192 0 : return new CatAxisContext( *this, mrModel.maAxes.create( nElement ) );
193 : case C_TOKEN( dateAx ):
194 0 : return new DateAxisContext( *this, mrModel.maAxes.create( nElement ) );
195 : case C_TOKEN( serAx ):
196 0 : return new SerAxisContext( *this, mrModel.maAxes.create( nElement ) );
197 : case C_TOKEN( valAx ):
198 0 : return new ValAxisContext( *this, mrModel.maAxes.create( nElement ) );
199 :
200 : case C_TOKEN( layout ):
201 0 : return new LayoutContext( *this, mrModel.mxLayout.create() );
202 : case C_TOKEN( spPr ):
203 0 : return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
204 : case C_TOKEN(dTable):
205 0 : return new DataTableContext( *this, mrModel.mxDataTable.create() );
206 : }
207 0 : break;
208 : }
209 0 : return 0;
210 : }
211 :
212 :
213 :
214 : } // namespace chart
215 : } // namespace drawingml
216 0 : } // namespace oox
217 :
218 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|