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_INDEXENTRYSUPPLIER_HXX_
28 #define _I18N_INDEXENTRYSUPPLIER_HXX_
29 
30 #include <com/sun/star/i18n/XExtendedIndexEntrySupplier.hpp>
31 #include <cppuhelper/implbase2.hxx> // helper for implementations
32 #include <com/sun/star/lang/XServiceInfo.hpp>
33 
34 namespace com { namespace sun { namespace star { namespace i18n {
35 
36 //	----------------------------------------------------
37 //	class IndexEntrySupplier
38 //	----------------------------------------------------
39 class IndexEntrySupplier : public cppu::WeakImplHelper2
40 <
41 	com::sun::star::i18n::XExtendedIndexEntrySupplier,
42 	com::sun::star::lang::XServiceInfo
43 >
44 {
45 public:
46 	IndexEntrySupplier( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF );
47 
48 	// Methods
49 	virtual com::sun::star::uno::Sequence < com::sun::star::lang::Locale > SAL_CALL getLocaleList()
50 		throw (com::sun::star::uno::RuntimeException);
51 
52 	virtual com::sun::star::uno::Sequence < rtl::OUString > SAL_CALL getAlgorithmList(
53 		const com::sun::star::lang::Locale& rLocale )
54 		throw (com::sun::star::uno::RuntimeException);
55 
56 	virtual sal_Bool SAL_CALL loadAlgorithm(
57 		const com::sun::star::lang::Locale& rLocale,
58 		const rtl::OUString& SortAlgorithm, sal_Int32 collatorOptions )
59 		throw (com::sun::star::uno::RuntimeException);
60 
61 	virtual sal_Bool SAL_CALL usePhoneticEntry(
62 		const com::sun::star::lang::Locale& rLocale )
63 		throw (com::sun::star::uno::RuntimeException);
64 
65 	virtual rtl::OUString SAL_CALL getPhoneticCandidate( const rtl::OUString& IndexEntry,
66 		const com::sun::star::lang::Locale& rLocale )
67 		throw (com::sun::star::uno::RuntimeException);
68 
69 	virtual rtl::OUString SAL_CALL getIndexKey( const rtl::OUString& IndexEntry,
70 		const rtl::OUString& PhoneticEntry, const com::sun::star::lang::Locale& rLocale )
71 		throw (com::sun::star::uno::RuntimeException);
72 
73 	virtual sal_Int16 SAL_CALL compareIndexEntry( const rtl::OUString& IndexEntry1,
74 		const rtl::OUString& PhoneticEntry1, const com::sun::star::lang::Locale& rLocale1,
75 		const rtl::OUString& IndexEntry2, const ::rtl::OUString& PhoneticEntry2,
76 		const com::sun::star::lang::Locale& rLocale2 )
77 		throw (com::sun::star::uno::RuntimeException);
78 
79 	virtual rtl::OUString SAL_CALL getIndexCharacter( const rtl::OUString& IndexEntry,
80 		const com::sun::star::lang::Locale& rLocale, const rtl::OUString& SortAlgorithm )
81 		throw (com::sun::star::uno::RuntimeException);
82 
83 	virtual rtl::OUString SAL_CALL getIndexFollowPageWord( sal_Bool MorePages,
84 		const com::sun::star::lang::Locale& rLocale )
85 		throw (com::sun::star::uno::RuntimeException);
86 
87 	//XServiceInfo
88 	virtual rtl::OUString SAL_CALL getImplementationName()
89 		throw( com::sun::star::uno::RuntimeException );
90 	virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName)
91 		throw( com::sun::star::uno::RuntimeException );
92 	virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames()
93 		throw( com::sun::star::uno::RuntimeException );
94 
95 private:
96 	rtl::OUString aServiceName;
97 	com::sun::star::uno::Reference < com::sun::star::i18n::XExtendedIndexEntrySupplier > xIES;
98 	com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > xMSF;
99 	sal_Bool SAL_CALL createLocaleSpecificIndexEntrySupplier(const rtl::OUString& name) throw( com::sun::star::uno::RuntimeException );
100 	com::sun::star::uno::Reference < com::sun::star::i18n::XExtendedIndexEntrySupplier > SAL_CALL getLocaleSpecificIndexEntrySupplier(
101 		const com::sun::star::lang::Locale& rLocale, const rtl::OUString& rSortAlgorithm) throw (com::sun::star::uno::RuntimeException);
102 
103 protected:
104 	com::sun::star::lang::Locale aLocale;
105 	rtl::OUString aSortAlgorithm;
106 };
107 
108 } } } }
109 
110 #endif
111