1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_LINGUCOMPONENT_SOURCE_SPELLCHECK_MACOSXSPELL_MACSPELLIMP_HXX
21 #define INCLUDED_LINGUCOMPONENT_SOURCE_SPELLCHECK_MACOSXSPELL_MACSPELLIMP_HXX
23 #include <cppuhelper/implbase1.hxx>
24 #include <cppuhelper/implbase6.hxx>
28 #include <Carbon/Carbon.h>
29 #import <Cocoa/Cocoa.h>
32 #include <com/sun/star/lang/XComponent.hpp>
33 #include <com/sun/star/lang/XInitialization.hpp>
34 #include <com/sun/star/lang/XServiceDisplayName.hpp>
35 #include <com/sun/star/beans/XPropertySet.hpp>
36 #include <com/sun/star/beans/PropertyValues.hpp>
37 #include <com/sun/star/lang/XServiceInfo.hpp>
38 #include <com/sun/star/linguistic2/XSpellChecker.hpp>
39 #include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
40 #include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp>
42 #include <linguistic/misc.hxx>
43 #include <linguistic/lngprophelp.hxx>
45 #include <lingutil.hxx>
47 using namespace ::com::sun::star::uno
;
48 using namespace ::com::sun::star::beans
;
49 using namespace ::com::sun::star::lang
;
50 using namespace ::com::sun::star::linguistic2
;
52 class MacSpellChecker
:
53 public cppu::WeakImplHelper6
56 XLinguServiceEventBroadcaster
,
63 Sequence
< Locale
> aSuppLocales
;
64 rtl_TextEncoding
* aDEncs
;
68 NSSpellChecker
* macSpell
;
69 int macTag
; // unique tag for this doc
71 ::cppu::OInterfaceContainerHelper aEvtListeners
;
72 Reference
< XPropertyChangeListener
> xPropHelper
;
73 linguistic::PropertyHelper_Spell
* pPropHelper
;
76 MacSpellChecker(const MacSpellChecker
&) SAL_DELETED_FUNCTION
;
77 MacSpellChecker
& operator = (const MacSpellChecker
&) SAL_DELETED_FUNCTION
;
79 linguistic::PropertyHelper_Spell
& GetPropHelper_Impl();
80 linguistic::PropertyHelper_Spell
& GetPropHelper()
82 return pPropHelper
? *pPropHelper
: GetPropHelper_Impl();
85 sal_Int16
GetSpellFailure( const OUString
&rWord
, const Locale
&rLocale
);
86 Reference
< XSpellAlternatives
> GetProposals( const OUString
&rWord
, const Locale
&rLocale
);
90 virtual ~MacSpellChecker();
92 // XSupportedLocales (for XSpellChecker)
93 virtual Sequence
< Locale
> SAL_CALL
getLocales() throw(RuntimeException
) SAL_OVERRIDE
;
94 virtual sal_Bool SAL_CALL
hasLocale( const Locale
& rLocale
) throw(RuntimeException
) SAL_OVERRIDE
;
97 virtual sal_Bool SAL_CALL
isValid( const OUString
& rWord
, const Locale
& rLocale
, const PropertyValues
& rProperties
) throw(IllegalArgumentException
, RuntimeException
) SAL_OVERRIDE
;
98 virtual Reference
< XSpellAlternatives
> SAL_CALL
spell( const OUString
& rWord
, const Locale
& rLocale
, const PropertyValues
& rProperties
) throw(IllegalArgumentException
, RuntimeException
) SAL_OVERRIDE
;
100 // XLinguServiceEventBroadcaster
101 virtual sal_Bool SAL_CALL
addLinguServiceEventListener( const Reference
< XLinguServiceEventListener
>& rxLstnr
) throw(RuntimeException
) SAL_OVERRIDE
;
102 virtual sal_Bool SAL_CALL
removeLinguServiceEventListener( const Reference
< XLinguServiceEventListener
>& rxLstnr
) throw(RuntimeException
) SAL_OVERRIDE
;
104 // XServiceDisplayName
105 virtual OUString SAL_CALL
getServiceDisplayName( const Locale
& rLocale
) throw(RuntimeException
) SAL_OVERRIDE
;
108 virtual void SAL_CALL
initialize( const Sequence
< Any
>& rArguments
) throw(Exception
, RuntimeException
) SAL_OVERRIDE
;
111 virtual void SAL_CALL
dispose() throw(RuntimeException
) SAL_OVERRIDE
;
112 virtual void SAL_CALL
addEventListener( const Reference
< XEventListener
>& rxListener
) throw(RuntimeException
) SAL_OVERRIDE
;
113 virtual void SAL_CALL
removeEventListener( const Reference
< XEventListener
>& rxListener
) throw(RuntimeException
) SAL_OVERRIDE
;
116 virtual OUString SAL_CALL
getImplementationName() throw(RuntimeException
) SAL_OVERRIDE
;
117 virtual sal_Bool SAL_CALL
supportsService( const OUString
& rServiceName
) throw(RuntimeException
) SAL_OVERRIDE
;
118 virtual Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() throw(RuntimeException
) SAL_OVERRIDE
;
120 static inline OUString
getImplementationName_Static() throw();
121 static Sequence
< OUString
> getSupportedServiceNames_Static() throw();
124 inline OUString
MacSpellChecker::getImplementationName_Static() throw()
126 return OUString( "org.openoffice.lingu.MacOSXSpellChecker" );
129 void * SAL_CALL
MacSpellChecker_getFactory(
130 char const * pImplName
, XMultiServiceFactory
* pServiceManager
, void *);
134 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */