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