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>
48 #include <linguistic/misc.hxx>
49 #include <linguistic/lngprophelp.hxx>
51 #include <lingutil.hxx>
53 using namespace ::rtl
;
54 using namespace ::com::sun::star::uno
;
55 using namespace ::com::sun::star::beans
;
56 using namespace ::com::sun::star::lang
;
57 using namespace ::com::sun::star::linguistic2
;
60 ///////////////////////////////////////////////////////////////////////////
64 public cppu::WeakImplHelper6
67 XLinguServiceEventBroadcaster
,
74 Sequence
< Locale
> aSuppLocales
;
76 rtl_TextEncoding
* aDEncs
;
81 ::cppu::OInterfaceContainerHelper aEvtListeners
;
82 Reference
< XPropertyChangeListener
> xPropHelper
;
83 linguistic::PropertyHelper_Spell
* pPropHelper
;
86 // disallow copy-constructor and assignment-operator for now
87 SpellChecker(const SpellChecker
&);
88 SpellChecker
& operator = (const SpellChecker
&);
90 linguistic::PropertyHelper_Spell
& GetPropHelper_Impl();
91 linguistic::PropertyHelper_Spell
& GetPropHelper()
93 return pPropHelper
? *pPropHelper
: GetPropHelper_Impl();
96 INT16
GetSpellFailure( const OUString
&rWord
, const Locale
&rLocale
);
97 Reference
< XSpellAlternatives
>
98 GetProposals( const OUString
&rWord
, const Locale
&rLocale
);
102 virtual ~SpellChecker();
104 // XSupportedLocales (for XSpellChecker)
105 virtual Sequence
< Locale
> SAL_CALL
107 throw(RuntimeException
);
108 virtual sal_Bool SAL_CALL
109 hasLocale( const Locale
& rLocale
)
110 throw(RuntimeException
);
113 virtual sal_Bool SAL_CALL
114 isValid( const OUString
& rWord
, const Locale
& rLocale
,
115 const PropertyValues
& rProperties
)
116 throw(IllegalArgumentException
,
118 virtual Reference
< XSpellAlternatives
> SAL_CALL
119 spell( const OUString
& rWord
, const Locale
& rLocale
,
120 const PropertyValues
& rProperties
)
121 throw(IllegalArgumentException
,
124 // XLinguServiceEventBroadcaster
125 virtual sal_Bool SAL_CALL
126 addLinguServiceEventListener(
127 const Reference
< XLinguServiceEventListener
>& rxLstnr
)
128 throw(RuntimeException
);
129 virtual sal_Bool SAL_CALL
130 removeLinguServiceEventListener(
131 const Reference
< XLinguServiceEventListener
>& rxLstnr
)
132 throw(RuntimeException
);
134 // XServiceDisplayName
135 virtual OUString SAL_CALL
136 getServiceDisplayName( const Locale
& rLocale
)
137 throw(RuntimeException
);
140 virtual void SAL_CALL
141 initialize( const Sequence
< Any
>& rArguments
)
142 throw(Exception
, RuntimeException
);
145 virtual void SAL_CALL
147 throw(RuntimeException
);
148 virtual void SAL_CALL
149 addEventListener( const Reference
< XEventListener
>& rxListener
)
150 throw(RuntimeException
);
151 virtual void SAL_CALL
152 removeEventListener( const Reference
< XEventListener
>& rxListener
)
153 throw(RuntimeException
);
155 ////////////////////////////////////////////////////////////
156 // Service specific part
160 virtual OUString SAL_CALL
161 getImplementationName()
162 throw(RuntimeException
);
163 virtual sal_Bool SAL_CALL
164 supportsService( const OUString
& rServiceName
)
165 throw(RuntimeException
);
166 virtual Sequence
< OUString
> SAL_CALL
167 getSupportedServiceNames()
168 throw(RuntimeException
);
171 static inline OUString
172 getImplementationName_Static() throw();
173 static Sequence
< OUString
>
174 getSupportedServiceNames_Static() throw();
177 inline OUString
SpellChecker::getImplementationName_Static() throw()
179 return A2OU( "org.openoffice.lingu.MySpellSpellChecker" );
184 ///////////////////////////////////////////////////////////////////////////