1/*************************************************************************
2 *
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
6 *
7 * OpenOffice.org - a multi-platform office productivity suite
8 *
9 * This file is part of OpenOffice.org.
10 *
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
14 *
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
20 *
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org.  If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
25 *
26 ************************************************************************/
27#ifndef __com_sun_star_linguistic2_XDictionary_idl__
28#define __com_sun_star_linguistic2_XDictionary_idl__
29
30#ifndef __com_sun_star_container_XNamed_idl__
31#include <com/sun/star/container/XNamed.idl>
32#endif
33
34#ifndef __com_sun_star_lang_Locale_idl__
35#include <com/sun/star/lang/Locale.idl>
36#endif
37
38#ifndef __com_sun_star_linguistic2_DictionaryType_idl__
39#include <com/sun/star/linguistic2/DictionaryType.idl>
40#endif
41
42#ifndef __com_sun_star_linguistic2_XDictionaryEntry_idl__
43#include <com/sun/star/linguistic2/XDictionaryEntry.idl>
44#endif
45
46#ifndef __com_sun_star_linguistic2_XDictionaryEventListener_idl__
47#include <com/sun/star/linguistic2/XDictionaryEventListener.idl>
48#endif
49
50//=============================================================================
51
52module com { module sun { module star { module linguistic2 {
53
54//=============================================================================
55/** This interfaces enables the object to access personal dictionaries.
56
57	<P>Personal dictionaries are used to supply additional
58	information for spellchecking and hyphenation (see
59	<type scope="com::sun::star::linguistic2">XDictionaryEntry</type>).
60	Only active dictionaries with an appropriate language are used
61	for that purpose.
62	The entries of an active, positive dictionary are words that are
63	required to be recognized as correct during the spellchecking
64	process. Additionally, they will be used for hyphenation.
65	Entries of a negative dictionary are required to be recognized
66	as negative words, for example, words that should not be used, during
67	spellcheck. An entry in a negative dictionary may supply a
68	proposal for a word to be used instead of the one being used.</P>
69
70    @see    <type scope="com::sun::star::linguistic2">XDictionaryEvent</type>
71    @see    <type scope="com::sun::star::container">XNamed</type>
72*/
73published interface XDictionary : com::sun::star::container::XNamed
74{
75	//-------------------------------------------------------------------------
76	/** returns the type of the dictionary.
77
78		@returns
79			the type of the dictionary.
80
81        @see    <type scope="com::sun::star::linguistic2">DictionaryType</type>
82	*/
83	com::sun::star::linguistic2::DictionaryType getDictionaryType();
84
85	//-------------------------------------------------------------------------
86	/** specifies whether the dictionary should be used or not .
87
88		@param	bAcvtivate
89            <TRUE/> if the dictionary should be used, <FALSE/> otherwise.
90
91	*/
92	void setActive( [in] boolean bActivate );
93
94	//-------------------------------------------------------------------------
95    /**
96		@returns
97			<TRUE/> if the dictionary is active, <FALSE/> otherwise.
98	*/
99	boolean isActive();
100
101	//-------------------------------------------------------------------------
102    /**
103		@returns
104	   		the number of entries in the dictionary.
105	*/
106    long getCount();
107
108	//-------------------------------------------------------------------------
109	/**
110	 	@returns
111	 		the language of the dictionary.
112
113        @see    <type scope="com::sun::star::lang">Locale</type>
114	*/
115	com::sun::star::lang::Locale getLocale();
116
117	//-------------------------------------------------------------------------
118	/** is used to set the language of the dictionary.
119
120	 	@param aLocale
121            the new language of the dictionary.
122
123        @see    <type scope="com::sun::star::lang">Locale</type>
124	*/
125	void setLocale( [in] com::sun::star::lang::Locale aLocale );
126
127	//-------------------------------------------------------------------------
128	/** searches for an entry that matches the given word.
129
130		@returns
131			the reference to the entry found. If no entry was found,
132			it is NULL.
133
134		@param	aWord
135			the word to be looked for.
136
137        @see    <type scope="com::sun::star::linguistic2">XDictionaryEntry</type>
138	*/
139	com::sun::star::linguistic2::XDictionaryEntry getEntry( [in] string aWord );
140
141	//-------------------------------------------------------------------------
142	/** is used to add an entry to the dictionary.
143
144		<P>If an entry already exists, the dictionary remains unchanged
145	 	and <FALSE/> will be returned.</P>
146
147		<P>In positive dictionaries only postive entries
148		can be made, and in negative ones only negative entries.</P>
149
150		@param	xDicEntry
151			the entry to be added.
152
153		@returns
154			<TRUE/> if the entry was successfully added <FALSE/> otherwise.
155
156        @see    <type scope="com::sun::star::linguistic2">XDictionaryEntry</type>
157        @see    <type scope="com::sun::star::linguistic2">DictionaryType</type>
158	*/
159	boolean addEntry(
160		[in] com::sun::star::linguistic2::XDictionaryEntry xDicEntry );
161
162	//-------------------------------------------------------------------------
163	/** is used to make an entry in the dictionary.
164
165		<P>If an entry already exists, the dictionary remains unchanged
166	 	and <FALSE/> will be returned.</P>
167
168		<P>In positive dictionaries only postive entries
169		can be made, and in negative ones only negative entries.</P>
170
171		@param	aWord
172			the word to be added.
173
174		@param	bIsNegative
175			specifies whether the entry will be a negative one or not.
176
177		@param	aRplcText
178			in the case of a negative entry, this is the replacement text to
179			be used when replacing aWord. Otherwise, it is undefined.
180
181		@returns
182			<TRUE/> if the entry was successfully added, <FALSE/> otherwise.
183
184        @see    <type scope="com::sun::star::linguistic2">DictionaryType</type>
185	*/
186	boolean add(
187			[in] string aWord,
188			[in] boolean bIsNegative,
189			[in] string aRplcText );
190
191	//-------------------------------------------------------------------------
192	/** removes an entry from the dictionary.
193
194		@param	aWord
195			the word matching the entry to be removed.
196
197		@returns
198			<TRUE/> if the entry was successfully removed, <FALSE/>
199			otherwise (especially if the entry was not found).
200	*/
201	boolean remove( [in] string aWord );
202
203	//-------------------------------------------------------------------------
204	/**
205		@returns
206	 		<TRUE/> if the dictionary is full and no further
207			entry can be made, <FALSE/> otherwise.
208	*/
209	boolean isFull();
210
211	//-------------------------------------------------------------------------
212	/**
213        <p>This function should no longer be used since with the expansion of the
214        maximum number of allowed entries the result may become unreasonable large!</p>
215
216	 	@returns
217	 		a sequence with all the entries of the dictionary.
218
219        @see    <type scope="com::sun::star::linguistic2">XDictionaryEntry</type>
220        @see    <type scope="com::sun::star::linguistic2">XSearchableDictionary</type>
221        @deprecated
222	*/
223
224	sequence<com::sun::star::linguistic2::XDictionaryEntry> getEntries();
225
226	//-------------------------------------------------------------------------
227	/** removes all entries from the dictionary.
228	*/
229	void clear();
230
231	//-------------------------------------------------------------------------
232	/** adds an entry to the list of dictionary event listeners.
233
234		<P>On dictionary events, each entry in the listener list will
235	 	be notified via a call to
236        <member scope="com::sun::star::linguistic2">XDictionaryEventListener::processDictionaryEvent</member>.</P>
237
238		@param	xListener
239			the entry to be made, that is, the object that wants notifications.
240
241		@returns
242			<TRUE/> if the entry was successfully made, <FALSE/> otherwise.
243            If <member scope="com::sun::star::lang">XEventListener::disposing</member> was called before,
244            it will always fail.
245
246        @see    <member scope="com::sun::star::linguistic2">XDictionary::removeDictionaryEventListener</member>
247        @see    <type scope="com::sun::star::linguistic2">XDictionaryEventListener</type>
248	*/
249	boolean addDictionaryEventListener(
250		[in] com::sun::star::linguistic2::XDictionaryEventListener xListener );
251
252	//-------------------------------------------------------------------------
253	/** removes an entry from the list of dictionary event listeners.
254
255		@param	xListener
256			the reference to the listening object to be removed.
257
258		@returns
259			<TRUE/> if the object to be removed was found and removed,
260			<FALSE/> if the object was not found in the list.
261
262        @see    <member scope="com::sun::star::linguistic2">XDictionary::addDictionaryEventListener</member>
263        @see    <type scope="com::sun::star::linguistic2">XDictionaryEventListener</type>
264	*/
265	boolean removeDictionaryEventListener(
266		[in] com::sun::star::linguistic2::XDictionaryEventListener xListener );
267
268};
269
270//=============================================================================
271
272}; }; }; };
273
274#endif
275
276