1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #ifndef _I18N_LOCALEDATA_HXX_ 28 #define _I18N_LOCALEDATA_HXX_ 29 30 #include <com/sun/star/lang/XMultiServiceFactory.hpp> 31 32 #include <comphelper/processfactory.hxx> 33 34 #include <com/sun/star/i18n/XLocaleData2.hpp> 35 36 37 #include <cppuhelper/implbase2.hxx> // helper for implementations 38 #include <cppu/macros.hxx> 39 #include <com/sun/star/uno/Reference.h> 40 41 #include <com/sun/star/uno/Sequence.h> 42 #include <com/sun/star/i18n/Calendar.hpp> 43 #include <com/sun/star/i18n/FormatElement.hpp> 44 #include <com/sun/star/i18n/Currency.hpp> 45 #include <com/sun/star/lang/Locale.hpp> 46 #include <com/sun/star/i18n/LocaleDataItem.hpp> 47 #include <com/sun/star/i18n/UnicodeScript.hpp> 48 #include <com/sun/star/uno/RuntimeException.hpp> 49 #include <com/sun/star/uno/Reference.h> 50 #include <com/sun/star/uno/XInterface.hpp> 51 #include <rtl/ustring.hxx> 52 #include <vector> 53 #include <memory> 54 #include <osl/module.hxx> 55 56 // 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> 61 // 62 #include <com/sun/star/uno/Reference.hxx> 63 #include <com/sun/star/container/XIndexAccess.hpp> 64 #include <com/sun/star/lang/XServiceInfo.hpp> 65 66 struct LocaleDataLookupTableItem; 67 68 namespace com { namespace sun { namespace star { namespace i18n { 69 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; 72 }; 73 74 class LocaleData : public cppu::WeakImplHelper2 75 < 76 XLocaleData2, 77 com::sun::star::lang::XServiceInfo 78 > 79 { 80 public: 81 LocaleData(); 82 ~LocaleData(); 83 84 virtual LanguageCountryInfo SAL_CALL getLanguageCountryInfo( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); 85 virtual LocaleDataItem SAL_CALL getLocaleItem( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); 86 virtual com::sun::star::uno::Sequence< Calendar > SAL_CALL getAllCalendars( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); 87 virtual com::sun::star::uno::Sequence< Currency > SAL_CALL getAllCurrencies( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); 88 virtual com::sun::star::uno::Sequence< Currency2 > SAL_CALL getAllCurrencies2( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); 89 virtual com::sun::star::uno::Sequence< FormatElement > SAL_CALL getAllFormats( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); 90 virtual com::sun::star::uno::Sequence< Implementation > SAL_CALL getCollatorImplementations( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); 91 virtual rtl::OUString SAL_CALL getCollatorRuleByAlgorithm( const com::sun::star::lang::Locale& rLocale, const rtl::OUString& algorithm ) throw(com::sun::star::uno::RuntimeException); 92 virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getTransliterations( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); 93 virtual ForbiddenCharacters SAL_CALL getForbiddenCharacters( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); 94 virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getReservedWord( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException) ; 95 virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getBreakIteratorRules( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException) ; 96 virtual com::sun::star::uno::Sequence< com::sun::star::lang::Locale > SAL_CALL getAllInstalledLocaleNames() throw(com::sun::star::uno::RuntimeException); 97 98 virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSearchOptions( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); 99 virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getCollationOptions( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); 100 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); 101 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); 102 103 // following methods are used by indexentry service 104 virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getIndexAlgorithm( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); 105 virtual rtl::OUString SAL_CALL getDefaultIndexAlgorithm( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); 106 virtual rtl::OUString SAL_CALL getIndexKeysByAlgorithm( const com::sun::star::lang::Locale& rLocale, const rtl::OUString& algorithm ) throw(com::sun::star::uno::RuntimeException); 107 virtual rtl::OUString SAL_CALL getIndexModuleByAlgorithm( const com::sun::star::lang::Locale& rLocale, const rtl::OUString& algorithm ) throw(com::sun::star::uno::RuntimeException); 108 virtual com::sun::star::uno::Sequence< UnicodeScript > SAL_CALL getUnicodeScripts( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); 109 virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getFollowPageWords( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); 110 virtual sal_Bool SAL_CALL hasPhonetic( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); 111 virtual sal_Bool SAL_CALL isPhonetic( const com::sun::star::lang::Locale& rLocale, const rtl::OUString& algorithm ) throw(com::sun::star::uno::RuntimeException); 112 virtual rtl::OUString SAL_CALL getHangingCharacters( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); 113 114 //XServiceInfo 115 virtual rtl::OUString SAL_CALL getImplementationName() throw( com::sun::star::uno::RuntimeException ); 116 virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( com::sun::star::uno::RuntimeException ); 117 virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() throw( com::sun::star::uno::RuntimeException ); 118 119 private : 120 friend sal_Bool operator ==(const com::sun::star::lang::Locale& l1, const com::sun::star::lang::Locale& l2); 121 122 ::std::auto_ptr< LocaleDataLookupTableItem > cachedItem; 123 124 oslGenericFunction SAL_CALL getFunctionSymbol( const com::sun::star::lang::Locale& rLocale, const sal_Char* pFunction ) throw( com::sun::star::uno::RuntimeException ); 125 oslGenericFunction SAL_CALL getFunctionSymbolByName( const rtl::OUString& localeName, const sal_Char* pFunction ); 126 sal_Unicode ** SAL_CALL getIndexArray(const com::sun::star::lang::Locale& rLocale, sal_Int16& indexCount); 127 sal_Unicode ** SAL_CALL getIndexArrayForAlgorithm(const com::sun::star::lang::Locale& rLocale, const rtl::OUString& rAlgorithm); 128 com::sun::star::i18n::Calendar ref_cal; 129 rtl::OUString ref_name; 130 com::sun::star::uno::Sequence< com::sun::star::i18n::CalendarItem > & 131 getCalendarItemByName(const rtl::OUString& name, 132 const com::sun::star::lang::Locale& rLocale, 133 const com::sun::star::uno::Sequence< com::sun::star::i18n::Calendar >& calendarsSeq, 134 sal_Int16 len, sal_Int16 item) throw( com::sun::star::uno::RuntimeException ); 135 }; 136 137 } } } } 138 139 #endif // _I18N_LOCALEDATA_HXX_ 140