Coverage Report

Created: 2026-06-30 11:14

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/lingucomponent/source/thesaurus/libnth/nthesimp.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
#ifndef INCLUDED_LINGUCOMPONENT_SOURCE_THESAURUS_LIBNTH_NTHESIMP_HXX
21
#define INCLUDED_LINGUCOMPONENT_SOURCE_THESAURUS_LIBNTH_NTHESIMP_HXX
22
23
#include <comphelper/interfacecontainer3.hxx>
24
#include <cppuhelper/implbase.hxx>
25
#include <com/sun/star/uno/Reference.h>
26
#include <com/sun/star/uno/Sequence.h>
27
#include <com/sun/star/lang/XComponent.hpp>
28
#include <com/sun/star/lang/XInitialization.hpp>
29
#include <com/sun/star/lang/XServiceDisplayName.hpp>
30
#include <com/sun/star/beans/XPropertySet.hpp>
31
#include <com/sun/star/beans/PropertyValues.hpp>
32
33
#include <com/sun/star/lang/XServiceInfo.hpp>
34
#include <com/sun/star/linguistic2/XMeaning.hpp>
35
#include <com/sun/star/linguistic2/XThesaurus.hpp>
36
37
#include <unotools/charclass.hxx>
38
39
#include <lingutil.hxx>
40
#include <linguistic/misc.hxx>
41
#include <linguistic/lngprophelp.hxx>
42
43
#include <osl/file.hxx>
44
#include <mythes.hxx>
45
#include <memory>
46
#include <vector>
47
48
using namespace ::com::sun::star::uno;
49
using namespace ::com::sun::star::beans;
50
using namespace ::com::sun::star::lang;
51
using namespace ::com::sun::star::linguistic2;
52
53
namespace com::sun::star::beans { class XPropertySet; }
54
55
class Thesaurus :
56
    public cppu::WeakImplHelper
57
    <
58
        XThesaurus,
59
        XInitialization,
60
        XComponent,
61
        XServiceInfo,
62
        XServiceDisplayName
63
    >
64
{
65
    Sequence< Locale >                      aSuppLocales;
66
67
    ::comphelper::OInterfaceContainerHelper3<XEventListener> aEvtListeners;
68
    linguistic::PropertyHelper_Thesaurus*       pPropHelper;
69
    bool                                    bDisposing;
70
    struct ThesInfo
71
    {
72
        std::unique_ptr<CharClass> aCharSetInfo;
73
        std::unique_ptr<MyThes> aThes;
74
        rtl_TextEncoding aEncoding;
75
        Locale aLocale;
76
        OUString aName;
77
    };
78
    std::vector<ThesInfo>                   mvThesInfo;
79
80
    // cache for the Thesaurus dialog
81
    Sequence < Reference < css::linguistic2::XMeaning > > prevMeanings;
82
    OUString  prevTerm;
83
    LanguageType prevLocale;
84
85
    Thesaurus(const Thesaurus &) = delete;
86
    Thesaurus & operator = (const Thesaurus &) = delete;
87
88
    linguistic::PropertyHelper_Thesaurus&   GetPropHelper_Impl();
89
    linguistic::PropertyHelper_Thesaurus&   GetPropHelper()
90
0
    {
91
0
        return pPropHelper ? *pPropHelper : GetPropHelper_Impl();
92
0
    }
93
94
public:
95
    Thesaurus();
96
    virtual ~Thesaurus() override;
97
98
    // XSupportedLocales (for XThesaurus)
99
    virtual Sequence< Locale > SAL_CALL getLocales() override;
100
    virtual sal_Bool SAL_CALL hasLocale( const Locale& rLocale ) override;
101
102
    // XThesaurus
103
    virtual Sequence< Reference < css::linguistic2::XMeaning > > SAL_CALL queryMeanings( const OUString& rTerm, const Locale& rLocale, const css::uno::Sequence< css::beans::PropertyValue >& rProperties ) override;
104
105
    // XServiceDisplayName
106
    virtual OUString SAL_CALL getServiceDisplayName( const Locale& rLocale ) override;
107
108
    // XInitialization
109
    virtual void SAL_CALL initialize( const Sequence< Any >& rArguments ) override;
110
111
    // XComponent
112
    virtual void SAL_CALL dispose() override;
113
    virtual void SAL_CALL addEventListener( const Reference< XEventListener >& rxListener ) override;
114
    virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& rxListener ) override;
115
116
    // XServiceInfo
117
    virtual OUString SAL_CALL getImplementationName() override;
118
    virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) override;
119
    virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
120
121
private:
122
    static OUString makeLowerCase(const OUString&, CharClass const *);
123
    static OUString makeUpperCase(const OUString&, CharClass const *);
124
    static OUString makeInitCap(const OUString&, CharClass const *);
125
};
126
127
#endif
128
129
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */