1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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"
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
):
53 case C_TOKEN( depthPercent
):
54 mrModel
.mnDepthPercent
= rAttribs
.getInteger( XML_val
, 100 );
56 case C_TOKEN( hPercent
):
57 mrModel
.monHeightPercent
= rAttribs
.getInteger( XML_val
, 100 );
59 case C_TOKEN( perspective
):
60 mrModel
.mnPerspective
= rAttribs
.getInteger( XML_val
, 30 );
62 case C_TOKEN( rAngAx
):
63 mrModel
.mbRightAngled
= rAttribs
.getBool( XML_val
, !bMSO2007Doc
);
66 // default value dependent on chart type
67 mrModel
.monRotationX
= rAttribs
.getInteger( XML_val
);
70 // default value dependent on chart type
71 mrModel
.monRotationY
= rAttribs
.getInteger( XML_val
);
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
):
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() );
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
):
124 case C_TOKEN( showHorzBorder
):
125 mrModel
.mbShowHBorder
= rAttribs
.getBool( XML_val
, false );
127 case C_TOKEN( showVertBorder
):
128 mrModel
.mbShowVBorder
= rAttribs
.getBool( XML_val
, false );
130 case C_TOKEN( showOutline
):
131 mrModel
.mbShowOutline
= rAttribs
.getBool( XML_val
, false );
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
):
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() );
203 } // namespace drawingml
206 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */