Line data Source code
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 _I18N_LOCALEDATA_HXX_
20 : #define _I18N_LOCALEDATA_HXX_
21 :
22 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
23 :
24 : #include <comphelper/processfactory.hxx>
25 :
26 : #include <com/sun/star/i18n/XLocaleData4.hpp>
27 :
28 :
29 : #include <cppuhelper/implbase2.hxx> // helper for implementations
30 : #include <cppu/macros.hxx>
31 : #include <com/sun/star/uno/Reference.h>
32 :
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>
43 : #include <vector>
44 : #include <memory>
45 : #include <osl/module.hxx>
46 :
47 : //
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>
52 : //
53 : #include <com/sun/star/uno/Reference.hxx>
54 : #include <com/sun/star/container/XIndexAccess.hpp>
55 : #include <com/sun/star/lang/XServiceInfo.hpp>
56 :
57 : struct LocaleDataLookupTableItem;
58 :
59 : namespace com { namespace sun { namespace star { namespace i18n {
60 :
61 95314 : inline sal_Bool operator ==(const com::sun::star::lang::Locale& l1, const com::sun::star::lang::Locale& l2) {
62 95314 : return l1.Language == l2.Language && l1.Country == l2.Country && l1.Variant == l2.Variant;
63 : };
64 :
65 : class LocaleData : public cppu::WeakImplHelper2
66 : <
67 : com::sun::star::i18n::XLocaleData4,
68 : com::sun::star::lang::XServiceInfo
69 : >
70 : {
71 : public:
72 : LocaleData();
73 : ~LocaleData();
74 :
75 : static com::sun::star::uno::Sequence< com::sun::star::i18n::CalendarItem > downcastCalendarItems( const com::sun::star::uno::Sequence< com::sun::star::i18n::CalendarItem2 > & rCi );
76 : static com::sun::star::i18n::Calendar downcastCalendar( const com::sun::star::i18n::Calendar2 & rC );
77 :
78 : virtual LanguageCountryInfo SAL_CALL getLanguageCountryInfo( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException);
79 : virtual LocaleDataItem SAL_CALL getLocaleItem( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException);
80 : virtual com::sun::star::uno::Sequence< Calendar2 > SAL_CALL getAllCalendars2( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException);
81 : virtual com::sun::star::uno::Sequence< Calendar > SAL_CALL getAllCalendars( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException);
82 : virtual com::sun::star::uno::Sequence< Currency > SAL_CALL getAllCurrencies( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException);
83 : virtual com::sun::star::uno::Sequence< Currency2 > SAL_CALL getAllCurrencies2( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException);
84 : virtual com::sun::star::uno::Sequence< FormatElement > SAL_CALL getAllFormats( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException);
85 : virtual com::sun::star::uno::Sequence< Implementation > SAL_CALL getCollatorImplementations( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException);
86 : virtual OUString SAL_CALL getCollatorRuleByAlgorithm( const com::sun::star::lang::Locale& rLocale, const OUString& algorithm ) throw(com::sun::star::uno::RuntimeException);
87 : virtual com::sun::star::uno::Sequence< OUString > SAL_CALL getTransliterations( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException);
88 : virtual ForbiddenCharacters SAL_CALL getForbiddenCharacters( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException);
89 : virtual com::sun::star::uno::Sequence< OUString > SAL_CALL getReservedWord( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException) ;
90 : virtual com::sun::star::uno::Sequence< OUString > SAL_CALL getBreakIteratorRules( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException) ;
91 : virtual com::sun::star::uno::Sequence< com::sun::star::lang::Locale > SAL_CALL getAllInstalledLocaleNames() throw(com::sun::star::uno::RuntimeException);
92 :
93 : virtual com::sun::star::uno::Sequence< OUString > SAL_CALL getSearchOptions( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException);
94 : virtual com::sun::star::uno::Sequence< OUString > SAL_CALL getCollationOptions( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException);
95 : 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);
96 : 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);
97 :
98 : // XLocaleData4
99 : virtual com::sun::star::uno::Sequence< OUString > SAL_CALL getDateAcceptancePatterns( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException);
100 :
101 : // following methods are used by indexentry service
102 : virtual com::sun::star::uno::Sequence< OUString > SAL_CALL getIndexAlgorithm( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException);
103 : virtual OUString SAL_CALL getDefaultIndexAlgorithm( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException);
104 : virtual OUString SAL_CALL getIndexKeysByAlgorithm( const com::sun::star::lang::Locale& rLocale, const OUString& algorithm ) throw(com::sun::star::uno::RuntimeException);
105 : virtual OUString SAL_CALL getIndexModuleByAlgorithm( const com::sun::star::lang::Locale& rLocale, const OUString& algorithm ) throw(com::sun::star::uno::RuntimeException);
106 : virtual com::sun::star::uno::Sequence< UnicodeScript > SAL_CALL getUnicodeScripts( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException);
107 : virtual com::sun::star::uno::Sequence< OUString > SAL_CALL getFollowPageWords( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException);
108 : virtual sal_Bool SAL_CALL hasPhonetic( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException);
109 : virtual sal_Bool SAL_CALL isPhonetic( const com::sun::star::lang::Locale& rLocale, const OUString& algorithm ) throw(com::sun::star::uno::RuntimeException);
110 : virtual OUString SAL_CALL getHangingCharacters( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException);
111 :
112 : //XServiceInfo
113 : virtual OUString SAL_CALL getImplementationName() throw( com::sun::star::uno::RuntimeException );
114 : virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw( com::sun::star::uno::RuntimeException );
115 : virtual com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( com::sun::star::uno::RuntimeException );
116 :
117 : private :
118 : friend sal_Bool operator ==(const com::sun::star::lang::Locale& l1, const com::sun::star::lang::Locale& l2);
119 :
120 : ::std::auto_ptr< LocaleDataLookupTableItem > cachedItem;
121 :
122 : oslGenericFunction SAL_CALL getFunctionSymbol( const com::sun::star::lang::Locale& rLocale, const sal_Char* pFunction ) throw( com::sun::star::uno::RuntimeException );
123 : oslGenericFunction SAL_CALL getFunctionSymbolByName( const OUString& localeName, const sal_Char* pFunction );
124 : sal_Unicode ** SAL_CALL getIndexArray(const com::sun::star::lang::Locale& rLocale, sal_Int16& indexCount);
125 : sal_Unicode ** SAL_CALL getIndexArrayForAlgorithm(const com::sun::star::lang::Locale& rLocale, const OUString& rAlgorithm);
126 : com::sun::star::i18n::Calendar2 ref_cal;
127 : OUString ref_name;
128 : com::sun::star::uno::Sequence< com::sun::star::i18n::CalendarItem2 > &
129 : getCalendarItemByName(const OUString& name,
130 : const com::sun::star::lang::Locale& rLocale,
131 : const com::sun::star::uno::Sequence< com::sun::star::i18n::Calendar2 >& calendarsSeq,
132 : sal_Int16 item) throw( com::sun::star::uno::RuntimeException );
133 :
134 : /// Helper to obtain a sequence of days, months, gmonths or eras.
135 : com::sun::star::uno::Sequence< com::sun::star::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 com::sun::star::lang::Locale & rLocale,
141 : const com::sun::star::uno::Sequence< com::sun::star::i18n::Calendar2 > & calendarsSeq )
142 : throw( com::sun::star::uno::RuntimeException );
143 :
144 : };
145 :
146 : } } } }
147 :
148 : #endif // _I18N_LOCALEDATA_HXX_
149 :
150 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|