Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / i18npool / inc / localedata.hxx
blobb707ed3596b1ae33899d20ea6443ac28c3cd19d4
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 .
19 #ifndef INCLUDED_I18NPOOL_INC_LOCALEDATA_HXX
20 #define INCLUDED_I18NPOOL_INC_LOCALEDATA_HXX
22 #include <com/sun/star/i18n/XLocaleData5.hpp>
25 #include <cppuhelper/implbase.hxx>
27 #include <com/sun/star/uno/Sequence.h>
28 #include <com/sun/star/i18n/Calendar.hpp>
29 #include <com/sun/star/i18n/LocaleDataItem2.hpp>
30 #include <com/sun/star/i18n/UnicodeScript.hpp>
31 #include <rtl/ref.hxx>
32 #include <rtl/ustring.hxx>
33 #include <vector>
34 #include <memory>
35 #include <osl/module.hxx>
38 #include <com/sun/star/lang/XServiceInfo.hpp>
40 namespace com::sun::star::beans { struct PropertyValue; }
41 namespace com::sun::star::container { class XIndexAccess; }
42 namespace com::sun::star::i18n { struct Currency; }
43 namespace com::sun::star::i18n { struct Currency2; }
44 namespace com::sun::star::i18n { struct FormatElement; }
45 namespace com::sun::star::lang { struct Locale; }
47 struct LocaleDataLookupTableItem;
49 namespace i18npool {
51 class LocaleDataImpl : public cppu::WeakImplHelper
53 css::i18n::XLocaleData5,
54 css::lang::XServiceInfo
57 public:
58 LocaleDataImpl();
59 virtual ~LocaleDataImpl() override;
61 static rtl::Reference<LocaleDataImpl> get() { return new LocaleDataImpl; }
63 static css::uno::Sequence< css::i18n::CalendarItem > downcastCalendarItems( const css::uno::Sequence< css::i18n::CalendarItem2 > & rCi );
64 static css::i18n::Calendar downcastCalendar( const css::i18n::Calendar2 & rC );
66 /** Generates a <Language>_<Country> or <Variant> (if Language=="qlt")
67 string suitable as part of service name with all '-' replaced by '_' */
68 static OUString getFirstLocaleServiceName( const css::lang::Locale & rLocale );
69 /** Generates fallback strings suitable as parts of service names,
70 excluding the one obtained via getFirstLocaleServiceName() */
71 static ::std::vector< OUString > getFallbackLocaleServiceNames( const css::lang::Locale & rLocale );
73 virtual css::i18n::LanguageCountryInfo SAL_CALL getLanguageCountryInfo( const css::lang::Locale& rLocale ) override;
74 virtual css::i18n::LocaleDataItem SAL_CALL getLocaleItem( const css::lang::Locale& rLocale ) override;
75 virtual css::uno::Sequence< css::i18n::Calendar2 > SAL_CALL getAllCalendars2( const css::lang::Locale& rLocale ) override;
76 virtual css::uno::Sequence< css::i18n::Calendar > SAL_CALL getAllCalendars( const css::lang::Locale& rLocale ) override;
77 virtual css::uno::Sequence< css::i18n::Currency > SAL_CALL getAllCurrencies( const css::lang::Locale& rLocale ) override;
78 virtual css::uno::Sequence< css::i18n::Currency2 > SAL_CALL getAllCurrencies2( const css::lang::Locale& rLocale ) override;
79 virtual css::uno::Sequence< css::i18n::FormatElement > SAL_CALL getAllFormats( const css::lang::Locale& rLocale ) override;
80 virtual css::uno::Sequence< css::i18n::Implementation > SAL_CALL getCollatorImplementations( const css::lang::Locale& rLocale ) override;
81 /// @throws css::uno::RuntimeException
82 OUString getCollatorRuleByAlgorithm( const css::lang::Locale& rLocale, const OUString& algorithm );
83 virtual css::uno::Sequence< OUString > SAL_CALL getTransliterations( const css::lang::Locale& rLocale ) override;
84 virtual css::i18n::ForbiddenCharacters SAL_CALL getForbiddenCharacters( const css::lang::Locale& rLocale ) override;
85 virtual css::uno::Sequence< OUString > SAL_CALL getReservedWord( const css::lang::Locale& rLocale ) override ;
86 /// @throws css::uno::RuntimeException
87 css::uno::Sequence< OUString > getBreakIteratorRules( const css::lang::Locale& rLocale ) ;
88 virtual css::uno::Sequence< css::lang::Locale > SAL_CALL getAllInstalledLocaleNames() override;
90 virtual css::uno::Sequence< OUString > SAL_CALL getSearchOptions( const css::lang::Locale& rLocale ) override;
91 virtual css::uno::Sequence< OUString > SAL_CALL getCollationOptions( const css::lang::Locale& rLocale ) override;
92 /// @throws css::uno::RuntimeException
93 css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > getContinuousNumberingLevels( const css::lang::Locale& rLocale );
94 /// @throws css::uno::RuntimeException
95 css::uno::Sequence< css::uno::Reference< css::container::XIndexAccess > > getOutlineNumberingLevels( const css::lang::Locale& rLocale );
97 // XLocaleData4
98 virtual css::uno::Sequence< OUString > SAL_CALL getDateAcceptancePatterns( const css::lang::Locale& rLocale ) override;
100 // XLocaleData5
101 virtual css::i18n::LocaleDataItem2 SAL_CALL getLocaleItem2( const css::lang::Locale& rLocale ) override;
103 // following methods are used by indexentry service
104 /// @throws css::uno::RuntimeException
105 css::uno::Sequence< OUString > getIndexAlgorithm( const css::lang::Locale& rLocale );
106 /// @throws css::uno::RuntimeException
107 OUString getDefaultIndexAlgorithm( const css::lang::Locale& rLocale );
108 /// @throws css::uno::RuntimeException
109 OUString getIndexKeysByAlgorithm( const css::lang::Locale& rLocale, const OUString& algorithm );
110 /// @throws css::uno::RuntimeException
111 OUString getIndexModuleByAlgorithm( const css::lang::Locale& rLocale, const OUString& algorithm );
112 /// @throws css::uno::RuntimeException
113 css::uno::Sequence< css::i18n::UnicodeScript > getUnicodeScripts( const css::lang::Locale& rLocale );
114 /// @throws css::uno::RuntimeException
115 css::uno::Sequence< OUString > getFollowPageWords( const css::lang::Locale& rLocale );
116 /// @throws css::uno::RuntimeException
117 bool hasPhonetic( const css::lang::Locale& rLocale );
118 /// @throws css::uno::RuntimeException
119 bool isPhonetic( const css::lang::Locale& rLocale, const OUString& algorithm );
120 /// @throws css::uno::RuntimeException
121 OUString getHangingCharacters( const css::lang::Locale& rLocale );
123 //XServiceInfo
124 virtual OUString SAL_CALL getImplementationName() override;
125 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
126 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
128 private:
129 ::std::unique_ptr< LocaleDataLookupTableItem > cachedItem;
130 css::i18n::Calendar2 ref_cal;
131 OUString ref_name;
133 /// @throws css::uno::RuntimeException
134 oslGenericFunction getFunctionSymbol( const css::lang::Locale& rLocale, const sal_Char* pFunction );
135 sal_Unicode ** getIndexArray(const css::lang::Locale& rLocale, sal_Int16& indexCount);
136 sal_Unicode ** getIndexArrayForAlgorithm(const css::lang::Locale& rLocale, const OUString& rAlgorithm);
137 /// @throws css::uno::RuntimeException
138 css::uno::Sequence< css::i18n::CalendarItem2 > &
139 getCalendarItemByName(const OUString& name,
140 const css::lang::Locale& rLocale,
141 const css::uno::Sequence< css::i18n::Calendar2 >& calendarsSeq,
142 sal_Int16 item);
144 /// Helper to obtain a sequence of days, months, gmonths or eras.
146 /// @throws css::uno::RuntimeException
147 css::uno::Sequence< css::i18n::CalendarItem2 > getCalendarItems(
148 sal_Unicode const * const * const allCalendars,
149 sal_Int16 & rnOffset,
150 const sal_Int16 nWhichItem,
151 const sal_Int16 nCalendar,
152 const css::lang::Locale & rLocale,
153 const css::uno::Sequence< css::i18n::Calendar2 > & calendarsSeq );
159 #endif // INCLUDED_I18NPOOL_INC_LOCALEDATA_HXX
161 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */