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