Update ooo320-m1
[ooovba.git] / lingucomponent / source / thesaurus / libnth / nthesimp.hxx
blob224e65ccfa1a7291a1bdc1cf45c22c61362ef0a7
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: nthesimp.hxx,v $
10 * $Revision: 1.6.16.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _LINGU2_THESIMP_HXX_
32 #define _LINGU2_THESIMP_HXX_
34 #include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
35 #include <cppuhelper/implbase1.hxx> // helper for implementations
36 #include <cppuhelper/implbase5.hxx> // helper for implementations
37 #include <com/sun/star/uno/Reference.h>
38 #include <com/sun/star/uno/Sequence.h>
39 #include <com/sun/star/lang/XComponent.hpp>
40 #include <com/sun/star/lang/XInitialization.hpp>
41 #include <com/sun/star/lang/XServiceDisplayName.hpp>
42 #include <com/sun/star/beans/XPropertySet.hpp>
43 #include <com/sun/star/beans/PropertyValues.hpp>
45 #include <com/sun/star/lang/XServiceInfo.hpp>
46 #include <com/sun/star/linguistic2/XMeaning.hpp>
47 #include <com/sun/star/linguistic2/XThesaurus.hpp>
49 #include <com/sun/star/linguistic2/XLinguServiceManager.hpp>
50 #include <com/sun/star/linguistic2/XSpellChecker1.hpp>
52 #include <tools/table.hxx>
54 #include <unotools/charclass.hxx>
56 #include <lingutil.hxx>
57 #include <linguistic/misc.hxx>
58 #include <linguistic/lngprophelp.hxx>
60 #include <osl/file.hxx>
61 #include "mythes.hxx"
63 using namespace ::rtl;
64 using namespace ::com::sun::star::uno;
65 using namespace ::com::sun::star::beans;
66 using namespace ::com::sun::star::lang;
67 using namespace ::com::sun::star::linguistic2;
69 namespace com { namespace sun { namespace star { namespace beans {
70 class XPropertySet;
71 }}}}
75 ///////////////////////////////////////////////////////////////////////////
78 class Thesaurus :
79 public cppu::WeakImplHelper5
81 XThesaurus,
82 XInitialization,
83 XComponent,
84 XServiceInfo,
85 XServiceDisplayName
88 Sequence< Locale > aSuppLocales;
90 ::cppu::OInterfaceContainerHelper aEvtListeners;
91 Reference< XPropertyChangeListener > xPropHelper;
92 linguistic::PropertyHelper_Thes * pPropHelper;
93 BOOL bDisposing;
94 CharClass ** aCharSetInfo;
95 MyThes ** aThes;
96 rtl_TextEncoding * aTEncs;
97 Locale * aTLocs;
98 OUString * aTNames;
99 sal_Int32 numthes;
101 // cache for the Thesaurus dialog
102 Sequence < Reference < ::com::sun::star::linguistic2::XMeaning > > prevMeanings;
103 OUString prevTerm;
104 INT16 prevLocale;
106 // disallow copy-constructor and assignment-operator for now
107 Thesaurus(const Thesaurus &);
108 Thesaurus & operator = (const Thesaurus &);
110 linguistic::PropertyHelper_Thes & GetPropHelper_Impl();
111 linguistic::PropertyHelper_Thes & GetPropHelper()
113 return pPropHelper ? *pPropHelper : GetPropHelper_Impl();
117 public:
118 Thesaurus();
119 virtual ~Thesaurus();
121 // XSupportedLocales (for XThesaurus)
122 virtual Sequence< Locale > SAL_CALL
123 getLocales()
124 throw(RuntimeException);
125 virtual sal_Bool SAL_CALL
126 hasLocale( const Locale& rLocale )
127 throw(RuntimeException);
129 // XThesaurus
130 virtual Sequence< Reference < ::com::sun::star::linguistic2::XMeaning > > SAL_CALL
131 queryMeanings( const OUString& rTerm, const Locale& rLocale,
132 const PropertyValues& rProperties )
133 throw(IllegalArgumentException,
134 RuntimeException);
136 // XServiceDisplayName
137 virtual OUString SAL_CALL
138 getServiceDisplayName( const Locale& rLocale )
139 throw(RuntimeException);
141 // XInitialization
142 virtual void SAL_CALL
143 initialize( const Sequence< Any >& rArguments )
144 throw(Exception, RuntimeException);
146 // XComponent
147 virtual void SAL_CALL
148 dispose()
149 throw(RuntimeException);
150 virtual void SAL_CALL
151 addEventListener( const Reference< XEventListener >& rxListener )
152 throw(RuntimeException);
153 virtual void SAL_CALL
154 removeEventListener( const Reference< XEventListener >& rxListener )
155 throw(RuntimeException);
157 ////////////////////////////////////////////////////////////
158 // Service specific part
161 // XServiceInfo
162 virtual OUString SAL_CALL
163 getImplementationName()
164 throw(RuntimeException);
165 virtual sal_Bool SAL_CALL
166 supportsService( const OUString& rServiceName )
167 throw(RuntimeException);
168 virtual Sequence< OUString > SAL_CALL
169 getSupportedServiceNames()
170 throw(RuntimeException);
173 static inline OUString
174 getImplementationName_Static() throw();
175 static Sequence< OUString >
176 getSupportedServiceNames_Static() throw();
178 private:
179 sal_uInt16 SAL_CALL capitalType(const OUString&, CharClass *);
180 OUString SAL_CALL makeLowerCase(const OUString&, CharClass *);
181 OUString SAL_CALL makeUpperCase(const OUString&, CharClass *);
182 OUString SAL_CALL makeInitCap(const OUString&, CharClass *);
184 /* static ::com::sun::star::uno::Reference<
185 ::com::sun::star::linguistic2::XLinguServiceManager > xLngSvcMgr;
186 static ::com::sun::star::uno::Reference<
187 ::com::sun::star::linguistic2::XSpellChecker1 > xSpell;
189 static ::com::sun::star::uno::Reference<
190 ::com::sun::star::linguistic2::XLinguServiceManager > GetLngSvcMgr();
194 inline OUString Thesaurus::getImplementationName_Static() throw()
196 return A2OU( "org.openoffice.lingu.new.Thesaurus" );
200 ///////////////////////////////////////////////////////////////////////////
202 #endif