Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef _LINGU2_THESIMP_HXX_
21 : #define _LINGU2_THESIMP_HXX_
22 :
23 : #include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
24 : #include <cppuhelper/implbase1.hxx> // helper for implementations
25 : #include <cppuhelper/implbase5.hxx> // helper for implementations
26 : #include <com/sun/star/uno/Reference.h>
27 : #include <com/sun/star/uno/Sequence.h>
28 : #include <com/sun/star/lang/XComponent.hpp>
29 : #include <com/sun/star/lang/XInitialization.hpp>
30 : #include <com/sun/star/lang/XServiceDisplayName.hpp>
31 : #include <com/sun/star/beans/XPropertySet.hpp>
32 : #include <com/sun/star/beans/PropertyValues.hpp>
33 :
34 : #include <com/sun/star/lang/XServiceInfo.hpp>
35 : #include <com/sun/star/linguistic2/XMeaning.hpp>
36 : #include <com/sun/star/linguistic2/XThesaurus.hpp>
37 :
38 : #include <com/sun/star/linguistic2/XLinguServiceManager.hpp>
39 : #include <com/sun/star/linguistic2/XSpellChecker1.hpp>
40 :
41 : #include <unotools/charclass.hxx>
42 :
43 : #include <lingutil.hxx>
44 : #include <linguistic/misc.hxx>
45 : #include <linguistic/lngprophelp.hxx>
46 :
47 : #include <osl/file.hxx>
48 : #include "mythes.hxx"
49 :
50 : using namespace ::rtl;
51 : using namespace ::com::sun::star::uno;
52 : using namespace ::com::sun::star::beans;
53 : using namespace ::com::sun::star::lang;
54 : using namespace ::com::sun::star::linguistic2;
55 :
56 : namespace com { namespace sun { namespace star { namespace beans {
57 : class XPropertySet;
58 : }}}}
59 :
60 :
61 :
62 : ///////////////////////////////////////////////////////////////////////////
63 :
64 :
65 : class Thesaurus :
66 : public cppu::WeakImplHelper5
67 : <
68 : XThesaurus,
69 : XInitialization,
70 : XComponent,
71 : XServiceInfo,
72 : XServiceDisplayName
73 : >
74 : {
75 : Sequence< Locale > aSuppLocales;
76 :
77 : ::cppu::OInterfaceContainerHelper aEvtListeners;
78 : linguistic::PropertyHelper_Thesaurus* pPropHelper;
79 : bool bDisposing;
80 : CharClass ** aCharSetInfo;
81 : MyThes ** aThes;
82 : rtl_TextEncoding * aTEncs;
83 : Locale * aTLocs;
84 : OUString * aTNames;
85 : sal_Int32 numthes;
86 :
87 : // cache for the Thesaurus dialog
88 : Sequence < Reference < ::com::sun::star::linguistic2::XMeaning > > prevMeanings;
89 : OUString prevTerm;
90 : sal_Int16 prevLocale;
91 :
92 : // disallow copy-constructor and assignment-operator for now
93 : Thesaurus(const Thesaurus &);
94 : Thesaurus & operator = (const Thesaurus &);
95 :
96 : linguistic::PropertyHelper_Thesaurus& GetPropHelper_Impl();
97 0 : linguistic::PropertyHelper_Thesaurus& GetPropHelper()
98 : {
99 0 : return pPropHelper ? *pPropHelper : GetPropHelper_Impl();
100 : }
101 :
102 :
103 : public:
104 : Thesaurus();
105 : virtual ~Thesaurus();
106 :
107 : // XSupportedLocales (for XThesaurus)
108 : virtual Sequence< Locale > SAL_CALL getLocales() throw(RuntimeException);
109 : virtual sal_Bool SAL_CALL hasLocale( const Locale& rLocale ) throw(RuntimeException);
110 :
111 : // XThesaurus
112 : virtual Sequence< Reference < ::com::sun::star::linguistic2::XMeaning > > SAL_CALL queryMeanings( const OUString& rTerm, const Locale& rLocale, const PropertyValues& rProperties ) throw(IllegalArgumentException, RuntimeException);
113 :
114 : // XServiceDisplayName
115 : virtual OUString SAL_CALL getServiceDisplayName( const Locale& rLocale ) throw(RuntimeException);
116 :
117 : // XInitialization
118 : virtual void SAL_CALL initialize( const Sequence< Any >& rArguments ) throw(Exception, RuntimeException);
119 :
120 : // XComponent
121 : virtual void SAL_CALL dispose() throw(RuntimeException);
122 : virtual void SAL_CALL addEventListener( const Reference< XEventListener >& rxListener ) throw(RuntimeException);
123 : virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& rxListener ) throw(RuntimeException);
124 :
125 : // XServiceInfo
126 : virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);
127 : virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) throw(RuntimeException);
128 : virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException);
129 :
130 :
131 : static inline OUString
132 : getImplementationName_Static() throw();
133 : static Sequence< OUString >
134 : getSupportedServiceNames_Static() throw();
135 :
136 : private:
137 : OUString SAL_CALL makeLowerCase(const OUString&, CharClass *);
138 : OUString SAL_CALL makeUpperCase(const OUString&, CharClass *);
139 : OUString SAL_CALL makeInitCap(const OUString&, CharClass *);
140 :
141 : /* static ::com::sun::star::uno::Reference<
142 : ::com::sun::star::linguistic2::XLinguServiceManager > xLngSvcMgr;
143 : static ::com::sun::star::uno::Reference<
144 : ::com::sun::star::linguistic2::XSpellChecker1 > xSpell;
145 : */
146 : static ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XLinguServiceManager > GetLngSvcMgr();
147 :
148 : };
149 :
150 0 : inline OUString Thesaurus::getImplementationName_Static() throw()
151 : {
152 0 : return A2OU( "org.openoffice.lingu.new.Thesaurus" );
153 : }
154 :
155 :
156 : ///////////////////////////////////////////////////////////////////////////
157 :
158 : #endif
159 :
160 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|