bump product version to 6.3.0.0.beta1
[LibreOffice.git] / lingucomponent / source / thesaurus / libnth / nthesimp.hxx
blob394aefada281e8aab26f8a80bbc59aac3cfba7dc
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_LINGUCOMPONENT_SOURCE_THESAURUS_LIBNTH_NTHESIMP_HXX
21 #define INCLUDED_LINGUCOMPONENT_SOURCE_THESAURUS_LIBNTH_NTHESIMP_HXX
23 #include <cppuhelper/implbase.hxx>
24 #include <com/sun/star/uno/Reference.h>
25 #include <com/sun/star/uno/Sequence.h>
26 #include <com/sun/star/lang/XComponent.hpp>
27 #include <com/sun/star/lang/XInitialization.hpp>
28 #include <com/sun/star/lang/XServiceDisplayName.hpp>
29 #include <com/sun/star/beans/XPropertySet.hpp>
30 #include <com/sun/star/beans/PropertyValues.hpp>
32 #include <com/sun/star/lang/XServiceInfo.hpp>
33 #include <com/sun/star/linguistic2/XMeaning.hpp>
34 #include <com/sun/star/linguistic2/XThesaurus.hpp>
36 #include <unotools/charclass.hxx>
38 #include <lingutil.hxx>
39 #include <linguistic/misc.hxx>
40 #include <linguistic/lngprophelp.hxx>
42 #include <osl/file.hxx>
43 #include <mythes.hxx>
44 #include <memory>
45 #include <vector>
47 using namespace ::com::sun::star::uno;
48 using namespace ::com::sun::star::beans;
49 using namespace ::com::sun::star::lang;
50 using namespace ::com::sun::star::linguistic2;
52 namespace com { namespace sun { namespace star { namespace beans {
53 class XPropertySet;
54 }}}}
56 class Thesaurus :
57 public cppu::WeakImplHelper
59 XThesaurus,
60 XInitialization,
61 XComponent,
62 XServiceInfo,
63 XServiceDisplayName
66 Sequence< Locale > aSuppLocales;
68 ::comphelper::OInterfaceContainerHelper2 aEvtListeners;
69 linguistic::PropertyHelper_Thesaurus* pPropHelper;
70 bool bDisposing;
71 struct ThesInfo
73 std::unique_ptr<CharClass> aCharSetInfo;
74 std::unique_ptr<MyThes> aThes;
75 rtl_TextEncoding aEncoding;
76 Locale aLocale;
77 OUString aName;
79 std::vector<ThesInfo> mvThesInfo;
81 // cache for the Thesaurus dialog
82 Sequence < Reference < css::linguistic2::XMeaning > > prevMeanings;
83 OUString prevTerm;
84 LanguageType prevLocale;
86 Thesaurus(const Thesaurus &) = delete;
87 Thesaurus & operator = (const Thesaurus &) = delete;
89 linguistic::PropertyHelper_Thesaurus& GetPropHelper_Impl();
90 linguistic::PropertyHelper_Thesaurus& GetPropHelper()
92 return pPropHelper ? *pPropHelper : GetPropHelper_Impl();
95 public:
96 Thesaurus();
97 virtual ~Thesaurus() override;
99 // XSupportedLocales (for XThesaurus)
100 virtual Sequence< Locale > SAL_CALL getLocales() override;
101 virtual sal_Bool SAL_CALL hasLocale( const Locale& rLocale ) override;
103 // XThesaurus
104 virtual Sequence< Reference < css::linguistic2::XMeaning > > SAL_CALL queryMeanings( const OUString& rTerm, const Locale& rLocale, const css::uno::Sequence< css::beans::PropertyValue >& rProperties ) override;
106 // XServiceDisplayName
107 virtual OUString SAL_CALL getServiceDisplayName( const Locale& rLocale ) override;
109 // XInitialization
110 virtual void SAL_CALL initialize( const Sequence< Any >& rArguments ) override;
112 // XComponent
113 virtual void SAL_CALL dispose() override;
114 virtual void SAL_CALL addEventListener( const Reference< XEventListener >& rxListener ) override;
115 virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& rxListener ) override;
117 // XServiceInfo
118 virtual OUString SAL_CALL getImplementationName() override;
119 virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) override;
120 virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
122 static inline OUString
123 getImplementationName_Static() throw();
124 static Sequence< OUString >
125 getSupportedServiceNames_Static() throw();
127 private:
128 static OUString makeLowerCase(const OUString&, CharClass const *);
129 static OUString makeUpperCase(const OUString&, CharClass const *);
130 static OUString makeInitCap(const OUString&, CharClass const *);
133 inline OUString Thesaurus::getImplementationName_Static() throw()
135 return OUString( "org.openoffice.lingu.new.Thesaurus" );
138 #endif
140 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */