CWS-TOOLING: integrate CWS os146
[LibreOffice.git] / i18npool / inc / indexentrysupplier_default.hxx
blobeae78f5c576dad26bb73c84304ee53810cad1acb
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
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.
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).
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.
26 ************************************************************************/
27 #ifndef _I18N_INDEXENTRYSUPPLIER_DEFAULT_HXX_
28 #define _I18N_INDEXENTRYSUPPLIER_DEFAULT_HXX_
30 #include <indexentrysupplier_common.hxx>
32 namespace com { namespace sun { namespace star { namespace i18n {
34 class Index;
36 // ----------------------------------------------------
37 // class IndexEntrySupplier_Unicode
38 // ----------------------------------------------------
39 class IndexEntrySupplier_Unicode : public IndexEntrySupplier_Common {
40 public:
41 IndexEntrySupplier_Unicode( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF );
42 ~IndexEntrySupplier_Unicode();
44 virtual sal_Bool SAL_CALL loadAlgorithm(
45 const com::sun::star::lang::Locale& rLocale,
46 const rtl::OUString& SortAlgorithm, sal_Int32 collatorOptions )
47 throw (com::sun::star::uno::RuntimeException);
49 virtual rtl::OUString SAL_CALL getIndexKey( const rtl::OUString& IndexEntry,
50 const rtl::OUString& PhoneticEntry, const com::sun::star::lang::Locale& rLocale )
51 throw (com::sun::star::uno::RuntimeException);
53 virtual sal_Int16 SAL_CALL compareIndexEntry( const rtl::OUString& IndexEntry1,
54 const rtl::OUString& PhoneticEntry1, const com::sun::star::lang::Locale& rLocale1,
55 const rtl::OUString& IndexEntry2, const ::rtl::OUString& PhoneticEntry2,
56 const com::sun::star::lang::Locale& rLocale2 )
57 throw (com::sun::star::uno::RuntimeException);
59 virtual rtl::OUString SAL_CALL getIndexCharacter( const rtl::OUString& rIndexEntry,
60 const com::sun::star::lang::Locale& rLocale, const rtl::OUString& rSortAlgorithm )
61 throw (com::sun::star::uno::RuntimeException);
63 private:
64 Index *index;
67 struct IndexKey {
68 sal_Unicode key;
69 rtl::OUString mkey;
70 rtl::OUString desc;
73 class IndexTable
75 public:
76 IndexTable();
77 ~IndexTable();
79 void init(sal_Unicode start_, sal_Unicode end_, IndexKey* keys, sal_Int16 key_count, Index *index);
81 sal_Unicode start;
82 sal_Unicode end;
83 sal_uInt8 *table;
86 #define MAX_KEYS 0xff
87 #define MAX_TABLES 20
89 class Index
91 public:
92 Index(const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF);
93 ~Index();
95 void init(const com::sun::star::lang::Locale& rLocale, const rtl::OUString& algorithm) throw (com::sun::star::uno::RuntimeException);
97 void makeIndexKeys(const com::sun::star::lang::Locale &rLocale, const rtl::OUString &algorithm) throw (com::sun::star::uno::RuntimeException);
98 sal_Int16 getIndexWeight(const rtl::OUString& rIndexEntry);
99 rtl::OUString getIndexDescription(const rtl::OUString& rIndexEntry);
101 IndexTable tables[MAX_TABLES];
102 sal_Int16 table_count;
103 IndexKey keys[MAX_KEYS];
104 sal_Int16 key_count;
105 sal_Int16 mkeys[MAX_KEYS];
106 sal_Int16 mkey_count;
107 rtl::OUString skipping_chars;
108 CollatorImpl *collator;
109 sal_Int16 compare(sal_Unicode c1, sal_Unicode c2);
112 } } } }
114 #endif