1*b1cdbd2cSJim Jagielski /**************************************************************
2*b1cdbd2cSJim Jagielski *
3*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one
4*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file
5*b1cdbd2cSJim Jagielski * distributed with this work for additional information
6*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file
7*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the
8*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance
9*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at
10*b1cdbd2cSJim Jagielski *
11*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0
12*b1cdbd2cSJim Jagielski *
13*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing,
14*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an
15*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the
17*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations
18*b1cdbd2cSJim Jagielski * under the License.
19*b1cdbd2cSJim Jagielski *
20*b1cdbd2cSJim Jagielski *************************************************************/
21*b1cdbd2cSJim Jagielski
22*b1cdbd2cSJim Jagielski
23*b1cdbd2cSJim Jagielski
24*b1cdbd2cSJim Jagielski #ifndef _LINGU2_SPELLIMP_HXX_
25*b1cdbd2cSJim Jagielski #define _LINGU2_SPELLIMP_HXX_
26*b1cdbd2cSJim Jagielski
27*b1cdbd2cSJim Jagielski #include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
28*b1cdbd2cSJim Jagielski #include <cppuhelper/implbase1.hxx> // helper for implementations
29*b1cdbd2cSJim Jagielski #include <cppuhelper/implbase6.hxx> // helper for implementations
30*b1cdbd2cSJim Jagielski #include <com/sun/star/lang/XComponent.hpp>
31*b1cdbd2cSJim Jagielski #include <com/sun/star/lang/XInitialization.hpp>
32*b1cdbd2cSJim Jagielski #include <com/sun/star/lang/XServiceDisplayName.hpp>
33*b1cdbd2cSJim Jagielski #include <com/sun/star/beans/XPropertySet.hpp>
34*b1cdbd2cSJim Jagielski #include <com/sun/star/beans/PropertyValues.hpp>
35*b1cdbd2cSJim Jagielski #include <com/sun/star/lang/XServiceInfo.hpp>
36*b1cdbd2cSJim Jagielski #include <com/sun/star/linguistic2/XSpellChecker.hpp>
37*b1cdbd2cSJim Jagielski #include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
38*b1cdbd2cSJim Jagielski #include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp>
39*b1cdbd2cSJim Jagielski #include <tools/table.hxx>
40*b1cdbd2cSJim Jagielski
41*b1cdbd2cSJim Jagielski #include "linguistic/misc.hxx"
42*b1cdbd2cSJim Jagielski #include "sprophelp.hxx"
43*b1cdbd2cSJim Jagielski
44*b1cdbd2cSJim Jagielski using namespace ::rtl;
45*b1cdbd2cSJim Jagielski using namespace ::com::sun::star::uno;
46*b1cdbd2cSJim Jagielski using namespace ::com::sun::star::beans;
47*b1cdbd2cSJim Jagielski using namespace ::com::sun::star::lang;
48*b1cdbd2cSJim Jagielski using namespace ::com::sun::star::linguistic2;
49*b1cdbd2cSJim Jagielski
50*b1cdbd2cSJim Jagielski
51*b1cdbd2cSJim Jagielski #define A2OU(x) ::rtl::OUString::createFromAscii( x )
52*b1cdbd2cSJim Jagielski
53*b1cdbd2cSJim Jagielski ///////////////////////////////////////////////////////////////////////////
54*b1cdbd2cSJim Jagielski
55*b1cdbd2cSJim Jagielski
56*b1cdbd2cSJim Jagielski class SpellChecker :
57*b1cdbd2cSJim Jagielski public cppu::WeakImplHelper6
58*b1cdbd2cSJim Jagielski <
59*b1cdbd2cSJim Jagielski XSpellChecker,
60*b1cdbd2cSJim Jagielski XLinguServiceEventBroadcaster,
61*b1cdbd2cSJim Jagielski XInitialization,
62*b1cdbd2cSJim Jagielski XComponent,
63*b1cdbd2cSJim Jagielski XServiceInfo,
64*b1cdbd2cSJim Jagielski XServiceDisplayName
65*b1cdbd2cSJim Jagielski >
66*b1cdbd2cSJim Jagielski {
67*b1cdbd2cSJim Jagielski Sequence< Locale > aSuppLocales;
68*b1cdbd2cSJim Jagielski ::cppu::OInterfaceContainerHelper aEvtListeners;
69*b1cdbd2cSJim Jagielski Reference< XPropertyChangeListener > xPropHelper;
70*b1cdbd2cSJim Jagielski PropertyHelper_Spell * pPropHelper;
71*b1cdbd2cSJim Jagielski BOOL bDisposing;
72*b1cdbd2cSJim Jagielski
73*b1cdbd2cSJim Jagielski // disallow copy-constructor and assignment-operator for now
74*b1cdbd2cSJim Jagielski SpellChecker(const SpellChecker &);
75*b1cdbd2cSJim Jagielski SpellChecker & operator = (const SpellChecker &);
76*b1cdbd2cSJim Jagielski
77*b1cdbd2cSJim Jagielski PropertyHelper_Spell & GetPropHelper_Impl();
GetPropHelper()78*b1cdbd2cSJim Jagielski PropertyHelper_Spell & GetPropHelper()
79*b1cdbd2cSJim Jagielski {
80*b1cdbd2cSJim Jagielski return pPropHelper ? *pPropHelper : GetPropHelper_Impl();
81*b1cdbd2cSJim Jagielski }
82*b1cdbd2cSJim Jagielski
83*b1cdbd2cSJim Jagielski INT16 GetSpellFailure( const OUString &rWord, const Locale &rLocale );
84*b1cdbd2cSJim Jagielski Reference< XSpellAlternatives >
85*b1cdbd2cSJim Jagielski GetProposals( const OUString &rWord, const Locale &rLocale );
86*b1cdbd2cSJim Jagielski
87*b1cdbd2cSJim Jagielski public:
88*b1cdbd2cSJim Jagielski SpellChecker();
89*b1cdbd2cSJim Jagielski virtual ~SpellChecker();
90*b1cdbd2cSJim Jagielski
91*b1cdbd2cSJim Jagielski // XSupportedLocales (for XSpellChecker)
92*b1cdbd2cSJim Jagielski virtual Sequence< Locale > SAL_CALL
93*b1cdbd2cSJim Jagielski getLocales()
94*b1cdbd2cSJim Jagielski throw(RuntimeException);
95*b1cdbd2cSJim Jagielski virtual sal_Bool SAL_CALL
96*b1cdbd2cSJim Jagielski hasLocale( const Locale& rLocale )
97*b1cdbd2cSJim Jagielski throw(RuntimeException);
98*b1cdbd2cSJim Jagielski
99*b1cdbd2cSJim Jagielski // XSpellChecker
100*b1cdbd2cSJim Jagielski virtual sal_Bool SAL_CALL
101*b1cdbd2cSJim Jagielski isValid( const OUString& rWord, const Locale& rLocale,
102*b1cdbd2cSJim Jagielski const PropertyValues& rProperties )
103*b1cdbd2cSJim Jagielski throw(IllegalArgumentException,
104*b1cdbd2cSJim Jagielski RuntimeException);
105*b1cdbd2cSJim Jagielski virtual Reference< XSpellAlternatives > SAL_CALL
106*b1cdbd2cSJim Jagielski spell( const OUString& rWord, const Locale& rLocale,
107*b1cdbd2cSJim Jagielski const PropertyValues& rProperties )
108*b1cdbd2cSJim Jagielski throw(IllegalArgumentException,
109*b1cdbd2cSJim Jagielski RuntimeException);
110*b1cdbd2cSJim Jagielski
111*b1cdbd2cSJim Jagielski // XLinguServiceEventBroadcaster
112*b1cdbd2cSJim Jagielski virtual sal_Bool SAL_CALL
113*b1cdbd2cSJim Jagielski addLinguServiceEventListener(
114*b1cdbd2cSJim Jagielski const Reference< XLinguServiceEventListener >& rxLstnr )
115*b1cdbd2cSJim Jagielski throw(RuntimeException);
116*b1cdbd2cSJim Jagielski virtual sal_Bool SAL_CALL
117*b1cdbd2cSJim Jagielski removeLinguServiceEventListener(
118*b1cdbd2cSJim Jagielski const Reference< XLinguServiceEventListener >& rxLstnr )
119*b1cdbd2cSJim Jagielski throw(RuntimeException);
120*b1cdbd2cSJim Jagielski
121*b1cdbd2cSJim Jagielski // XServiceDisplayName
122*b1cdbd2cSJim Jagielski virtual OUString SAL_CALL
123*b1cdbd2cSJim Jagielski getServiceDisplayName( const Locale& rLocale )
124*b1cdbd2cSJim Jagielski throw(RuntimeException);
125*b1cdbd2cSJim Jagielski
126*b1cdbd2cSJim Jagielski // XInitialization
127*b1cdbd2cSJim Jagielski virtual void SAL_CALL
128*b1cdbd2cSJim Jagielski initialize( const Sequence< Any >& rArguments )
129*b1cdbd2cSJim Jagielski throw(Exception, RuntimeException);
130*b1cdbd2cSJim Jagielski
131*b1cdbd2cSJim Jagielski // XComponent
132*b1cdbd2cSJim Jagielski virtual void SAL_CALL
133*b1cdbd2cSJim Jagielski dispose()
134*b1cdbd2cSJim Jagielski throw(RuntimeException);
135*b1cdbd2cSJim Jagielski virtual void SAL_CALL
136*b1cdbd2cSJim Jagielski addEventListener( const Reference< XEventListener >& rxListener )
137*b1cdbd2cSJim Jagielski throw(RuntimeException);
138*b1cdbd2cSJim Jagielski virtual void SAL_CALL
139*b1cdbd2cSJim Jagielski removeEventListener( const Reference< XEventListener >& rxListener )
140*b1cdbd2cSJim Jagielski throw(RuntimeException);
141*b1cdbd2cSJim Jagielski
142*b1cdbd2cSJim Jagielski ////////////////////////////////////////////////////////////
143*b1cdbd2cSJim Jagielski // Service specific part
144*b1cdbd2cSJim Jagielski //
145*b1cdbd2cSJim Jagielski
146*b1cdbd2cSJim Jagielski // XServiceInfo
147*b1cdbd2cSJim Jagielski virtual OUString SAL_CALL
148*b1cdbd2cSJim Jagielski getImplementationName()
149*b1cdbd2cSJim Jagielski throw(RuntimeException);
150*b1cdbd2cSJim Jagielski virtual sal_Bool SAL_CALL
151*b1cdbd2cSJim Jagielski supportsService( const OUString& rServiceName )
152*b1cdbd2cSJim Jagielski throw(RuntimeException);
153*b1cdbd2cSJim Jagielski virtual Sequence< OUString > SAL_CALL
154*b1cdbd2cSJim Jagielski getSupportedServiceNames()
155*b1cdbd2cSJim Jagielski throw(RuntimeException);
156*b1cdbd2cSJim Jagielski
157*b1cdbd2cSJim Jagielski
158*b1cdbd2cSJim Jagielski static inline OUString
159*b1cdbd2cSJim Jagielski getImplementationName_Static() throw();
160*b1cdbd2cSJim Jagielski static Sequence< OUString >
161*b1cdbd2cSJim Jagielski getSupportedServiceNames_Static() throw();
162*b1cdbd2cSJim Jagielski };
163*b1cdbd2cSJim Jagielski
getImplementationName_Static()164*b1cdbd2cSJim Jagielski inline OUString SpellChecker::getImplementationName_Static() throw()
165*b1cdbd2cSJim Jagielski {
166*b1cdbd2cSJim Jagielski return A2OU( "com.sun.star.lingu.examples.SpellChecker" );
167*b1cdbd2cSJim Jagielski }
168*b1cdbd2cSJim Jagielski
169*b1cdbd2cSJim Jagielski
170*b1cdbd2cSJim Jagielski ///////////////////////////////////////////////////////////////////////////
171*b1cdbd2cSJim Jagielski
172*b1cdbd2cSJim Jagielski #endif
173*b1cdbd2cSJim Jagielski
174