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: breakhdl.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 <breakhdl.hxx>
34 #include <xmloff/xmltoken.hxx>
35 #include <xmloff/xmluconv.hxx>
36 #include <rtl/ustrbuf.hxx>
37 #include <com/sun/star/style/BreakType.hpp>
38 #include <com/sun/star/uno/Any.hxx>
40 #ifndef _XMLOFF_XMLEMENT_HXX
41 #include <xmloff/xmlelement.hxx>
44 using ::rtl::OUString
;
45 using ::rtl::OUStringBuffer
;
47 using namespace ::com::sun::star
;
48 using namespace ::xmloff::token
;
50 SvXMLEnumMapEntry pXML_BreakTypes
[] =
57 { XML_TOKEN_INVALID
, 0}
60 ///////////////////////////////////////////////////////////////////////////////
62 // class XMLFmtBreakBeforePropHdl
65 XMLFmtBreakBeforePropHdl::~XMLFmtBreakBeforePropHdl()
70 sal_Bool
XMLFmtBreakBeforePropHdl::importXML( const OUString
& rStrImpValue
, uno::Any
& rValue
, const SvXMLUnitConverter
& ) const
73 sal_Bool bRet
= SvXMLUnitConverter::convertEnum( nEnum
, rStrImpValue
, pXML_BreakTypes
);
76 style::BreakType eBreak
;
80 eBreak
= style::BreakType_NONE
;
83 eBreak
= style::BreakType_COLUMN_BEFORE
;
86 eBreak
= style::BreakType_PAGE_BEFORE
;
95 sal_Bool
XMLFmtBreakBeforePropHdl::exportXML( OUString
& rStrExpValue
, const uno::Any
& rValue
, const SvXMLUnitConverter
& ) const
97 style::BreakType eBreak
;
99 if( !( rValue
>>= eBreak
) )
101 sal_Int32 nValue
= 0;
102 if( !( rValue
>>= nValue
) )
105 eBreak
= (style::BreakType
) nValue
;
108 sal_uInt16 nEnum
= 0;
111 case style::BreakType_COLUMN_BEFORE
:
114 case style::BreakType_PAGE_BEFORE
:
117 case style::BreakType_NONE
:
125 /* sal_Bool bOk = */ SvXMLUnitConverter::convertEnum( aOut
, nEnum
, pXML_BreakTypes
);
126 rStrExpValue
= aOut
.makeStringAndClear();
131 ///////////////////////////////////////////////////////////////////////////////
133 // class XMLFmtBreakBeforePropHdl
136 XMLFmtBreakAfterPropHdl::~XMLFmtBreakAfterPropHdl()
141 sal_Bool
XMLFmtBreakAfterPropHdl::importXML( const OUString
& rStrImpValue
, uno::Any
& rValue
, const SvXMLUnitConverter
& ) const
144 sal_Bool bRet
= SvXMLUnitConverter::convertEnum( nEnum
, rStrImpValue
, pXML_BreakTypes
);
147 style::BreakType eBreak
;
151 eBreak
= style::BreakType_NONE
;
154 eBreak
= style::BreakType_COLUMN_AFTER
;
157 eBreak
= style::BreakType_PAGE_AFTER
;
166 sal_Bool
XMLFmtBreakAfterPropHdl::exportXML( OUString
& rStrExpValue
, const uno::Any
& rValue
, const SvXMLUnitConverter
& ) const
168 style::BreakType eBreak
;
170 if( !( rValue
>>= eBreak
) )
172 sal_Int32 nValue
= 0;
173 if( !( rValue
>>= nValue
) )
176 eBreak
= (style::BreakType
) nValue
;
179 sal_uInt16 nEnum
= 0;
182 case style::BreakType_COLUMN_AFTER
:
185 case style::BreakType_PAGE_AFTER
:
188 case style::BreakType_NONE
:
196 /* sal_Bool bOk = */ SvXMLUnitConverter::convertEnum( aOut
, nEnum
, pXML_BreakTypes
);
197 rStrExpValue
= aOut
.makeStringAndClear();