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/tablerowcontext.hxx"
27 #include "oox/drawingml/table/tablecellcontext.hxx"
28 #include "oox/drawingml/table/tablerow.hxx"
29 
30 using namespace ::oox::core;
31 using namespace ::com::sun::star;
32 using ::rtl::OUString;
33 
34 namespace oox { namespace drawingml { namespace table {
35 
TableRowContext(ContextHandler & rParent,const uno::Reference<xml::sax::XFastAttributeList> & xAttribs,TableRow & rTableRow)36 TableRowContext::TableRowContext( ContextHandler& rParent, const uno::Reference< xml::sax::XFastAttributeList >& xAttribs, TableRow& rTableRow )
37 : ContextHandler( rParent )
38 , mrTableRow( rTableRow )
39 {
40 	rTableRow.setHeight( xAttribs->getOptionalValue( XML_h ).toInt32() );
41 }
42 
~TableRowContext()43 TableRowContext::~TableRowContext()
44 {
45 }
46 
47 uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
createFastChildContext(::sal_Int32 aElementToken,const uno::Reference<xml::sax::XFastAttributeList> & xAttribs)48 TableRowContext::createFastChildContext( ::sal_Int32 aElementToken, const uno::Reference< xml::sax::XFastAttributeList >& xAttribs )
49 	throw ( xml::sax::SAXException, uno::RuntimeException)
50 {
51 	uno::Reference< xml::sax::XFastContextHandler > xRet;
52 
53 	switch( aElementToken )
54 	{
55 	case A_TOKEN( tc ):			// CT_TableCell
56 		{
57 			std::vector< TableCell >& rvTableCells = mrTableRow.getTableCells();
58 			rvTableCells.resize( rvTableCells.size() + 1 );
59 			xRet.set( new TableCellContext( *this, xAttribs, rvTableCells.back() ) );
60 		}
61 		break;
62 	case A_TOKEN( extLst ):		// CT_OfficeArtExtensionList
63 	default:
64 		break;
65 	}
66 	if( !xRet.is() )
67 	{
68         uno::Reference< XFastContextHandler > xTmp( this );
69 		xRet.set( xTmp );
70 	}
71 	return xRet;
72 }
73 
74 } } }
75