tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / oox / source / drawingml / chart / chartspacefragment.cxx
blobf43908d65cb557c8aa4a6a2a00686d9e815d6041
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::drawingml::chart {
33 using namespace ::oox::core;
35 ChartSpaceFragment::ChartSpaceFragment( XmlFilterBase& rFilter, const OUString& rFragmentPath, ChartSpaceModel& rModel ) :
36 FragmentBase< ChartSpaceModel >( rFilter, rFragmentPath, rModel )
40 ChartSpaceFragment::~ChartSpaceFragment()
44 ContextHandlerRef ChartSpaceFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
46 bool bMSO2007Document = getFilter().isMSO2007Document();
47 switch( getCurrentElement() )
49 case XML_ROOT_CONTEXT:
50 switch( nElement )
52 case C_TOKEN( chartSpace ):
53 return this;
55 break;
57 case C_TOKEN( chartSpace ):
58 switch( nElement )
60 case C_TOKEN( chart ):
61 return this;
62 case C_TOKEN( spPr ):
63 return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
64 case C_TOKEN( style ):
65 mrModel.mnStyle = rAttribs.getInteger( XML_val, 2 );
66 return nullptr;
67 case C_TOKEN( txPr ):
68 return new TextBodyContext( *this, mrModel.mxTextProp.create() );
69 case C_TOKEN( userShapes ):
70 mrModel.maDrawingPath = getFragmentPathFromRelId( rAttribs.getStringDefaulted( R_TOKEN( id )) );
71 return nullptr;
72 case C_TOKEN( pivotSource ):
73 mrModel.mbPivotChart = true;
74 return nullptr;
75 case C_TOKEN (externalData):
76 mrModel.maSheetPath = getFragmentPathFromRelId(rAttribs.getStringDefaulted(R_TOKEN(id)));
77 return nullptr;
78 case C_TOKEN(clrMapOvr):
79 if (mrModel.mpClrMap)
80 for (auto nClrToken : {
81 XML_bg1,
82 XML_tx1,
83 XML_bg2,
84 XML_tx2,
85 XML_accent1,
86 XML_accent2,
87 XML_accent3,
88 XML_accent4,
89 XML_accent5,
90 XML_accent6,
91 XML_hlink,
92 XML_folHlink,
94 if (auto oMappedToken = rAttribs.getToken(nClrToken))
95 mrModel.mpClrMap->setColorMap(nClrToken, *oMappedToken);
96 return nullptr;
98 break;
100 case C_TOKEN( chart ):
101 switch( nElement )
103 case C_TOKEN( autoTitleDeleted ):
106 mrModel.mbAutoTitleDel = rAttribs.getBool( XML_val, !bMSO2007Document );
107 return nullptr;
109 case C_TOKEN( backWall ):
110 return new WallFloorContext( *this, mrModel.mxBackWall.create() );
111 case C_TOKEN( dispBlanksAs ):
113 // default value is XML_gap for MSO 2007 and XML_zero in OOXML
114 mrModel.mnDispBlanksAs = rAttribs.getToken( XML_val, bMSO2007Document ? XML_gap : XML_zero );
115 return nullptr;
117 case C_TOKEN( floor ):
118 return new WallFloorContext( *this, mrModel.mxFloor.create() );
119 case C_TOKEN( legend ):
120 return new LegendContext( *this, mrModel.mxLegend.create() );
121 case C_TOKEN( plotArea ):
122 return new PlotAreaContext( *this, mrModel.mxPlotArea.create() );
123 case C_TOKEN( plotVisOnly ):
124 mrModel.mbPlotVisOnly = rAttribs.getBool( XML_val, !bMSO2007Document );
125 return nullptr;
126 case C_TOKEN( showDLblsOverMax ):
127 mrModel.mbShowLabelsOverMax = rAttribs.getBool( XML_val, !bMSO2007Document );
128 return nullptr;
129 case C_TOKEN( sideWall ):
130 return new WallFloorContext( *this, mrModel.mxSideWall.create() );
131 case C_TOKEN( title ):
132 return new TitleContext( *this, mrModel.mxTitle.create() );
133 case C_TOKEN( view3D ):
134 return new View3DContext( *this, mrModel.mxView3D.create(bMSO2007Document) );
136 break;
138 return nullptr;
141 } // namespace oox::drawingml::chart
143 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */