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 <chrlohdl.hxx>
21 #include <xmloff/xmltoken.hxx>
22 #include <xmloff/xmluconv.hxx>
23 #include <rtl/ustrbuf.hxx>
24 #include <com/sun/star/uno/Any.hxx>
25 #include <com/sun/star/lang/Locale.hpp>
28 using namespace ::com::sun::star
;
29 using namespace ::xmloff::token
;
31 ///////////////////////////////////////////////////////////////////////////////
33 // class XMLEscapementPropHdl
36 XMLCharLanguageHdl::~XMLCharLanguageHdl()
41 bool XMLCharLanguageHdl::equals( const ::com::sun::star::uno::Any
& r1
, const ::com::sun::star::uno::Any
& r2
) const
43 sal_Bool bRet
= sal_False
;
44 lang::Locale aLocale1
, aLocale2
;
46 if( ( r1
>>= aLocale1
) && ( r2
>>= aLocale2
) )
47 bRet
= ( aLocale1
.Language
== aLocale2
.Language
);
52 sal_Bool
XMLCharLanguageHdl::importXML( const OUString
& rStrImpValue
, uno::Any
& rValue
, const SvXMLUnitConverter
& ) const
58 if( !IsXMLToken(rStrImpValue
, XML_NONE
) )
59 aLocale
.Language
= rStrImpValue
;
65 sal_Bool
XMLCharLanguageHdl::exportXML( OUString
& rStrExpValue
, const uno::Any
& rValue
, const SvXMLUnitConverter
& ) const
68 if(!(rValue
>>= aLocale
))
71 rStrExpValue
= aLocale
.Language
;
73 if( rStrExpValue
.isEmpty() )
74 rStrExpValue
= GetXMLToken( XML_NONE
);
79 ///////////////////////////////////////////////////////////////////////////////
81 // class XMLEscapementHeightPropHdl
84 XMLCharCountryHdl::~XMLCharCountryHdl()
89 bool XMLCharCountryHdl::equals( const ::com::sun::star::uno::Any
& r1
, const ::com::sun::star::uno::Any
& r2
) const
91 sal_Bool bRet
= sal_False
;
92 lang::Locale aLocale1
, aLocale2
;
94 if( ( r1
>>= aLocale1
) && ( r2
>>= aLocale2
) )
95 bRet
= ( aLocale1
.Country
== aLocale2
.Country
);
100 sal_Bool
XMLCharCountryHdl::importXML( const OUString
& rStrImpValue
, uno::Any
& rValue
, const SvXMLUnitConverter
& ) const
102 lang::Locale aLocale
;
106 if( !IsXMLToken( rStrImpValue
, XML_NONE
) )
107 aLocale
.Country
= rStrImpValue
;
113 sal_Bool
XMLCharCountryHdl::exportXML( OUString
& rStrExpValue
, const uno::Any
& rValue
, const SvXMLUnitConverter
& ) const
115 lang::Locale aLocale
;
116 if(!(rValue
>>= aLocale
))
119 rStrExpValue
= aLocale
.Country
;
121 if( rStrExpValue
.isEmpty() )
122 rStrExpValue
= GetXMLToken( XML_NONE
);
127 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */