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/shapestylecontext.hxx"
25 
26 #include "oox/helper/attributelist.hxx"
27 #include "oox/drawingml/colorchoicecontext.hxx"
28 
29 using ::rtl::OUString;
30 using namespace ::oox::core;
31 using namespace ::com::sun::star::uno;
32 using namespace ::com::sun::star::xml::sax;
33 
34 namespace oox { namespace drawingml {
35 
36 // ---------------
37 // CT_ShapeStyle
38 // ---------------
ShapeStyleContext(ContextHandler & rParent,Shape & rShape)39 ShapeStyleContext::ShapeStyleContext( ContextHandler& rParent, Shape& rShape )
40 : ContextHandler( rParent )
41 , mrShape( rShape )
42 {
43 }
44 
~ShapeStyleContext()45 ShapeStyleContext::~ShapeStyleContext()
46 {
47 }
48 
49 // --------------------------------------------------------------------
50 
endFastElement(sal_Int32)51 void ShapeStyleContext::endFastElement( sal_Int32 ) throw (SAXException, RuntimeException)
52 {
53 }
54 
55 // --------------------------------------------------------------------
56 
createFastChildContext(sal_Int32 aElementToken,const Reference<XFastAttributeList> & rxAttributes)57 Reference< XFastContextHandler > ShapeStyleContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& rxAttributes )
58 	throw ( SAXException, RuntimeException )
59 {
60 	Reference< XFastContextHandler > xRet;
61     AttributeList aAttribs( rxAttributes );
62 	switch( aElementToken )
63 	{
64         case A_TOKEN( lnRef ) :     // CT_StyleMatrixReference
65         case A_TOKEN( fillRef ) :   // CT_StyleMatrixReference
66         case A_TOKEN( effectRef ) : // CT_StyleMatrixReference
67         case A_TOKEN( fontRef ) :   // CT_FontReference
68         {
69             sal_Int32 nToken = getBaseToken( aElementToken );
70             ShapeStyleRef& rStyleRef = mrShape.getShapeStyleRefs()[ nToken ];
71             rStyleRef.mnThemedIdx = (nToken == XML_fontRef) ? aAttribs.getToken( XML_idx, XML_none ) : aAttribs.getInteger( XML_idx, 0 );
72             xRet.set( new ColorContext( *this, rStyleRef.maPhClr ) );
73         }
74         break;
75 	}
76 	return xRet;
77 }
78 
79 // --------------------------------------------------------------------
80 
81 } }
82 
83