Line data Source code
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 :
20 : #include "oox/drawingml/chart/chartspacefragment.hxx"
21 :
22 : #include "oox/drawingml/shapepropertiescontext.hxx"
23 : #include "oox/drawingml/textbodycontext.hxx"
24 : #include "oox/drawingml/chart/chartspacemodel.hxx"
25 : #include "oox/drawingml/chart/plotareacontext.hxx"
26 : #include "oox/drawingml/chart/titlecontext.hxx"
27 :
28 : namespace oox {
29 : namespace drawingml {
30 : namespace chart {
31 :
32 :
33 :
34 : using namespace ::oox::core;
35 :
36 :
37 :
38 0 : ChartSpaceFragment::ChartSpaceFragment( XmlFilterBase& rFilter, const OUString& rFragmentPath, ChartSpaceModel& rModel ) :
39 : FragmentBase< ChartSpaceModel >( rFilter, rFragmentPath, rModel ),
40 0 : mpFilterBase(rFilter)
41 : {
42 0 : }
43 :
44 0 : ChartSpaceFragment::~ChartSpaceFragment()
45 : {
46 0 : }
47 :
48 0 : ContextHandlerRef ChartSpaceFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
49 : {
50 0 : switch( getCurrentElement() )
51 : {
52 : case XML_ROOT_CONTEXT:
53 0 : switch( nElement )
54 : {
55 : case C_TOKEN( chartSpace ):
56 0 : return this;
57 : }
58 0 : break;
59 :
60 : case C_TOKEN( chartSpace ):
61 0 : switch( nElement )
62 : {
63 : case C_TOKEN( chart ):
64 0 : return this;
65 : case C_TOKEN( spPr ):
66 0 : return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
67 : case C_TOKEN( style ):
68 0 : mrModel.mnStyle = rAttribs.getInteger( XML_val, 2 );
69 0 : return 0;
70 : case C_TOKEN( txPr ):
71 0 : return new TextBodyContext( *this, mrModel.mxTextProp.create() );
72 : case C_TOKEN( userShapes ):
73 0 : mrModel.maDrawingPath = getFragmentPathFromRelId( rAttribs.getString( R_TOKEN( id ), OUString() ) );
74 0 : return 0;
75 : case C_TOKEN( pivotSource ):
76 0 : mrModel.mbPivotChart = true;
77 0 : return 0;
78 : case C_TOKEN (externalData):
79 0 : mrModel.maSheetPath = getFragmentPathFromRelId(rAttribs.getString(R_TOKEN(id),OUString()));
80 0 : return 0;
81 : }
82 0 : break;
83 :
84 : case C_TOKEN( chart ):
85 0 : switch( nElement )
86 : {
87 : case C_TOKEN( autoTitleDeleted ):
88 : // default is 'false', not 'true' as specified
89 0 : mrModel.mbAutoTitleDel = rAttribs.getBool( XML_val, false );
90 0 : return 0;
91 : case C_TOKEN( backWall ):
92 0 : return new WallFloorContext( *this, mrModel.mxBackWall.create() );
93 : case C_TOKEN( dispBlanksAs ):
94 0 : mrModel.mnDispBlanksAs = rAttribs.getToken( XML_val, XML_zero );
95 0 : return 0;
96 : case C_TOKEN( floor ):
97 0 : return new WallFloorContext( *this, mrModel.mxFloor.create() );
98 : case C_TOKEN( legend ):
99 0 : return new LegendContext( *this, mrModel.mxLegend.create() );
100 : case C_TOKEN( plotArea ):
101 0 : return new PlotAreaContext( *this, mrModel.mxPlotArea.create() );
102 : case C_TOKEN( plotVisOnly ):
103 : // default is 'false', not 'true' as specified
104 0 : mrModel.mbPlotVisOnly = rAttribs.getBool( XML_val, false );
105 0 : return 0;
106 : case C_TOKEN( showDLblsOverMax ):
107 : // default is 'false', not 'true' as specified
108 0 : mrModel.mbShowLabelsOverMax = rAttribs.getBool( XML_val, false );
109 0 : return 0;
110 : case C_TOKEN( sideWall ):
111 0 : return new WallFloorContext( *this, mrModel.mxSideWall.create() );
112 : case C_TOKEN( title ):
113 0 : return new TitleContext( *this, mrModel.mxTitle.create() );
114 : case C_TOKEN( view3D ):
115 0 : return new View3DContext( *this, mrModel.mxView3D.create() );
116 : }
117 0 : break;
118 : }
119 0 : return 0;
120 : }
121 :
122 :
123 :
124 : } // namespace chart
125 : } // namespace drawingml
126 0 : } // namespace oox
127 :
128 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|