1*f7bd9df4SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*f7bd9df4SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*f7bd9df4SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*f7bd9df4SAndrew Rist * distributed with this work for additional information 6*f7bd9df4SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*f7bd9df4SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*f7bd9df4SAndrew Rist * "License"); you may not use this file except in compliance 9*f7bd9df4SAndrew Rist * with the License. You may obtain a copy of the License at 10*f7bd9df4SAndrew Rist * 11*f7bd9df4SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*f7bd9df4SAndrew Rist * 13*f7bd9df4SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*f7bd9df4SAndrew Rist * software distributed under the License is distributed on an 15*f7bd9df4SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*f7bd9df4SAndrew Rist * KIND, either express or implied. See the License for the 17*f7bd9df4SAndrew Rist * specific language governing permissions and limitations 18*f7bd9df4SAndrew Rist * under the License. 19*f7bd9df4SAndrew Rist * 20*f7bd9df4SAndrew Rist *************************************************************/ 21*f7bd9df4SAndrew Rist 22*f7bd9df4SAndrew Rist 23cdf0e10cSrcweir #ifndef _I18N_INDEXENTRYSUPPLIER_DEFAULT_HXX_ 24cdf0e10cSrcweir #define _I18N_INDEXENTRYSUPPLIER_DEFAULT_HXX_ 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <indexentrysupplier_common.hxx> 27cdf0e10cSrcweir 28cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace i18n { 29cdf0e10cSrcweir 30cdf0e10cSrcweir class Index; 31cdf0e10cSrcweir 32cdf0e10cSrcweir // ---------------------------------------------------- 33cdf0e10cSrcweir // class IndexEntrySupplier_Unicode 34cdf0e10cSrcweir // ---------------------------------------------------- 35cdf0e10cSrcweir class IndexEntrySupplier_Unicode : public IndexEntrySupplier_Common { 36cdf0e10cSrcweir public: 37cdf0e10cSrcweir IndexEntrySupplier_Unicode( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF ); 38cdf0e10cSrcweir ~IndexEntrySupplier_Unicode(); 39cdf0e10cSrcweir 40cdf0e10cSrcweir virtual sal_Bool SAL_CALL loadAlgorithm( 41cdf0e10cSrcweir const com::sun::star::lang::Locale& rLocale, 42cdf0e10cSrcweir const rtl::OUString& SortAlgorithm, sal_Int32 collatorOptions ) 43cdf0e10cSrcweir throw (com::sun::star::uno::RuntimeException); 44cdf0e10cSrcweir 45cdf0e10cSrcweir virtual rtl::OUString SAL_CALL getIndexKey( const rtl::OUString& IndexEntry, 46cdf0e10cSrcweir const rtl::OUString& PhoneticEntry, const com::sun::star::lang::Locale& rLocale ) 47cdf0e10cSrcweir throw (com::sun::star::uno::RuntimeException); 48cdf0e10cSrcweir 49cdf0e10cSrcweir virtual sal_Int16 SAL_CALL compareIndexEntry( const rtl::OUString& IndexEntry1, 50cdf0e10cSrcweir const rtl::OUString& PhoneticEntry1, const com::sun::star::lang::Locale& rLocale1, 51cdf0e10cSrcweir const rtl::OUString& IndexEntry2, const ::rtl::OUString& PhoneticEntry2, 52cdf0e10cSrcweir const com::sun::star::lang::Locale& rLocale2 ) 53cdf0e10cSrcweir throw (com::sun::star::uno::RuntimeException); 54cdf0e10cSrcweir 55cdf0e10cSrcweir virtual rtl::OUString SAL_CALL getIndexCharacter( const rtl::OUString& rIndexEntry, 56cdf0e10cSrcweir const com::sun::star::lang::Locale& rLocale, const rtl::OUString& rSortAlgorithm ) 57cdf0e10cSrcweir throw (com::sun::star::uno::RuntimeException); 58cdf0e10cSrcweir 59cdf0e10cSrcweir private: 60cdf0e10cSrcweir Index *index; 61cdf0e10cSrcweir }; 62cdf0e10cSrcweir 63cdf0e10cSrcweir struct IndexKey { 64cdf0e10cSrcweir sal_Unicode key; 65cdf0e10cSrcweir rtl::OUString mkey; 66cdf0e10cSrcweir rtl::OUString desc; 67cdf0e10cSrcweir }; 68cdf0e10cSrcweir 69cdf0e10cSrcweir class IndexTable 70cdf0e10cSrcweir { 71cdf0e10cSrcweir public: 72cdf0e10cSrcweir IndexTable(); 73cdf0e10cSrcweir ~IndexTable(); 74cdf0e10cSrcweir 75cdf0e10cSrcweir void init(sal_Unicode start_, sal_Unicode end_, IndexKey* keys, sal_Int16 key_count, Index *index); 76cdf0e10cSrcweir 77cdf0e10cSrcweir sal_Unicode start; 78cdf0e10cSrcweir sal_Unicode end; 79cdf0e10cSrcweir sal_uInt8 *table; 80cdf0e10cSrcweir }; 81cdf0e10cSrcweir 82cdf0e10cSrcweir #define MAX_KEYS 0xff 83cdf0e10cSrcweir #define MAX_TABLES 20 84cdf0e10cSrcweir 85cdf0e10cSrcweir class Index 86cdf0e10cSrcweir { 87cdf0e10cSrcweir public: 88cdf0e10cSrcweir Index(const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF); 89cdf0e10cSrcweir ~Index(); 90cdf0e10cSrcweir 91cdf0e10cSrcweir void init(const com::sun::star::lang::Locale& rLocale, const rtl::OUString& algorithm) throw (com::sun::star::uno::RuntimeException); 92cdf0e10cSrcweir 93cdf0e10cSrcweir void makeIndexKeys(const com::sun::star::lang::Locale &rLocale, const rtl::OUString &algorithm) throw (com::sun::star::uno::RuntimeException); 94cdf0e10cSrcweir sal_Int16 getIndexWeight(const rtl::OUString& rIndexEntry); 95cdf0e10cSrcweir rtl::OUString getIndexDescription(const rtl::OUString& rIndexEntry); 96cdf0e10cSrcweir 97cdf0e10cSrcweir IndexTable tables[MAX_TABLES]; 98cdf0e10cSrcweir sal_Int16 table_count; 99cdf0e10cSrcweir IndexKey keys[MAX_KEYS]; 100cdf0e10cSrcweir sal_Int16 key_count; 101cdf0e10cSrcweir sal_Int16 mkeys[MAX_KEYS]; 102cdf0e10cSrcweir sal_Int16 mkey_count; 103cdf0e10cSrcweir rtl::OUString skipping_chars; 104cdf0e10cSrcweir CollatorImpl *collator; 105cdf0e10cSrcweir sal_Int16 compare(sal_Unicode c1, sal_Unicode c2); 106cdf0e10cSrcweir }; 107cdf0e10cSrcweir 108cdf0e10cSrcweir } } } } 109cdf0e10cSrcweir 110cdf0e10cSrcweir #endif 111