Replace workaround of resize to invalidate with an explicit SfxHint
[LibreOffice.git] / i18npool / inc / indexentrysupplier_default.hxx
blobe9c43583b634c66f31724e1d015a6dea997e7e59
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #pragma once
21 #include "indexentrysupplier_common.hxx"
23 #include <memory>
24 #include <string_view>
26 namespace i18npool {
28 class Index;
32 class IndexEntrySupplier_Unicode final : public IndexEntrySupplier_Common {
33 public:
34 IndexEntrySupplier_Unicode( const css::uno::Reference < css::uno::XComponentContext >& rxContext );
35 virtual ~IndexEntrySupplier_Unicode() override;
37 virtual sal_Bool SAL_CALL loadAlgorithm(
38 const css::lang::Locale& rLocale,
39 const OUString& SortAlgorithm, sal_Int32 collatorOptions ) override;
41 virtual OUString SAL_CALL getIndexKey( const OUString& IndexEntry,
42 const OUString& PhoneticEntry, const css::lang::Locale& rLocale ) override;
44 virtual sal_Int16 SAL_CALL compareIndexEntry( const OUString& IndexEntry1,
45 const OUString& PhoneticEntry1, const css::lang::Locale& rLocale1,
46 const OUString& IndexEntry2, const OUString& PhoneticEntry2,
47 const css::lang::Locale& rLocale2 ) override;
49 virtual OUString SAL_CALL getIndexCharacter( const OUString& rIndexEntry,
50 const css::lang::Locale& rLocale, const OUString& rSortAlgorithm ) override;
52 private:
53 std::unique_ptr<Index> index;
56 struct IndexKey {
57 sal_Unicode key;
58 OUString mkey;
59 OUString desc;
62 class IndexTable
64 public:
65 IndexTable();
66 ~IndexTable();
68 void init(sal_Unicode start_, sal_Unicode end_, IndexKey const * keys, sal_Int16 key_count, Index *index);
70 sal_Unicode start;
71 sal_Unicode end;
72 sal_uInt8 *table;
75 #define MAX_KEYS 0xff
76 #define MAX_TABLES 20
78 class Index
80 public:
81 Index(const css::uno::Reference < css::uno::XComponentContext >& rxContext);
82 ~Index();
84 /// @throws css::uno::RuntimeException
85 void init(const css::lang::Locale& rLocale, const OUString& algorithm);
87 /// @throws css::uno::RuntimeException
88 void makeIndexKeys(const css::lang::Locale &rLocale, std::u16string_view algorithm);
89 sal_Int16 getIndexWeight(const OUString& rIndexEntry);
90 OUString getIndexDescription(const OUString& rIndexEntry);
91 sal_Int16 compare(sal_Unicode c1, sal_Unicode c2);
93 private:
94 IndexTable tables[MAX_TABLES];
95 sal_Int16 table_count;
96 IndexKey keys[MAX_KEYS];
97 sal_Int16 key_count;
98 sal_Int16 mkeys[MAX_KEYS];
99 sal_Int16 mkey_count;
100 OUString skipping_chars;
101 rtl::Reference<CollatorImpl> collator;
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */