bump product version to 4.1.6.2
[LibreOffice.git] / xmloff / source / style / chrlohdl.cxx
blob9a702723f8a7c81fcbbd9ac6dd1e0160ca6b277e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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()
38 // nothing to do
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 );
49 return bRet;
52 sal_Bool XMLCharLanguageHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
54 lang::Locale aLocale;
56 rValue >>= aLocale;
58 if( !IsXMLToken(rStrImpValue, XML_NONE) )
59 aLocale.Language = rStrImpValue;
61 rValue <<= aLocale;
62 return sal_True;
65 sal_Bool XMLCharLanguageHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
67 lang::Locale aLocale;
68 if(!(rValue >>= aLocale))
69 return sal_False;
71 rStrExpValue = aLocale.Language;
73 if( rStrExpValue.isEmpty() )
74 rStrExpValue = GetXMLToken( XML_NONE );
76 return sal_True;
79 ///////////////////////////////////////////////////////////////////////////////
81 // class XMLEscapementHeightPropHdl
84 XMLCharCountryHdl::~XMLCharCountryHdl()
86 // nothing to do
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 );
97 return bRet;
100 sal_Bool XMLCharCountryHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
102 lang::Locale aLocale;
104 rValue >>= aLocale;
106 if( !IsXMLToken( rStrImpValue, XML_NONE ) )
107 aLocale.Country = rStrImpValue;
109 rValue <<= aLocale;
110 return sal_True;
113 sal_Bool XMLCharCountryHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
115 lang::Locale aLocale;
116 if(!(rValue >>= aLocale))
117 return sal_False;
119 rStrExpValue = aLocale.Country;
121 if( rStrExpValue.isEmpty() )
122 rStrExpValue = GetXMLToken( XML_NONE );
124 return sal_True;
127 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */