Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
5 : : * This Source Code Form is subject to the terms of the Mozilla Public
6 : : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
11 : : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : : * contributor license agreements. See the NOTICE file distributed
13 : : * with this work for additional information regarding copyright
14 : : * ownership. The ASF licenses this file to you under the Apache
15 : : * License, Version 2.0 (the "License"); you may not use this file
16 : : * except in compliance with the License. You may obtain a copy of
17 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : : */
19 : :
20 : : #include <osl/diagnose.h>
21 : : #include "oox/helper/attributelist.hxx"
22 : : #include "oox/drawingml/guidcontext.hxx"
23 : : #include "oox/drawingml/table/tablecontext.hxx"
24 : : #include "oox/drawingml/table/tableproperties.hxx"
25 : : #include "oox/drawingml/table/tablestylecontext.hxx"
26 : : #include "oox/drawingml/table/tablerowcontext.hxx"
27 : :
28 : : using namespace ::oox::core;
29 : : using namespace ::com::sun::star;
30 : : using ::rtl::OUString;
31 : :
32 : : namespace oox { namespace drawingml { namespace table {
33 : :
34 : 0 : TableContext::TableContext( ContextHandler& rParent, ShapePtr pShapePtr )
35 : : : ShapeContext( rParent, ShapePtr(), pShapePtr )
36 [ # # ][ # # ]: 0 : , mrTableProperties( *pShapePtr->getTableProperties().get() )
[ # # ][ # # ]
[ # # ]
37 : : {
38 [ # # ]: 0 : pShapePtr->setTableType();
39 : 0 : }
40 : :
41 : 0 : TableContext::~TableContext()
42 : : {
43 [ # # ]: 0 : }
44 : :
45 : : uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
46 : 0 : TableContext::createFastChildContext( ::sal_Int32 aElementToken, const uno::Reference< xml::sax::XFastAttributeList >& xAttribs )
47 : : throw ( xml::sax::SAXException, uno::RuntimeException)
48 : : {
49 : 0 : uno::Reference< xml::sax::XFastContextHandler > xRet;
50 : :
51 [ # # # # : 0 : switch( aElementToken )
# # # ]
52 : : {
53 : : case A_TOKEN( tblPr ): // CT_TableProperties
54 : : {
55 [ # # ]: 0 : AttributeList aAttribs( xAttribs );
56 [ # # ]: 0 : mrTableProperties.isRtl() = aAttribs.getBool( XML_rtl, sal_False );
57 [ # # ]: 0 : mrTableProperties.isFirstRow() = aAttribs.getBool( XML_firstRow, sal_False );
58 [ # # ]: 0 : mrTableProperties.isFirstCol() = aAttribs.getBool( XML_firstCol, sal_False );
59 [ # # ]: 0 : mrTableProperties.isLastRow() = aAttribs.getBool( XML_lastRow, sal_False );
60 [ # # ]: 0 : mrTableProperties.isLastCol() = aAttribs.getBool( XML_lastCol, sal_False );
61 [ # # ]: 0 : mrTableProperties.isBandRow() = aAttribs.getBool( XML_bandRow, sal_False );
62 [ # # ][ # # ]: 0 : mrTableProperties.isBandCol() = aAttribs.getBool( XML_bandCol, sal_False );
63 : : }
64 : 0 : break;
65 : : case A_TOKEN( tableStyle ): // CT_TableStyle
66 : : {
67 : 0 : boost::shared_ptr< TableStyle >& rTableStyle = mrTableProperties.getTableStyle();
68 [ # # ][ # # ]: 0 : rTableStyle.reset( new TableStyle() );
[ # # ]
69 [ # # ][ # # ]: 0 : xRet = new TableStyleContext( *this, xAttribs, *rTableStyle );
[ # # ]
70 : : }
71 : 0 : break;
72 : : case A_TOKEN( tableStyleId ): // ST_Guid
73 [ # # ][ # # ]: 0 : xRet.set( new oox::drawingml::GuidContext( *this, mrTableProperties.getStyleId() ) );
[ # # ]
74 : 0 : break;
75 : :
76 : : case A_TOKEN( tblGrid ): // CT_TableGrid
77 : 0 : break;
78 : : case A_TOKEN( gridCol ): // CT_TableCol
79 : : {
80 : 0 : std::vector< sal_Int32 >& rvTableGrid( mrTableProperties.getTableGrid() );
81 [ # # ][ # # ]: 0 : rvTableGrid.push_back( xAttribs->getOptionalValue( XML_w ).toInt32() );
[ # # ]
82 : : }
83 : 0 : break;
84 : : case A_TOKEN( tr ): // CT_TableRow
85 : : {
86 : 0 : std::vector< TableRow >& rvTableRows( mrTableProperties.getTableRows() );
87 [ # # ]: 0 : rvTableRows.resize( rvTableRows.size() + 1 );
88 [ # # ][ # # ]: 0 : xRet.set( new TableRowContext( *this, xAttribs, rvTableRows.back() ) );
[ # # ][ # # ]
89 : : }
90 : 0 : break;
91 : : }
92 : :
93 [ # # ]: 0 : if( !xRet.is() )
94 [ # # ]: 0 : xRet.set( this );
95 : :
96 : 0 : return xRet;
97 : : }
98 : :
99 [ + - ][ + - ]: 285 : } } }
100 : :
101 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|