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: shapepropertiescontext.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 "oox/drawingml/shapepropertiescontext.hxx"
33 #include <com/sun/star/xml/sax/FastToken.hpp>
34 #include <com/sun/star/drawing/LineStyle.hpp>
35 #include <com/sun/star/beans/XMultiPropertySet.hpp>
36 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
37 #include <com/sun/star/container/XNamed.hpp>
39 #include "oox/core/namespaces.hxx"
40 #include "oox/drawingml/linepropertiescontext.hxx"
41 #include "oox/drawingml/fillpropertiesgroupcontext.hxx"
42 #include "oox/drawingml/transform2dcontext.hxx"
43 #include "oox/drawingml/customshapegeometry.hxx"
47 using namespace oox::core
;
48 using namespace ::com::sun::star
;
49 using namespace ::com::sun::star::uno
;
50 using namespace ::com::sun::star::drawing
;
51 using namespace ::com::sun::star::beans
;
52 using namespace ::com::sun::star::xml::sax
;
54 namespace oox
{ namespace drawingml
{
56 // ====================================================================
59 ShapePropertiesContext::ShapePropertiesContext( ContextHandler
& rParent
, Shape
& rShape
)
60 : ContextHandler( rParent
)
65 // --------------------------------------------------------------------
67 Reference
< XFastContextHandler
> ShapePropertiesContext::createFastChildContext( sal_Int32 aElementToken
, const Reference
< XFastAttributeList
>& xAttribs
) throw (SAXException
, RuntimeException
)
69 Reference
< XFastContextHandler
> xRet
;
71 switch( aElementToken
)
74 case NMSP_DRAWINGML
|XML_xfrm
:
75 xRet
.set( new Transform2DContext( *this, xAttribs
, mrShape
) );
79 case NMSP_DRAWINGML
|XML_custGeom
: // custom geometry "CT_CustomGeometry2D"
80 xRet
.set( new CustomShapeGeometryContext( *this, xAttribs
, mrShape
) );
84 case NMSP_DRAWINGML
|XML_prstGeom
: // preset geometry "CT_PresetGeometry2D"
86 sal_Int32 nToken
= xAttribs
->getOptionalValueToken( XML_prst
, 0 );
87 if ( nToken
== XML_line
)
89 static const OUString
sLineShape( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.LineShape" ) );
90 mrShape
.getServiceName() = sLineShape
;
92 xRet
.set( new PresetShapeGeometryContext( *this, xAttribs
, *(mrShape
.getCustomShapeProperties()) ) );
96 case NMSP_DRAWINGML
|XML_prstTxWarp
:
97 xRet
.set( new PresetTextShapeContext( *this, xAttribs
, *(mrShape
.getCustomShapeProperties()) ) );
101 case NMSP_DRAWINGML
|XML_ln
:
102 xRet
.set( new LinePropertiesContext( *this, xAttribs
, mrShape
.getLineProperties() ) );
105 // EffectPropertiesGroup
106 // todo not supported by core
107 case NMSP_DRAWINGML
|XML_effectLst
: // CT_EffectList
108 case NMSP_DRAWINGML
|XML_effectDag
: // CT_EffectContainer
112 case NMSP_DRAWINGML
|XML_scene3d
: // CT_Scene3D
113 case NMSP_DRAWINGML
|XML_sp3d
: // CT_Shape3D
117 // FillPropertiesGroupContext
119 xRet
.set( FillPropertiesContext::createFillContext( *this, aElementToken
, xAttribs
, mrShape
.getFillProperties() ) );