fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / oox / source / drawingml / shapepropertiescontext.cxx
blobe0fe19f450a4fa81e01c7766c78b696a22609e6c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "oox/drawingml/shapepropertiescontext.hxx"
22 #include <com/sun/star/xml/sax/FastToken.hpp>
23 #include <com/sun/star/drawing/LineStyle.hpp>
24 #include <com/sun/star/beans/XMultiPropertySet.hpp>
25 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
26 #include <com/sun/star/container/XNamed.hpp>
28 #include "oox/drawingml/scene3dcontext.hxx"
29 #include "oox/drawingml/linepropertiescontext.hxx"
30 #include "oox/drawingml/fillpropertiesgroupcontext.hxx"
31 #include "oox/drawingml/transform2dcontext.hxx"
32 #include "oox/drawingml/customshapegeometry.hxx"
33 #include "oox/drawingml/effectpropertiescontext.hxx"
35 using namespace oox::core;
36 using namespace ::com::sun::star;
37 using namespace ::com::sun::star::uno;
38 using namespace ::com::sun::star::drawing;
39 using namespace ::com::sun::star::beans;
40 using namespace ::com::sun::star::xml::sax;
42 namespace oox { namespace drawingml {
44 // ====================================================================
46 // CT_ShapeProperties
47 ShapePropertiesContext::ShapePropertiesContext( ContextHandler& rParent, Shape& rShape )
48 : ContextHandler( rParent )
49 , mrShape( rShape )
53 // --------------------------------------------------------------------
55 Reference< XFastContextHandler > ShapePropertiesContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException)
57 Reference< XFastContextHandler > xRet;
59 switch( aElementToken )
61 // CT_Transform2D
62 case A_TOKEN( xfrm ):
63 xRet.set( new Transform2DContext( *this, xAttribs, mrShape ) );
64 break;
66 // GeometryGroup
67 case A_TOKEN( custGeom ): // custom geometry "CT_CustomGeometry2D"
68 xRet.set( new CustomShapeGeometryContext( *this, xAttribs, *(mrShape.getCustomShapeProperties()) ) );
69 break;
72 case A_TOKEN( prstGeom ): // preset geometry "CT_PresetGeometry2D"
74 sal_Int32 nToken = xAttribs->getOptionalValueToken( XML_prst, 0 );
75 // TODO: Move the following checks to a separate place or as a separate function
76 if ( nToken == XML_line )
78 mrShape.getServiceName() = "com.sun.star.drawing.LineShape";
80 if( ( nToken >= XML_bentConnector2 && nToken <= XML_bentConnector5 ) ||
81 ( nToken >= XML_curvedConnector2 && nToken <= XML_curvedConnector5 ) ||
82 nToken == XML_straightConnector1 )
84 mrShape.getServiceName() = "com.sun.star.drawing.CustomShape";
86 xRet.set( new PresetShapeGeometryContext( *this, xAttribs, *(mrShape.getCustomShapeProperties()) ) );
88 break;
90 case A_TOKEN( prstTxWarp ):
91 xRet.set( new PresetTextShapeContext( *this, xAttribs, *(mrShape.getCustomShapeProperties()) ) );
92 break;
94 // CT_LineProperties
95 case A_TOKEN( ln ):
96 xRet.set( new LinePropertiesContext( *this, xAttribs, mrShape.getLineProperties() ) );
97 break;
99 // EffectPropertiesGroup
100 // todo not supported by core
101 case A_TOKEN( effectLst ): // CT_EffectList
102 case A_TOKEN( effectDag ): // CT_EffectContainer
103 xRet.set( new EffectPropertiesContext( *this, mrShape.getEffectProperties() ) );
104 break;
106 // todo
107 case A_TOKEN( scene3d ): // CT_Scene3D
108 // xRet.set( new Scene3DContext( *this, xAttribs, *(mrShape.get3DShapeProperties()) ) );
109 break;
111 // todo
112 case A_TOKEN( sp3d ): // CT_Shape3D
113 break;
116 // FillPropertiesGroupContext
117 if( !xRet.is() )
118 xRet.set( FillPropertiesContext::createFillContext( *this, aElementToken, xAttribs, mrShape.getFillProperties() ) );
120 return xRet;
125 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */