fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / oox / source / drawingml / shapecontext.cxx
blob5bb38a4f9581f74d93cceefcfcc060398d1a89b7
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 <com/sun/star/xml/sax/FastToken.hpp>
21 #include <com/sun/star/drawing/LineStyle.hpp>
22 #include <com/sun/star/beans/XMultiPropertySet.hpp>
23 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
24 #include <com/sun/star/container/XNamed.hpp>
26 #include "oox/helper/attributelist.hxx"
27 #include "oox/drawingml/shapecontext.hxx"
28 #include <drawingml/shapepropertiescontext.hxx>
29 #include "drawingml/shapestylecontext.hxx"
30 #include "drawingml/fillpropertiesgroupcontext.hxx"
31 #include "oox/drawingml/lineproperties.hxx"
32 #include "oox/drawingml/drawingmltypes.hxx"
33 #include "drawingml/customshapegeometry.hxx"
34 #include "drawingml/textbodycontext.hxx"
35 #include "drawingml/textbodypropertiescontext.hxx"
36 #include "hyperlinkcontext.hxx"
38 using namespace oox::core;
39 using namespace ::com::sun::star;
40 using namespace ::com::sun::star::uno;
41 using namespace ::com::sun::star::drawing;
42 using namespace ::com::sun::star::beans;
43 using namespace ::com::sun::star::text;
44 using namespace ::com::sun::star::xml::sax;
46 namespace oox { namespace drawingml {
48 // CT_Shape
49 ShapeContext::ShapeContext( ContextHandler2Helper& rParent, ShapePtr pMasterShapePtr, ShapePtr pShapePtr )
50 : ContextHandler2( rParent )
51 , mpMasterShapePtr( pMasterShapePtr )
52 , mpShapePtr( pShapePtr )
56 ShapeContext::~ShapeContext()
58 if ( mpMasterShapePtr.get() && mpShapePtr.get() )
59 mpMasterShapePtr->addChild( mpShapePtr );
62 ContextHandlerRef ShapeContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs )
64 switch( getBaseToken( aElementToken ) )
66 // nvSpPr CT_ShapeNonVisual begin
67 // case XML_drElemPr:
68 // break;
69 case XML_cNvPr:
71 mpShapePtr->setHidden( rAttribs.getBool( XML_hidden, false ) );
72 mpShapePtr->setId( rAttribs.getString( XML_id ).get() );
73 mpShapePtr->setName( rAttribs.getString( XML_name ).get() );
74 break;
76 case XML_hlinkMouseOver:
77 case XML_hlinkClick:
78 return new HyperLinkContext( *this, rAttribs, getShape()->getShapeProperties() );
79 case XML_ph:
80 mpShapePtr->setSubType( rAttribs.getToken( XML_type, XML_obj ) );
81 if( rAttribs.hasAttribute( XML_idx ) )
82 mpShapePtr->setSubTypeIndex( rAttribs.getString( XML_idx ).get().toInt32() );
83 break;
84 // nvSpPr CT_ShapeNonVisual end
86 case XML_spPr:
87 return new ShapePropertiesContext( *this, *mpShapePtr );
89 case XML_style:
90 return new ShapeStyleContext( *this, *mpShapePtr );
92 case XML_txBody:
93 case XML_txbxContent:
95 if (!mpShapePtr->getTextBody())
96 mpShapePtr->setTextBody( TextBodyPtr(new TextBody) );
97 return new TextBodyContext( *this, *mpShapePtr->getTextBody() );
99 case XML_txXfrm:
101 mpShapePtr->getTextBody()->getTextProperties().moRotation = rAttribs.getInteger( XML_rot );
102 return 0;
104 case XML_cNvSpPr:
105 break;
106 case XML_spLocks:
107 break;
108 case XML_bodyPr:
109 if (!mpShapePtr->getTextBody())
110 mpShapePtr->setTextBody( TextBodyPtr(new TextBody) );
111 return new TextBodyPropertiesContext( *this, rAttribs, mpShapePtr->getTextBody()->getTextProperties() );
112 break;
113 case XML_txbx:
114 break;
115 case XML_cNvPicPr:
116 break;
117 case XML_nvPicPr:
118 break;
119 case XML_relIds:
120 break;
121 case XML_nvSpPr:
122 break;
123 default:
124 SAL_WARN("oox", "ShapeContext::onCreateContext: unhandled element: " << getBaseToken(aElementToken));
125 break;
128 return this;
133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */