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 <com/sun/star/xml/sax/FastToken.hpp> 29 #include <com/sun/star/beans/XMultiPropertySet.hpp> 30 #include <com/sun/star/container/XNamed.hpp> 31 32 #include "oox/helper/attributelist.hxx" 33 #include "oox/ppt/pptshape.hxx" 34 #include "oox/ppt/pptshapecontext.hxx" 35 #include "oox/ppt/pptshapegroupcontext.hxx" 36 #include "oox/drawingml/graphicshapecontext.hxx" 37 #include "oox/drawingml/lineproperties.hxx" 38 #include "oox/drawingml/drawingmltypes.hxx" 39 #include "oox/drawingml/customshapegeometry.hxx" 40 #include "oox/drawingml/textbodycontext.hxx" 41 #include "oox/drawingml/connectorshapecontext.hxx" 42 43 using rtl::OUString; 44 using namespace oox::core; 45 using namespace ::com::sun::star; 46 using namespace ::com::sun::star::uno; 47 using namespace ::com::sun::star::drawing; 48 using namespace ::com::sun::star::beans; 49 using namespace ::com::sun::star::text; 50 using namespace ::com::sun::star::xml::sax; 51 52 namespace oox { namespace ppt { 53 54 PPTShapeGroupContext::PPTShapeGroupContext( 55 ContextHandler& rParent, 56 const oox::ppt::SlidePersistPtr pSlidePersistPtr, 57 const ShapeLocation eShapeLocation, 58 oox::drawingml::ShapePtr pMasterShapePtr, 59 oox::drawingml::ShapePtr pGroupShapePtr ) 60 : ShapeGroupContext( rParent, pMasterShapePtr, pGroupShapePtr ) 61 , mpSlidePersistPtr( pSlidePersistPtr ) 62 , meShapeLocation( eShapeLocation ) 63 { 64 } 65 66 Reference< XFastContextHandler > PPTShapeGroupContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException) 67 { 68 Reference< XFastContextHandler > xRet; 69 70 switch( aElementToken ) 71 { 72 case PPT_TOKEN( cNvPr ): 73 { 74 AttributeList aAttribs( xAttribs ); 75 mpGroupShapePtr->setHidden( aAttribs.getBool( XML_hidden, false ) ); 76 mpGroupShapePtr->setId( xAttribs->getOptionalValue( XML_id ) ); 77 mpGroupShapePtr->setName( xAttribs->getOptionalValue( XML_name ) ); 78 break; 79 } 80 case PPT_TOKEN( ph ): 81 mpGroupShapePtr->setSubType( xAttribs->getOptionalValueToken( XML_type, FastToken::DONTKNOW ) ); 82 mpGroupShapePtr->setSubTypeIndex( xAttribs->getOptionalValue( XML_idx ).toInt32() ); 83 break; 84 // nvSpPr CT_ShapeNonVisual end 85 86 case PPT_TOKEN( grpSpPr ): 87 xRet = new oox::drawingml::ShapePropertiesContext( *this, *mpGroupShapePtr ); 88 break; 89 case PPT_TOKEN( spPr ): 90 xRet = new oox::drawingml::ShapePropertiesContext( *this, *mpGroupShapePtr ); 91 break; 92 /* 93 case PPT_TOKEN( style ): 94 xRet = new ShapeStyleContext( getParser() ); 95 break; 96 */ 97 case PPT_TOKEN( cxnSp ): // connector shape 98 xRet.set( new oox::drawingml::ConnectorShapeContext( *this, mpGroupShapePtr, oox::drawingml::ShapePtr( new PPTShape( meShapeLocation, "com.sun.star.drawing.ConnectorShape" ) ) ) ); 99 break; 100 case PPT_TOKEN( grpSp ): // group shape 101 xRet.set( new PPTShapeGroupContext( *this, mpSlidePersistPtr, meShapeLocation, mpGroupShapePtr, oox::drawingml::ShapePtr( new PPTShape( meShapeLocation, "com.sun.star.drawing.GroupShape" ) ) ) ); 102 break; 103 case PPT_TOKEN( sp ): // Shape 104 xRet.set( new PPTShapeContext( *this, mpSlidePersistPtr, mpGroupShapePtr, oox::drawingml::ShapePtr( new PPTShape( meShapeLocation, "com.sun.star.drawing.CustomShape" ) ) ) ); 105 break; 106 case PPT_TOKEN( pic ): // CT_Picture 107 xRet.set( new oox::drawingml::GraphicShapeContext( *this, mpGroupShapePtr, oox::drawingml::ShapePtr( new PPTShape( meShapeLocation, "com.sun.star.drawing.GraphicObjectShape" ) ) ) ); 108 break; 109 case PPT_TOKEN( graphicFrame ): // CT_GraphicalObjectFrame 110 xRet.set( new oox::drawingml::GraphicalObjectFrameContext( *this, mpGroupShapePtr, oox::drawingml::ShapePtr( new PPTShape( meShapeLocation, "com.sun.star.drawing.OLE2Shape" ) ), true ) ); 111 break; 112 113 } 114 if( !xRet.is() ) 115 xRet.set( this ); 116 117 118 return xRet; 119 } 120 121 } } 122