LibreOffice Module lingucomponent (master) 1
sspellimp.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#ifndef INCLUDED_LINGUCOMPONENT_SOURCE_SPELLCHECK_SPELL_SSPELLIMP_HXX
21#define INCLUDED_LINGUCOMPONENT_SOURCE_SPELLCHECK_SPELL_SSPELLIMP_HXX
22
25#include <com/sun/star/lang/XComponent.hpp>
26#include <com/sun/star/lang/XInitialization.hpp>
27#include <com/sun/star/lang/XServiceDisplayName.hpp>
28#include <com/sun/star/beans/PropertyValue.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>
32
34
35#include <memory>
36
37#include <hunspell.hxx>
38
39using namespace ::com::sun::star::uno;
40using namespace ::com::sun::star::beans;
41using namespace ::com::sun::star::lang;
42using namespace ::com::sun::star::linguistic2;
43
45 public cppu::WeakImplHelper
46 <
47 XSpellChecker,
48 XLinguServiceEventBroadcaster,
49 XInitialization,
50 XComponent,
51 XServiceInfo,
52 XServiceDisplayName
53 >
54{
55 struct DictItem
56 {
57 OUString m_aDName;
59 std::unique_ptr<Hunspell> m_pDict;
60 rtl_TextEncoding m_aDEnc;
61
62 DictItem(OUString i_DName, Locale i_DLoc, rtl_TextEncoding i_DEnc);
63 };
64
65 std::vector<DictItem> m_DictItems;
66
67 Sequence< Locale > m_aSuppLocales;
68
70 std::unique_ptr<linguistic::PropertyHelper_Spelling> m_pPropHelper;
72
73 SpellChecker(const SpellChecker &) = delete;
75
76 linguistic::PropertyHelper_Spelling& GetPropHelper_Impl();
77 linguistic::PropertyHelper_Spelling& GetPropHelper()
78 {
80 }
81
82 sal_Int16 GetSpellFailure( const OUString &rWord, const Locale &rLocale, int& rInfo );
83 Reference< XSpellAlternatives > GetProposals( const OUString &rWord, const Locale &rLocale );
84
85public:
87 virtual ~SpellChecker() override;
88
89 // XSupportedLocales (for XSpellChecker)
90 virtual Sequence< Locale > SAL_CALL getLocales() override;
91 virtual sal_Bool SAL_CALL hasLocale( const Locale& rLocale ) override;
92
93 // XSpellChecker
94 virtual sal_Bool SAL_CALL isValid( const OUString& rWord, const Locale& rLocale, const css::uno::Sequence< css::beans::PropertyValue >& rProperties ) override;
95 virtual Reference< XSpellAlternatives > SAL_CALL spell( const OUString& rWord, const Locale& rLocale, const css::uno::Sequence< css::beans::PropertyValue >& rProperties ) override;
96
97 // XLinguServiceEventBroadcaster
98 virtual sal_Bool SAL_CALL addLinguServiceEventListener( const Reference< XLinguServiceEventListener >& rxLstnr ) override;
99 virtual sal_Bool SAL_CALL removeLinguServiceEventListener( const Reference< XLinguServiceEventListener >& rxLstnr ) override;
100
101 // XServiceDisplayName
102 virtual OUString SAL_CALL getServiceDisplayName( const Locale& rLocale ) override;
103
104 // XInitialization
105 virtual void SAL_CALL initialize( const Sequence< Any >& rArguments ) override;
106
107 // XComponent
108 virtual void SAL_CALL dispose() override;
109 virtual void SAL_CALL addEventListener( const Reference< XEventListener >& rxListener ) override;
110 virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& rxListener ) override;
111
112 // XServiceInfo
113 virtual OUString SAL_CALL getImplementationName() override;
114 virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) override;
115 virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
116};
117
118#endif
119
120/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool m_bDisposing
Definition: sspellimp.hxx:71
linguistic::PropertyHelper_Spelling & GetPropHelper_Impl()
Definition: sspellimp.cxx:95
virtual ~SpellChecker() override
Definition: sspellimp.cxx:87
virtual sal_Bool SAL_CALL addLinguServiceEventListener(const Reference< XLinguServiceEventListener > &rxLstnr) override
Definition: sspellimp.cxx:533
virtual Sequence< Locale > SAL_CALL getLocales() override
Definition: sspellimp.cxx:107
SpellChecker(const SpellChecker &)=delete
virtual void SAL_CALL initialize(const Sequence< Any > &rArguments) override
Definition: sspellimp.cxx:565
::comphelper::OInterfaceContainerHelper3< XEventListener > m_aEvtListeners
Definition: sspellimp.hxx:69
virtual sal_Bool SAL_CALL isValid(const OUString &rWord, const Locale &rLocale, const css::uno::Sequence< css::beans::PropertyValue > &rProperties) override
Definition: sspellimp.cxx:376
virtual void SAL_CALL addEventListener(const Reference< XEventListener > &rxListener) override
Definition: sspellimp.cxx:608
Reference< XSpellAlternatives > GetProposals(const OUString &rWord, const Locale &rLocale)
Definition: sspellimp.cxx:429
linguistic::PropertyHelper_Spelling & GetPropHelper()
Definition: sspellimp.hxx:77
SpellChecker & operator=(const SpellChecker &)=delete
virtual OUString SAL_CALL getServiceDisplayName(const Locale &rLocale) override
Definition: sspellimp.cxx:559
virtual sal_Bool SAL_CALL hasLocale(const Locale &rLocale) override
Definition: sspellimp.cxx:227
std::unique_ptr< linguistic::PropertyHelper_Spelling > m_pPropHelper
Definition: sspellimp.hxx:70
Sequence< Locale > m_aSuppLocales
Definition: sspellimp.hxx:67
virtual sal_Bool SAL_CALL supportsService(const OUString &rServiceName) override
Definition: sspellimp.cxx:630
virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: sspellimp.cxx:635
virtual OUString SAL_CALL getImplementationName() override
Definition: sspellimp.cxx:625
virtual Reference< XSpellAlternatives > SAL_CALL spell(const OUString &rWord, const Locale &rLocale, const css::uno::Sequence< css::beans::PropertyValue > &rProperties) override
Definition: sspellimp.cxx:513
virtual void SAL_CALL dispose() override
Definition: sspellimp.cxx:591
virtual void SAL_CALL removeEventListener(const Reference< XEventListener > &rxListener) override
Definition: sspellimp.cxx:616
std::vector< DictItem > m_DictItems
Definition: sspellimp.hxx:65
sal_Int16 GetSpellFailure(const OUString &rWord, const Locale &rLocale, int &rInfo)
Definition: sspellimp.cxx:246
virtual sal_Bool SAL_CALL removeLinguServiceEventListener(const Reference< XLinguServiceEventListener > &rxLstnr) override
Definition: sspellimp.cxx:546
DictItem(OUString i_DName, Locale i_DLoc, rtl_TextEncoding i_DEnc)
Definition: sspellimp.cxx:80
std::unique_ptr< Hunspell > m_pDict
Definition: sspellimp.hxx:59
rtl_TextEncoding m_aDEnc
Definition: sspellimp.hxx:60
unsigned char sal_Bool