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/tablepartstylecontext.hxx"
27 #include "oox/drawingml/table/tablestyletextstylecontext.hxx"
28 #include "oox/drawingml/table/tablestylecellstylecontext.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 
TablePartStyleContext(ContextHandler & rParent,TableStylePart & rTableStylePart)38 TablePartStyleContext::TablePartStyleContext( ContextHandler& rParent, TableStylePart& rTableStylePart )
39 : ContextHandler( rParent )
40 , mrTableStylePart( rTableStylePart )
41 {
42 }
43 
~TablePartStyleContext()44 TablePartStyleContext::~TablePartStyleContext()
45 {
46 }
47 
48 // CT_TablePartStyle
49 uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
createFastChildContext(::sal_Int32 aElementToken,const uno::Reference<xml::sax::XFastAttributeList> & xAttribs)50 TablePartStyleContext::createFastChildContext( ::sal_Int32 aElementToken, const uno::Reference< xml::sax::XFastAttributeList >& xAttribs )
51 	throw ( xml::sax::SAXException, uno::RuntimeException)
52 {
53 	uno::Reference< xml::sax::XFastContextHandler > xRet;
54 
55 	switch( aElementToken )
56 	{
57 		case A_TOKEN( tcTxStyle ):	// CT_TableStyleTextStyle
58 			xRet.set( new TableStyleTextStyleContext( *this, xAttribs, mrTableStylePart ) );
59 			break;
60 		case A_TOKEN( tcStyle ):	// CT_TableStyleCellStyle
61 			xRet.set( new TableStyleCellStyleContext( *this,  mrTableStylePart ) );
62 			break;
63 	}
64 	if( !xRet.is() )
65 	{
66         uno::Reference<XFastContextHandler> xTmp(this);
67 		xRet.set( xTmp );
68 	}
69 	return xRet;
70 }
71 
72 } } }
73