merged tag ooo/DEV300_m83
[LibreOffice.git] / lingucomponent / source / thesaurus / libnth / nthesimp.hxx
blob94bbb6fb3ea6d79e95cf30b7a8af6475c890652f
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef _LINGU2_THESIMP_HXX_
29 #define _LINGU2_THESIMP_HXX_
31 #include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
32 #include <cppuhelper/implbase1.hxx> // helper for implementations
33 #include <cppuhelper/implbase5.hxx> // helper for implementations
34 #include <com/sun/star/uno/Reference.h>
35 #include <com/sun/star/uno/Sequence.h>
36 #include <com/sun/star/lang/XComponent.hpp>
37 #include <com/sun/star/lang/XInitialization.hpp>
38 #include <com/sun/star/lang/XServiceDisplayName.hpp>
39 #include <com/sun/star/beans/XPropertySet.hpp>
40 #include <com/sun/star/beans/PropertyValues.hpp>
42 #include <com/sun/star/lang/XServiceInfo.hpp>
43 #include <com/sun/star/linguistic2/XMeaning.hpp>
44 #include <com/sun/star/linguistic2/XThesaurus.hpp>
46 #include <com/sun/star/linguistic2/XLinguServiceManager.hpp>
47 #include <com/sun/star/linguistic2/XSpellChecker1.hpp>
49 #include <tools/table.hxx>
51 #include <unotools/charclass.hxx>
53 #include <lingutil.hxx>
54 #include <linguistic/misc.hxx>
55 #include <linguistic/lngprophelp.hxx>
57 #include <osl/file.hxx>
58 #include "mythes.hxx"
60 using namespace ::rtl;
61 using namespace ::com::sun::star::uno;
62 using namespace ::com::sun::star::beans;
63 using namespace ::com::sun::star::lang;
64 using namespace ::com::sun::star::linguistic2;
66 namespace com { namespace sun { namespace star { namespace beans {
67 class XPropertySet;
68 }}}}
72 ///////////////////////////////////////////////////////////////////////////
75 class Thesaurus :
76 public cppu::WeakImplHelper5
78 XThesaurus,
79 XInitialization,
80 XComponent,
81 XServiceInfo,
82 XServiceDisplayName
85 Sequence< Locale > aSuppLocales;
87 ::cppu::OInterfaceContainerHelper aEvtListeners;
88 Reference< XPropertyChangeListener > xPropHelper;
89 linguistic::PropertyHelper_Thes * pPropHelper;
90 BOOL bDisposing;
91 CharClass ** aCharSetInfo;
92 MyThes ** aThes;
93 rtl_TextEncoding * aTEncs;
94 Locale * aTLocs;
95 OUString * aTNames;
96 sal_Int32 numthes;
98 // cache for the Thesaurus dialog
99 Sequence < Reference < ::com::sun::star::linguistic2::XMeaning > > prevMeanings;
100 OUString prevTerm;
101 INT16 prevLocale;
103 // disallow copy-constructor and assignment-operator for now
104 Thesaurus(const Thesaurus &);
105 Thesaurus & operator = (const Thesaurus &);
107 linguistic::PropertyHelper_Thes & GetPropHelper_Impl();
108 linguistic::PropertyHelper_Thes & GetPropHelper()
110 return pPropHelper ? *pPropHelper : GetPropHelper_Impl();
114 public:
115 Thesaurus();
116 virtual ~Thesaurus();
118 // XSupportedLocales (for XThesaurus)
119 virtual Sequence< Locale > SAL_CALL
120 getLocales()
121 throw(RuntimeException);
122 virtual sal_Bool SAL_CALL
123 hasLocale( const Locale& rLocale )
124 throw(RuntimeException);
126 // XThesaurus
127 virtual Sequence< Reference < ::com::sun::star::linguistic2::XMeaning > > SAL_CALL
128 queryMeanings( const OUString& rTerm, const Locale& rLocale,
129 const PropertyValues& rProperties )
130 throw(IllegalArgumentException,
131 RuntimeException);
133 // XServiceDisplayName
134 virtual OUString SAL_CALL
135 getServiceDisplayName( const Locale& rLocale )
136 throw(RuntimeException);
138 // XInitialization
139 virtual void SAL_CALL
140 initialize( const Sequence< Any >& rArguments )
141 throw(Exception, RuntimeException);
143 // XComponent
144 virtual void SAL_CALL
145 dispose()
146 throw(RuntimeException);
147 virtual void SAL_CALL
148 addEventListener( const Reference< XEventListener >& rxListener )
149 throw(RuntimeException);
150 virtual void SAL_CALL
151 removeEventListener( const Reference< XEventListener >& rxListener )
152 throw(RuntimeException);
154 ////////////////////////////////////////////////////////////
155 // Service specific part
158 // XServiceInfo
159 virtual OUString SAL_CALL
160 getImplementationName()
161 throw(RuntimeException);
162 virtual sal_Bool SAL_CALL
163 supportsService( const OUString& rServiceName )
164 throw(RuntimeException);
165 virtual Sequence< OUString > SAL_CALL
166 getSupportedServiceNames()
167 throw(RuntimeException);
170 static inline OUString
171 getImplementationName_Static() throw();
172 static Sequence< OUString >
173 getSupportedServiceNames_Static() throw();
175 private:
176 sal_uInt16 SAL_CALL capitalType(const OUString&, CharClass *);
177 OUString SAL_CALL makeLowerCase(const OUString&, CharClass *);
178 OUString SAL_CALL makeUpperCase(const OUString&, CharClass *);
179 OUString SAL_CALL makeInitCap(const OUString&, CharClass *);
181 /* static ::com::sun::star::uno::Reference<
182 ::com::sun::star::linguistic2::XLinguServiceManager > xLngSvcMgr;
183 static ::com::sun::star::uno::Reference<
184 ::com::sun::star::linguistic2::XSpellChecker1 > xSpell;
186 static ::com::sun::star::uno::Reference<
187 ::com::sun::star::linguistic2::XLinguServiceManager > GetLngSvcMgr();
191 inline OUString Thesaurus::getImplementationName_Static() throw()
193 return A2OU( "org.openoffice.lingu.new.Thesaurus" );
197 ///////////////////////////////////////////////////////////////////////////
199 #endif