bump product version to 4.2.0.1
[LibreOffice.git] / lingucomponent / source / spellcheck / macosxspell / macspellimp.hxx
blob06db94287907e581e117a67cf5440d878c835a0a
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 _MACSPELLIMP_H_
21 #define _MACSPELLIMP_H_
23 #include <uno/lbnames.h>
24 #include <cppuhelper/implbase1.hxx>
25 #include <cppuhelper/implbase6.hxx>
27 #ifdef MACOSX
28 #include <premac.h>
29 #include <Carbon/Carbon.h>
30 #import <Cocoa/Cocoa.h>
31 #include <postmac.h>
32 #endif
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/beans/PropertyValues.hpp>
38 #include <com/sun/star/lang/XServiceInfo.hpp>
39 #include <com/sun/star/linguistic2/XSpellChecker.hpp>
40 #include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
41 #include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp>
43 #include <linguistic/misc.hxx>
44 #include <linguistic/lngprophelp.hxx>
46 #include <lingutil.hxx>
48 using namespace ::com::sun::star::uno;
49 using namespace ::com::sun::star::beans;
50 using namespace ::com::sun::star::lang;
51 using namespace ::com::sun::star::linguistic2;
53 ///////////////////////////////////////////////////////////////////////////
56 class MacSpellChecker :
57 public cppu::WeakImplHelper6
59 XSpellChecker,
60 XLinguServiceEventBroadcaster,
61 XInitialization,
62 XComponent,
63 XServiceInfo,
64 XServiceDisplayName
67 Sequence< Locale > aSuppLocales;
68 rtl_TextEncoding * aDEncs;
69 Locale * aDLocs;
70 OUString * aDNames;
71 sal_Int32 numdict;
72 NSSpellChecker * macSpell;
73 int macTag; //unique tag for this doc
75 ::cppu::OInterfaceContainerHelper aEvtListeners;
76 Reference< XPropertyChangeListener > xPropHelper;
77 linguistic::PropertyHelper_Spell * pPropHelper;
78 bool bDisposing;
80 // disallow copy-constructor and assignment-operator for now
81 MacSpellChecker(const MacSpellChecker &);
82 MacSpellChecker & operator = (const MacSpellChecker &);
84 linguistic::PropertyHelper_Spell & GetPropHelper_Impl();
85 linguistic::PropertyHelper_Spell & GetPropHelper()
87 return pPropHelper ? *pPropHelper : GetPropHelper_Impl();
90 sal_Int16 GetSpellFailure( const OUString &rWord, const Locale &rLocale );
91 Reference< XSpellAlternatives > GetProposals( const OUString &rWord, const Locale &rLocale );
93 public:
94 MacSpellChecker();
95 virtual ~MacSpellChecker();
97 // XSupportedLocales (for XSpellChecker)
98 virtual Sequence< Locale > SAL_CALL getLocales() throw(RuntimeException);
99 virtual sal_Bool SAL_CALL hasLocale( const Locale& rLocale ) throw(RuntimeException);
101 // XSpellChecker
102 virtual sal_Bool SAL_CALL isValid( const OUString& rWord, const Locale& rLocale, const PropertyValues& rProperties ) throw(IllegalArgumentException, RuntimeException);
103 virtual Reference< XSpellAlternatives > SAL_CALL spell( const OUString& rWord, const Locale& rLocale, const PropertyValues& rProperties ) throw(IllegalArgumentException, RuntimeException);
105 // XLinguServiceEventBroadcaster
106 virtual sal_Bool SAL_CALL addLinguServiceEventListener( const Reference< XLinguServiceEventListener >& rxLstnr ) throw(RuntimeException);
107 virtual sal_Bool SAL_CALL removeLinguServiceEventListener( const Reference< XLinguServiceEventListener >& rxLstnr ) throw(RuntimeException);
109 // XServiceDisplayName
110 virtual OUString SAL_CALL getServiceDisplayName( const Locale& rLocale ) throw(RuntimeException);
112 // XInitialization
113 virtual void SAL_CALL initialize( const Sequence< Any >& rArguments ) throw(Exception, RuntimeException);
115 // XComponent
116 virtual void SAL_CALL dispose() throw(RuntimeException);
117 virtual void SAL_CALL addEventListener( const Reference< XEventListener >& rxListener ) throw(RuntimeException);
118 virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& rxListener ) throw(RuntimeException);
120 // XServiceInfo
121 virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);
122 virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) throw(RuntimeException);
123 virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException);
126 static inline OUString getImplementationName_Static() throw();
127 static Sequence< OUString > getSupportedServiceNames_Static() throw();
130 inline OUString MacSpellChecker::getImplementationName_Static() throw()
132 return OUString( "org.openoffice.lingu.MacOSXSpellChecker" );
137 ///////////////////////////////////////////////////////////////////////////
139 #endif
141 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */