GPU-Calc: remove Alloc_Host_Ptr for clmem of NAN vector
[LibreOffice.git] / oox / source / drawingml / shapepropertiescontext.cxx
blobda1b2b9f742f94a63386908dec7f850e75e370e7
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( ContextHandler2Helper& rParent, Shape& rShape )
48 : ContextHandler2( rParent )
49 , mrShape( rShape )
53 // --------------------------------------------------------------------
55 ContextHandlerRef ShapePropertiesContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs )
57 switch( aElementToken )
59 // CT_Transform2D
60 case A_TOKEN( xfrm ):
61 return new Transform2DContext( *this, rAttribs, mrShape );
63 // GeometryGroup
64 case A_TOKEN( custGeom ): // custom geometry "CT_CustomGeometry2D"
65 return new CustomShapeGeometryContext( *this, rAttribs, *(mrShape.getCustomShapeProperties()) );
67 case A_TOKEN( prstGeom ): // preset geometry "CT_PresetGeometry2D"
69 sal_Int32 nToken = rAttribs.getToken( XML_prst, 0 );
70 // TODO: Move the following checks to a separate place or as a separate function
71 if ( nToken == XML_line )
73 mrShape.getServiceName() = "com.sun.star.drawing.LineShape";
75 if( ( nToken >= XML_bentConnector2 && nToken <= XML_bentConnector5 ) ||
76 ( nToken >= XML_curvedConnector2 && nToken <= XML_curvedConnector5 ) ||
77 nToken == XML_straightConnector1 )
79 mrShape.getServiceName() = "com.sun.star.drawing.CustomShape";
81 return new PresetShapeGeometryContext( *this, rAttribs, *(mrShape.getCustomShapeProperties()) );
84 case A_TOKEN( prstTxWarp ):
85 return new PresetTextShapeContext( *this, rAttribs, *(mrShape.getCustomShapeProperties()) );
87 // CT_LineProperties
88 case A_TOKEN( ln ):
89 return new LinePropertiesContext( *this, rAttribs, mrShape.getLineProperties() );
91 // EffectPropertiesGroup
92 // todo not supported by core
93 case A_TOKEN( effectLst ): // CT_EffectList
94 case A_TOKEN( effectDag ): // CT_EffectContainer
95 return new EffectPropertiesContext( *this, mrShape.getEffectProperties() );
97 // todo
98 case A_TOKEN( scene3d ): // CT_Scene3D
99 // return new Scene3DContext( *this, rAttribs, *(mrShape.get3DShapeProperties()) );
100 break;
102 // todo
103 case A_TOKEN( sp3d ): // CT_Shape3D
104 break;
107 // FillPropertiesGroupContext
108 return FillPropertiesContext::createFillContext( *this, aElementToken, rAttribs, mrShape.getFillProperties() );
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */