Bump for 3.6-28
[LibreOffice.git] / xmloff / source / style / chrlohdl.cxx
blob36710a7df1d8a4f30cdcd3dad3abe05e0b491cf0
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
31 #include <chrlohdl.hxx>
32 #include <xmloff/xmltoken.hxx>
33 #include <xmloff/xmluconv.hxx>
34 #include <rtl/ustrbuf.hxx>
35 #include <com/sun/star/uno/Any.hxx>
36 #include <com/sun/star/lang/Locale.hpp>
38 using ::rtl::OUString;
39 using ::rtl::OUStringBuffer;
41 using namespace ::com::sun::star;
42 using namespace ::xmloff::token;
44 // this is a copy of defines in svx/inc/escpitem.hxx
45 #define DFLT_ESC_PROP 58
46 #define DFLT_ESC_AUTO_SUPER 101
47 #define DFLT_ESC_AUTO_SUB -101
49 ///////////////////////////////////////////////////////////////////////////////
51 // class XMLEscapementPropHdl
54 XMLCharLanguageHdl::~XMLCharLanguageHdl()
56 // nothing to do
59 bool XMLCharLanguageHdl::equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const
61 sal_Bool bRet = sal_False;
62 lang::Locale aLocale1, aLocale2;
64 if( ( r1 >>= aLocale1 ) && ( r2 >>= aLocale2 ) )
65 bRet = ( aLocale1.Language == aLocale2.Language );
67 return bRet;
70 sal_Bool XMLCharLanguageHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
72 lang::Locale aLocale;
74 rValue >>= aLocale;
76 if( !IsXMLToken(rStrImpValue, XML_NONE) )
77 aLocale.Language = rStrImpValue;
79 rValue <<= aLocale;
80 return sal_True;
83 sal_Bool XMLCharLanguageHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
85 lang::Locale aLocale;
86 if(!(rValue >>= aLocale))
87 return sal_False;
89 rStrExpValue = aLocale.Language;
91 if( rStrExpValue.isEmpty() )
92 rStrExpValue = GetXMLToken( XML_NONE );
94 return sal_True;
97 ///////////////////////////////////////////////////////////////////////////////
99 // class XMLEscapementHeightPropHdl
102 XMLCharCountryHdl::~XMLCharCountryHdl()
104 // nothing to do
107 bool XMLCharCountryHdl::equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const
109 sal_Bool bRet = sal_False;
110 lang::Locale aLocale1, aLocale2;
112 if( ( r1 >>= aLocale1 ) && ( r2 >>= aLocale2 ) )
113 bRet = ( aLocale1.Country == aLocale2.Country );
115 return bRet;
118 sal_Bool XMLCharCountryHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& ) const
120 lang::Locale aLocale;
122 rValue >>= aLocale;
124 if( !IsXMLToken( rStrImpValue, XML_NONE ) )
125 aLocale.Country = rStrImpValue;
127 rValue <<= aLocale;
128 return sal_True;
131 sal_Bool XMLCharCountryHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const
133 lang::Locale aLocale;
134 if(!(rValue >>= aLocale))
135 return sal_False;
137 rStrExpValue = aLocale.Country;
139 if( rStrExpValue.isEmpty() )
140 rStrExpValue = GetXMLToken( XML_NONE );
142 return sal_True;
145 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */