xref: /trunk/main/lingucomponent/source/thesaurus/libnth/nthesimp.hxx (revision 914d351e5f5b84e4342a86d6ab8d4aca7308b9bd)
1e7675e54SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3e7675e54SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4e7675e54SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5e7675e54SAndrew Rist  * distributed with this work for additional information
6e7675e54SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7e7675e54SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8e7675e54SAndrew Rist  * "License"); you may not use this file except in compliance
9e7675e54SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11e7675e54SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13e7675e54SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14e7675e54SAndrew Rist  * software distributed under the License is distributed on an
15e7675e54SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16e7675e54SAndrew Rist  * KIND, either express or implied.  See the License for the
17e7675e54SAndrew Rist  * specific language governing permissions and limitations
18e7675e54SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20e7675e54SAndrew Rist  *************************************************************/
21e7675e54SAndrew Rist 
22e7675e54SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _LINGU2_THESIMP_HXX_
25cdf0e10cSrcweir #define _LINGU2_THESIMP_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <uno/lbnames.h>            // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
28cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx> // helper for implementations
29cdf0e10cSrcweir #include <cppuhelper/implbase5.hxx> // helper for implementations
30cdf0e10cSrcweir #include <com/sun/star/uno/Reference.h>
31cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.h>
32cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp>
33cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp>
34cdf0e10cSrcweir #include <com/sun/star/lang/XServiceDisplayName.hpp>
35cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
36cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValues.hpp>
37cdf0e10cSrcweir 
38cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
39cdf0e10cSrcweir #include <com/sun/star/linguistic2/XMeaning.hpp>
40cdf0e10cSrcweir #include <com/sun/star/linguistic2/XThesaurus.hpp>
41cdf0e10cSrcweir 
42cdf0e10cSrcweir #include <com/sun/star/linguistic2/XLinguServiceManager.hpp>
43cdf0e10cSrcweir #include <com/sun/star/linguistic2/XSpellChecker1.hpp>
44cdf0e10cSrcweir 
45cdf0e10cSrcweir #include <tools/table.hxx>
46cdf0e10cSrcweir 
47cdf0e10cSrcweir #include <unotools/charclass.hxx>
48cdf0e10cSrcweir 
49cdf0e10cSrcweir #include <lingutil.hxx>
50cdf0e10cSrcweir #include <linguistic/misc.hxx>
51cdf0e10cSrcweir #include <linguistic/lngprophelp.hxx>
52cdf0e10cSrcweir 
53cdf0e10cSrcweir #include <osl/file.hxx>
54cdf0e10cSrcweir #include "mythes.hxx"
55cdf0e10cSrcweir 
56cdf0e10cSrcweir using namespace ::rtl;
57cdf0e10cSrcweir using namespace ::com::sun::star::uno;
58cdf0e10cSrcweir using namespace ::com::sun::star::beans;
59cdf0e10cSrcweir using namespace ::com::sun::star::lang;
60cdf0e10cSrcweir using namespace ::com::sun::star::linguistic2;
61cdf0e10cSrcweir 
62cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace beans {
63cdf0e10cSrcweir         class XPropertySet;
64cdf0e10cSrcweir }}}}
65cdf0e10cSrcweir 
66cdf0e10cSrcweir 
67cdf0e10cSrcweir 
68cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////////
69cdf0e10cSrcweir 
70cdf0e10cSrcweir 
71cdf0e10cSrcweir class Thesaurus :
72cdf0e10cSrcweir     public cppu::WeakImplHelper5
73cdf0e10cSrcweir     <
74cdf0e10cSrcweir         XThesaurus,
75cdf0e10cSrcweir         XInitialization,
76cdf0e10cSrcweir         XComponent,
77cdf0e10cSrcweir         XServiceInfo,
78cdf0e10cSrcweir         XServiceDisplayName
79cdf0e10cSrcweir     >
80cdf0e10cSrcweir {
81cdf0e10cSrcweir     Sequence< Locale >                      aSuppLocales;
82cdf0e10cSrcweir 
83cdf0e10cSrcweir     ::cppu::OInterfaceContainerHelper       aEvtListeners;
84*b63233d8Sdamjan     linguistic::PropertyHelper_Thesaurus*       pPropHelper;
85cdf0e10cSrcweir     sal_Bool                                    bDisposing;
86cdf0e10cSrcweir     CharClass **                            aCharSetInfo;
87cdf0e10cSrcweir     MyThes **                               aThes;
88cdf0e10cSrcweir     rtl_TextEncoding *                      aTEncs;
89cdf0e10cSrcweir     Locale *                                aTLocs;
90cdf0e10cSrcweir     OUString *                              aTNames;
91cdf0e10cSrcweir     sal_Int32                               numthes;
92cdf0e10cSrcweir 
93cdf0e10cSrcweir     // cache for the Thesaurus dialog
94cdf0e10cSrcweir     Sequence < Reference < ::com::sun::star::linguistic2::XMeaning > > prevMeanings;
95cdf0e10cSrcweir     OUString  prevTerm;
96cdf0e10cSrcweir     sal_Int16 prevLocale;
97cdf0e10cSrcweir 
98cdf0e10cSrcweir     // disallow copy-constructor and assignment-operator for now
99cdf0e10cSrcweir     Thesaurus(const Thesaurus &);
100cdf0e10cSrcweir     Thesaurus & operator = (const Thesaurus &);
101cdf0e10cSrcweir 
102*b63233d8Sdamjan     linguistic::PropertyHelper_Thesaurus&   GetPropHelper_Impl();
GetPropHelper()103*b63233d8Sdamjan     linguistic::PropertyHelper_Thesaurus&   GetPropHelper()
104cdf0e10cSrcweir     {
105cdf0e10cSrcweir         return pPropHelper ? *pPropHelper : GetPropHelper_Impl();
106cdf0e10cSrcweir     }
107cdf0e10cSrcweir 
108cdf0e10cSrcweir 
109cdf0e10cSrcweir public:
110cdf0e10cSrcweir     Thesaurus();
111cdf0e10cSrcweir     virtual ~Thesaurus();
112cdf0e10cSrcweir 
113cdf0e10cSrcweir     // XSupportedLocales (for XThesaurus)
114cdf0e10cSrcweir     virtual Sequence< Locale > SAL_CALL getLocales() throw(RuntimeException);
115cdf0e10cSrcweir     virtual sal_Bool SAL_CALL hasLocale( const Locale& rLocale ) throw(RuntimeException);
116cdf0e10cSrcweir 
117cdf0e10cSrcweir     // XThesaurus
118cdf0e10cSrcweir     virtual Sequence< Reference < ::com::sun::star::linguistic2::XMeaning > > SAL_CALL queryMeanings( const OUString& rTerm, const Locale& rLocale, const PropertyValues& rProperties ) throw(IllegalArgumentException, RuntimeException);
119cdf0e10cSrcweir 
120cdf0e10cSrcweir     // XServiceDisplayName
121cdf0e10cSrcweir     virtual OUString SAL_CALL getServiceDisplayName( const Locale& rLocale ) throw(RuntimeException);
122cdf0e10cSrcweir 
123cdf0e10cSrcweir     // XInitialization
124cdf0e10cSrcweir     virtual void SAL_CALL initialize( const Sequence< Any >& rArguments ) throw(Exception, RuntimeException);
125cdf0e10cSrcweir 
126cdf0e10cSrcweir     // XComponent
127cdf0e10cSrcweir     virtual void SAL_CALL dispose() throw(RuntimeException);
128cdf0e10cSrcweir     virtual void SAL_CALL addEventListener( const Reference< XEventListener >& rxListener ) throw(RuntimeException);
129cdf0e10cSrcweir     virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& rxListener ) throw(RuntimeException);
130cdf0e10cSrcweir 
131cdf0e10cSrcweir     // XServiceInfo
132cdf0e10cSrcweir     virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);
133cdf0e10cSrcweir     virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) throw(RuntimeException);
134cdf0e10cSrcweir     virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException);
135cdf0e10cSrcweir 
136cdf0e10cSrcweir 
137cdf0e10cSrcweir     static inline OUString
138cdf0e10cSrcweir         getImplementationName_Static() throw();
139cdf0e10cSrcweir         static Sequence< OUString >
140cdf0e10cSrcweir         getSupportedServiceNames_Static() throw();
141cdf0e10cSrcweir 
142cdf0e10cSrcweir private:
143cdf0e10cSrcweir         sal_uInt16 SAL_CALL capitalType(const OUString&, CharClass *);
144cdf0e10cSrcweir         OUString SAL_CALL makeLowerCase(const OUString&, CharClass *);
145cdf0e10cSrcweir         OUString SAL_CALL makeUpperCase(const OUString&, CharClass *);
146cdf0e10cSrcweir         OUString SAL_CALL makeInitCap(const OUString&, CharClass *);
147cdf0e10cSrcweir 
148cdf0e10cSrcweir /*  static ::com::sun::star::uno::Reference<
149cdf0e10cSrcweir         ::com::sun::star::linguistic2::XLinguServiceManager > xLngSvcMgr;
150cdf0e10cSrcweir     static ::com::sun::star::uno::Reference<
151cdf0e10cSrcweir         ::com::sun::star::linguistic2::XSpellChecker1 > xSpell;
152cdf0e10cSrcweir */
153cdf0e10cSrcweir     static ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XLinguServiceManager > GetLngSvcMgr();
154cdf0e10cSrcweir 
155cdf0e10cSrcweir };
156cdf0e10cSrcweir 
getImplementationName_Static()157cdf0e10cSrcweir inline OUString Thesaurus::getImplementationName_Static() throw()
158cdf0e10cSrcweir {
159cdf0e10cSrcweir     return A2OU( "org.openoffice.lingu.new.Thesaurus" );
160cdf0e10cSrcweir }
161cdf0e10cSrcweir 
162cdf0e10cSrcweir 
163cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////////
164cdf0e10cSrcweir 
165cdf0e10cSrcweir #endif
166