1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 <adjushdl.hxx>
21 #include <xmloff/xmltoken.hxx>
22 #include <xmloff/xmluconv.hxx>
23 #include <rtl/ustrbuf.hxx>
24 #include <com/sun/star/style/ParagraphAdjust.hpp>
25 #include <com/sun/star/uno/Any.hxx>
27 using namespace ::com::sun::star
;
29 using namespace ::xmloff::token
;
31 SvXMLEnumMapEntry
const pXML_Para_Adjust_Enum
[] =
33 { XML_START
, style::ParagraphAdjust_LEFT
},
34 { XML_END
, style::ParagraphAdjust_RIGHT
},
35 { XML_CENTER
, style::ParagraphAdjust_CENTER
},
36 { XML_JUSTIFY
, style::ParagraphAdjust_BLOCK
},
37 { XML_JUSTIFIED
, style::ParagraphAdjust_BLOCK
}, // obsolete
38 { XML_LEFT
, style::ParagraphAdjust_LEFT
},
39 { XML_RIGHT
, style::ParagraphAdjust_RIGHT
},
40 { XML_TOKEN_INVALID
, 0 }
43 SvXMLEnumMapEntry
const pXML_Para_Align_Last_Enum
[] =
45 { XML_START
, style::ParagraphAdjust_LEFT
},
46 { XML_CENTER
, style::ParagraphAdjust_CENTER
},
47 { XML_JUSTIFY
, style::ParagraphAdjust_BLOCK
},
48 { XML_JUSTIFIED
, style::ParagraphAdjust_BLOCK
}, // obsolete
49 { XML_TOKEN_INVALID
, 0 }
53 // class XMLParaAdjustPropHdl
56 XMLParaAdjustPropHdl::~XMLParaAdjustPropHdl()
61 bool XMLParaAdjustPropHdl::importXML( const OUString
& rStrImpValue
, uno::Any
& rValue
, const SvXMLUnitConverter
& ) const
64 bool bRet
= SvXMLUnitConverter::convertEnum( eAdjust
, rStrImpValue
, pXML_Para_Adjust_Enum
);
66 rValue
<<= (sal_Int16
)eAdjust
;
71 bool XMLParaAdjustPropHdl::exportXML( OUString
& rStrExpValue
, const uno::Any
& rValue
, const SvXMLUnitConverter
& ) const
73 if(!rValue
.hasValue())
80 bool bRet
= SvXMLUnitConverter::convertEnum( aOut
, nVal
, pXML_Para_Adjust_Enum
, XML_START
);
82 rStrExpValue
= aOut
.makeStringAndClear();
88 // class XMLLastLineAdjustPropHdl
91 XMLLastLineAdjustPropHdl::~XMLLastLineAdjustPropHdl()
96 bool XMLLastLineAdjustPropHdl::importXML( const OUString
& rStrImpValue
, uno::Any
& rValue
, const SvXMLUnitConverter
& ) const
99 bool bRet
= SvXMLUnitConverter::convertEnum( eAdjust
, rStrImpValue
, pXML_Para_Align_Last_Enum
);
101 rValue
<<= (sal_Int16
)eAdjust
;
106 bool XMLLastLineAdjustPropHdl::exportXML( OUString
& rStrExpValue
, const uno::Any
& rValue
, const SvXMLUnitConverter
& ) const
114 if( nVal
!= style::ParagraphAdjust_LEFT
)
115 bRet
= SvXMLUnitConverter::convertEnum( aOut
, nVal
, pXML_Para_Align_Last_Enum
, XML_START
);
117 rStrExpValue
= aOut
.makeStringAndClear();
122 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */