fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / oox / source / drawingml / table / tablecellcontext.cxx
blobb0df1663c10ea4aa8b387801205d7e1bfa20c231
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <osl/diagnose.h>
22 #include "drawingml/table/tablecellcontext.hxx"
23 #include "drawingml/textbodycontext.hxx"
24 #include "drawingml/linepropertiescontext.hxx"
25 #include "drawingml/fillpropertiesgroupcontext.hxx"
26 #include "oox/helper/attributelist.hxx"
28 using namespace ::oox::core;
29 using namespace ::com::sun::star;
31 namespace oox { namespace drawingml { namespace table {
33 TableCellContext::TableCellContext( ContextHandler2Helper& rParent, const AttributeList& rAttribs, TableCell& rTableCell )
34 : ContextHandler2( rParent )
35 , mrTableCell( rTableCell )
37 if ( rAttribs.hasAttribute( XML_rowSpan ) )
38 mrTableCell.setRowSpan( rAttribs.getString( XML_rowSpan ).get().toInt32() );
39 if ( rAttribs.hasAttribute( XML_gridSpan ) )
40 mrTableCell.setGridSpan( rAttribs.getString( XML_gridSpan ).get().toInt32() );
42 mrTableCell.sethMerge( rAttribs.getBool( XML_hMerge, false ) );
43 mrTableCell.setvMerge( rAttribs.getBool( XML_vMerge, false ) );
46 TableCellContext::~TableCellContext()
50 ContextHandlerRef
51 TableCellContext::onCreateContext( ::sal_Int32 aElementToken, const AttributeList& rAttribs )
53 switch( aElementToken )
55 case A_TOKEN( txBody ): // CT_TextBody
57 oox::drawingml::TextBodyPtr xTextBody( new oox::drawingml::TextBody );
58 mrTableCell.setTextBody( xTextBody );
59 return new oox::drawingml::TextBodyContext( *this, *xTextBody );
62 case A_TOKEN( tcPr ): // CT_TableCellProperties
64 mrTableCell.setLeftMargin( rAttribs.getInteger( XML_marL, 91440 ) );
65 mrTableCell.setRightMargin( rAttribs.getInteger( XML_marR, 91440 ) );
66 mrTableCell.setTopMargin( rAttribs.getInteger( XML_marT, 45720 ) );
67 mrTableCell.setBottomMargin( rAttribs.getInteger( XML_marB, 45720 ) );
68 mrTableCell.setVertToken( rAttribs.getToken( XML_vert, XML_horz ) ); // ST_TextVerticalType
69 mrTableCell.setAnchorToken( rAttribs.getToken( XML_anchor, XML_t ) ); // ST_TextAnchoringType
70 mrTableCell.setAnchorCtr( rAttribs.getBool( XML_anchorCtr, false ) );
71 mrTableCell.setHorzOverflowToken( rAttribs.getToken( XML_horzOverflow, XML_clip ) ); // ST_TextHorzOverflowType
73 break;
74 case A_TOKEN( lnL ):
75 return new oox::drawingml::LinePropertiesContext( *this, rAttribs, mrTableCell.maLinePropertiesLeft );
76 case A_TOKEN( lnR ):
77 return new oox::drawingml::LinePropertiesContext( *this, rAttribs, mrTableCell.maLinePropertiesRight );
78 case A_TOKEN( lnT ):
79 return new oox::drawingml::LinePropertiesContext( *this, rAttribs, mrTableCell.maLinePropertiesTop );
80 case A_TOKEN( lnB ):
81 return new oox::drawingml::LinePropertiesContext( *this, rAttribs, mrTableCell.maLinePropertiesBottom );
82 case A_TOKEN( lnTlToBr ):
83 return new oox::drawingml::LinePropertiesContext( *this, rAttribs, mrTableCell.maLinePropertiesTopLeftToBottomRight );
84 case A_TOKEN( lnBlToTr ):
85 return new oox::drawingml::LinePropertiesContext( *this, rAttribs, mrTableCell.maLinePropertiesBottomLeftToTopRight );
86 case A_TOKEN( cell3D ): // CT_Cell3D
87 break;
89 case A_TOKEN( extLst ): // CT_OfficeArtExtensionList
90 break;
92 default:
93 return FillPropertiesContext::createFillContext( *this, aElementToken, rAttribs, mrTableCell.maFillProperties );
97 return this;
100 } } }
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */