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 .
19 #ifndef INCLUDED_I18NPOOL_INC_LOCALEDATA_HXX
20 #define INCLUDED_I18NPOOL_INC_LOCALEDATA_HXX
22 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
24 #include <comphelper/processfactory.hxx>
26 #include <com/sun/star/i18n/XLocaleData4.hpp>
29 #include <cppuhelper/implbase.hxx>
30 #include <cppu/macros.hxx>
31 #include <com/sun/star/uno/Reference.h>
33 #include <com/sun/star/uno/Sequence.h>
34 #include <com/sun/star/i18n/Calendar.hpp>
35 #include <com/sun/star/i18n/FormatElement.hpp>
36 #include <com/sun/star/i18n/Currency.hpp>
37 #include <com/sun/star/lang/Locale.hpp>
38 #include <com/sun/star/i18n/LocaleDataItem.hpp>
39 #include <com/sun/star/i18n/UnicodeScript.hpp>
40 #include <com/sun/star/uno/RuntimeException.hpp>
41 #include <com/sun/star/uno/XInterface.hpp>
42 #include <rtl/ustring.hxx>
45 #include <osl/module.hxx>
48 #include <defaultnumberingprovider.hxx>
49 #include <com/sun/star/style/NumberingType.hpp>
50 #include <com/sun/star/beans/PropertyValue.hpp>
51 #include <com/sun/star/text/HoriOrientation.hpp>
53 #include <com/sun/star/uno/Reference.hxx>
54 #include <com/sun/star/container/XIndexAccess.hpp>
55 #include <com/sun/star/lang/XServiceInfo.hpp>
57 struct LocaleDataLookupTableItem
;
59 namespace com
{ namespace sun
{ namespace star
{ namespace i18n
{
61 class LocaleDataImpl
: public cppu::WeakImplHelper
63 css::i18n::XLocaleData4
,
64 css::lang::XServiceInfo
69 virtual ~LocaleDataImpl();
71 static css::uno::Sequence
< css::i18n::CalendarItem
> downcastCalendarItems( const css::uno::Sequence
< css::i18n::CalendarItem2
> & rCi
);
72 static css::i18n::Calendar
downcastCalendar( const css::i18n::Calendar2
& rC
);
74 /** Generates a <Language>_<Country> or <Variant> (if Language=="qlt")
75 string suitable as part of service name with all '-' replaced by '_' */
76 static OUString
getFirstLocaleServiceName( const css::lang::Locale
& rLocale
);
77 /** Generates fallback strings suitable as parts of service names,
78 excluding the one obtained via getFirstLocaleServiceName() */
79 static ::std::vector
< OUString
> getFallbackLocaleServiceNames( const css::lang::Locale
& rLocale
);
81 virtual LanguageCountryInfo SAL_CALL
getLanguageCountryInfo( const css::lang::Locale
& rLocale
) throw(css::uno::RuntimeException
, std::exception
) override
;
82 virtual LocaleDataItem SAL_CALL
getLocaleItem( const css::lang::Locale
& rLocale
) throw(css::uno::RuntimeException
, std::exception
) override
;
83 virtual css::uno::Sequence
< Calendar2
> SAL_CALL
getAllCalendars2( const css::lang::Locale
& rLocale
) throw(css::uno::RuntimeException
, std::exception
) override
;
84 virtual css::uno::Sequence
< Calendar
> SAL_CALL
getAllCalendars( const css::lang::Locale
& rLocale
) throw(css::uno::RuntimeException
, std::exception
) override
;
85 virtual css::uno::Sequence
< Currency
> SAL_CALL
getAllCurrencies( const css::lang::Locale
& rLocale
) throw(css::uno::RuntimeException
, std::exception
) override
;
86 virtual css::uno::Sequence
< Currency2
> SAL_CALL
getAllCurrencies2( const css::lang::Locale
& rLocale
) throw(css::uno::RuntimeException
, std::exception
) override
;
87 virtual css::uno::Sequence
< FormatElement
> SAL_CALL
getAllFormats( const css::lang::Locale
& rLocale
) throw(css::uno::RuntimeException
, std::exception
) override
;
88 virtual css::uno::Sequence
< Implementation
> SAL_CALL
getCollatorImplementations( const css::lang::Locale
& rLocale
) throw(css::uno::RuntimeException
, std::exception
) override
;
89 OUString SAL_CALL
getCollatorRuleByAlgorithm( const css::lang::Locale
& rLocale
, const OUString
& algorithm
) throw(css::uno::RuntimeException
, std::exception
);
90 virtual css::uno::Sequence
< OUString
> SAL_CALL
getTransliterations( const css::lang::Locale
& rLocale
) throw(css::uno::RuntimeException
, std::exception
) override
;
91 virtual ForbiddenCharacters SAL_CALL
getForbiddenCharacters( const css::lang::Locale
& rLocale
) throw(css::uno::RuntimeException
, std::exception
) override
;
92 virtual css::uno::Sequence
< OUString
> SAL_CALL
getReservedWord( const css::lang::Locale
& rLocale
) throw(css::uno::RuntimeException
, std::exception
) override
;
93 css::uno::Sequence
< OUString
> SAL_CALL
getBreakIteratorRules( const css::lang::Locale
& rLocale
) throw(css::uno::RuntimeException
, std::exception
) ;
94 virtual css::uno::Sequence
< css::lang::Locale
> SAL_CALL
getAllInstalledLocaleNames() throw(css::uno::RuntimeException
, std::exception
) override
;
96 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSearchOptions( const css::lang::Locale
& rLocale
) throw(css::uno::RuntimeException
, std::exception
) override
;
97 virtual css::uno::Sequence
< OUString
> SAL_CALL
getCollationOptions( const css::lang::Locale
& rLocale
) throw(css::uno::RuntimeException
, std::exception
) override
;
98 css::uno::Sequence
< css::uno::Sequence
< beans::PropertyValue
> > SAL_CALL
getContinuousNumberingLevels( const css::lang::Locale
& rLocale
) throw(css::uno::RuntimeException
, std::exception
);
99 css::uno::Sequence
< css::uno::Reference
< container::XIndexAccess
> > SAL_CALL
getOutlineNumberingLevels( const css::lang::Locale
& rLocale
) throw(css::uno::RuntimeException
, std::exception
);
102 virtual css::uno::Sequence
< OUString
> SAL_CALL
getDateAcceptancePatterns( const css::lang::Locale
& rLocale
) throw(css::uno::RuntimeException
, std::exception
) override
;
104 // following methods are used by indexentry service
105 css::uno::Sequence
< OUString
> SAL_CALL
getIndexAlgorithm( const css::lang::Locale
& rLocale
) throw(css::uno::RuntimeException
);
106 OUString SAL_CALL
getDefaultIndexAlgorithm( const css::lang::Locale
& rLocale
) throw(css::uno::RuntimeException
);
107 OUString SAL_CALL
getIndexKeysByAlgorithm( const css::lang::Locale
& rLocale
, const OUString
& algorithm
) throw(css::uno::RuntimeException
);
108 OUString SAL_CALL
getIndexModuleByAlgorithm( const css::lang::Locale
& rLocale
, const OUString
& algorithm
) throw(css::uno::RuntimeException
);
109 css::uno::Sequence
< UnicodeScript
> SAL_CALL
getUnicodeScripts( const css::lang::Locale
& rLocale
) throw(css::uno::RuntimeException
, std::exception
);
110 css::uno::Sequence
< OUString
> SAL_CALL
getFollowPageWords( const css::lang::Locale
& rLocale
) throw(css::uno::RuntimeException
, std::exception
);
111 bool SAL_CALL
hasPhonetic( const css::lang::Locale
& rLocale
) throw(css::uno::RuntimeException
);
112 bool SAL_CALL
isPhonetic( const css::lang::Locale
& rLocale
, const OUString
& algorithm
) throw(css::uno::RuntimeException
);
113 OUString SAL_CALL
getHangingCharacters( const css::lang::Locale
& rLocale
) throw(css::uno::RuntimeException
, std::exception
);
116 virtual OUString SAL_CALL
getImplementationName() throw( css::uno::RuntimeException
, std::exception
) override
;
117 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) throw( css::uno::RuntimeException
, std::exception
) override
;
118 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() throw( css::uno::RuntimeException
, std::exception
) override
;
121 ::std::unique_ptr
< LocaleDataLookupTableItem
> cachedItem
;
122 css::i18n::Calendar2 ref_cal
;
125 oslGenericFunction SAL_CALL
getFunctionSymbol( const css::lang::Locale
& rLocale
, const sal_Char
* pFunction
) throw( css::uno::RuntimeException
, std::exception
);
126 sal_Unicode
** SAL_CALL
getIndexArray(const css::lang::Locale
& rLocale
, sal_Int16
& indexCount
);
127 sal_Unicode
** SAL_CALL
getIndexArrayForAlgorithm(const css::lang::Locale
& rLocale
, const OUString
& rAlgorithm
);
128 css::uno::Sequence
< css::i18n::CalendarItem2
> &
129 getCalendarItemByName(const OUString
& name
,
130 const css::lang::Locale
& rLocale
,
131 const css::uno::Sequence
< css::i18n::Calendar2
>& calendarsSeq
,
132 sal_Int16 item
) throw( css::uno::RuntimeException
);
134 /// Helper to obtain a sequence of days, months, gmonths or eras.
135 css::uno::Sequence
< css::i18n::CalendarItem2
> getCalendarItems(
136 sal_Unicode
const * const * const allCalendars
,
137 sal_Int16
& rnOffset
,
138 const sal_Int16 nWhichItem
,
139 const sal_Int16 nCalendar
,
140 const css::lang::Locale
& rLocale
,
141 const css::uno::Sequence
< css::i18n::Calendar2
> & calendarsSeq
)
142 throw( css::uno::RuntimeException
);
148 #endif // INCLUDED_I18NPOOL_INC_LOCALEDATA_HXX
150 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */