1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _I18N_INDEXENTRYSUPPLIER_HXX_
24 #define _I18N_INDEXENTRYSUPPLIER_HXX_
25 
26 #include <com/sun/star/i18n/XExtendedIndexEntrySupplier.hpp>
27 #include <cppuhelper/implbase2.hxx> // helper for implementations
28 #include <com/sun/star/lang/XServiceInfo.hpp>
29 
30 namespace com { namespace sun { namespace star { namespace i18n {
31 
32 //	----------------------------------------------------
33 //	class IndexEntrySupplier
34 //	----------------------------------------------------
35 class IndexEntrySupplier : public cppu::WeakImplHelper2
36 <
37 	com::sun::star::i18n::XExtendedIndexEntrySupplier,
38 	com::sun::star::lang::XServiceInfo
39 >
40 {
41 public:
42 	IndexEntrySupplier( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF );
43 
44 	// Methods
45 	virtual com::sun::star::uno::Sequence < com::sun::star::lang::Locale > SAL_CALL getLocaleList()
46 		throw (com::sun::star::uno::RuntimeException);
47 
48 	virtual com::sun::star::uno::Sequence < rtl::OUString > SAL_CALL getAlgorithmList(
49 		const com::sun::star::lang::Locale& rLocale )
50 		throw (com::sun::star::uno::RuntimeException);
51 
52 	virtual sal_Bool SAL_CALL loadAlgorithm(
53 		const com::sun::star::lang::Locale& rLocale,
54 		const rtl::OUString& SortAlgorithm, sal_Int32 collatorOptions )
55 		throw (com::sun::star::uno::RuntimeException);
56 
57 	virtual sal_Bool SAL_CALL usePhoneticEntry(
58 		const com::sun::star::lang::Locale& rLocale )
59 		throw (com::sun::star::uno::RuntimeException);
60 
61 	virtual rtl::OUString SAL_CALL getPhoneticCandidate( const rtl::OUString& IndexEntry,
62 		const com::sun::star::lang::Locale& rLocale )
63 		throw (com::sun::star::uno::RuntimeException);
64 
65 	virtual rtl::OUString SAL_CALL getIndexKey( const rtl::OUString& IndexEntry,
66 		const rtl::OUString& PhoneticEntry, const com::sun::star::lang::Locale& rLocale )
67 		throw (com::sun::star::uno::RuntimeException);
68 
69 	virtual sal_Int16 SAL_CALL compareIndexEntry( const rtl::OUString& IndexEntry1,
70 		const rtl::OUString& PhoneticEntry1, const com::sun::star::lang::Locale& rLocale1,
71 		const rtl::OUString& IndexEntry2, const ::rtl::OUString& PhoneticEntry2,
72 		const com::sun::star::lang::Locale& rLocale2 )
73 		throw (com::sun::star::uno::RuntimeException);
74 
75 	virtual rtl::OUString SAL_CALL getIndexCharacter( const rtl::OUString& IndexEntry,
76 		const com::sun::star::lang::Locale& rLocale, const rtl::OUString& SortAlgorithm )
77 		throw (com::sun::star::uno::RuntimeException);
78 
79 	virtual rtl::OUString SAL_CALL getIndexFollowPageWord( sal_Bool MorePages,
80 		const com::sun::star::lang::Locale& rLocale )
81 		throw (com::sun::star::uno::RuntimeException);
82 
83 	//XServiceInfo
84 	virtual rtl::OUString SAL_CALL getImplementationName()
85 		throw( com::sun::star::uno::RuntimeException );
86 	virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName)
87 		throw( com::sun::star::uno::RuntimeException );
88 	virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames()
89 		throw( com::sun::star::uno::RuntimeException );
90 
91 private:
92 	rtl::OUString aServiceName;
93 	com::sun::star::uno::Reference < com::sun::star::i18n::XExtendedIndexEntrySupplier > xIES;
94 	com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > xMSF;
95 	sal_Bool SAL_CALL createLocaleSpecificIndexEntrySupplier(const rtl::OUString& name) throw( com::sun::star::uno::RuntimeException );
96 	com::sun::star::uno::Reference < com::sun::star::i18n::XExtendedIndexEntrySupplier > SAL_CALL getLocaleSpecificIndexEntrySupplier(
97 		const com::sun::star::lang::Locale& rLocale, const rtl::OUString& rSortAlgorithm) throw (com::sun::star::uno::RuntimeException);
98 
99 protected:
100 	com::sun::star::lang::Locale aLocale;
101 	rtl::OUString aSortAlgorithm;
102 };
103 
104 } } } }
105 
106 #endif
107