bump product version to 6.3.0.0.beta1
[LibreOffice.git] / lingucomponent / source / spellcheck / macosxspell / macspellimp.hxx
blobfea3ba77c742c1313101de45666e22cb591dd109
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/implbase.hxx>
25 #include <premac.h>
26 #ifdef MACOSX
27 #include <Carbon/Carbon.h>
28 #import <Cocoa/Cocoa.h>
29 #else
30 #include <UIKit/UIKit.h>
31 #endif
32 #include <postmac.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
54 XSpellChecker,
55 XLinguServiceEventBroadcaster,
56 XInitialization,
57 XComponent,
58 XServiceInfo,
59 XServiceDisplayName
62 Sequence< Locale > aSuppLocales;
63 rtl_TextEncoding * aDEncs;
64 Locale * aDLocs;
65 OUString * aDNames;
66 sal_Int32 numdict;
67 #ifdef MACOSX
68 int macTag; // unique tag for this doc
69 #else
70 UITextChecker * pChecker;
71 #endif
72 ::comphelper::OInterfaceContainerHelper2 aEvtListeners;
73 Reference< XPropertyChangeListener > xPropHelper;
74 linguistic::PropertyHelper_Spell * pPropHelper;
75 bool bDisposing;
77 MacSpellChecker(const MacSpellChecker &) = delete;
78 MacSpellChecker & operator = (const MacSpellChecker &) = delete;
80 linguistic::PropertyHelper_Spell & GetPropHelper_Impl();
81 linguistic::PropertyHelper_Spell & GetPropHelper()
83 return pPropHelper ? *pPropHelper : GetPropHelper_Impl();
86 sal_Int16 GetSpellFailure( const OUString &rWord, const Locale &rLocale );
87 Reference< XSpellAlternatives > GetProposals( const OUString &rWord, const Locale &rLocale );
89 public:
90 MacSpellChecker();
91 virtual ~MacSpellChecker() override;
93 // XSupportedLocales (for XSpellChecker)
94 virtual Sequence< Locale > SAL_CALL getLocales() override;
95 virtual sal_Bool SAL_CALL hasLocale( const Locale& rLocale ) override;
97 // XSpellChecker
98 virtual sal_Bool SAL_CALL isValid( const OUString& rWord, const Locale& rLocale, const css::uno::Sequence<PropertyValue>& rProperties ) override;
99 virtual Reference< XSpellAlternatives > SAL_CALL spell( const OUString& rWord, const Locale& rLocale, const css::uno::Sequence<PropertyValue>& rProperties ) override;
101 // XLinguServiceEventBroadcaster
102 virtual sal_Bool SAL_CALL addLinguServiceEventListener( const Reference< XLinguServiceEventListener >& rxLstnr ) override;
103 virtual sal_Bool SAL_CALL removeLinguServiceEventListener( const Reference< XLinguServiceEventListener >& rxLstnr ) override;
105 // XServiceDisplayName
106 virtual OUString SAL_CALL getServiceDisplayName( const Locale& rLocale ) override;
108 // XInitialization
109 virtual void SAL_CALL initialize( const Sequence< Any >& rArguments ) override;
111 // XComponent
112 virtual void SAL_CALL dispose() override;
113 virtual void SAL_CALL addEventListener( const Reference< XEventListener >& rxListener ) override;
114 virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& rxListener ) override;
116 // XServiceInfo
117 virtual OUString SAL_CALL getImplementationName() override;
118 virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) override;
119 virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
121 static inline OUString getImplementationName_Static() throw();
122 static Sequence< OUString > getSupportedServiceNames_Static() throw();
125 inline OUString MacSpellChecker::getImplementationName_Static() throw()
127 return OUString( "org.openoffice.lingu.MacOSXSpellChecker" );
130 #endif
132 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */