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