1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #include "oox/drawingml/spdefcontext.hxx"
25 #include "oox/drawingml/shapepropertiescontext.hxx"
26 #include "oox/drawingml/textbody.hxx"
27 #include "oox/drawingml/textbodypropertiescontext.hxx"
28 #include "oox/drawingml/textliststylecontext.hxx"
29 
30 using rtl::OUString;
31 using namespace ::oox::core;
32 using namespace ::com::sun::star::uno;
33 using namespace ::com::sun::star::xml::sax;
34 
35 namespace oox { namespace drawingml {
36 
spDefContext(ContextHandler & rParent,Shape & rDefaultObject)37 spDefContext::spDefContext( ContextHandler& rParent, Shape& rDefaultObject )
38 : ContextHandler( rParent )
39 , mrDefaultObject( rDefaultObject )
40 {
41 }
42 
createFastChildContext(sal_Int32 aElementToken,const Reference<XFastAttributeList> & xAttribs)43 Reference< XFastContextHandler > spDefContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException)
44 {
45 	Reference< XFastContextHandler > xRet;
46 	switch( aElementToken )
47 	{
48 		case A_TOKEN( spPr ):
49 		{
50             xRet = new ShapePropertiesContext( *this, mrDefaultObject );
51 			break;
52 		}
53 		case A_TOKEN( bodyPr ):
54 		{
55             TextBodyPtr xTextBody( new TextBody );
56             mrDefaultObject.setTextBody( xTextBody );
57             xRet = new TextBodyPropertiesContext( *this, xAttribs, xTextBody->getTextProperties() );
58 			break;
59 		}
60 		case A_TOKEN( lstStyle ):
61             xRet.set( new TextListStyleContext( *this, *mrDefaultObject.getMasterTextListStyle() ) );
62 			break;
63 		case A_TOKEN( style ):
64 			break;
65 	}
66 	if( !xRet.is() )
67 		xRet.set( this );
68 
69 	return xRet;
70 }
71 
72 } }
73