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 <osl/diagnose.h>
25
26 #include "oox/drawingml/table/tablebackgroundstylecontext.hxx"
27 #include "oox/drawingml/fillpropertiesgroupcontext.hxx"
28 #include "oox/helper/attributelist.hxx"
29
30 using namespace ::oox::core;
31 using namespace ::com::sun::star;
32 using namespace ::com::sun::star::uno;
33 using namespace ::com::sun::star::xml::sax;
34 using ::rtl::OUString;
35
36 namespace oox { namespace drawingml { namespace table {
37
TableBackgroundStyleContext(ContextHandler & rParent,TableStyle & rTableStyle)38 TableBackgroundStyleContext::TableBackgroundStyleContext( ContextHandler& rParent, TableStyle& rTableStyle )
39 : ContextHandler( rParent )
40 , mrTableStyle( rTableStyle )
41 {
42 }
43
~TableBackgroundStyleContext()44 TableBackgroundStyleContext::~TableBackgroundStyleContext()
45 {
46 }
47
48 uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
createFastChildContext(::sal_Int32 aElementToken,const uno::Reference<xml::sax::XFastAttributeList> & xAttribs)49 TableBackgroundStyleContext::createFastChildContext( ::sal_Int32 aElementToken, const uno::Reference< xml::sax::XFastAttributeList >& xAttribs )
50 {
51 uno::Reference< xml::sax::XFastContextHandler > xRet;
52
53 AttributeList aAttribs( xAttribs );
54 switch( aElementToken )
55 {
56 // EG_ThemeableFillStyle (choice)
57 case A_TOKEN( fill ): // CT_FillProperties
58 {
59 boost::shared_ptr< FillProperties >& rxFillProperties = mrTableStyle.getBackgroundFillProperties();
60 rxFillProperties.reset( new FillProperties );
61 xRet.set( new FillPropertiesContext( *this, *rxFillProperties ) );
62 }
63 break;
64 case A_TOKEN( fillRef ): // CT_StyleMatrixReference
65 {
66 ShapeStyleRef& rStyleRef = mrTableStyle.getBackgroundFillStyleRef();
67 rStyleRef.mnThemedIdx = aAttribs.getInteger( XML_idx, 0 );
68 xRet.set( new ColorContext( *this, rStyleRef.maPhClr ) );
69 }
70 break;
71
72 // EG_ThemeableEffectStyle (choice)
73 case A_TOKEN( effect ): // CT_EffectProperties
74 break;
75 case A_TOKEN( effectRef ): // CT_StyleMatrixReference
76 break;
77 }
78 if( !xRet.is() )
79 {
80 uno::Reference<XFastContextHandler> xTmp(this);
81 xRet.set( xTmp );
82 }
83 return xRet;
84 }
85
86 } } }
87