merge the formfield patch from ooo-build
[ooovba.git] / i18npool / inc / indexentrysupplier_default.hxx
blob0c3e84d662efa459de6098faa622827431483a2b
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: indexentrysupplier_default.hxx,v $
10 * $Revision: 1.7 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _I18N_INDEXENTRYSUPPLIER_DEFAULT_HXX_
31 #define _I18N_INDEXENTRYSUPPLIER_DEFAULT_HXX_
33 #include <indexentrysupplier_common.hxx>
35 namespace com { namespace sun { namespace star { namespace i18n {
37 class Index;
39 // ----------------------------------------------------
40 // class IndexEntrySupplier_Unicode
41 // ----------------------------------------------------
42 class IndexEntrySupplier_Unicode : public IndexEntrySupplier_Common {
43 public:
44 IndexEntrySupplier_Unicode( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF );
45 ~IndexEntrySupplier_Unicode();
47 virtual sal_Bool SAL_CALL loadAlgorithm(
48 const com::sun::star::lang::Locale& rLocale,
49 const rtl::OUString& SortAlgorithm, sal_Int32 collatorOptions )
50 throw (com::sun::star::uno::RuntimeException);
52 virtual rtl::OUString SAL_CALL getIndexKey( const rtl::OUString& IndexEntry,
53 const rtl::OUString& PhoneticEntry, const com::sun::star::lang::Locale& rLocale )
54 throw (com::sun::star::uno::RuntimeException);
56 virtual sal_Int16 SAL_CALL compareIndexEntry( const rtl::OUString& IndexEntry1,
57 const rtl::OUString& PhoneticEntry1, const com::sun::star::lang::Locale& rLocale1,
58 const rtl::OUString& IndexEntry2, const ::rtl::OUString& PhoneticEntry2,
59 const com::sun::star::lang::Locale& rLocale2 )
60 throw (com::sun::star::uno::RuntimeException);
62 virtual rtl::OUString SAL_CALL getIndexCharacter( const rtl::OUString& rIndexEntry,
63 const com::sun::star::lang::Locale& rLocale, const rtl::OUString& rSortAlgorithm )
64 throw (com::sun::star::uno::RuntimeException);
66 private:
67 Index *index;
70 struct IndexKey {
71 sal_Unicode key;
72 rtl::OUString mkey;
73 rtl::OUString desc;
76 class IndexTable
78 public:
79 IndexTable();
80 ~IndexTable();
82 void init(sal_Unicode start_, sal_Unicode end_, IndexKey* keys, sal_Int16 key_count, Index *index);
84 sal_Unicode start;
85 sal_Unicode end;
86 sal_uInt8 *table;
89 #define MAX_KEYS 0xff
90 #define MAX_TABLES 20
92 class Index
94 public:
95 Index(const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF);
96 ~Index();
98 void init(const com::sun::star::lang::Locale& rLocale, const rtl::OUString& algorithm) throw (com::sun::star::uno::RuntimeException);
100 void makeIndexKeys(const com::sun::star::lang::Locale &rLocale, const rtl::OUString &algorithm) throw (com::sun::star::uno::RuntimeException);
101 sal_Int16 getIndexWeight(const rtl::OUString& rIndexEntry);
102 rtl::OUString getIndexDescription(const rtl::OUString& rIndexEntry);
104 IndexTable tables[MAX_TABLES];
105 sal_Int16 table_count;
106 IndexKey keys[MAX_KEYS];
107 sal_Int16 key_count;
108 sal_Int16 mkeys[MAX_KEYS];
109 sal_Int16 mkey_count;
110 rtl::OUString skipping_chars;
111 CollatorImpl *collator;
112 sal_Int16 compare(sal_Unicode c1, sal_Unicode c2);
115 } } } }
117 #endif