1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: CellMarginHandler.cxx,v $
13 * This file is part of OpenOffice.org.
15 * OpenOffice.org is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License version 3
17 * only, as published by the Free Software Foundation.
19 * OpenOffice.org is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License version 3 for more details
23 * (a copy is included in the LICENSE file that accompanied this code).
25 * You should have received a copy of the GNU Lesser General Public License
26 * version 3 along with OpenOffice.org. If not, see
27 * <http://www.openoffice.org/license.html>
28 * for a copy of the LGPLv3 License.
30 ************************************************************************/
31 #include <CellMarginHandler.hxx>
32 #include <PropertyMap.hxx>
33 #include <doctok/resourceids.hxx>
34 #include <ConversionHelper.hxx>
35 #include <ooxml/resourceids.hxx>
37 namespace writerfilter
{
40 using namespace ::com::sun::star
;
41 using namespace ::writerfilter
;
42 //using namespace ::std;
44 /*-- 18.02.2008 12:36:51---------------------------------------------------
46 -----------------------------------------------------------------------*/
47 CellMarginHandler::CellMarginHandler() :
50 m_bLeftMarginValid( false ),
52 m_bRightMarginValid( false ),
54 m_bTopMarginValid( false ),
56 m_bBottomMarginValid( false )
59 /*-- 18.02.2008 12:36:51---------------------------------------------------
61 -----------------------------------------------------------------------*/
62 CellMarginHandler::~CellMarginHandler()
65 /*-- 18.02.2008 12:36:51---------------------------------------------------
67 -----------------------------------------------------------------------*/
68 void CellMarginHandler::attribute(Id rName
, Value
& rVal
)
70 sal_Int32 nIntValue
= rVal
.getInt();
73 /* WRITERFILTERSTATUS: table: CellColor_attributedata */
76 case NS_ooxml::LN_CT_TblWidth_w
:
77 m_nValue
= ConversionHelper::convertTwipToMM100( nIntValue
);
79 case NS_ooxml::LN_CT_TblWidth_type
:
80 OSL_ENSURE( NS_ooxml::LN_Value_ST_TblWidth_dxa
== sal::static_int_cast
<Id
>(nIntValue
), "cell margins work for absolute values, only");
83 OSL_ENSURE( false, "unknown attribute");
86 /*-- 18.02.2008 12:36:51---------------------------------------------------
88 -----------------------------------------------------------------------*/
89 void CellMarginHandler::sprm(Sprm
& rSprm
)
91 writerfilter::Reference
<Properties
>::Pointer_t pProperties
= rSprm
.getProps();
92 if( pProperties
.get())
94 pProperties
.get()->resolve( *this );
95 switch( rSprm
.getId() )
97 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
98 case NS_ooxml::LN_CT_TblCellMar_top
:
99 m_nTopMargin
= m_nValue
;
100 m_bTopMarginValid
= true;
102 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
103 case NS_ooxml::LN_CT_TblCellMar_left
:
104 m_nLeftMargin
= m_nValue
;
105 m_bLeftMarginValid
= true;
107 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
108 case NS_ooxml::LN_CT_TblCellMar_bottom
:
109 m_nBottomMargin
= m_nValue
;
110 m_bBottomMarginValid
= true;
112 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
113 case NS_ooxml::LN_CT_TblCellMar_right
:
114 m_nRightMargin
= m_nValue
;
115 m_bRightMarginValid
= true;
118 OSL_ENSURE( false, "unknown attribute");
123 } //namespace dmapper
124 } //namespace writerfilter