Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _LINGU2_THESIMP_HXX_
30 : : #define _LINGU2_THESIMP_HXX_
31 : :
32 : : #include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
33 : : #include <cppuhelper/implbase1.hxx> // helper for implementations
34 : : #include <cppuhelper/implbase5.hxx> // helper for implementations
35 : : #include <com/sun/star/uno/Reference.h>
36 : : #include <com/sun/star/uno/Sequence.h>
37 : : #include <com/sun/star/lang/XComponent.hpp>
38 : : #include <com/sun/star/lang/XInitialization.hpp>
39 : : #include <com/sun/star/lang/XServiceDisplayName.hpp>
40 : : #include <com/sun/star/beans/XPropertySet.hpp>
41 : : #include <com/sun/star/beans/PropertyValues.hpp>
42 : :
43 : : #include <com/sun/star/lang/XServiceInfo.hpp>
44 : : #include <com/sun/star/linguistic2/XMeaning.hpp>
45 : : #include <com/sun/star/linguistic2/XThesaurus.hpp>
46 : :
47 : : #include <com/sun/star/linguistic2/XLinguServiceManager.hpp>
48 : : #include <com/sun/star/linguistic2/XSpellChecker1.hpp>
49 : :
50 : : #include <unotools/charclass.hxx>
51 : :
52 : : #include <lingutil.hxx>
53 : : #include <linguistic/misc.hxx>
54 : : #include <linguistic/lngprophelp.hxx>
55 : :
56 : : #include <osl/file.hxx>
57 : : #include "mythes.hxx"
58 : :
59 : : using namespace ::rtl;
60 : : using namespace ::com::sun::star::uno;
61 : : using namespace ::com::sun::star::beans;
62 : : using namespace ::com::sun::star::lang;
63 : : using namespace ::com::sun::star::linguistic2;
64 : :
65 : : namespace com { namespace sun { namespace star { namespace beans {
66 : : class XPropertySet;
67 : : }}}}
68 : :
69 : :
70 : :
71 : : ///////////////////////////////////////////////////////////////////////////
72 : :
73 : :
74 : : class Thesaurus :
75 : : public cppu::WeakImplHelper5
76 : : <
77 : : XThesaurus,
78 : : XInitialization,
79 : : XComponent,
80 : : XServiceInfo,
81 : : XServiceDisplayName
82 : : >
83 : : {
84 : : Sequence< Locale > aSuppLocales;
85 : :
86 : : ::cppu::OInterfaceContainerHelper aEvtListeners;
87 : : linguistic::PropertyHelper_Thesaurus* pPropHelper;
88 : : sal_Bool bDisposing;
89 : : CharClass ** aCharSetInfo;
90 : : MyThes ** aThes;
91 : : rtl_TextEncoding * aTEncs;
92 : : Locale * aTLocs;
93 : : OUString * aTNames;
94 : : sal_Int32 numthes;
95 : :
96 : : // cache for the Thesaurus dialog
97 : : Sequence < Reference < ::com::sun::star::linguistic2::XMeaning > > prevMeanings;
98 : : OUString prevTerm;
99 : : sal_Int16 prevLocale;
100 : :
101 : : // disallow copy-constructor and assignment-operator for now
102 : : Thesaurus(const Thesaurus &);
103 : : Thesaurus & operator = (const Thesaurus &);
104 : :
105 : : linguistic::PropertyHelper_Thesaurus& GetPropHelper_Impl();
106 : 0 : linguistic::PropertyHelper_Thesaurus& GetPropHelper()
107 : : {
108 [ # # ]: 0 : return pPropHelper ? *pPropHelper : GetPropHelper_Impl();
109 : : }
110 : :
111 : :
112 : : public:
113 : : Thesaurus();
114 : : virtual ~Thesaurus();
115 : :
116 : : // XSupportedLocales (for XThesaurus)
117 : : virtual Sequence< Locale > SAL_CALL getLocales() throw(RuntimeException);
118 : : virtual sal_Bool SAL_CALL hasLocale( const Locale& rLocale ) throw(RuntimeException);
119 : :
120 : : // XThesaurus
121 : : virtual Sequence< Reference < ::com::sun::star::linguistic2::XMeaning > > SAL_CALL queryMeanings( const OUString& rTerm, const Locale& rLocale, const PropertyValues& rProperties ) throw(IllegalArgumentException, RuntimeException);
122 : :
123 : : // XServiceDisplayName
124 : : virtual OUString SAL_CALL getServiceDisplayName( const Locale& rLocale ) throw(RuntimeException);
125 : :
126 : : // XInitialization
127 : : virtual void SAL_CALL initialize( const Sequence< Any >& rArguments ) throw(Exception, RuntimeException);
128 : :
129 : : // XComponent
130 : : virtual void SAL_CALL dispose() throw(RuntimeException);
131 : : virtual void SAL_CALL addEventListener( const Reference< XEventListener >& rxListener ) throw(RuntimeException);
132 : : virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& rxListener ) throw(RuntimeException);
133 : :
134 : : // XServiceInfo
135 : : virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);
136 : : virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) throw(RuntimeException);
137 : : virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException);
138 : :
139 : :
140 : : static inline OUString
141 : : getImplementationName_Static() throw();
142 : : static Sequence< OUString >
143 : : getSupportedServiceNames_Static() throw();
144 : :
145 : : private:
146 : : sal_uInt16 SAL_CALL capitalType(const OUString&, CharClass *);
147 : : OUString SAL_CALL makeLowerCase(const OUString&, CharClass *);
148 : : OUString SAL_CALL makeUpperCase(const OUString&, CharClass *);
149 : : OUString SAL_CALL makeInitCap(const OUString&, CharClass *);
150 : :
151 : : /* static ::com::sun::star::uno::Reference<
152 : : ::com::sun::star::linguistic2::XLinguServiceManager > xLngSvcMgr;
153 : : static ::com::sun::star::uno::Reference<
154 : : ::com::sun::star::linguistic2::XSpellChecker1 > xSpell;
155 : : */
156 : : static ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XLinguServiceManager > GetLngSvcMgr();
157 : :
158 : : };
159 : :
160 : 140 : inline OUString Thesaurus::getImplementationName_Static() throw()
161 : : {
162 : 140 : return A2OU( "org.openoffice.lingu.new.Thesaurus" );
163 : : }
164 : :
165 : :
166 : : ///////////////////////////////////////////////////////////////////////////
167 : :
168 : : #endif
169 : :
170 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|