Update ooo320-m1
[ooovba.git] / lingucomponent / source / spellcheck / macosxspell / macspellimp.hxx
blobc495f0883d038c7fb592126674ece92aa40e94a5
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: macspellimp.hxx,v $
10 * $Revision: 1.4 $
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 _MACSPELLIMP_H_
32 #define _MACSPELLIMP_H_
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
38 #ifdef MACOSX
39 #include <premac.h>
40 #include <Carbon/Carbon.h>
41 #import <Cocoa/Cocoa.h>
42 #include <postmac.h>
43 #endif
44 #include <com/sun/star/lang/XComponent.hpp>
45 #include <com/sun/star/lang/XInitialization.hpp>
46 #include <com/sun/star/lang/XServiceDisplayName.hpp>
47 #include <com/sun/star/beans/XPropertySet.hpp>
48 #include <com/sun/star/beans/PropertyValues.hpp>
49 #include <com/sun/star/lang/XServiceInfo.hpp>
50 #include <com/sun/star/linguistic2/XSpellChecker.hpp>
51 #include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
52 #include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp>
53 #include <tools/table.hxx>
55 #include <linguistic/misc.hxx>
56 #include <linguistic/lngprophelp.hxx>
58 #include <lingutil.hxx>
60 using namespace ::rtl;
61 using namespace ::com::sun::star::uno;
62 using namespace ::com::sun::star::beans;
63 using namespace ::com::sun::star::lang;
64 using namespace ::com::sun::star::linguistic2;
67 ///////////////////////////////////////////////////////////////////////////
70 class MacSpellChecker :
71 public cppu::WeakImplHelper6
73 XSpellChecker,
74 XLinguServiceEventBroadcaster,
75 XInitialization,
76 XComponent,
77 XServiceInfo,
78 XServiceDisplayName
81 Sequence< Locale > aSuppLocales;
82 // Hunspell ** aDicts;
83 rtl_TextEncoding * aDEncs;
84 Locale * aDLocs;
85 OUString * aDNames;
86 sal_Int32 numdict;
87 NSSpellChecker * macSpell;
88 int macTag; //unique tag for this doc
90 ::cppu::OInterfaceContainerHelper aEvtListeners;
91 Reference< XPropertyChangeListener > xPropHelper;
92 linguistic::PropertyHelper_Spell * pPropHelper;
93 BOOL bDisposing;
95 // disallow copy-constructor and assignment-operator for now
96 MacSpellChecker(const MacSpellChecker &);
97 MacSpellChecker & operator = (const MacSpellChecker &);
99 linguistic::PropertyHelper_Spell & GetPropHelper_Impl();
100 linguistic::PropertyHelper_Spell & GetPropHelper()
102 return pPropHelper ? *pPropHelper : GetPropHelper_Impl();
105 INT16 GetSpellFailure( const OUString &rWord, const Locale &rLocale );
106 Reference< XSpellAlternatives >
107 GetProposals( const OUString &rWord, const Locale &rLocale );
109 public:
110 MacSpellChecker();
111 virtual ~MacSpellChecker();
113 // XSupportedLocales (for XSpellChecker)
114 virtual Sequence< Locale > SAL_CALL
115 getLocales()
116 throw(RuntimeException);
117 virtual sal_Bool SAL_CALL
118 hasLocale( const Locale& rLocale )
119 throw(RuntimeException);
121 // XSpellChecker
122 virtual sal_Bool SAL_CALL
123 isValid( const OUString& rWord, const Locale& rLocale,
124 const PropertyValues& rProperties )
125 throw(IllegalArgumentException,
126 RuntimeException);
127 virtual Reference< XSpellAlternatives > SAL_CALL
128 spell( const OUString& rWord, const Locale& rLocale,
129 const PropertyValues& rProperties )
130 throw(IllegalArgumentException,
131 RuntimeException);
133 // XLinguServiceEventBroadcaster
134 virtual sal_Bool SAL_CALL
135 addLinguServiceEventListener(
136 const Reference< XLinguServiceEventListener >& rxLstnr )
137 throw(RuntimeException);
138 virtual sal_Bool SAL_CALL
139 removeLinguServiceEventListener(
140 const Reference< XLinguServiceEventListener >& rxLstnr )
141 throw(RuntimeException);
143 // XServiceDisplayName
144 virtual OUString SAL_CALL
145 getServiceDisplayName( const Locale& rLocale )
146 throw(RuntimeException);
148 // XInitialization
149 virtual void SAL_CALL
150 initialize( const Sequence< Any >& rArguments )
151 throw(Exception, RuntimeException);
153 // XComponent
154 virtual void SAL_CALL
155 dispose()
156 throw(RuntimeException);
157 virtual void SAL_CALL
158 addEventListener( const Reference< XEventListener >& rxListener )
159 throw(RuntimeException);
160 virtual void SAL_CALL
161 removeEventListener( const Reference< XEventListener >& rxListener )
162 throw(RuntimeException);
164 ////////////////////////////////////////////////////////////
165 // Service specific part
168 // XServiceInfo
169 virtual OUString SAL_CALL
170 getImplementationName()
171 throw(RuntimeException);
172 virtual sal_Bool SAL_CALL
173 supportsService( const OUString& rServiceName )
174 throw(RuntimeException);
175 virtual Sequence< OUString > SAL_CALL
176 getSupportedServiceNames()
177 throw(RuntimeException);
180 static inline OUString
181 getImplementationName_Static() throw();
182 static Sequence< OUString >
183 getSupportedServiceNames_Static() throw();
186 inline OUString MacSpellChecker::getImplementationName_Static() throw()
188 return A2OU( "org.openoffice.lingu.MacOSXSpellChecker" );
193 ///////////////////////////////////////////////////////////////////////////
195 #endif