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: XMLRectangleMembersHandler.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_xmloff.hxx"
33 #include <xmloff/xmluconv.hxx>
34 #include <rtl/ustrbuf.hxx>
35 #include <com/sun/star/uno/Any.hxx>
37 #ifndef _COM_SUN_STAR_AWT_RECTANGLE_HDL_
38 #include <com/sun/star/awt/Rectangle.hdl>
40 #include "XMLRectangleMembersHandler.hxx"
41 #include <xmloff/xmltypes.hxx>
43 using namespace ::com::sun::star
;
44 using namespace ::com::sun::star::uno
;
45 using ::rtl::OUString
;
46 using ::rtl::OUStringBuffer
;
49 XMLRectangleMembersHdl::XMLRectangleMembersHdl( sal_Int32 nType
)
59 XMLRectangleMembersHdl::~XMLRectangleMembersHdl()
63 sal_Bool
XMLRectangleMembersHdl::importXML(
64 const OUString
& rStrImpValue
,
66 const SvXMLUnitConverter
& rUnitConverter
) const
68 awt::Rectangle
aRect( 0, 0, 0, 0 );
69 if( rValue
.hasValue() )
74 if( rUnitConverter
.convertMeasure( nValue
, rStrImpValue
) )
78 case XML_TYPE_RECTANGLE_LEFT
:
81 case XML_TYPE_RECTANGLE_TOP
:
84 case XML_TYPE_RECTANGLE_WIDTH
:
87 case XML_TYPE_RECTANGLE_HEIGHT
:
88 aRect
.Height
= nValue
;
99 sal_Bool
XMLRectangleMembersHdl::exportXML(
100 OUString
& rStrExpValue
,
102 const SvXMLUnitConverter
& rUnitConverter
) const
104 awt::Rectangle
aRect( 0, 0, 0, 0 );
111 case XML_TYPE_RECTANGLE_LEFT
:
114 case XML_TYPE_RECTANGLE_TOP
:
117 case XML_TYPE_RECTANGLE_WIDTH
:
118 nValue
= aRect
.Width
;
120 case XML_TYPE_RECTANGLE_HEIGHT
:
121 nValue
= aRect
.Height
;
124 nValue
= 0; // TODO What value should this be?
128 rtl::OUStringBuffer sBuffer
;
129 rUnitConverter
.convertMeasure( sBuffer
, nValue
);
130 rStrExpValue
= sBuffer
.makeStringAndClear();