Branch libreoffice-5-0-4
[LibreOffice.git] / linguistic / workben / sspellimp.hxx
blob58b0afe138e015a9bbce8f97ee94b986cf94391b
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_LINGUISTIC_WORKBEN_SSPELLIMP_HXX
21 #define INCLUDED_LINGUISTIC_WORKBEN_SSPELLIMP_HXX
23 #include <cppuhelper/implbase1.hxx>
24 #include <cppuhelper/implbase6.hxx>
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/XPropertySet.hpp>
29 #include <com/sun/star/beans/PropertyValues.hpp>
30 #include <com/sun/star/lang/XServiceInfo.hpp>
31 #include <com/sun/star/linguistic2/XSpellChecker.hpp>
32 #include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
33 #include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp>
35 #include "linguistic/misc.hxx"
36 #include "sprophelp.hxx"
38 using namespace ::com::sun::star::uno;
39 using namespace ::com::sun::star::beans;
40 using namespace ::com::sun::star::lang;
41 using namespace ::com::sun::star::linguistic2;
45 class SpellChecker :
46 public cppu::WeakImplHelper6
48 XSpellChecker,
49 XLinguServiceEventBroadcaster,
50 XInitialization,
51 XComponent,
52 XServiceInfo,
53 XServiceDisplayName
56 Sequence< Locale > aSuppLocales;
57 ::cppu::OInterfaceContainerHelper aEvtListeners;
58 Reference< XPropertyChangeListener > xPropHelper;
59 PropertyHelper_Spell * pPropHelper;
60 sal_Bool bDisposing;
62 // disallow copy-constructor and assignment-operator for now
63 SpellChecker(const SpellChecker &);
64 SpellChecker & operator = (const SpellChecker &);
66 PropertyHelper_Spell & GetPropHelper_Impl();
67 PropertyHelper_Spell & GetPropHelper()
69 return pPropHelper ? *pPropHelper : GetPropHelper_Impl();
72 sal_Int16 GetSpellFailure( const OUString &rWord, const Locale &rLocale );
73 Reference< XSpellAlternatives >
74 GetProposals( const OUString &rWord, const Locale &rLocale );
76 public:
77 SpellChecker();
78 virtual ~SpellChecker();
80 // XSupportedLocales (for XSpellChecker)
81 virtual Sequence< Locale > SAL_CALL
82 getLocales()
83 throw(RuntimeException);
84 virtual sal_Bool SAL_CALL
85 hasLocale( const Locale& rLocale )
86 throw(RuntimeException);
88 // XSpellChecker
89 virtual sal_Bool SAL_CALL
90 isValid( const OUString& rWord, const Locale& rLocale,
91 const PropertyValues& rProperties )
92 throw(IllegalArgumentException,
93 RuntimeException);
94 virtual Reference< XSpellAlternatives > SAL_CALL
95 spell( const OUString& rWord, const Locale& rLocale,
96 const PropertyValues& rProperties )
97 throw(IllegalArgumentException,
98 RuntimeException);
100 // XLinguServiceEventBroadcaster
101 virtual sal_Bool SAL_CALL
102 addLinguServiceEventListener(
103 const Reference< XLinguServiceEventListener >& rxLstnr )
104 throw(RuntimeException);
105 virtual sal_Bool SAL_CALL
106 removeLinguServiceEventListener(
107 const Reference< XLinguServiceEventListener >& rxLstnr )
108 throw(RuntimeException);
110 // XServiceDisplayName
111 virtual OUString SAL_CALL
112 getServiceDisplayName( const Locale& rLocale )
113 throw(RuntimeException);
115 // XInitialization
116 virtual void SAL_CALL
117 initialize( const Sequence< Any >& rArguments )
118 throw(Exception, RuntimeException);
120 // XComponent
121 virtual void SAL_CALL
122 dispose()
123 throw(RuntimeException);
124 virtual void SAL_CALL
125 addEventListener( const Reference< XEventListener >& rxListener )
126 throw(RuntimeException);
127 virtual void SAL_CALL
128 removeEventListener( const Reference< XEventListener >& rxListener )
129 throw(RuntimeException);
131 // Service specific part
133 // XServiceInfo
134 virtual OUString SAL_CALL
135 getImplementationName()
136 throw(RuntimeException);
137 virtual sal_Bool SAL_CALL
138 supportsService( const OUString& rServiceName )
139 throw(RuntimeException);
140 virtual Sequence< OUString > SAL_CALL
141 getSupportedServiceNames()
142 throw(RuntimeException);
145 static inline OUString
146 getImplementationName_Static() throw();
147 static Sequence< OUString >
148 getSupportedServiceNames_Static() throw();
151 inline OUString SpellChecker::getImplementationName_Static() throw()
153 return OUString( "com.sun.star.lingu.examples.SpellChecker" );
158 #endif
160 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */