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/typegroupcontext.hxx>
27 #include <drawingml/chart/datatablecontext.hxx>
28 #include <oox/core/xmlfilterbase.hxx>
29 #include <oox/helper/attributelist.hxx>
30 #include <oox/token/namespaces.hxx>
31 #include <oox/token/tokens.hxx>
33 namespace oox::drawingml::chart
{
35 using ::oox::core::ContextHandler2Helper
;
36 using ::oox::core::ContextHandlerRef
;
38 View3DContext::View3DContext( ContextHandler2Helper
& rParent
, View3DModel
& rModel
) :
39 ContextBase
< View3DModel
>( rParent
, rModel
)
43 View3DContext::~View3DContext()
47 ContextHandlerRef
View3DContext::onCreateContext( sal_Int32 nElement
, const AttributeList
& rAttribs
)
49 bool bMSO2007Doc
= getFilter().isMSO2007Document();
50 switch( getCurrentElement() )
52 case C_TOKEN( view3D
):
55 case C_TOKEN( depthPercent
):
56 mrModel
.mnDepthPercent
= rAttribs
.getInteger( XML_val
, 100 );
58 case C_TOKEN( hPercent
):
59 mrModel
.monHeightPercent
= rAttribs
.getInteger( XML_val
, 100 );
61 case C_TOKEN( perspective
):
62 mrModel
.mnPerspective
= rAttribs
.getInteger( XML_val
, 30 );
64 case C_TOKEN( rAngAx
):
65 mrModel
.mbRightAngled
= rAttribs
.getBool( XML_val
, !bMSO2007Doc
);
68 // default value dependent on chart type
69 mrModel
.monRotationX
= rAttribs
.getInteger( XML_val
);
72 // default value dependent on chart type
73 mrModel
.monRotationY
= rAttribs
.getInteger( XML_val
);
81 WallFloorContext::WallFloorContext( ContextHandler2Helper
& rParent
, WallFloorModel
& rModel
) :
82 ContextBase
< WallFloorModel
>( rParent
, rModel
)
86 WallFloorContext::~WallFloorContext()
90 ContextHandlerRef
WallFloorContext::onCreateContext( sal_Int32 nElement
, const AttributeList
& )
92 bool bMSO2007Doc
= getFilter().isMSO2007Document();
93 switch( getCurrentElement() )
95 case C_TOKEN( backWall
):
96 case C_TOKEN( floor
):
97 case C_TOKEN( sideWall
):
100 case C_TOKEN( pictureOptions
):
101 return new PictureOptionsContext( *this, mrModel
.mxPicOptions
.create(bMSO2007Doc
) );
102 case C_TOKEN( spPr
):
103 return new ShapePropertiesContext( *this, mrModel
.mxShapeProp
.create() );
110 PlotAreaContext::PlotAreaContext( ContextHandler2Helper
& rParent
, PlotAreaModel
& rModel
) :
111 ContextBase
< PlotAreaModel
>( rParent
, rModel
)
115 PlotAreaContext::~PlotAreaContext()
119 ContextHandlerRef
PlotAreaContext::onCreateContext( sal_Int32 nElement
, const AttributeList
& )
121 bool bMSO2007Doc
= getFilter().isMSO2007Document();
122 switch( getCurrentElement() )
124 case C_TOKEN( plotArea
):
127 case C_TOKEN( area3DChart
):
128 case C_TOKEN( areaChart
):
129 return new AreaTypeGroupContext( *this, mrModel
.maTypeGroups
.create( nElement
, bMSO2007Doc
) );
130 case C_TOKEN( bar3DChart
):
131 case C_TOKEN( barChart
):
132 return new BarTypeGroupContext( *this, mrModel
.maTypeGroups
.create( nElement
, bMSO2007Doc
) );
133 case C_TOKEN( bubbleChart
):
134 return new BubbleTypeGroupContext( *this, mrModel
.maTypeGroups
.create( nElement
, bMSO2007Doc
) );
135 case C_TOKEN( line3DChart
):
136 case C_TOKEN( lineChart
):
137 case C_TOKEN( stockChart
):
138 return new LineTypeGroupContext( *this, mrModel
.maTypeGroups
.create( nElement
, bMSO2007Doc
) );
139 case C_TOKEN( ofPieChart
):
140 return new OfPieTypeGroupContext( *this, mrModel
.maTypeGroups
.create( nElement
, bMSO2007Doc
) );
141 case C_TOKEN( doughnutChart
):
142 case C_TOKEN( pie3DChart
):
143 case C_TOKEN( pieChart
):
144 return new PieTypeGroupContext( *this, mrModel
.maTypeGroups
.create( nElement
, bMSO2007Doc
) );
145 case C_TOKEN( radarChart
):
146 return new RadarTypeGroupContext( *this, mrModel
.maTypeGroups
.create( nElement
, bMSO2007Doc
) );
147 case C_TOKEN( scatterChart
):
148 return new ScatterTypeGroupContext( *this, mrModel
.maTypeGroups
.create( nElement
, bMSO2007Doc
) );
149 case C_TOKEN( surface3DChart
):
150 case C_TOKEN( surfaceChart
):
151 return new SurfaceTypeGroupContext( *this, mrModel
.maTypeGroups
.create( nElement
, bMSO2007Doc
) );
153 case C_TOKEN( catAx
):
154 return new CatAxisContext( *this, mrModel
.maAxes
.create( nElement
, bMSO2007Doc
) );
155 case C_TOKEN( dateAx
):
156 return new DateAxisContext( *this, mrModel
.maAxes
.create( nElement
, bMSO2007Doc
) );
157 case C_TOKEN( serAx
):
158 return new SerAxisContext( *this, mrModel
.maAxes
.create( nElement
, bMSO2007Doc
) );
159 case C_TOKEN( valAx
):
160 return new ValAxisContext( *this, mrModel
.maAxes
.create( nElement
, bMSO2007Doc
) );
162 case C_TOKEN( layout
):
163 return new LayoutContext( *this, mrModel
.mxLayout
.create() );
164 case C_TOKEN( spPr
):
165 return new ShapePropertiesContext( *this, mrModel
.mxShapeProp
.getOrCreate() );
166 case C_TOKEN(dTable
):
167 return new DataTableContext( *this, mrModel
.mxDataTable
.create() );
174 } // namespace oox::drawingml::chart
176 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */