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