Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / oox / source / drawingml / chart / chartspacefragment.cxx
blobcefda2ebd2ba21bbfd51510ad2157c6128f07d68
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/chartspacefragment.hxx>
22 #include <drawingml/shapepropertiescontext.hxx>
23 #include <drawingml/textbodycontext.hxx>
24 #include <drawingml/chart/chartspacemodel.hxx>
25 #include <drawingml/chart/plotareacontext.hxx>
26 #include <drawingml/chart/titlecontext.hxx>
27 #include <oox/core/xmlfilterbase.hxx>
28 #include <oox/helper/attributelist.hxx>
29 #include <oox/token/namespaces.hxx>
31 namespace oox {
32 namespace drawingml {
33 namespace chart {
35 using namespace ::oox::core;
37 ChartSpaceFragment::ChartSpaceFragment( XmlFilterBase& rFilter, const OUString& rFragmentPath, ChartSpaceModel& rModel ) :
38 FragmentBase< ChartSpaceModel >( rFilter, rFragmentPath, rModel )
42 ChartSpaceFragment::~ChartSpaceFragment()
46 ContextHandlerRef ChartSpaceFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
48 bool bMSO2007Document = getFilter().isMSO2007Document();
49 switch( getCurrentElement() )
51 case XML_ROOT_CONTEXT:
52 switch( nElement )
54 case C_TOKEN( chartSpace ):
55 return this;
57 break;
59 case C_TOKEN( chartSpace ):
60 switch( nElement )
62 case C_TOKEN( chart ):
63 return this;
64 case C_TOKEN( spPr ):
65 return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
66 case C_TOKEN( style ):
67 mrModel.mnStyle = rAttribs.getInteger( XML_val, 2 );
68 return nullptr;
69 case C_TOKEN( txPr ):
70 return new TextBodyContext( *this, mrModel.mxTextProp.create() );
71 case C_TOKEN( userShapes ):
72 mrModel.maDrawingPath = getFragmentPathFromRelId( rAttribs.getString( R_TOKEN( id ), OUString() ) );
73 return nullptr;
74 case C_TOKEN( pivotSource ):
75 mrModel.mbPivotChart = true;
76 return nullptr;
77 case C_TOKEN (externalData):
78 mrModel.maSheetPath = getFragmentPathFromRelId(rAttribs.getString(R_TOKEN(id),OUString()));
79 return nullptr;
81 break;
83 case C_TOKEN( chart ):
84 switch( nElement )
86 case C_TOKEN( autoTitleDeleted ):
89 mrModel.mbAutoTitleDel = rAttribs.getBool( XML_val, !bMSO2007Document );
90 return nullptr;
92 case C_TOKEN( backWall ):
93 return new WallFloorContext( *this, mrModel.mxBackWall.create() );
94 case C_TOKEN( dispBlanksAs ):
96 // default value is XML_gap for MSO 2007 and XML_zero in OOXML
97 mrModel.mnDispBlanksAs = rAttribs.getToken( XML_val, bMSO2007Document ? XML_gap : XML_zero );
98 return nullptr;
100 case C_TOKEN( floor ):
101 return new WallFloorContext( *this, mrModel.mxFloor.create() );
102 case C_TOKEN( legend ):
103 return new LegendContext( *this, mrModel.mxLegend.create(bMSO2007Document) );
104 case C_TOKEN( plotArea ):
105 return new PlotAreaContext( *this, mrModel.mxPlotArea.create() );
106 case C_TOKEN( plotVisOnly ):
107 mrModel.mbPlotVisOnly = rAttribs.getBool( XML_val, !bMSO2007Document );
108 return nullptr;
109 case C_TOKEN( showDLblsOverMax ):
110 mrModel.mbShowLabelsOverMax = rAttribs.getBool( XML_val, !bMSO2007Document );
111 return nullptr;
112 case C_TOKEN( sideWall ):
113 return new WallFloorContext( *this, mrModel.mxSideWall.create() );
114 case C_TOKEN( title ):
115 return new TitleContext( *this, mrModel.mxTitle.create() );
116 case C_TOKEN( view3D ):
117 return new View3DContext( *this, mrModel.mxView3D.create(bMSO2007Document) );
119 break;
121 return nullptr;
124 } // namespace chart
125 } // namespace drawingml
126 } // namespace oox
128 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */