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 : :
22 : : #include "oox/drawingml/table/tablecellcontext.hxx"
23 : : #include "oox/drawingml/textbodycontext.hxx"
24 : : #include "oox/drawingml/linepropertiescontext.hxx"
25 : : #include "oox/drawingml/fillpropertiesgroupcontext.hxx"
26 : : #include "oox/helper/attributelist.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 : TableCellContext::TableCellContext( ContextHandler& rParent, const uno::Reference< xml::sax::XFastAttributeList >& xAttribs, TableCell& rTableCell )
35 : : : ContextHandler( rParent )
36 : 0 : , mrTableCell( rTableCell )
37 : : {
38 [ # # ][ # # ]: 0 : if ( xAttribs->hasAttribute( XML_rowSpan ) )
[ # # ]
39 [ # # ][ # # ]: 0 : mrTableCell.setRowSpan( xAttribs->getOptionalValue( XML_rowSpan ).toInt32() );
40 [ # # ][ # # ]: 0 : if ( xAttribs->hasAttribute( XML_gridSpan ) )
[ # # ]
41 [ # # ][ # # ]: 0 : mrTableCell.setGridSpan( xAttribs->getOptionalValue( XML_gridSpan ).toInt32() );
42 : :
43 [ # # ]: 0 : AttributeList aAttribs( xAttribs );
44 [ # # ]: 0 : mrTableCell.sethMerge( aAttribs.getBool( XML_hMerge, sal_False ) );
45 [ # # ][ # # ]: 0 : mrTableCell.setvMerge( aAttribs.getBool( XML_vMerge, sal_False ) );
46 : 0 : }
47 : :
48 : 0 : TableCellContext::~TableCellContext()
49 : : {
50 [ # # ]: 0 : }
51 : :
52 : : uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
53 : 0 : TableCellContext::createFastChildContext( ::sal_Int32 aElementToken, const uno::Reference< xml::sax::XFastAttributeList >& xAttribs )
54 : : throw ( xml::sax::SAXException, uno::RuntimeException)
55 : : {
56 : 0 : uno::Reference< xml::sax::XFastContextHandler > xRet;
57 : :
58 [ # # # # : 0 : switch( aElementToken )
# # # # #
# # ]
59 : : {
60 : : case A_TOKEN( txBody ): // CT_TextBody
61 : : {
62 [ # # ][ # # ]: 0 : oox::drawingml::TextBodyPtr xTextBody( new oox::drawingml::TextBody );
[ # # ]
63 [ # # ]: 0 : mrTableCell.setTextBody( xTextBody );
64 [ # # ][ # # ]: 0 : xRet = new oox::drawingml::TextBodyContext( *this, *xTextBody );
[ # # ][ # # ]
65 : : }
66 : 0 : break;
67 : :
68 : : case A_TOKEN( tcPr ): // CT_TableCellProperties
69 : : {
70 [ # # ]: 0 : AttributeList aAttribs( xAttribs );
71 [ # # ]: 0 : mrTableCell.setLeftMargin( aAttribs.getInteger( XML_marL, 91440 ) );
72 [ # # ]: 0 : mrTableCell.setRightMargin( aAttribs.getInteger( XML_marR, 91440 ) );
73 [ # # ]: 0 : mrTableCell.setTopMargin( aAttribs.getInteger( XML_marT, 45720 ) );
74 [ # # ]: 0 : mrTableCell.setBottomMargin( aAttribs.getInteger( XML_marB, 45720 ) );
75 [ # # ][ # # ]: 0 : mrTableCell.setVertToken( xAttribs->getOptionalValueToken( XML_vert, XML_horz ) ); // ST_TextVerticalType
76 [ # # ][ # # ]: 0 : mrTableCell.setAnchorToken( xAttribs->getOptionalValueToken( XML_anchor, XML_t ) ); // ST_TextAnchoringType
77 [ # # ]: 0 : mrTableCell.setAnchorCtr( aAttribs.getBool( XML_anchorCtr, sal_False ) );
78 [ # # ][ # # ]: 0 : mrTableCell.setHorzOverflowToken( xAttribs->getOptionalValueToken( XML_horzOverflow, XML_clip ) ); // ST_TextHorzOverflowType
[ # # ]
79 : : }
80 : 0 : break;
81 : : case A_TOKEN( lnL ):
82 [ # # ][ # # ]: 0 : xRet.set( new oox::drawingml::LinePropertiesContext( *this, xAttribs, mrTableCell.maLinePropertiesLeft ) );
83 : 0 : break;
84 : : case A_TOKEN( lnR ):
85 [ # # ][ # # ]: 0 : xRet.set( new oox::drawingml::LinePropertiesContext( *this, xAttribs, mrTableCell.maLinePropertiesRight ) );
86 : 0 : break;
87 : : case A_TOKEN( lnT ):
88 [ # # ][ # # ]: 0 : xRet.set( new oox::drawingml::LinePropertiesContext( *this, xAttribs, mrTableCell.maLinePropertiesTop ) );
89 : 0 : break;
90 : : case A_TOKEN( lnB ):
91 [ # # ][ # # ]: 0 : xRet.set( new oox::drawingml::LinePropertiesContext( *this, xAttribs, mrTableCell.maLinePropertiesBottom ) );
92 : 0 : break;
93 : : case A_TOKEN( lnTlToBr ):
94 [ # # ][ # # ]: 0 : xRet.set( new oox::drawingml::LinePropertiesContext( *this, xAttribs, mrTableCell.maLinePropertiesTopLeftToBottomRight ) );
95 : 0 : break;
96 : : case A_TOKEN( lnBlToTr ):
97 [ # # ][ # # ]: 0 : xRet.set( new oox::drawingml::LinePropertiesContext( *this, xAttribs, mrTableCell.maLinePropertiesBottomLeftToTopRight ) );
98 : 0 : break;
99 : : case A_TOKEN( cell3D ): // CT_Cell3D
100 : 0 : break;
101 : :
102 : : case A_TOKEN( extLst ): // CT_OfficeArtExtensionList
103 : 0 : break;
104 : :
105 : : default:
106 [ # # ][ # # ]: 0 : xRet.set( FillPropertiesContext::createFillContext( *this, aElementToken, xAttribs, mrTableCell.maFillProperties ) );
107 : 0 : break;
108 : :
109 : : }
110 [ # # ]: 0 : if ( !xRet.is() )
111 : : {
112 [ # # ]: 0 : uno::Reference< XFastContextHandler > xTmp( this );
113 [ # # ]: 0 : xRet.set( xTmp );
114 : : }
115 : 0 : return xRet;
116 : : }
117 : :
118 [ + - ][ + - ]: 285 : } } }
119 : :
120 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|