1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: pptshapegroupcontext.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include <com/sun/star/xml/sax/FastToken.hpp>
32 #include <com/sun/star/beans/XMultiPropertySet.hpp>
33 #include <com/sun/star/container/XNamed.hpp>
35 #include "oox/ppt/pptshape.hxx"
36 #include "oox/ppt/pptgraphicshapecontext.hxx"
37 #include "oox/ppt/pptshapecontext.hxx"
38 #include "oox/ppt/pptshapegroupcontext.hxx"
39 #include "oox/drawingml/graphicshapecontext.hxx"
40 #include "oox/drawingml/lineproperties.hxx"
41 #include "oox/drawingml/drawingmltypes.hxx"
42 #include "oox/drawingml/customshapegeometry.hxx"
43 #include "oox/drawingml/textbodycontext.hxx"
44 #include "oox/drawingml/connectorshapecontext.hxx"
45 #include "oox/core/namespaces.hxx"
49 using namespace oox::core
;
50 using namespace ::com::sun::star
;
51 using namespace ::com::sun::star::uno
;
52 using namespace ::com::sun::star::drawing
;
53 using namespace ::com::sun::star::beans
;
54 using namespace ::com::sun::star::text
;
55 using namespace ::com::sun::star::xml::sax
;
57 namespace oox
{ namespace ppt
{
59 PPTShapeGroupContext::PPTShapeGroupContext(
60 ContextHandler
& rParent
,
61 const oox::ppt::SlidePersistPtr pSlidePersistPtr
,
62 const ShapeLocation eShapeLocation
,
63 oox::drawingml::ShapePtr pMasterShapePtr
,
64 oox::drawingml::ShapePtr pGroupShapePtr
)
65 : ShapeGroupContext( rParent
, pMasterShapePtr
, pGroupShapePtr
)
66 , mpSlidePersistPtr( pSlidePersistPtr
)
67 , meShapeLocation( eShapeLocation
)
71 Reference
< XFastContextHandler
> PPTShapeGroupContext::createFastChildContext( sal_Int32 aElementToken
, const Reference
< XFastAttributeList
>& xAttribs
) throw (SAXException
, RuntimeException
)
73 Reference
< XFastContextHandler
> xRet
;
75 switch( aElementToken
)
77 case NMSP_PPT
|XML_cNvPr
:
78 mpGroupShapePtr
->setId( xAttribs
->getOptionalValue( XML_id
) );
79 mpGroupShapePtr
->setName( xAttribs
->getOptionalValue( XML_name
) );
82 mpGroupShapePtr
->setSubType( xAttribs
->getOptionalValueToken( XML_type
, FastToken::DONTKNOW
) );
83 mpGroupShapePtr
->setIndex( xAttribs
->getOptionalValue( XML_idx
).toInt32() );
85 // nvSpPr CT_ShapeNonVisual end
87 case NMSP_PPT
|XML_grpSpPr
:
88 xRet
= new oox::drawingml::ShapePropertiesContext( *this, *mpGroupShapePtr
);
90 case NMSP_PPT
|XML_spPr
:
91 xRet
= new oox::drawingml::ShapePropertiesContext( *this, *mpGroupShapePtr
);
94 case NMSP_PPT|XML_style:
95 xRet = new ShapeStyleContext( getParser() );
98 case NMSP_PPT
|XML_cxnSp
: // connector shape
99 xRet
.set( new oox::drawingml::ConnectorShapeContext( *this, mpGroupShapePtr
, oox::drawingml::ShapePtr( new PPTShape( meShapeLocation
, "com.sun.star.drawing.ConnectorShape" ) ) ) );
101 case NMSP_PPT
|XML_grpSp
: // group shape
102 xRet
.set( new PPTShapeGroupContext( *this, mpSlidePersistPtr
, meShapeLocation
, mpGroupShapePtr
, oox::drawingml::ShapePtr( new PPTShape( meShapeLocation
, "com.sun.star.drawing.GroupShape" ) ) ) );
104 case NMSP_PPT
|XML_sp
: // Shape
105 xRet
.set( new PPTShapeContext( *this, mpSlidePersistPtr
, mpGroupShapePtr
, oox::drawingml::ShapePtr( new PPTShape( meShapeLocation
, "com.sun.star.drawing.CustomShape" ) ) ) );
107 case NMSP_PPT
|XML_pic
: // CT_Picture
108 xRet
.set( new PPTGraphicShapeContext( *this, mpSlidePersistPtr
, mpGroupShapePtr
, oox::drawingml::ShapePtr( new PPTShape( meShapeLocation
, "com.sun.star.drawing.GraphicObjectShape" ) ) ) );
110 case NMSP_PPT
|XML_graphicFrame
: // CT_GraphicalObjectFrame
111 xRet
.set( new oox::drawingml::GraphicalObjectFrameContext( *this, mpGroupShapePtr
, oox::drawingml::ShapePtr( new PPTShape( meShapeLocation
, "com.sun.star.drawing.OLE2Shape" ) ) ) );