Version 6.1.4.1, tag libreoffice-6.1.4.1
[LibreOffice.git] / i18npool / inc / indexentrysupplier_common.hxx
blob9eb2044506c4c1d589b752595a832836efbae1ff
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 .
20 #ifndef INCLUDED_I18NPOOL_INC_INDEXENTRYSUPPLIER_COMMON_HXX
21 #define INCLUDED_I18NPOOL_INC_INDEXENTRYSUPPLIER_COMMON_HXX
23 #include <com/sun/star/i18n/XExtendedIndexEntrySupplier.hpp>
24 #include <cppuhelper/implbase.hxx>
25 #include <com/sun/star/lang/XServiceInfo.hpp>
26 #include <rtl/ref.hxx>
27 #include "collatorImpl.hxx"
29 #include <memory>
31 namespace i18npool {
34 // class IndexEntrySupplier_Common
37 class IndexEntrySupplier_Common : public cppu::WeakImplHelper
39 css::i18n::XExtendedIndexEntrySupplier,
40 css::lang::XServiceInfo
43 public:
44 IndexEntrySupplier_Common( const css::uno::Reference < css::uno::XComponentContext >& rxContext );
45 virtual ~IndexEntrySupplier_Common() override;
47 virtual css::uno::Sequence < css::lang::Locale > SAL_CALL getLocaleList() override;
49 virtual css::uno::Sequence < OUString > SAL_CALL getAlgorithmList(
50 const css::lang::Locale& rLocale ) override;
52 virtual sal_Bool SAL_CALL usePhoneticEntry(
53 const css::lang::Locale& rLocale ) override;
55 virtual OUString SAL_CALL getPhoneticCandidate( const OUString& IndexEntry,
56 const css::lang::Locale& rLocale ) override;
58 virtual sal_Bool SAL_CALL loadAlgorithm(
59 const css::lang::Locale& rLocale,
60 const OUString& SortAlgorithm, sal_Int32 collatorOptions ) override;
62 virtual OUString SAL_CALL getIndexKey( const OUString& IndexEntry,
63 const OUString& PhoneticEntry, const css::lang::Locale& rLocale ) override;
65 virtual sal_Int16 SAL_CALL compareIndexEntry( const OUString& IndexEntry1,
66 const OUString& PhoneticEntry1, const css::lang::Locale& rLocale1,
67 const OUString& IndexEntry2, const OUString& PhoneticEntry2,
68 const css::lang::Locale& rLocale2 ) override;
70 virtual OUString SAL_CALL getIndexCharacter( const OUString& rIndexEntry,
71 const css::lang::Locale& rLocale, const OUString& rSortAlgorithm ) override;
73 virtual OUString SAL_CALL getIndexFollowPageWord( sal_Bool MorePages,
74 const css::lang::Locale& rLocale ) override;
76 //XServiceInfo
77 virtual OUString SAL_CALL getImplementationName() override;
78 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
79 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
81 protected:
82 const sal_Char * implementationName;
83 bool usePhonetic;
84 rtl::Reference<CollatorImpl>
85 collator;
86 css::lang::Locale aLocale;
87 OUString aAlgorithm;
89 /// @throws css::uno::RuntimeException
90 const OUString& getEntry( const OUString& IndexEntry,
91 const OUString& PhoneticEntry, const css::lang::Locale& rLocale );
95 #endif
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */