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