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()
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
);
70 sal_Bool
XMLCharLanguageHdl::importXML( const OUString
& rStrImpValue
, uno::Any
& rValue
, const SvXMLUnitConverter
& ) const
76 if( !IsXMLToken(rStrImpValue
, XML_NONE
) )
77 aLocale
.Language
= rStrImpValue
;
83 sal_Bool
XMLCharLanguageHdl::exportXML( OUString
& rStrExpValue
, const uno::Any
& rValue
, const SvXMLUnitConverter
& ) const
86 if(!(rValue
>>= aLocale
))
89 rStrExpValue
= aLocale
.Language
;
91 if( rStrExpValue
.isEmpty() )
92 rStrExpValue
= GetXMLToken( XML_NONE
);
97 ///////////////////////////////////////////////////////////////////////////////
99 // class XMLEscapementHeightPropHdl
102 XMLCharCountryHdl::~XMLCharCountryHdl()
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
);
118 sal_Bool
XMLCharCountryHdl::importXML( const OUString
& rStrImpValue
, uno::Any
& rValue
, const SvXMLUnitConverter
& ) const
120 lang::Locale aLocale
;
124 if( !IsXMLToken( rStrImpValue
, XML_NONE
) )
125 aLocale
.Country
= rStrImpValue
;
131 sal_Bool
XMLCharCountryHdl::exportXML( OUString
& rStrExpValue
, const uno::Any
& rValue
, const SvXMLUnitConverter
& ) const
133 lang::Locale aLocale
;
134 if(!(rValue
>>= aLocale
))
137 rStrExpValue
= aLocale
.Country
;
139 if( rStrExpValue
.isEmpty() )
140 rStrExpValue
= GetXMLToken( XML_NONE
);
145 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */