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