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 _LINGU2_SPELLIMP_HXX_
21 #define _LINGU2_SPELLIMP_HXX_
23 #include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
24 #include <cppuhelper/implbase1.hxx> // helper for implementations
25 #include <cppuhelper/implbase6.hxx> // helper for implementations
26 #include <com/sun/star/lang/XComponent.hpp>
27 #include <com/sun/star/lang/XInitialization.hpp>
28 #include <com/sun/star/lang/XServiceDisplayName.hpp>
29 #include <com/sun/star/beans/XPropertySet.hpp>
30 #include <com/sun/star/beans/PropertyValues.hpp>
31 #include <com/sun/star/lang/XServiceInfo.hpp>
32 #include <com/sun/star/linguistic2/XSpellChecker.hpp>
33 #include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
34 #include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp>
36 #include "linguistic/misc.hxx"
37 #include "sprophelp.hxx"
39 using namespace ::rtl
;
40 using namespace ::com::sun::star::uno
;
41 using namespace ::com::sun::star::beans
;
42 using namespace ::com::sun::star::lang
;
43 using namespace ::com::sun::star::linguistic2
;
48 public cppu::WeakImplHelper6
51 XLinguServiceEventBroadcaster
,
58 Sequence
< Locale
> aSuppLocales
;
59 ::cppu::OInterfaceContainerHelper aEvtListeners
;
60 Reference
< XPropertyChangeListener
> xPropHelper
;
61 PropertyHelper_Spell
* pPropHelper
;
64 // disallow copy-constructor and assignment-operator for now
65 SpellChecker(const SpellChecker
&);
66 SpellChecker
& operator = (const SpellChecker
&);
68 PropertyHelper_Spell
& GetPropHelper_Impl();
69 PropertyHelper_Spell
& GetPropHelper()
71 return pPropHelper
? *pPropHelper
: GetPropHelper_Impl();
74 sal_Int16
GetSpellFailure( const OUString
&rWord
, const Locale
&rLocale
);
75 Reference
< XSpellAlternatives
>
76 GetProposals( const OUString
&rWord
, const Locale
&rLocale
);
80 virtual ~SpellChecker();
82 // XSupportedLocales (for XSpellChecker)
83 virtual Sequence
< Locale
> SAL_CALL
85 throw(RuntimeException
);
86 virtual sal_Bool SAL_CALL
87 hasLocale( const Locale
& rLocale
)
88 throw(RuntimeException
);
91 virtual sal_Bool SAL_CALL
92 isValid( const OUString
& rWord
, const Locale
& rLocale
,
93 const PropertyValues
& rProperties
)
94 throw(IllegalArgumentException
,
96 virtual Reference
< XSpellAlternatives
> SAL_CALL
97 spell( const OUString
& rWord
, const Locale
& rLocale
,
98 const PropertyValues
& rProperties
)
99 throw(IllegalArgumentException
,
102 // XLinguServiceEventBroadcaster
103 virtual sal_Bool SAL_CALL
104 addLinguServiceEventListener(
105 const Reference
< XLinguServiceEventListener
>& rxLstnr
)
106 throw(RuntimeException
);
107 virtual sal_Bool SAL_CALL
108 removeLinguServiceEventListener(
109 const Reference
< XLinguServiceEventListener
>& rxLstnr
)
110 throw(RuntimeException
);
112 // XServiceDisplayName
113 virtual OUString SAL_CALL
114 getServiceDisplayName( const Locale
& rLocale
)
115 throw(RuntimeException
);
118 virtual void SAL_CALL
119 initialize( const Sequence
< Any
>& rArguments
)
120 throw(Exception
, RuntimeException
);
123 virtual void SAL_CALL
125 throw(RuntimeException
);
126 virtual void SAL_CALL
127 addEventListener( const Reference
< XEventListener
>& rxListener
)
128 throw(RuntimeException
);
129 virtual void SAL_CALL
130 removeEventListener( const Reference
< XEventListener
>& rxListener
)
131 throw(RuntimeException
);
133 // Service specific part
136 virtual OUString SAL_CALL
137 getImplementationName()
138 throw(RuntimeException
);
139 virtual sal_Bool SAL_CALL
140 supportsService( const OUString
& rServiceName
)
141 throw(RuntimeException
);
142 virtual Sequence
< OUString
> SAL_CALL
143 getSupportedServiceNames()
144 throw(RuntimeException
);
147 static inline OUString
148 getImplementationName_Static() throw();
149 static Sequence
< OUString
>
150 getSupportedServiceNames_Static() throw();
153 inline OUString
SpellChecker::getImplementationName_Static() throw()
155 return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.lingu.examples.SpellChecker" ));
162 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */