LibreOffice Module lingucomponent (master) 1
nthesimp.hxx
Go to the documentation of this file.
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
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
38
39#include <lingutil.hxx>
40#include <linguistic/misc.hxx>
42
43#include <osl/file.hxx>
44#include <mythes.hxx>
45#include <memory>
46#include <vector>
47
48using namespace ::com::sun::star::uno;
49using namespace ::com::sun::star::beans;
50using namespace ::com::sun::star::lang;
51using namespace ::com::sun::star::linguistic2;
52
53namespace com::sun::star::beans { class XPropertySet; }
54
55class Thesaurus :
56 public cppu::WeakImplHelper
57 <
58 XThesaurus,
59 XInitialization,
60 XComponent,
61 XServiceInfo,
62 XServiceDisplayName
63 >
64{
65 Sequence< Locale > aSuppLocales;
66
68 linguistic::PropertyHelper_Thesaurus* pPropHelper;
70 struct ThesInfo
71 {
72 std::unique_ptr<CharClass> aCharSetInfo;
73 std::unique_ptr<MyThes> aThes;
74 rtl_TextEncoding aEncoding;
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;
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 {
92 }
93
94public:
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
121private:
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: */
virtual OUString SAL_CALL getImplementationName() override
Definition: nthesimp.cxx:549
virtual void SAL_CALL dispose() override
Definition: nthesimp.cxx:514
Sequence< Reference< css::linguistic2::XMeaning > > prevMeanings
Definition: nthesimp.hxx:81
::comphelper::OInterfaceContainerHelper3< XEventListener > aEvtListeners
Definition: nthesimp.hxx:67
OUString prevTerm
Definition: nthesimp.hxx:82
static OUString makeUpperCase(const OUString &, CharClass const *)
Definition: nthesimp.cxx:490
virtual OUString SAL_CALL getServiceDisplayName(const Locale &rLocale) override
Definition: nthesimp.cxx:450
Thesaurus & operator=(const Thesaurus &)=delete
virtual void SAL_CALL initialize(const Sequence< Any > &rArguments) override
Definition: nthesimp.cxx:456
LanguageType prevLocale
Definition: nthesimp.hxx:83
virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: nthesimp.cxx:559
virtual void SAL_CALL addEventListener(const Reference< XEventListener > &rxListener) override
Definition: nthesimp.cxx:532
virtual void SAL_CALL removeEventListener(const Reference< XEventListener > &rxListener) override
Definition: nthesimp.cxx:540
virtual sal_Bool SAL_CALL supportsService(const OUString &rServiceName) override
Definition: nthesimp.cxx:554
virtual ~Thesaurus() override
Definition: nthesimp.cxx:75
virtual Sequence< Locale > SAL_CALL getLocales() override
Definition: nthesimp.cxx:96
static OUString makeLowerCase(const OUString &, CharClass const *)
Definition: nthesimp.cxx:483
bool bDisposing
Definition: nthesimp.hxx:69
linguistic::PropertyHelper_Thesaurus & GetPropHelper_Impl()
Definition: nthesimp.cxx:84
static OUString makeInitCap(const OUString &, CharClass const *)
Definition: nthesimp.cxx:497
Sequence< Locale > aSuppLocales
Definition: nthesimp.hxx:65
linguistic::PropertyHelper_Thesaurus * pPropHelper
Definition: nthesimp.hxx:68
std::vector< ThesInfo > mvThesInfo
Definition: nthesimp.hxx:78
linguistic::PropertyHelper_Thesaurus & GetPropHelper()
Definition: nthesimp.hxx:89
virtual sal_Bool SAL_CALL hasLocale(const Locale &rLocale) override
Definition: nthesimp.cxx:204
virtual Sequence< Reference< css::linguistic2::XMeaning > > SAL_CALL queryMeanings(const OUString &rTerm, const Locale &rLocale, const css::uno::Sequence< css::beans::PropertyValue > &rProperties) override
Definition: nthesimp.cxx:214
Thesaurus(const Thesaurus &)=delete
class SAL_NO_VTABLE XPropertySet
std::unique_ptr< CharClass > aCharSetInfo
Definition: nthesimp.hxx:72
std::unique_ptr< MyThes > aThes
Definition: nthesimp.hxx:73
rtl_TextEncoding aEncoding
Definition: nthesimp.hxx:74
unsigned char sal_Bool