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 ************************************************************************/
28 #ifndef _I18N_LOCALEDATA_HXX_
29 #define _I18N_LOCALEDATA_HXX_
31 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
33 #include <comphelper/processfactory.hxx>
35 #include <com/sun/star/i18n/XLocaleData4.hpp>
38 #include <cppuhelper/implbase2.hxx> // helper for implementations
39 #include <cppu/macros.hxx>
40 #include <com/sun/star/uno/Reference.h>
42 #include <com/sun/star/uno/Sequence.h>
43 #include <com/sun/star/i18n/Calendar.hpp>
44 #include <com/sun/star/i18n/FormatElement.hpp>
45 #include <com/sun/star/i18n/Currency.hpp>
46 #include <com/sun/star/lang/Locale.hpp>
47 #include <com/sun/star/i18n/LocaleDataItem.hpp>
48 #include <com/sun/star/i18n/UnicodeScript.hpp>
49 #include <com/sun/star/uno/RuntimeException.hpp>
50 #include <com/sun/star/uno/XInterface.hpp>
51 #include <rtl/ustring.hxx>
54 #include <osl/module.hxx>
57 #include <defaultnumberingprovider.hxx>
58 #include <com/sun/star/style/NumberingType.hpp>
59 #include <com/sun/star/beans/PropertyValue.hpp>
60 #include <com/sun/star/text/HoriOrientation.hpp>
62 #include <com/sun/star/uno/Reference.hxx>
63 #include <com/sun/star/container/XIndexAccess.hpp>
64 #include <com/sun/star/lang/XServiceInfo.hpp>
66 struct LocaleDataLookupTableItem
;
68 namespace com
{ namespace sun
{ namespace star
{ namespace i18n
{
70 inline sal_Bool
operator ==(const com::sun::star::lang::Locale
& l1
, const com::sun::star::lang::Locale
& l2
) {
71 return l1
.Language
== l2
.Language
&& l1
.Country
== l2
.Country
&& l1
.Variant
== l2
.Variant
;
74 class LocaleData
: public cppu::WeakImplHelper2
76 com::sun::star::i18n::XLocaleData4
,
77 com::sun::star::lang::XServiceInfo
84 static com::sun::star::uno::Sequence
< com::sun::star::i18n::CalendarItem
> downcastCalendarItems( const com::sun::star::uno::Sequence
< com::sun::star::i18n::CalendarItem2
> & rCi
);
85 static com::sun::star::i18n::Calendar
downcastCalendar( const com::sun::star::i18n::Calendar2
& rC
);
87 virtual LanguageCountryInfo SAL_CALL
getLanguageCountryInfo( const com::sun::star::lang::Locale
& rLocale
) throw(com::sun::star::uno::RuntimeException
);
88 virtual LocaleDataItem SAL_CALL
getLocaleItem( const com::sun::star::lang::Locale
& rLocale
) throw(com::sun::star::uno::RuntimeException
);
89 virtual com::sun::star::uno::Sequence
< Calendar2
> SAL_CALL
getAllCalendars2( const com::sun::star::lang::Locale
& rLocale
) throw(com::sun::star::uno::RuntimeException
);
90 virtual com::sun::star::uno::Sequence
< Calendar
> SAL_CALL
getAllCalendars( const com::sun::star::lang::Locale
& rLocale
) throw(com::sun::star::uno::RuntimeException
);
91 virtual com::sun::star::uno::Sequence
< Currency
> SAL_CALL
getAllCurrencies( const com::sun::star::lang::Locale
& rLocale
) throw(com::sun::star::uno::RuntimeException
);
92 virtual com::sun::star::uno::Sequence
< Currency2
> SAL_CALL
getAllCurrencies2( const com::sun::star::lang::Locale
& rLocale
) throw(com::sun::star::uno::RuntimeException
);
93 virtual com::sun::star::uno::Sequence
< FormatElement
> SAL_CALL
getAllFormats( const com::sun::star::lang::Locale
& rLocale
) throw(com::sun::star::uno::RuntimeException
);
94 virtual com::sun::star::uno::Sequence
< Implementation
> SAL_CALL
getCollatorImplementations( const com::sun::star::lang::Locale
& rLocale
) throw(com::sun::star::uno::RuntimeException
);
95 virtual rtl::OUString SAL_CALL
getCollatorRuleByAlgorithm( const com::sun::star::lang::Locale
& rLocale
, const rtl::OUString
& algorithm
) throw(com::sun::star::uno::RuntimeException
);
96 virtual com::sun::star::uno::Sequence
< rtl::OUString
> SAL_CALL
getTransliterations( const com::sun::star::lang::Locale
& rLocale
) throw(com::sun::star::uno::RuntimeException
);
97 virtual ForbiddenCharacters SAL_CALL
getForbiddenCharacters( const com::sun::star::lang::Locale
& rLocale
) throw(com::sun::star::uno::RuntimeException
);
98 virtual com::sun::star::uno::Sequence
< rtl::OUString
> SAL_CALL
getReservedWord( const com::sun::star::lang::Locale
& rLocale
) throw(com::sun::star::uno::RuntimeException
) ;
99 virtual com::sun::star::uno::Sequence
< rtl::OUString
> SAL_CALL
getBreakIteratorRules( const com::sun::star::lang::Locale
& rLocale
) throw(com::sun::star::uno::RuntimeException
) ;
100 virtual com::sun::star::uno::Sequence
< com::sun::star::lang::Locale
> SAL_CALL
getAllInstalledLocaleNames() throw(com::sun::star::uno::RuntimeException
);
102 virtual com::sun::star::uno::Sequence
< rtl::OUString
> SAL_CALL
getSearchOptions( const com::sun::star::lang::Locale
& rLocale
) throw(com::sun::star::uno::RuntimeException
);
103 virtual com::sun::star::uno::Sequence
< rtl::OUString
> SAL_CALL
getCollationOptions( const com::sun::star::lang::Locale
& rLocale
) throw(com::sun::star::uno::RuntimeException
);
104 virtual com::sun::star::uno::Sequence
< com::sun::star::uno::Sequence
< beans::PropertyValue
> > SAL_CALL
getContinuousNumberingLevels( const com::sun::star::lang::Locale
& rLocale
) throw(com::sun::star::uno::RuntimeException
);
105 virtual com::sun::star::uno::Sequence
< com::sun::star::uno::Reference
< container::XIndexAccess
> > SAL_CALL
getOutlineNumberingLevels( const com::sun::star::lang::Locale
& rLocale
) throw(com::sun::star::uno::RuntimeException
);
108 virtual com::sun::star::uno::Sequence
< rtl::OUString
> SAL_CALL
getDateAcceptancePatterns( const com::sun::star::lang::Locale
& rLocale
) throw(com::sun::star::uno::RuntimeException
);
110 // following methods are used by indexentry service
111 virtual com::sun::star::uno::Sequence
< rtl::OUString
> SAL_CALL
getIndexAlgorithm( const com::sun::star::lang::Locale
& rLocale
) throw(com::sun::star::uno::RuntimeException
);
112 virtual rtl::OUString SAL_CALL
getDefaultIndexAlgorithm( const com::sun::star::lang::Locale
& rLocale
) throw(com::sun::star::uno::RuntimeException
);
113 virtual rtl::OUString SAL_CALL
getIndexKeysByAlgorithm( const com::sun::star::lang::Locale
& rLocale
, const rtl::OUString
& algorithm
) throw(com::sun::star::uno::RuntimeException
);
114 virtual rtl::OUString SAL_CALL
getIndexModuleByAlgorithm( const com::sun::star::lang::Locale
& rLocale
, const rtl::OUString
& algorithm
) throw(com::sun::star::uno::RuntimeException
);
115 virtual com::sun::star::uno::Sequence
< UnicodeScript
> SAL_CALL
getUnicodeScripts( const com::sun::star::lang::Locale
& rLocale
) throw(com::sun::star::uno::RuntimeException
);
116 virtual com::sun::star::uno::Sequence
< rtl::OUString
> SAL_CALL
getFollowPageWords( const com::sun::star::lang::Locale
& rLocale
) throw(com::sun::star::uno::RuntimeException
);
117 virtual sal_Bool SAL_CALL
hasPhonetic( const com::sun::star::lang::Locale
& rLocale
) throw(com::sun::star::uno::RuntimeException
);
118 virtual sal_Bool SAL_CALL
isPhonetic( const com::sun::star::lang::Locale
& rLocale
, const rtl::OUString
& algorithm
) throw(com::sun::star::uno::RuntimeException
);
119 virtual rtl::OUString SAL_CALL
getHangingCharacters( const com::sun::star::lang::Locale
& rLocale
) throw(com::sun::star::uno::RuntimeException
);
122 virtual rtl::OUString SAL_CALL
getImplementationName() throw( com::sun::star::uno::RuntimeException
);
123 virtual sal_Bool SAL_CALL
supportsService(const rtl::OUString
& ServiceName
) throw( com::sun::star::uno::RuntimeException
);
124 virtual com::sun::star::uno::Sequence
< rtl::OUString
> SAL_CALL
getSupportedServiceNames() throw( com::sun::star::uno::RuntimeException
);
127 friend sal_Bool
operator ==(const com::sun::star::lang::Locale
& l1
, const com::sun::star::lang::Locale
& l2
);
129 ::std::auto_ptr
< LocaleDataLookupTableItem
> cachedItem
;
131 oslGenericFunction SAL_CALL
getFunctionSymbol( const com::sun::star::lang::Locale
& rLocale
, const sal_Char
* pFunction
) throw( com::sun::star::uno::RuntimeException
);
132 oslGenericFunction SAL_CALL
getFunctionSymbolByName( const rtl::OUString
& localeName
, const sal_Char
* pFunction
);
133 sal_Unicode
** SAL_CALL
getIndexArray(const com::sun::star::lang::Locale
& rLocale
, sal_Int16
& indexCount
);
134 sal_Unicode
** SAL_CALL
getIndexArrayForAlgorithm(const com::sun::star::lang::Locale
& rLocale
, const rtl::OUString
& rAlgorithm
);
135 com::sun::star::i18n::Calendar2 ref_cal
;
136 rtl::OUString ref_name
;
137 com::sun::star::uno::Sequence
< com::sun::star::i18n::CalendarItem2
> &
138 getCalendarItemByName(const rtl::OUString
& name
,
139 const com::sun::star::lang::Locale
& rLocale
,
140 const com::sun::star::uno::Sequence
< com::sun::star::i18n::Calendar2
>& calendarsSeq
,
141 sal_Int16 item
) throw( com::sun::star::uno::RuntimeException
);
143 /// Helper to obtain a sequence of days, months, gmonths or eras.
144 com::sun::star::uno::Sequence
< com::sun::star::i18n::CalendarItem2
> getCalendarItems(
145 sal_Unicode
const * const * const allCalendars
,
146 sal_Int16
& rnOffset
,
147 const sal_Int16 nWhichItem
,
148 const sal_Int16 nCalendar
,
149 const com::sun::star::lang::Locale
& rLocale
,
150 const com::sun::star::uno::Sequence
< com::sun::star::i18n::Calendar2
> & calendarsSeq
)
151 throw( com::sun::star::uno::RuntimeException
);
157 #endif // _I18N_LOCALEDATA_HXX_
159 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */