LibreOffice Module i18npool (master)  1
localedata.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 #ifndef INCLUDED_I18NPOOL_INC_LOCALEDATA_HXX
20 #define INCLUDED_I18NPOOL_INC_LOCALEDATA_HXX
21 
22 #include <com/sun/star/i18n/XLocaleData5.hpp>
23 
24 
25 #include <cppuhelper/implbase.hxx>
26 
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 <string_view>
35 #include <memory>
36 #include <osl/module.hxx>
37 
38 
39 #include <com/sun/star/lang/XServiceInfo.hpp>
40 
41 namespace com::sun::star::beans { struct PropertyValue; }
42 namespace com::sun::star::container { class XIndexAccess; }
43 namespace com::sun::star::i18n { struct Currency; }
44 namespace com::sun::star::i18n { struct Currency2; }
45 namespace com::sun::star::i18n { struct FormatElement; }
46 namespace com::sun::star::lang { struct Locale; }
47 
49 
50 namespace i18npool {
51 
52 class LocaleDataImpl final : public cppu::WeakImplHelper
53 <
54  css::i18n::XLocaleData5,
55  css::lang::XServiceInfo
56 >
57 {
58 public:
60  virtual ~LocaleDataImpl() override;
61 
62  static rtl::Reference<LocaleDataImpl> get() { return new LocaleDataImpl; }
63 
64  static css::uno::Sequence< css::i18n::CalendarItem > downcastCalendarItems( const css::uno::Sequence< css::i18n::CalendarItem2 > & rCi );
65  static css::i18n::Calendar downcastCalendar( const css::i18n::Calendar2 & rC );
66 
69  static OUString getFirstLocaleServiceName( const css::lang::Locale & rLocale );
72  static ::std::vector< OUString > getFallbackLocaleServiceNames( const css::lang::Locale & rLocale );
73 
74  virtual css::i18n::LanguageCountryInfo SAL_CALL getLanguageCountryInfo( const css::lang::Locale& rLocale ) override;
75  virtual css::i18n::LocaleDataItem SAL_CALL getLocaleItem( const css::lang::Locale& rLocale ) override;
76  virtual css::uno::Sequence< css::i18n::Calendar2 > SAL_CALL getAllCalendars2( const css::lang::Locale& rLocale ) override;
77  virtual css::uno::Sequence< css::i18n::Calendar > SAL_CALL getAllCalendars( const css::lang::Locale& rLocale ) override;
78  virtual css::uno::Sequence< css::i18n::Currency > SAL_CALL getAllCurrencies( const css::lang::Locale& rLocale ) override;
79  virtual css::uno::Sequence< css::i18n::Currency2 > SAL_CALL getAllCurrencies2( const css::lang::Locale& rLocale ) override;
80  virtual css::uno::Sequence< css::i18n::FormatElement > SAL_CALL getAllFormats( const css::lang::Locale& rLocale ) override;
81  virtual css::uno::Sequence< css::i18n::Implementation > SAL_CALL getCollatorImplementations( const css::lang::Locale& rLocale ) override;
83  OUString getCollatorRuleByAlgorithm( const css::lang::Locale& rLocale, std::u16string_view algorithm );
84  virtual css::uno::Sequence< OUString > SAL_CALL getTransliterations( const css::lang::Locale& rLocale ) override;
85  virtual css::i18n::ForbiddenCharacters SAL_CALL getForbiddenCharacters( const css::lang::Locale& rLocale ) override;
86  virtual css::uno::Sequence< OUString > SAL_CALL getReservedWord( const css::lang::Locale& rLocale ) override ;
88  css::uno::Sequence< OUString > getBreakIteratorRules( const css::lang::Locale& rLocale ) ;
89  virtual css::uno::Sequence< css::lang::Locale > SAL_CALL getAllInstalledLocaleNames() override;
90 
91  virtual css::uno::Sequence< OUString > SAL_CALL getSearchOptions( const css::lang::Locale& rLocale ) override;
92  virtual css::uno::Sequence< OUString > SAL_CALL getCollationOptions( const css::lang::Locale& rLocale ) override;
94  css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > getContinuousNumberingLevels( const css::lang::Locale& rLocale );
96  css::uno::Sequence< css::uno::Reference< css::container::XIndexAccess > > getOutlineNumberingLevels( const css::lang::Locale& rLocale );
97 
98  // XLocaleData4
99  virtual css::uno::Sequence< OUString > SAL_CALL getDateAcceptancePatterns( const css::lang::Locale& rLocale ) override;
100 
101  // XLocaleData5
102  virtual css::i18n::LocaleDataItem2 SAL_CALL getLocaleItem2( const css::lang::Locale& rLocale ) override;
103 
104  // following methods are used by indexentry service
106  css::uno::Sequence< OUString > getIndexAlgorithm( const css::lang::Locale& rLocale );
108  OUString getDefaultIndexAlgorithm( const css::lang::Locale& rLocale );
110  OUString getIndexKeysByAlgorithm(
111  const css::lang::Locale& rLocale, std::u16string_view algorithm );
113  OUString getIndexModuleByAlgorithm( const css::lang::Locale& rLocale, std::u16string_view algorithm );
115  css::uno::Sequence< css::i18n::UnicodeScript > getUnicodeScripts( const css::lang::Locale& rLocale );
117  css::uno::Sequence< OUString > getFollowPageWords( const css::lang::Locale& rLocale );
119  bool hasPhonetic( const css::lang::Locale& rLocale );
121  bool isPhonetic( const css::lang::Locale& rLocale, std::u16string_view algorithm );
123  OUString getHangingCharacters( const css::lang::Locale& rLocale );
124 
125  //XServiceInfo
126  virtual OUString SAL_CALL getImplementationName() override;
127  virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
128  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
129 
130 private:
131  ::std::unique_ptr< LocaleDataLookupTableItem > cachedItem;
132  css::i18n::Calendar2 ref_cal;
133  OUString ref_name;
134 
136  oslGenericFunction getFunctionSymbol( const css::lang::Locale& rLocale, const char* pFunction );
137  sal_Unicode ** getIndexArray(const css::lang::Locale& rLocale, sal_Int16& indexCount);
138  sal_Unicode ** getIndexArrayForAlgorithm(const css::lang::Locale& rLocale, std::u16string_view rAlgorithm);
140  css::uno::Sequence< css::i18n::CalendarItem2 > &
141  getCalendarItemByName(const OUString& name,
142  const css::lang::Locale& rLocale,
143  const css::uno::Sequence< css::i18n::Calendar2 >& calendarsSeq,
144  sal_Int16 item);
145 
149  css::uno::Sequence< css::i18n::CalendarItem2 > getCalendarItems(
150  sal_Unicode const * const * const allCalendars,
151  sal_Int16 & rnOffset,
152  const sal_Int16 nWhichItem,
153  const sal_Int16 nCalendar,
154  const css::lang::Locale & rLocale,
155  const css::uno::Sequence< css::i18n::Calendar2 > & calendarsSeq );
156 
157 };
158 
159 }
160 
161 #endif // INCLUDED_I18NPOOL_INC_LOCALEDATA_HXX
162 
163 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::i18n::Calendar2 ref_cal
Definition: localedata.hxx:132
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
OUString getCollatorRuleByAlgorithm(const css::lang::Locale &rLocale, std::u16string_view algorithm)
Definition: localedata.cxx:925
sal_Unicode ** getIndexArray(const css::lang::Locale &rLocale, sal_Int16 &indexCount)
virtual css::uno::Sequence< css::i18n::Implementation > SAL_CALL getCollatorImplementations(const css::lang::Locale &rLocale) override
Definition: localedata.cxx:940
virtual OUString SAL_CALL getImplementationName() override
OUString getDefaultIndexAlgorithm(const css::lang::Locale &rLocale)
OUString getHangingCharacters(const css::lang::Locale &rLocale)
virtual css::uno::Sequence< css::i18n::Currency2 > SAL_CALL getAllCurrencies2(const css::lang::Locale &rLocale) override
Definition: localedata.cxx:806
virtual css::i18n::ForbiddenCharacters SAL_CALL getForbiddenCharacters(const css::lang::Locale &rLocale) override
OUString getIndexKeysByAlgorithm(const css::lang::Locale &rLocale, std::u16string_view algorithm)
::std::unique_ptr< LocaleDataLookupTableItem > cachedItem
Definition: localedata.hxx:131
virtual css::uno::Sequence< css::i18n::Calendar > SAL_CALL getAllCalendars(const css::lang::Locale &rLocale) override
Definition: localedata.cxx:794
virtual css::uno::Sequence< css::i18n::Calendar2 > SAL_CALL getAllCalendars2(const css::lang::Locale &rLocale) override
Definition: localedata.cxx:748
sal_uInt16 sal_Unicode
virtual css::uno::Sequence< OUString > SAL_CALL getDateAcceptancePatterns(const css::lang::Locale &rLocale) override
Definition: localedata.cxx:896
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual css::i18n::LanguageCountryInfo SAL_CALL getLanguageCountryInfo(const css::lang::Locale &rLocale) override
virtual css::uno::Sequence< OUString > SAL_CALL getSearchOptions(const css::lang::Locale &rLocale) override
Definition: localedata.cxx:983
css::uno::Sequence< OUString > getFollowPageWords(const css::lang::Locale &rLocale)
OUString getIndexModuleByAlgorithm(const css::lang::Locale &rLocale, std::u16string_view algorithm)
static OUString getFirstLocaleServiceName(const css::lang::Locale &rLocale)
Generates a _ or (if Language=="qlt") string suitable as part of service...
virtual css::uno::Sequence< css::i18n::Currency > SAL_CALL getAllCurrencies(const css::lang::Locale &rLocale) override
Definition: localedata.cxx:838
css::uno::Sequence< css::i18n::CalendarItem2 > & getCalendarItemByName(const OUString &name, const css::lang::Locale &rLocale, const css::uno::Sequence< css::i18n::Calendar2 > &calendarsSeq, sal_Int16 item)
Definition: localedata.cxx:647
virtual css::uno::Sequence< OUString > SAL_CALL getTransliterations(const css::lang::Locale &rLocale) override
bool hasPhonetic(const css::lang::Locale &rLocale)
virtual css::i18n::LocaleDataItem2 SAL_CALL getLocaleItem2(const css::lang::Locale &rLocale) override
Definition: localedata.cxx:436
unsigned char sal_Bool
Constant values shared between i18npool and, for example, the number formatter.
css::uno::Sequence< OUString > getBreakIteratorRules(const css::lang::Locale &rLocale)
css::uno::Sequence< css::i18n::CalendarItem2 > getCalendarItems(sal_Unicode const *const *const allCalendars, sal_Int16 &rnOffset, const sal_Int16 nWhichItem, const sal_Int16 nCalendar, const css::lang::Locale &rLocale, const css::uno::Sequence< css::i18n::Calendar2 > &calendarsSeq)
Helper to obtain a sequence of days, months, gmonths or eras.
Definition: localedata.cxx:699
bool isPhonetic(const css::lang::Locale &rLocale, std::u16string_view algorithm)
static::std::vector< OUString > getFallbackLocaleServiceNames(const css::lang::Locale &rLocale)
Generates fallback strings suitable as parts of service names, excluding the one obtained via getFirs...
virtual css::uno::Sequence< css::lang::Locale > SAL_CALL getAllInstalledLocaleNames() override
css::uno::Sequence< OUString > getIndexAlgorithm(const css::lang::Locale &rLocale)
sal_Unicode ** getIndexArrayForAlgorithm(const css::lang::Locale &rLocale, std::u16string_view rAlgorithm)
css::uno::Sequence< css::uno::Reference< css::container::XIndexAccess > > getOutlineNumberingLevels(const css::lang::Locale &rLocale)
virtual css::i18n::LocaleDataItem SAL_CALL getLocaleItem(const css::lang::Locale &rLocale) override
Definition: localedata.cxx:398
static css::uno::Sequence< css::i18n::CalendarItem > downcastCalendarItems(const css::uno::Sequence< css::i18n::CalendarItem2 > &rCi)
Definition: localedata.cxx:367
virtual css::uno::Sequence< OUString > SAL_CALL getReservedWord(const css::lang::Locale &rLocale) override
oslGenericFunction getFunctionSymbol(const css::lang::Locale &rLocale, const char *pFunction)
static css::i18n::Calendar downcastCalendar(const css::i18n::Calendar2 &rC)
Definition: localedata.cxx:374
css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > getContinuousNumberingLevels(const css::lang::Locale &rLocale)
css::uno::Sequence< css::i18n::UnicodeScript > getUnicodeScripts(const css::lang::Locale &rLocale)
virtual css::uno::Sequence< OUString > SAL_CALL getCollationOptions(const css::lang::Locale &rLocale) override
Definition: localedata.cxx:963
virtual css::uno::Sequence< css::i18n::FormatElement > SAL_CALL getAllFormats(const css::lang::Locale &rLocale) override
Definition: localedata.cxx:845
virtual ~LocaleDataImpl() override
Definition: localedata.cxx:392