Coverage Report

Created: 2025-12-31 10:39

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/linguistic/source/thesdsp.hxx
Line
Count
Source
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
20
#pragma once
21
22
#include <com/sun/star/uno/Reference.h>
23
#include <com/sun/star/uno/Sequence.h>
24
25
#include <com/sun/star/linguistic2/XLinguProperties.hpp>
26
#include <com/sun/star/linguistic2/XThesaurus.hpp>
27
28
#include <cppuhelper/implbase.hxx>
29
#include <linguistic/misc.hxx>
30
31
#include <map>
32
#include <memory>
33
34
#include "defs.hxx"
35
36
37
class ThesaurusDispatcher :
38
    public cppu::WeakImplHelper< css::linguistic2::XThesaurus >,
39
    public LinguDispatcher
40
{
41
    typedef std::shared_ptr< LangSvcEntries_Thes >                LangSvcEntries_Thes_Ptr_t;
42
    typedef std::map< LanguageType, LangSvcEntries_Thes_Ptr_t >     ThesSvcByLangMap_t;
43
    ThesSvcByLangMap_t      aSvcMap;
44
45
    css::uno::Reference< css::linguistic2::XLinguProperties >     xPropSet;
46
47
    ThesaurusDispatcher(const ThesaurusDispatcher &) = delete;
48
    ThesaurusDispatcher & operator = (const ThesaurusDispatcher &) = delete;
49
50
    inline const css::uno::Reference< css::linguistic2::XLinguProperties > &
51
            GetPropSet();
52
53
    void    ClearSvcList();
54
55
public:
56
    ThesaurusDispatcher();
57
    virtual ~ThesaurusDispatcher() override;
58
59
    // XSupportedLocales
60
    virtual css::uno::Sequence< css::lang::Locale > SAL_CALL
61
        getLocales() override;
62
    virtual sal_Bool SAL_CALL
63
        hasLocale( const css::lang::Locale& aLocale ) override;
64
65
    // XThesaurus
66
    virtual css::uno::Sequence< css::uno::Reference< css::linguistic2::XMeaning > > SAL_CALL
67
        queryMeanings( const OUString& aTerm,
68
                const css::lang::Locale& aLocale,
69
                const css::uno::Sequence< ::css::beans::PropertyValue >& aProperties ) override;
70
71
    // LinguDispatcher
72
    virtual void
73
        SetServiceList( const css::lang::Locale &rLocale,
74
                const css::uno::Sequence< OUString > &rSvcImplNames ) override;
75
    virtual css::uno::Sequence< OUString >
76
        GetServiceList( const css::lang::Locale &rLocale ) const override;
77
};
78
79
80
inline const css::uno::Reference< css::linguistic2::XLinguProperties > &
81
        ThesaurusDispatcher::GetPropSet()
82
0
{
83
0
    if (!xPropSet.is())
84
0
        xPropSet = linguistic::GetLinguProperties();
85
0
    return xPropSet;
86
0
}
87
88
89
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */