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: shapecontext.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/drawing/LineStyle.hpp>
33 #include <com/sun/star/beans/XMultiPropertySet.hpp>
34 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
35 #include <com/sun/star/container/XNamed.hpp>
37 #include "oox/drawingml/shapecontext.hxx"
38 #include "oox/drawingml/shapestylecontext.hxx"
39 #include "oox/core/namespaces.hxx"
40 #include "oox/drawingml/fillpropertiesgroupcontext.hxx"
41 #include "oox/drawingml/lineproperties.hxx"
42 #include "oox/drawingml/drawingmltypes.hxx"
43 #include "oox/drawingml/customshapegeometry.hxx"
44 #include "oox/drawingml/textbodycontext.hxx"
48 using namespace oox::core
;
49 using namespace ::com::sun::star
;
50 using namespace ::com::sun::star::uno
;
51 using namespace ::com::sun::star::drawing
;
52 using namespace ::com::sun::star::beans
;
53 using namespace ::com::sun::star::text
;
54 using namespace ::com::sun::star::xml::sax
;
56 namespace oox
{ namespace drawingml
{
59 ShapeContext::ShapeContext( ContextHandler
& rParent
, ShapePtr pMasterShapePtr
, ShapePtr pShapePtr
)
60 : ContextHandler( rParent
)
61 , mpMasterShapePtr( pMasterShapePtr
)
62 , mpShapePtr( pShapePtr
)
66 ShapeContext::~ShapeContext()
68 if ( mpMasterShapePtr
.get() && mpShapePtr
.get() )
69 mpMasterShapePtr
->addChild( mpShapePtr
);
72 ShapePtr
ShapeContext::getShape()
77 void ShapeContext::endFastElement( sal_Int32
/* aElementToken */ ) throw( SAXException
, RuntimeException
)
81 Reference
< XFastContextHandler
> ShapeContext::createFastChildContext( sal_Int32 aElementToken
, const Reference
< XFastAttributeList
>& xAttribs
) throw (SAXException
, RuntimeException
)
83 Reference
< XFastContextHandler
> xRet
;
85 switch( getToken( aElementToken
) )
87 // nvSpPr CT_ShapeNonVisual begin
91 mpShapePtr
->setId( xAttribs
->getOptionalValue( XML_id
) );
92 mpShapePtr
->setName( xAttribs
->getOptionalValue( XML_name
) );
95 mpShapePtr
->setSubType( xAttribs
->getOptionalValueToken( XML_type
, XML_obj
) );
96 mpShapePtr
->setIndex( xAttribs
->getOptionalValue( XML_idx
).toInt32() );
98 // nvSpPr CT_ShapeNonVisual end
101 xRet
= new ShapePropertiesContext( *this, *mpShapePtr
);
105 xRet
= new ShapeStyleContext( *this, *mpShapePtr
);
110 TextBodyPtr
xTextBody( new TextBody
);
111 mpShapePtr
->setTextBody( xTextBody
);
112 xRet
= new TextBodyContext( *this, *xTextBody
);
119 uno::Reference
<XFastContextHandler
> xTmp(this);