2010-10-27 12:45:03 +01:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-10-08 10:00:18 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
2007-09-13 17:06:21 +00:00
|
|
|
*
|
2012-10-08 10:00:18 +01:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
2007-09-13 17:06:21 +00:00
|
|
|
*
|
2012-10-08 10:00:18 +01:00
|
|
|
* This file incorporates work covered by the following license notice:
|
2007-09-13 17:06:21 +00:00
|
|
|
*
|
2012-10-08 10:00:18 +01:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2007-09-13 17:06:21 +00:00
|
|
|
|
2014-04-18 22:47:44 +02:00
|
|
|
#ifndef INCLUDED_LINGUCOMPONENT_SOURCE_SPELLCHECK_MACOSXSPELL_MACSPELLIMP_HXX
|
|
|
|
#define INCLUDED_LINGUCOMPONENT_SOURCE_SPELLCHECK_MACOSXSPELL_MACSPELLIMP_HXX
|
2007-09-13 17:06:21 +00:00
|
|
|
|
2013-10-22 15:58:57 +03:00
|
|
|
#include <cppuhelper/implbase1.hxx>
|
|
|
|
#include <cppuhelper/implbase6.hxx>
|
2007-09-13 17:06:21 +00:00
|
|
|
|
|
|
|
#ifdef MACOSX
|
|
|
|
#include <premac.h>
|
|
|
|
#include <Carbon/Carbon.h>
|
|
|
|
#import <Cocoa/Cocoa.h>
|
|
|
|
#include <postmac.h>
|
|
|
|
#endif
|
|
|
|
#include <com/sun/star/lang/XComponent.hpp>
|
|
|
|
#include <com/sun/star/lang/XInitialization.hpp>
|
|
|
|
#include <com/sun/star/lang/XServiceDisplayName.hpp>
|
|
|
|
#include <com/sun/star/beans/XPropertySet.hpp>
|
|
|
|
#include <com/sun/star/beans/PropertyValues.hpp>
|
|
|
|
#include <com/sun/star/lang/XServiceInfo.hpp>
|
|
|
|
#include <com/sun/star/linguistic2/XSpellChecker.hpp>
|
|
|
|
#include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
|
|
|
|
#include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp>
|
|
|
|
|
|
|
|
#include <linguistic/misc.hxx>
|
2009-05-19 09:31:27 +00:00
|
|
|
#include <linguistic/lngprophelp.hxx>
|
|
|
|
|
|
|
|
#include <lingutil.hxx>
|
2007-09-13 17:06:21 +00:00
|
|
|
|
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star::beans;
|
|
|
|
using namespace ::com::sun::star::lang;
|
|
|
|
using namespace ::com::sun::star::linguistic2;
|
|
|
|
|
|
|
|
class MacSpellChecker :
|
|
|
|
public cppu::WeakImplHelper6
|
|
|
|
<
|
|
|
|
XSpellChecker,
|
|
|
|
XLinguServiceEventBroadcaster,
|
|
|
|
XInitialization,
|
|
|
|
XComponent,
|
|
|
|
XServiceInfo,
|
|
|
|
XServiceDisplayName
|
|
|
|
>
|
|
|
|
{
|
2010-07-21 16:29:56 +02:00
|
|
|
Sequence< Locale > aSuppLocales;
|
|
|
|
rtl_TextEncoding * aDEncs;
|
|
|
|
Locale * aDLocs;
|
|
|
|
OUString * aDNames;
|
|
|
|
sal_Int32 numdict;
|
|
|
|
NSSpellChecker * macSpell;
|
2014-02-26 16:06:37 +01:00
|
|
|
int macTag; // unique tag for this doc
|
2007-09-13 17:06:21 +00:00
|
|
|
|
|
|
|
::cppu::OInterfaceContainerHelper aEvtListeners;
|
|
|
|
Reference< XPropertyChangeListener > xPropHelper;
|
2009-05-19 09:31:27 +00:00
|
|
|
linguistic::PropertyHelper_Spell * pPropHelper;
|
2012-09-25 15:37:34 +02:00
|
|
|
bool bDisposing;
|
2007-09-13 17:06:21 +00:00
|
|
|
|
2015-02-07 17:24:28 +01:00
|
|
|
MacSpellChecker(const MacSpellChecker &) SAL_DELETED_FUNCTION;
|
|
|
|
MacSpellChecker & operator = (const MacSpellChecker &) SAL_DELETED_FUNCTION;
|
2007-09-13 17:06:21 +00:00
|
|
|
|
2009-05-19 09:31:27 +00:00
|
|
|
linguistic::PropertyHelper_Spell & GetPropHelper_Impl();
|
|
|
|
linguistic::PropertyHelper_Spell & GetPropHelper()
|
2007-09-13 17:06:21 +00:00
|
|
|
{
|
|
|
|
return pPropHelper ? *pPropHelper : GetPropHelper_Impl();
|
|
|
|
}
|
|
|
|
|
2011-01-07 18:15:52 +01:00
|
|
|
sal_Int16 GetSpellFailure( const OUString &rWord, const Locale &rLocale );
|
2010-07-21 16:29:56 +02:00
|
|
|
Reference< XSpellAlternatives > GetProposals( const OUString &rWord, const Locale &rLocale );
|
2007-09-13 17:06:21 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
MacSpellChecker();
|
|
|
|
virtual ~MacSpellChecker();
|
|
|
|
|
|
|
|
// XSupportedLocales (for XSpellChecker)
|
2014-03-30 22:19:37 +02:00
|
|
|
virtual Sequence< Locale > SAL_CALL getLocales() throw(RuntimeException) SAL_OVERRIDE;
|
|
|
|
virtual sal_Bool SAL_CALL hasLocale( const Locale& rLocale ) throw(RuntimeException) SAL_OVERRIDE;
|
2007-09-13 17:06:21 +00:00
|
|
|
|
|
|
|
// XSpellChecker
|
2014-03-30 22:19:37 +02:00
|
|
|
virtual sal_Bool SAL_CALL isValid( const OUString& rWord, const Locale& rLocale, const PropertyValues& rProperties ) throw(IllegalArgumentException, RuntimeException) SAL_OVERRIDE;
|
|
|
|
virtual Reference< XSpellAlternatives > SAL_CALL spell( const OUString& rWord, const Locale& rLocale, const PropertyValues& rProperties ) throw(IllegalArgumentException, RuntimeException) SAL_OVERRIDE;
|
2007-09-13 17:06:21 +00:00
|
|
|
|
|
|
|
// XLinguServiceEventBroadcaster
|
2014-03-30 22:19:37 +02:00
|
|
|
virtual sal_Bool SAL_CALL addLinguServiceEventListener( const Reference< XLinguServiceEventListener >& rxLstnr ) throw(RuntimeException) SAL_OVERRIDE;
|
|
|
|
virtual sal_Bool SAL_CALL removeLinguServiceEventListener( const Reference< XLinguServiceEventListener >& rxLstnr ) throw(RuntimeException) SAL_OVERRIDE;
|
2007-09-13 17:06:21 +00:00
|
|
|
|
|
|
|
// XServiceDisplayName
|
2014-03-30 22:19:37 +02:00
|
|
|
virtual OUString SAL_CALL getServiceDisplayName( const Locale& rLocale ) throw(RuntimeException) SAL_OVERRIDE;
|
2007-09-13 17:06:21 +00:00
|
|
|
|
|
|
|
// XInitialization
|
2014-03-30 22:19:37 +02:00
|
|
|
virtual void SAL_CALL initialize( const Sequence< Any >& rArguments ) throw(Exception, RuntimeException) SAL_OVERRIDE;
|
2007-09-13 17:06:21 +00:00
|
|
|
|
|
|
|
// XComponent
|
2014-03-30 22:19:37 +02:00
|
|
|
virtual void SAL_CALL dispose() throw(RuntimeException) SAL_OVERRIDE;
|
|
|
|
virtual void SAL_CALL addEventListener( const Reference< XEventListener >& rxListener ) throw(RuntimeException) SAL_OVERRIDE;
|
|
|
|
virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& rxListener ) throw(RuntimeException) SAL_OVERRIDE;
|
2007-09-13 17:06:21 +00:00
|
|
|
|
|
|
|
// XServiceInfo
|
2014-03-30 22:19:37 +02:00
|
|
|
virtual OUString SAL_CALL getImplementationName() throw(RuntimeException) SAL_OVERRIDE;
|
|
|
|
virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) throw(RuntimeException) SAL_OVERRIDE;
|
|
|
|
virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException) SAL_OVERRIDE;
|
2010-07-21 16:29:56 +02:00
|
|
|
|
|
|
|
static inline OUString getImplementationName_Static() throw();
|
|
|
|
static Sequence< OUString > getSupportedServiceNames_Static() throw();
|
2007-09-13 17:06:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
inline OUString MacSpellChecker::getImplementationName_Static() throw()
|
|
|
|
{
|
2013-01-30 11:44:23 +01:00
|
|
|
return OUString( "org.openoffice.lingu.MacOSXSpellChecker" );
|
2007-09-13 17:06:21 +00:00
|
|
|
}
|
|
|
|
|
2014-04-14 21:54:23 +02:00
|
|
|
void * SAL_CALL MacSpellChecker_getFactory(
|
|
|
|
char const * pImplName, XMultiServiceFactory * pServiceManager, void *);
|
|
|
|
|
2007-09-13 17:06:21 +00:00
|
|
|
#endif
|
|
|
|
|
2010-10-27 12:45:03 +01:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|