update dev300-m58
[ooovba.git] / linguistic / workben / sspellimp.hxx
blobdf866183bae54ff1d92d729920470514fe145463
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: sspellimp.hxx,v $
10 * $Revision: 1.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _LINGU2_SPELLIMP_HXX_
32 #define _LINGU2_SPELLIMP_HXX_
34 #include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
35 #include <cppuhelper/implbase1.hxx> // helper for implementations
36 #include <cppuhelper/implbase6.hxx> // helper for implementations
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 #include <com/sun/star/lang/XServiceInfo.hpp>
43 #include <com/sun/star/linguistic2/XSpellChecker.hpp>
44 #include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
45 #include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp>
46 #include <tools/table.hxx>
48 #include "misc.hxx"
49 #include "sprophelp.hxx"
51 using namespace ::rtl;
52 using namespace ::com::sun::star::uno;
53 using namespace ::com::sun::star::beans;
54 using namespace ::com::sun::star::lang;
55 using namespace ::com::sun::star::linguistic2;
58 #define A2OU(x) ::rtl::OUString::createFromAscii( x )
60 ///////////////////////////////////////////////////////////////////////////
63 class SpellChecker :
64 public cppu::WeakImplHelper6
66 XSpellChecker,
67 XLinguServiceEventBroadcaster,
68 XInitialization,
69 XComponent,
70 XServiceInfo,
71 XServiceDisplayName
74 Sequence< Locale > aSuppLocales;
75 ::cppu::OInterfaceContainerHelper aEvtListeners;
76 Reference< XPropertyChangeListener > xPropHelper;
77 PropertyHelper_Spell * pPropHelper;
78 BOOL bDisposing;
80 // disallow copy-constructor and assignment-operator for now
81 SpellChecker(const SpellChecker &);
82 SpellChecker & operator = (const SpellChecker &);
84 PropertyHelper_Spell & GetPropHelper_Impl();
85 PropertyHelper_Spell & GetPropHelper()
87 return pPropHelper ? *pPropHelper : GetPropHelper_Impl();
90 INT16 GetSpellFailure( const OUString &rWord, const Locale &rLocale );
91 Reference< XSpellAlternatives >
92 GetProposals( const OUString &rWord, const Locale &rLocale );
94 public:
95 SpellChecker();
96 virtual ~SpellChecker();
98 // XSupportedLocales (for XSpellChecker)
99 virtual Sequence< Locale > SAL_CALL
100 getLocales()
101 throw(RuntimeException);
102 virtual sal_Bool SAL_CALL
103 hasLocale( const Locale& rLocale )
104 throw(RuntimeException);
106 // XSpellChecker
107 virtual sal_Bool SAL_CALL
108 isValid( const OUString& rWord, const Locale& rLocale,
109 const PropertyValues& rProperties )
110 throw(IllegalArgumentException,
111 RuntimeException);
112 virtual Reference< XSpellAlternatives > SAL_CALL
113 spell( const OUString& rWord, const Locale& rLocale,
114 const PropertyValues& rProperties )
115 throw(IllegalArgumentException,
116 RuntimeException);
118 // XLinguServiceEventBroadcaster
119 virtual sal_Bool SAL_CALL
120 addLinguServiceEventListener(
121 const Reference< XLinguServiceEventListener >& rxLstnr )
122 throw(RuntimeException);
123 virtual sal_Bool SAL_CALL
124 removeLinguServiceEventListener(
125 const Reference< XLinguServiceEventListener >& rxLstnr )
126 throw(RuntimeException);
128 // XServiceDisplayName
129 virtual OUString SAL_CALL
130 getServiceDisplayName( const Locale& rLocale )
131 throw(RuntimeException);
133 // XInitialization
134 virtual void SAL_CALL
135 initialize( const Sequence< Any >& rArguments )
136 throw(Exception, RuntimeException);
138 // XComponent
139 virtual void SAL_CALL
140 dispose()
141 throw(RuntimeException);
142 virtual void SAL_CALL
143 addEventListener( const Reference< XEventListener >& rxListener )
144 throw(RuntimeException);
145 virtual void SAL_CALL
146 removeEventListener( const Reference< XEventListener >& rxListener )
147 throw(RuntimeException);
149 ////////////////////////////////////////////////////////////
150 // Service specific part
153 // XServiceInfo
154 virtual OUString SAL_CALL
155 getImplementationName()
156 throw(RuntimeException);
157 virtual sal_Bool SAL_CALL
158 supportsService( const OUString& rServiceName )
159 throw(RuntimeException);
160 virtual Sequence< OUString > SAL_CALL
161 getSupportedServiceNames()
162 throw(RuntimeException);
165 static inline OUString
166 getImplementationName_Static() throw();
167 static Sequence< OUString >
168 getSupportedServiceNames_Static() throw();
171 inline OUString SpellChecker::getImplementationName_Static() throw()
173 return A2OU( "com.sun.star.lingu.examples.SpellChecker" );
177 ///////////////////////////////////////////////////////////////////////////
179 #endif