xref: /trunk/main/oox/source/drawingml/table/tablerowcontext.cxx (revision 91144cd0085a7583d2099b982122deb2184ab956)
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 {
50     uno::Reference< xml::sax::XFastContextHandler > xRet;
51 
52     switch( aElementToken )
53     {
54     case A_TOKEN( tc ):         // CT_TableCell
55         {
56             std::vector< TableCell >& rvTableCells = mrTableRow.getTableCells();
57             rvTableCells.resize( rvTableCells.size() + 1 );
58             xRet.set( new TableCellContext( *this, xAttribs, rvTableCells.back() ) );
59         }
60         break;
61     case A_TOKEN( extLst ):     // CT_OfficeArtExtensionList
62     default:
63         break;
64     }
65     if( !xRet.is() )
66     {
67         uno::Reference< XFastContextHandler > xTmp( this );
68         xRet.set( xTmp );
69     }
70     return xRet;
71 }
72 
73 } } }
74