merged tag ooo/DEV300_m102
[LibreOffice.git] / lingucomponent / source / thesaurus / libnth / nthesimp.hxx
blobb0595ad4286ce686ee6829b1ae32735735f57aa0
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 sal_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 sal_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 getLocales() throw(RuntimeException);
120 virtual sal_Bool SAL_CALL hasLocale( const Locale& rLocale ) throw(RuntimeException);
122 // XThesaurus
123 virtual Sequence< Reference < ::com::sun::star::linguistic2::XMeaning > > SAL_CALL queryMeanings( const OUString& rTerm, const Locale& rLocale, const PropertyValues& rProperties ) throw(IllegalArgumentException, RuntimeException);
125 // XServiceDisplayName
126 virtual OUString SAL_CALL getServiceDisplayName( const Locale& rLocale ) throw(RuntimeException);
128 // XInitialization
129 virtual void SAL_CALL initialize( const Sequence< Any >& rArguments ) throw(Exception, RuntimeException);
131 // XComponent
132 virtual void SAL_CALL dispose() throw(RuntimeException);
133 virtual void SAL_CALL addEventListener( const Reference< XEventListener >& rxListener ) throw(RuntimeException);
134 virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& rxListener ) throw(RuntimeException);
136 // XServiceInfo
137 virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);
138 virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) throw(RuntimeException);
139 virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException);
142 static inline OUString
143 getImplementationName_Static() throw();
144 static Sequence< OUString >
145 getSupportedServiceNames_Static() throw();
147 private:
148 sal_uInt16 SAL_CALL capitalType(const OUString&, CharClass *);
149 OUString SAL_CALL makeLowerCase(const OUString&, CharClass *);
150 OUString SAL_CALL makeUpperCase(const OUString&, CharClass *);
151 OUString SAL_CALL makeInitCap(const OUString&, CharClass *);
153 /* static ::com::sun::star::uno::Reference<
154 ::com::sun::star::linguistic2::XLinguServiceManager > xLngSvcMgr;
155 static ::com::sun::star::uno::Reference<
156 ::com::sun::star::linguistic2::XSpellChecker1 > xSpell;
158 static ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XLinguServiceManager > GetLngSvcMgr();
162 inline OUString Thesaurus::getImplementationName_Static() throw()
164 return A2OU( "org.openoffice.lingu.new.Thesaurus" );
168 ///////////////////////////////////////////////////////////////////////////
170 #endif