1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #include "oox/drawingml/chart/plotareacontext.hxx" 29 30 #include "oox/drawingml/shapepropertiescontext.hxx" 31 #include "oox/drawingml/chart/axiscontext.hxx" 32 #include "oox/drawingml/chart/plotareamodel.hxx" 33 #include "oox/drawingml/chart/seriescontext.hxx" 34 #include "oox/drawingml/chart/titlecontext.hxx" 35 #include "oox/drawingml/chart/typegroupcontext.hxx" 36 37 namespace oox { 38 namespace drawingml { 39 namespace chart { 40 41 // ============================================================================ 42 43 using ::oox::core::ContextHandler2Helper; 44 using ::oox::core::ContextHandlerRef; 45 46 // ============================================================================ 47 48 View3DContext::View3DContext( ContextHandler2Helper& rParent, View3DModel& rModel ) : 49 ContextBase< View3DModel >( rParent, rModel ) 50 { 51 } 52 53 View3DContext::~View3DContext() 54 { 55 } 56 57 ContextHandlerRef View3DContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) 58 { 59 switch( getCurrentElement() ) 60 { 61 case C_TOKEN( view3D ): 62 switch( nElement ) 63 { 64 case C_TOKEN( depthPercent ): 65 mrModel.mnDepthPercent = rAttribs.getInteger( XML_val, 100 ); 66 return 0; 67 case C_TOKEN( hPercent ): 68 mrModel.monHeightPercent = rAttribs.getInteger( XML_val, 100 ); 69 return 0; 70 case C_TOKEN( perspective ): 71 mrModel.mnPerspective = rAttribs.getInteger( XML_val, 30 ); 72 return 0; 73 case C_TOKEN( rAngAx ): 74 // default is 'false', not 'true' as specified 75 mrModel.mbRightAngled = rAttribs.getBool( XML_val, false ); 76 return 0; 77 case C_TOKEN( rotX ): 78 // default value dependent on chart type 79 mrModel.monRotationX = rAttribs.getInteger( XML_val ); 80 return 0; 81 case C_TOKEN( rotY ): 82 // default value dependent on chart type 83 mrModel.monRotationY = rAttribs.getInteger( XML_val ); 84 return 0; 85 } 86 break; 87 } 88 return 0; 89 } 90 91 // ============================================================================ 92 93 WallFloorContext::WallFloorContext( ContextHandler2Helper& rParent, WallFloorModel& rModel ) : 94 ContextBase< WallFloorModel >( rParent, rModel ) 95 { 96 } 97 98 WallFloorContext::~WallFloorContext() 99 { 100 } 101 102 ContextHandlerRef WallFloorContext::onCreateContext( sal_Int32 nElement, const AttributeList& ) 103 { 104 switch( getCurrentElement() ) 105 { 106 case C_TOKEN( backWall ): 107 case C_TOKEN( floor ): 108 case C_TOKEN( sideWall ): 109 switch( nElement ) 110 { 111 case C_TOKEN( pictureOptions ): 112 return new PictureOptionsContext( *this, mrModel.mxPicOptions.create() ); 113 case C_TOKEN( spPr ): 114 return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() ); 115 } 116 break; 117 } 118 return 0; 119 } 120 121 // ============================================================================ 122 123 PlotAreaContext::PlotAreaContext( ContextHandler2Helper& rParent, PlotAreaModel& rModel ) : 124 ContextBase< PlotAreaModel >( rParent, rModel ) 125 { 126 } 127 128 PlotAreaContext::~PlotAreaContext() 129 { 130 } 131 132 ContextHandlerRef PlotAreaContext::onCreateContext( sal_Int32 nElement, const AttributeList& ) 133 { 134 switch( getCurrentElement() ) 135 { 136 case C_TOKEN( plotArea ): 137 switch( nElement ) 138 { 139 case C_TOKEN( area3DChart ): 140 case C_TOKEN( areaChart ): 141 return new AreaTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement ) ); 142 case C_TOKEN( bar3DChart ): 143 case C_TOKEN( barChart ): 144 return new BarTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement ) ); 145 case C_TOKEN( bubbleChart ): 146 return new BubbleTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement ) ); 147 case C_TOKEN( line3DChart ): 148 case C_TOKEN( lineChart ): 149 case C_TOKEN( stockChart ): 150 return new LineTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement ) ); 151 case C_TOKEN( doughnutChart ): 152 case C_TOKEN( ofPieChart ): 153 case C_TOKEN( pie3DChart ): 154 case C_TOKEN( pieChart ): 155 return new PieTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement ) ); 156 case C_TOKEN( radarChart ): 157 return new RadarTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement ) ); 158 case C_TOKEN( scatterChart ): 159 return new ScatterTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement ) ); 160 case C_TOKEN( surface3DChart ): 161 case C_TOKEN( surfaceChart ): 162 return new SurfaceTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement ) ); 163 164 case C_TOKEN( catAx ): 165 return new CatAxisContext( *this, mrModel.maAxes.create( nElement ) ); 166 case C_TOKEN( dateAx ): 167 return new DateAxisContext( *this, mrModel.maAxes.create( nElement ) ); 168 case C_TOKEN( serAx ): 169 return new SerAxisContext( *this, mrModel.maAxes.create( nElement ) ); 170 case C_TOKEN( valAx ): 171 return new ValAxisContext( *this, mrModel.maAxes.create( nElement ) ); 172 173 case C_TOKEN( layout ): 174 return new LayoutContext( *this, mrModel.mxLayout.create() ); 175 case C_TOKEN( spPr ): 176 return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() ); 177 } 178 break; 179 } 180 return 0; 181 } 182 183 // ============================================================================ 184 185 } // namespace chart 186 } // namespace drawingml 187 } // namespace oox 188