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_SPELL_SSPELLIMP_HXX
21 #define INCLUDED_LINGUCOMPONENT_SOURCE_SPELLCHECK_SPELL_SSPELLIMP_HXX
23 #include <cppuhelper/implbase.hxx>
24 #include <com/sun/star/lang/XComponent.hpp>
25 #include <com/sun/star/lang/XInitialization.hpp>
26 #include <com/sun/star/lang/XServiceDisplayName.hpp>
27 #include <com/sun/star/beans/XPropertySet.hpp>
28 #include <com/sun/star/beans/PropertyValues.hpp>
29 #include <com/sun/star/lang/XServiceInfo.hpp>
30 #include <com/sun/star/linguistic2/XSpellChecker.hpp>
31 #include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp>
33 #include <linguistic/misc.hxx>
34 #include <linguistic/lngprophelp.hxx>
36 #include <lingutil.hxx>
39 using namespace ::com::sun::star::uno
;
40 using namespace ::com::sun::star::beans
;
41 using namespace ::com::sun::star::lang
;
42 using namespace ::com::sun::star::linguistic2
;
47 public cppu::WeakImplHelper
50 XLinguServiceEventBroadcaster
,
61 std::unique_ptr
<Hunspell
> m_pDict
;
62 rtl_TextEncoding m_aDEnc
;
64 DictItem(OUString i_DName
, Locale i_DLoc
, rtl_TextEncoding i_DEnc
);
67 std::vector
<DictItem
> m_DictItems
;
69 Sequence
< Locale
> m_aSuppLocales
;
71 ::comphelper::OInterfaceContainerHelper2 m_aEvtListeners
;
72 std::unique_ptr
<linguistic::PropertyHelper_Spelling
> m_pPropHelper
;
75 SpellChecker(const SpellChecker
&) = delete;
76 SpellChecker
& operator = (const SpellChecker
&) = delete;
78 linguistic::PropertyHelper_Spelling
& GetPropHelper_Impl();
79 linguistic::PropertyHelper_Spelling
& GetPropHelper()
81 return m_pPropHelper
? *m_pPropHelper
: GetPropHelper_Impl();
84 sal_Int16
GetSpellFailure( const OUString
&rWord
, const Locale
&rLocale
);
85 Reference
< XSpellAlternatives
> GetProposals( const OUString
&rWord
, const Locale
&rLocale
);
89 virtual ~SpellChecker() override
;
91 // XSupportedLocales (for XSpellChecker)
92 virtual Sequence
< Locale
> SAL_CALL
getLocales() override
;
93 virtual sal_Bool SAL_CALL
hasLocale( const Locale
& rLocale
) override
;
96 virtual sal_Bool SAL_CALL
isValid( const OUString
& rWord
, const Locale
& rLocale
, const css::uno::Sequence
< css::beans::PropertyValue
>& rProperties
) override
;
97 virtual Reference
< XSpellAlternatives
> SAL_CALL
spell( const OUString
& rWord
, const Locale
& rLocale
, const css::uno::Sequence
< css::beans::PropertyValue
>& rProperties
) override
;
99 // XLinguServiceEventBroadcaster
100 virtual sal_Bool SAL_CALL
addLinguServiceEventListener( const Reference
< XLinguServiceEventListener
>& rxLstnr
) override
;
101 virtual sal_Bool SAL_CALL
removeLinguServiceEventListener( const Reference
< XLinguServiceEventListener
>& rxLstnr
) override
;
103 // XServiceDisplayName
104 virtual OUString SAL_CALL
getServiceDisplayName( const Locale
& rLocale
) override
;
107 virtual void SAL_CALL
initialize( const Sequence
< Any
>& rArguments
) override
;
110 virtual void SAL_CALL
dispose() override
;
111 virtual void SAL_CALL
addEventListener( const Reference
< XEventListener
>& rxListener
) override
;
112 virtual void SAL_CALL
removeEventListener( const Reference
< XEventListener
>& rxListener
) override
;
115 virtual OUString SAL_CALL
getImplementationName() override
;
116 virtual sal_Bool SAL_CALL
supportsService( const OUString
& rServiceName
) override
;
117 virtual Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
119 static inline OUString
getImplementationName_Static() throw();
120 static Sequence
< OUString
> getSupportedServiceNames_Static() throw();
123 inline OUString
SpellChecker::getImplementationName_Static() throw()
125 return OUString( "org.openoffice.lingu.MySpellSpellChecker" );
130 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */