Version 3.6.0.2, tag libreoffice-3.6.0.2
[LibreOffice.git] / i18npool / inc / indexentrysupplier_default.hxx
blob9958df85d0ce22afdfb22d146a138a6e0f175f6f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
28 #ifndef _I18N_INDEXENTRYSUPPLIER_DEFAULT_HXX_
29 #define _I18N_INDEXENTRYSUPPLIER_DEFAULT_HXX_
31 #include <indexentrysupplier_common.hxx>
33 namespace com { namespace sun { namespace star { namespace i18n {
35 class Index;
37 // ----------------------------------------------------
38 // class IndexEntrySupplier_Unicode
39 // ----------------------------------------------------
40 class IndexEntrySupplier_Unicode : public IndexEntrySupplier_Common {
41 public:
42 IndexEntrySupplier_Unicode( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF );
43 ~IndexEntrySupplier_Unicode();
45 virtual sal_Bool SAL_CALL loadAlgorithm(
46 const com::sun::star::lang::Locale& rLocale,
47 const rtl::OUString& SortAlgorithm, sal_Int32 collatorOptions )
48 throw (com::sun::star::uno::RuntimeException);
50 virtual rtl::OUString SAL_CALL getIndexKey( const rtl::OUString& IndexEntry,
51 const rtl::OUString& PhoneticEntry, const com::sun::star::lang::Locale& rLocale )
52 throw (com::sun::star::uno::RuntimeException);
54 virtual sal_Int16 SAL_CALL compareIndexEntry( const rtl::OUString& IndexEntry1,
55 const rtl::OUString& PhoneticEntry1, const com::sun::star::lang::Locale& rLocale1,
56 const rtl::OUString& IndexEntry2, const ::rtl::OUString& PhoneticEntry2,
57 const com::sun::star::lang::Locale& rLocale2 )
58 throw (com::sun::star::uno::RuntimeException);
60 virtual rtl::OUString SAL_CALL getIndexCharacter( const rtl::OUString& rIndexEntry,
61 const com::sun::star::lang::Locale& rLocale, const rtl::OUString& rSortAlgorithm )
62 throw (com::sun::star::uno::RuntimeException);
64 private:
65 Index *index;
68 struct IndexKey {
69 sal_Unicode key;
70 rtl::OUString mkey;
71 rtl::OUString desc;
74 class IndexTable
76 public:
77 IndexTable();
78 ~IndexTable();
80 void init(sal_Unicode start_, sal_Unicode end_, IndexKey* keys, sal_Int16 key_count, Index *index);
82 sal_Unicode start;
83 sal_Unicode end;
84 sal_uInt8 *table;
87 #define MAX_KEYS 0xff
88 #define MAX_TABLES 20
90 class Index
92 public:
93 Index(const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF);
94 ~Index();
96 void init(const com::sun::star::lang::Locale& rLocale, const rtl::OUString& algorithm) throw (com::sun::star::uno::RuntimeException);
98 void makeIndexKeys(const com::sun::star::lang::Locale &rLocale, const rtl::OUString &algorithm) throw (com::sun::star::uno::RuntimeException);
99 sal_Int16 getIndexWeight(const rtl::OUString& rIndexEntry);
100 rtl::OUString getIndexDescription(const rtl::OUString& rIndexEntry);
102 IndexTable tables[MAX_TABLES];
103 sal_Int16 table_count;
104 IndexKey keys[MAX_KEYS];
105 sal_Int16 key_count;
106 sal_Int16 mkeys[MAX_KEYS];
107 sal_Int16 mkey_count;
108 rtl::OUString skipping_chars;
109 CollatorImpl *collator;
110 sal_Int16 compare(sal_Unicode c1, sal_Unicode c2);
113 } } } }
115 #endif
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */