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