Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _LINGU2_SPELLIMP_HXX_
30 : : #define _LINGU2_SPELLIMP_HXX_
31 : :
32 : : #include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
33 : : #include <cppuhelper/implbase1.hxx> // helper for implementations
34 : : #include <cppuhelper/implbase6.hxx> // helper for implementations
35 : : #include <com/sun/star/lang/XComponent.hpp>
36 : : #include <com/sun/star/lang/XInitialization.hpp>
37 : : #include <com/sun/star/lang/XServiceDisplayName.hpp>
38 : : #include <com/sun/star/beans/XPropertySet.hpp>
39 : : #include <com/sun/star/beans/PropertyValues.hpp>
40 : : #include <com/sun/star/lang/XServiceInfo.hpp>
41 : : #include <com/sun/star/linguistic2/XSpellChecker.hpp>
42 : : #include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
43 : : #include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp>
44 : :
45 : : #include <linguistic/misc.hxx>
46 : : #include <linguistic/lngprophelp.hxx>
47 : :
48 : : #include <lingutil.hxx>
49 : :
50 : : using namespace ::rtl;
51 : : using namespace ::com::sun::star::uno;
52 : : using namespace ::com::sun::star::beans;
53 : : using namespace ::com::sun::star::lang;
54 : : using namespace ::com::sun::star::linguistic2;
55 : :
56 : :
57 : : ///////////////////////////////////////////////////////////////////////////
58 : :
59 : :
60 : : class SpellChecker :
61 : : public cppu::WeakImplHelper6
62 : : <
63 : : XSpellChecker,
64 : : XLinguServiceEventBroadcaster,
65 : : XInitialization,
66 : : XComponent,
67 : : XServiceInfo,
68 : : XServiceDisplayName
69 : : >
70 : : {
71 : : Sequence< Locale > aSuppLocales;
72 : : Hunspell ** aDicts;
73 : : rtl_TextEncoding * aDEncs;
74 : : Locale * aDLocs;
75 : : OUString * aDNames;
76 : : sal_Int32 numdict;
77 : :
78 : : ::cppu::OInterfaceContainerHelper aEvtListeners;
79 : : linguistic::PropertyHelper_Spelling* pPropHelper;
80 : : sal_Bool bDisposing;
81 : :
82 : : // disallow copy-constructor and assignment-operator for now
83 : : SpellChecker(const SpellChecker &);
84 : : SpellChecker & operator = (const SpellChecker &);
85 : :
86 : : linguistic::PropertyHelper_Spelling& GetPropHelper_Impl();
87 : 14837 : linguistic::PropertyHelper_Spelling& GetPropHelper()
88 : : {
89 [ + + ]: 14837 : return pPropHelper ? *pPropHelper : GetPropHelper_Impl();
90 : : }
91 : :
92 : : sal_Int16 GetSpellFailure( const OUString &rWord, const Locale &rLocale );
93 : : Reference< XSpellAlternatives > GetProposals( const OUString &rWord, const Locale &rLocale );
94 : :
95 : : public:
96 : : SpellChecker();
97 : : virtual ~SpellChecker();
98 : :
99 : : // XSupportedLocales (for XSpellChecker)
100 : : virtual Sequence< Locale > SAL_CALL getLocales() throw(RuntimeException);
101 : : virtual sal_Bool SAL_CALL hasLocale( const Locale& rLocale ) throw(RuntimeException);
102 : :
103 : : // XSpellChecker
104 : : virtual sal_Bool SAL_CALL isValid( const OUString& rWord, const Locale& rLocale, const PropertyValues& rProperties ) throw(IllegalArgumentException, RuntimeException);
105 : : virtual Reference< XSpellAlternatives > SAL_CALL spell( const OUString& rWord, const Locale& rLocale, const PropertyValues& rProperties ) throw(IllegalArgumentException, RuntimeException);
106 : :
107 : : // XLinguServiceEventBroadcaster
108 : : virtual sal_Bool SAL_CALL addLinguServiceEventListener( const Reference< XLinguServiceEventListener >& rxLstnr ) throw(RuntimeException);
109 : : virtual sal_Bool SAL_CALL removeLinguServiceEventListener( const Reference< XLinguServiceEventListener >& rxLstnr ) throw(RuntimeException);
110 : :
111 : : // XServiceDisplayName
112 : : virtual OUString SAL_CALL getServiceDisplayName( const Locale& rLocale ) throw(RuntimeException);
113 : :
114 : : // XInitialization
115 : : virtual void SAL_CALL initialize( const Sequence< Any >& rArguments ) throw(Exception, RuntimeException);
116 : :
117 : : // XComponent
118 : : virtual void SAL_CALL dispose() throw(RuntimeException);
119 : : virtual void SAL_CALL addEventListener( const Reference< XEventListener >& rxListener ) throw(RuntimeException);
120 : : virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& rxListener ) throw(RuntimeException);
121 : :
122 : : // XServiceInfo
123 : : virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);
124 : : virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) throw(RuntimeException);
125 : : virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException);
126 : :
127 : :
128 : : static inline OUString getImplementationName_Static() throw();
129 : : static Sequence< OUString > getSupportedServiceNames_Static() throw();
130 : : };
131 : :
132 : 148 : inline OUString SpellChecker::getImplementationName_Static() throw()
133 : : {
134 : 148 : return A2OU( "org.openoffice.lingu.MySpellSpellChecker" );
135 : : }
136 : :
137 : :
138 : : ///////////////////////////////////////////////////////////////////////////
139 : :
140 : : #endif
141 : :
142 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|