1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: sspellimp.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _LINGU2_SPELLIMP_HXX_
32 #define _LINGU2_SPELLIMP_HXX_
34 #include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
35 #include <cppuhelper/implbase1.hxx> // helper for implementations
36 #include <cppuhelper/implbase6.hxx> // helper for implementations
37 #include <com/sun/star/lang/XComponent.hpp>
38 #include <com/sun/star/lang/XInitialization.hpp>
39 #include <com/sun/star/lang/XServiceDisplayName.hpp>
40 #include <com/sun/star/beans/XPropertySet.hpp>
41 #include <com/sun/star/beans/PropertyValues.hpp>
42 #include <com/sun/star/lang/XServiceInfo.hpp>
43 #include <com/sun/star/linguistic2/XSpellChecker.hpp>
44 #include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
45 #include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp>
46 #include <tools/table.hxx>
49 #include "sprophelp.hxx"
51 using namespace ::rtl
;
52 using namespace ::com::sun::star::uno
;
53 using namespace ::com::sun::star::beans
;
54 using namespace ::com::sun::star::lang
;
55 using namespace ::com::sun::star::linguistic2
;
58 #define A2OU(x) ::rtl::OUString::createFromAscii( x )
60 ///////////////////////////////////////////////////////////////////////////
64 public cppu::WeakImplHelper6
67 XLinguServiceEventBroadcaster
,
74 Sequence
< Locale
> aSuppLocales
;
75 ::cppu::OInterfaceContainerHelper aEvtListeners
;
76 Reference
< XPropertyChangeListener
> xPropHelper
;
77 PropertyHelper_Spell
* pPropHelper
;
80 // disallow copy-constructor and assignment-operator for now
81 SpellChecker(const SpellChecker
&);
82 SpellChecker
& operator = (const SpellChecker
&);
84 PropertyHelper_Spell
& GetPropHelper_Impl();
85 PropertyHelper_Spell
& GetPropHelper()
87 return pPropHelper
? *pPropHelper
: GetPropHelper_Impl();
90 INT16
GetSpellFailure( const OUString
&rWord
, const Locale
&rLocale
);
91 Reference
< XSpellAlternatives
>
92 GetProposals( const OUString
&rWord
, const Locale
&rLocale
);
96 virtual ~SpellChecker();
98 // XSupportedLocales (for XSpellChecker)
99 virtual Sequence
< Locale
> SAL_CALL
101 throw(RuntimeException
);
102 virtual sal_Bool SAL_CALL
103 hasLocale( const Locale
& rLocale
)
104 throw(RuntimeException
);
107 virtual sal_Bool SAL_CALL
108 isValid( const OUString
& rWord
, const Locale
& rLocale
,
109 const PropertyValues
& rProperties
)
110 throw(IllegalArgumentException
,
112 virtual Reference
< XSpellAlternatives
> SAL_CALL
113 spell( const OUString
& rWord
, const Locale
& rLocale
,
114 const PropertyValues
& rProperties
)
115 throw(IllegalArgumentException
,
118 // XLinguServiceEventBroadcaster
119 virtual sal_Bool SAL_CALL
120 addLinguServiceEventListener(
121 const Reference
< XLinguServiceEventListener
>& rxLstnr
)
122 throw(RuntimeException
);
123 virtual sal_Bool SAL_CALL
124 removeLinguServiceEventListener(
125 const Reference
< XLinguServiceEventListener
>& rxLstnr
)
126 throw(RuntimeException
);
128 // XServiceDisplayName
129 virtual OUString SAL_CALL
130 getServiceDisplayName( const Locale
& rLocale
)
131 throw(RuntimeException
);
134 virtual void SAL_CALL
135 initialize( const Sequence
< Any
>& rArguments
)
136 throw(Exception
, RuntimeException
);
139 virtual void SAL_CALL
141 throw(RuntimeException
);
142 virtual void SAL_CALL
143 addEventListener( const Reference
< XEventListener
>& rxListener
)
144 throw(RuntimeException
);
145 virtual void SAL_CALL
146 removeEventListener( const Reference
< XEventListener
>& rxListener
)
147 throw(RuntimeException
);
149 ////////////////////////////////////////////////////////////
150 // Service specific part
154 virtual OUString SAL_CALL
155 getImplementationName()
156 throw(RuntimeException
);
157 virtual sal_Bool SAL_CALL
158 supportsService( const OUString
& rServiceName
)
159 throw(RuntimeException
);
160 virtual Sequence
< OUString
> SAL_CALL
161 getSupportedServiceNames()
162 throw(RuntimeException
);
165 static inline OUString
166 getImplementationName_Static() throw();
167 static Sequence
< OUString
>
168 getSupportedServiceNames_Static() throw();
171 inline OUString
SpellChecker::getImplementationName_Static() throw()
173 return A2OU( "com.sun.star.lingu.examples.SpellChecker" );
177 ///////////////////////////////////////////////////////////////////////////