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 <comphelper/interfacecontainer3.hxx>
24 #include <cppuhelper/implbase.hxx>
28 #import <Cocoa/Cocoa.h>
30 #include <UIKit/UIKit.h>
33 #include <com/sun/star/lang/XComponent.hpp>
34 #include <com/sun/star/lang/XInitialization.hpp>
35 #include <com/sun/star/lang/XServiceDisplayName.hpp>
36 #include <com/sun/star/beans/XPropertySet.hpp>
37 #include <com/sun/star/lang/XServiceInfo.hpp>
38 #include <com/sun/star/linguistic2/XSpellChecker.hpp>
39 #include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp>
41 #include <linguistic/misc.hxx>
42 #include <linguistic/lngprophelp.hxx>
44 #include <lingutil.hxx>
46 using namespace ::com::sun::star::uno
;
47 using namespace ::com::sun::star::beans
;
48 using namespace ::com::sun::star::lang
;
49 using namespace ::com::sun::star::linguistic2
;
51 class MacSpellChecker
:
52 public cppu::WeakImplHelper
55 XLinguServiceEventBroadcaster
,
62 Sequence
< Locale
> aSuppLocales
;
63 rtl_TextEncoding
* aDEncs
;
68 int macTag
; // unique tag for this doc
70 UITextChecker
* pChecker
;
72 ::comphelper::OInterfaceContainerHelper3
<XEventListener
> aEvtListeners
;
73 rtl::Reference
< linguistic::PropertyHelper_Spell
> xPropHelper
;
76 MacSpellChecker(const MacSpellChecker
&) = delete;
77 MacSpellChecker
& operator = (const MacSpellChecker
&) = delete;
79 linguistic::PropertyHelper_Spell
& GetPropHelper_Impl();
80 linguistic::PropertyHelper_Spell
& GetPropHelper()
82 return xPropHelper
.is() ? *xPropHelper
: 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() override
;
92 // XSupportedLocales (for XSpellChecker)
93 virtual Sequence
< Locale
> SAL_CALL
getLocales() override
;
94 virtual sal_Bool SAL_CALL
hasLocale( const Locale
& rLocale
) override
;
97 virtual sal_Bool SAL_CALL
isValid( const OUString
& rWord
, const Locale
& rLocale
, const css::uno::Sequence
<PropertyValue
>& rProperties
) override
;
98 virtual Reference
< XSpellAlternatives
> SAL_CALL
spell( const OUString
& rWord
, const Locale
& rLocale
, const css::uno::Sequence
<PropertyValue
>& rProperties
) override
;
100 // XLinguServiceEventBroadcaster
101 virtual sal_Bool SAL_CALL
addLinguServiceEventListener( const Reference
< XLinguServiceEventListener
>& rxLstnr
) override
;
102 virtual sal_Bool SAL_CALL
removeLinguServiceEventListener( const Reference
< XLinguServiceEventListener
>& rxLstnr
) override
;
104 // XServiceDisplayName
105 virtual OUString SAL_CALL
getServiceDisplayName( const Locale
& rLocale
) override
;
108 virtual void SAL_CALL
initialize( const Sequence
< Any
>& rArguments
) override
;
111 virtual void SAL_CALL
dispose() override
;
112 virtual void SAL_CALL
addEventListener( const Reference
< XEventListener
>& rxListener
) override
;
113 virtual void SAL_CALL
removeEventListener( const Reference
< XEventListener
>& rxListener
) override
;
116 virtual OUString SAL_CALL
getImplementationName() override
;
117 virtual sal_Bool SAL_CALL
supportsService( const OUString
& rServiceName
) override
;
118 virtual Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */