Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef _I18N_INDEXENTRYSUPPLIER_DEFAULT_HXX_
20 : #define _I18N_INDEXENTRYSUPPLIER_DEFAULT_HXX_
21 :
22 : #include <indexentrysupplier_common.hxx>
23 :
24 : namespace com { namespace sun { namespace star { namespace i18n {
25 :
26 : class Index;
27 :
28 :
29 : // class IndexEntrySupplier_Unicode
30 :
31 : class IndexEntrySupplier_Unicode : public IndexEntrySupplier_Common {
32 : public:
33 : IndexEntrySupplier_Unicode( const com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext >& rxContext );
34 : virtual ~IndexEntrySupplier_Unicode();
35 :
36 : virtual sal_Bool SAL_CALL loadAlgorithm(
37 : const com::sun::star::lang::Locale& rLocale,
38 : const OUString& SortAlgorithm, sal_Int32 collatorOptions )
39 : throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
40 :
41 : virtual OUString SAL_CALL getIndexKey( const OUString& IndexEntry,
42 : const OUString& PhoneticEntry, const com::sun::star::lang::Locale& rLocale )
43 : throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
44 :
45 : virtual sal_Int16 SAL_CALL compareIndexEntry( const OUString& IndexEntry1,
46 : const OUString& PhoneticEntry1, const com::sun::star::lang::Locale& rLocale1,
47 : const OUString& IndexEntry2, const OUString& PhoneticEntry2,
48 : const com::sun::star::lang::Locale& rLocale2 )
49 : throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
50 :
51 : virtual OUString SAL_CALL getIndexCharacter( const OUString& rIndexEntry,
52 : const com::sun::star::lang::Locale& rLocale, const OUString& rSortAlgorithm )
53 : throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
54 :
55 : private:
56 : Index *index;
57 : };
58 :
59 0 : struct IndexKey {
60 : sal_Unicode key;
61 : OUString mkey;
62 : OUString desc;
63 : };
64 :
65 : class IndexTable
66 : {
67 : public:
68 : IndexTable();
69 : ~IndexTable();
70 :
71 : void init(sal_Unicode start_, sal_Unicode end_, IndexKey* keys, sal_Int16 key_count, Index *index);
72 :
73 : sal_Unicode start;
74 : sal_Unicode end;
75 : sal_uInt8 *table;
76 : };
77 :
78 : #define MAX_KEYS 0xff
79 : #define MAX_TABLES 20
80 :
81 : class Index
82 : {
83 : public:
84 : Index(const com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext >& rxContext);
85 : ~Index();
86 :
87 : void init(const com::sun::star::lang::Locale& rLocale, const OUString& algorithm) throw (com::sun::star::uno::RuntimeException);
88 :
89 : void makeIndexKeys(const com::sun::star::lang::Locale &rLocale, const OUString &algorithm) throw (com::sun::star::uno::RuntimeException);
90 : sal_Int16 getIndexWeight(const OUString& rIndexEntry);
91 : OUString getIndexDescription(const OUString& rIndexEntry);
92 :
93 : IndexTable tables[MAX_TABLES];
94 : sal_Int16 table_count;
95 : IndexKey keys[MAX_KEYS];
96 : sal_Int16 key_count;
97 : sal_Int16 mkeys[MAX_KEYS];
98 : sal_Int16 mkey_count;
99 : OUString skipping_chars;
100 : CollatorImpl *collator;
101 : sal_Int16 compare(sal_Unicode c1, sal_Unicode c2);
102 : };
103 :
104 : } } } }
105 :
106 : #endif
107 :
108 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|