LibreOffice Module oox (master) 1
chartspacefragment.cxx
Go to the documentation of this file.
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
21
29#include <oox/token/namespaces.hxx>
30
31namespace oox::drawingml::chart {
32
33using namespace ::oox::core;
34
35ChartSpaceFragment::ChartSpaceFragment( XmlFilterBase& rFilter, const OUString& rFragmentPath, ChartSpaceModel& rModel ) :
36 FragmentBase< ChartSpaceModel >( rFilter, rFragmentPath, rModel )
37{
38}
39
41{
42}
43
45{
46 bool bMSO2007Document = getFilter().isMSO2007Document();
47 switch( getCurrentElement() )
48 {
50 switch( nElement )
51 {
52 case C_TOKEN( chartSpace ):
53 return this;
54 }
55 break;
56
57 case C_TOKEN( chartSpace ):
58 switch( nElement )
59 {
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 }
79 break;
80
81 case C_TOKEN( chart ):
82 switch( nElement )
83 {
84 case C_TOKEN( autoTitleDeleted ):
85 {
86
87 mrModel.mbAutoTitleDel = rAttribs.getBool( XML_val, !bMSO2007Document );
88 return nullptr;
89 }
90 case C_TOKEN( backWall ):
91 return new WallFloorContext( *this, mrModel.mxBackWall.create() );
92 case C_TOKEN( dispBlanksAs ):
93 {
94 // default value is XML_gap for MSO 2007 and XML_zero in OOXML
95 mrModel.mnDispBlanksAs = rAttribs.getToken( XML_val, bMSO2007Document ? XML_gap : XML_zero );
96 return nullptr;
97 }
98 case C_TOKEN( floor ):
99 return new WallFloorContext( *this, mrModel.mxFloor.create() );
100 case C_TOKEN( legend ):
101 return new LegendContext( *this, mrModel.mxLegend.create() );
102 case C_TOKEN( plotArea ):
103 return new PlotAreaContext( *this, mrModel.mxPlotArea.create() );
104 case C_TOKEN( plotVisOnly ):
105 mrModel.mbPlotVisOnly = rAttribs.getBool( XML_val, !bMSO2007Document );
106 return nullptr;
107 case C_TOKEN( showDLblsOverMax ):
108 mrModel.mbShowLabelsOverMax = rAttribs.getBool( XML_val, !bMSO2007Document );
109 return nullptr;
110 case C_TOKEN( sideWall ):
111 return new WallFloorContext( *this, mrModel.mxSideWall.create() );
112 case C_TOKEN( title ):
113 return new TitleContext( *this, mrModel.mxTitle.create() );
114 case C_TOKEN( view3D ):
115 return new View3DContext( *this, mrModel.mxView3D.create(bMSO2007Document) );
116 }
117 break;
118 }
119 return nullptr;
120}
121
122} // namespace oox::drawingml::chart
123
124/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Provides access to attribute values of an element.
OUString getStringDefaulted(sal_Int32 nAttrToken) const
Returns the string value of the specified attribute, returns an empty string if attribute not present...
std::optional< sal_Int32 > getInteger(sal_Int32 nAttrToken) const
Returns the 32-bit signed integer value of the specified attribute (decimal).
std::optional< bool > getBool(sal_Int32 nAttrToken) const
Returns the boolean value of the specified attribute.
std::optional< sal_Int32 > getToken(sal_Int32 nAttrToken) const
Returns the token identifier of the value of the specified attribute.
ChartSpaceFragment(::oox::core::XmlFilterBase &rFilter, const OUString &rFragmentPath, ChartSpaceModel &rModel)
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
Handler for a chart legend context (c:legend element).
Handler for a chart plot area context (c:plotArea element).
Handler for a chart title context (c:title element).
Handler for a chart plot area context (c:plotArea element).
Handler for a chart wall/floor context (c:backWall, c:floor, c:sideWall elements).
const sal_Int32 XML_ROOT_CONTEXT
PlotAreaRef mxPlotArea
Global chart text formatting.
bool mbPivotChart
True = show labels over chart maximum.
WallFloorRef mxSideWall
Back wall formatting in 3D charts.
TextBodyRef mxTextProp
Chart frame formatting.
LegendRef mxLegend
Chart main title.
bool mbAutoTitleDel
Index to default formatting.
bool mbPlotVisOnly
True = automatic title deleted manually.
WallFloorRef mxBackWall
Floor formatting in 3D charts.
sal_Int32 mnDispBlanksAs
Path to embedded charts.
sal_Int32 mnStyle
Mode how to display blank values.
View3DRef mxView3D
Side wall formatting in 3D charts.
WallFloorRef mxFloor
Plot area of the chart.
bool mbShowLabelsOverMax
True = plot visible cells in a sheet only.
OUString maSheetPath
Path to drawing fragment with embedded shapes.