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