Branch libreoffice-5-0-4
[LibreOffice.git] / lingucomponent / source / thesaurus / libnth / nthesimp.hxx
blob7652349432313e72b83704339936d6214cedfdb8
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/implbase1.hxx>
24 #include <cppuhelper/implbase5.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>
33 #include <com/sun/star/lang/XServiceInfo.hpp>
34 #include <com/sun/star/linguistic2/XMeaning.hpp>
35 #include <com/sun/star/linguistic2/XThesaurus.hpp>
37 #include <com/sun/star/linguistic2/XLinguServiceManager.hpp>
38 #include <com/sun/star/linguistic2/XSpellChecker1.hpp>
40 #include <unotools/charclass.hxx>
42 #include <lingutil.hxx>
43 #include <linguistic/misc.hxx>
44 #include <linguistic/lngprophelp.hxx>
46 #include <osl/file.hxx>
47 #include "mythes.hxx"
49 using namespace ::com::sun::star::uno;
50 using namespace ::com::sun::star::beans;
51 using namespace ::com::sun::star::lang;
52 using namespace ::com::sun::star::linguistic2;
54 namespace com { namespace sun { namespace star { namespace beans {
55 class XPropertySet;
56 }}}}
58 class Thesaurus :
59 public cppu::WeakImplHelper5
61 XThesaurus,
62 XInitialization,
63 XComponent,
64 XServiceInfo,
65 XServiceDisplayName
68 Sequence< Locale > aSuppLocales;
70 ::cppu::OInterfaceContainerHelper aEvtListeners;
71 linguistic::PropertyHelper_Thesaurus* pPropHelper;
72 bool bDisposing;
73 CharClass ** aCharSetInfo;
74 MyThes ** aThes;
75 rtl_TextEncoding * aTEncs;
76 Locale * aTLocs;
77 OUString * aTNames;
78 sal_Int32 numthes;
80 // cache for the Thesaurus dialog
81 Sequence < Reference < ::com::sun::star::linguistic2::XMeaning > > prevMeanings;
82 OUString prevTerm;
83 sal_Int16 prevLocale;
85 Thesaurus(const Thesaurus &) SAL_DELETED_FUNCTION;
86 Thesaurus & operator = (const Thesaurus &) SAL_DELETED_FUNCTION;
88 linguistic::PropertyHelper_Thesaurus& GetPropHelper_Impl();
89 linguistic::PropertyHelper_Thesaurus& GetPropHelper()
91 return pPropHelper ? *pPropHelper : GetPropHelper_Impl();
94 public:
95 Thesaurus();
96 virtual ~Thesaurus();
98 // XSupportedLocales (for XThesaurus)
99 virtual Sequence< Locale > SAL_CALL getLocales() throw(RuntimeException, std::exception) SAL_OVERRIDE;
100 virtual sal_Bool SAL_CALL hasLocale( const Locale& rLocale ) throw(RuntimeException, std::exception) SAL_OVERRIDE;
102 // XThesaurus
103 virtual Sequence< Reference < ::com::sun::star::linguistic2::XMeaning > > SAL_CALL queryMeanings( const OUString& rTerm, const Locale& rLocale, const PropertyValues& rProperties ) throw(IllegalArgumentException, RuntimeException, std::exception) SAL_OVERRIDE;
105 // XServiceDisplayName
106 virtual OUString SAL_CALL getServiceDisplayName( const Locale& rLocale ) throw(RuntimeException, std::exception) SAL_OVERRIDE;
108 // XInitialization
109 virtual void SAL_CALL initialize( const Sequence< Any >& rArguments ) throw(Exception, RuntimeException, std::exception) SAL_OVERRIDE;
111 // XComponent
112 virtual void SAL_CALL dispose() throw(RuntimeException, std::exception) SAL_OVERRIDE;
113 virtual void SAL_CALL addEventListener( const Reference< XEventListener >& rxListener ) throw(RuntimeException, std::exception) SAL_OVERRIDE;
114 virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& rxListener ) throw(RuntimeException, std::exception) SAL_OVERRIDE;
116 // XServiceInfo
117 virtual OUString SAL_CALL getImplementationName() throw(RuntimeException, std::exception) SAL_OVERRIDE;
118 virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) throw(RuntimeException, std::exception) SAL_OVERRIDE;
119 virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException, std::exception) SAL_OVERRIDE;
121 static inline OUString
122 getImplementationName_Static() throw();
123 static Sequence< OUString >
124 getSupportedServiceNames_Static() throw();
126 private:
127 static OUString SAL_CALL makeLowerCase(const OUString&, CharClass *);
128 static OUString SAL_CALL makeUpperCase(const OUString&, CharClass *);
129 static OUString SAL_CALL makeInitCap(const OUString&, CharClass *);
131 /* static ::com::sun::star::uno::Reference<
132 ::com::sun::star::linguistic2::XLinguServiceManager > xLngSvcMgr;
133 static ::com::sun::star::uno::Reference<
134 ::com::sun::star::linguistic2::XSpellChecker1 > xSpell;
136 static ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XLinguServiceManager > GetLngSvcMgr();
140 inline OUString Thesaurus::getImplementationName_Static() throw()
142 return OUString( "org.openoffice.lingu.new.Thesaurus" );
145 void * SAL_CALL Thesaurus_getFactory(
146 char const * pImplName, css::lang::XMultiServiceFactory * pServiceManager,
147 void *);
149 #endif
151 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */