summaryrefslogtreecommitdiffstats
path: root/kdejava/koala/org/kde/koala/KSpell.java
blob: ab13812487a2ef6c03e05d40c666aad82ddf002f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
//Auto-generated by kalyptus. DO NOT EDIT.
package org.kde.koala;

import org.kde.qt.Qt;
import org.kde.qt.TQMetaObject;
import org.kde.qt.QtSupport;
import org.kde.qt.TQObject;
import java.util.ArrayList;
import org.kde.qt.TQWidget;
import org.kde.qt.TQObject;

/**

 %KDE Spellchecker
 A %KDE programmer's interface to International ISpell 3.1, ASpell,
 HSpell and ZPSpell..
 A static method, modalCheck() is provided for convenient
  access to the spellchecker.
 See {@link KSpellSignals} for signals emitted by KSpell
		@author David Sweet <dsweet@kde.org>

		@short    %KDE Spellchecker 
		@see KSpellConfig
		@see KSyntaxHighlighter

*/
public class KSpell extends TQObject  {
	protected KSpell(Class dummy){super((Class) null);}
	/**	
		 Possible states of the spell checker.
		
			<li>
			<code>Starting</code> - After creation of KSpell.
			</li>
			
			<li>
			<code>Running</code> - After the ready signal has been emitted.
			</li>
			
			<li>
			<code>Cleaning</code> - After cleanUp() has been called.
			</li>
			
			<li>
			<code>Finished</code> - After cleanUp() has been completed.
			</li>
				 The following error states exist:
		
			<li>
			<code>Error</code> -  An error occurred in the <code>Starting</code> state.
			</li>
			
			<li>
			<code>Crashed</code> - An error occurred in the <code>Running</code> state.
			</li>
					@short    Possible states of the spell checker.
	*/
	public static final int Starting = 0;
	public static final int Running = 1;
	public static final int Cleaning = 2;
	public static final int Finished = 3;
	public static final int Error = 4;
	public static final int Crashed = 5;
	public static final int FinishedNoMisspellingsEncountered = 6;

	/**	
		 These are possible types of documents which the spell checker can check.
		
			<li>
			<code>Text</code>  - The default type, checks every word
			</li>
			
			<li>
			<code>HTML</code>  - For HTML/SGML/XML documents, will skip the tags,
			</li>
			
			<li>
			<code>TeX</code>   - For TeX/LaTeX documents, will skip commands,
			</li>
			
			<li>
			<code>Nroff</code> - For nroff/troff documents.
			</li>
				 Please note that not every option is supported on every type of
		 checker (e.g. ASpell doesn't support Nroff). In case a type
		 of a document is not supported the default Text option will
		 be used.
		   		@short    These are possible types of documents which the spell checker can check.
	*/
	public static final int Text = 0;
	public static final int HTML = 1;
	public static final int TeX = 2;
	public static final int Nroff = 3;

	public native TQMetaObject metaObject();
	public native String className();
	/**	
		 Starts the spellchecker.
			 KSpell emits ready() when it has verified that
		 ISpell/ASpell is working properly. Pass the name of a slot -- do not pass zero!
		 Be sure to call cleanUp() when you are done with KSpell.
			 If KSpell could not be started correctly, death() is emitted.
			@param parent Parent of KSpellConfig dialog..
			@param caption Caption of KSpellConfig dialog.
			@param receiver Receiver object for the ready(KSpell ) signal.
			@param slot Receiver's slot, will be connected to the ready(KSpell ) signal.
			@param kcs Configuration for KSpell.
			@param progressbar Indicates if progress bar should be shown.
			@param modal Indicates modal or non-modal dialog.
		   		@short    Starts the spellchecker.
	*/
	public KSpell(TQWidget parent, String caption, TQObject receiver, String slot, KSpellConfig kcs, boolean progressbar, boolean modal) {
		super((Class) null);
		newKSpell(parent,caption,receiver,slot,kcs,progressbar,modal);
	}
	private native void newKSpell(TQWidget parent, String caption, TQObject receiver, String slot, KSpellConfig kcs, boolean progressbar, boolean modal);
	public KSpell(TQWidget parent, String caption, TQObject receiver, String slot, KSpellConfig kcs, boolean progressbar) {
		super((Class) null);
		newKSpell(parent,caption,receiver,slot,kcs,progressbar);
	}
	private native void newKSpell(TQWidget parent, String caption, TQObject receiver, String slot, KSpellConfig kcs, boolean progressbar);
	public KSpell(TQWidget parent, String caption, TQObject receiver, String slot, KSpellConfig kcs) {
		super((Class) null);
		newKSpell(parent,caption,receiver,slot,kcs);
	}
	private native void newKSpell(TQWidget parent, String caption, TQObject receiver, String slot, KSpellConfig kcs);
	public KSpell(TQWidget parent, String caption, TQObject receiver, String slot) {
		super((Class) null);
		newKSpell(parent,caption,receiver,slot);
	}
	private native void newKSpell(TQWidget parent, String caption, TQObject receiver, String slot);
	/**	
		 Starts the spellchecker.
			 KSpell emits ready() when it has verified that
		 ISpell/ASpell is working properly. Pass the name of a slot -- do not pass zero!
		 Be sure to call cleanUp() when you are done with KSpell.
			 If KSpell could not be started correctly, death() is emitted.
			@param parent Parent of KSpellConfig dialog..
			@param caption Caption of KSpellConfig dialog.
			@param receiver Receiver object for the ready(KSpell ) signal.
			@param slot Receiver's slot, will be connected to the ready(KSpell ) signal.
			@param kcs Configuration for KSpell.
			@param progressbar Indicates if progress bar should be shown.
			@param modal Indicates modal or non-modal dialog.
			@param type Type of the document to check
		   		@short    Starts the spellchecker.
	*/
	public KSpell(TQWidget parent, String caption, TQObject receiver, String slot, KSpellConfig kcs, boolean progressbar, boolean modal, int type) {
		super((Class) null);
		newKSpell(parent,caption,receiver,slot,kcs,progressbar,modal,type);
	}
	private native void newKSpell(TQWidget parent, String caption, TQObject receiver, String slot, KSpellConfig kcs, boolean progressbar, boolean modal, int type);
	/**	
		 Returns the status of KSpell.
				@short    Returns the status of KSpell.
		@see #spellStatus
	*/
	public native int status();
	/**	
		 Cleans up ISpell.
			 Write out the personal dictionary and close ISpell's
		  stdin.  A death() signal will be emitted when the cleanup is
		  complete, but this method will return immediately.
		   		@short    Cleans up ISpell.
	*/
	public native void cleanUp();
	/**	
		 Sets the auto-delete flag. If this is set, the KSpell object
		 is automatically deleted after emitting death().
		   		@short    Sets the auto-delete flag.
	*/
	public native void setAutoDelete(boolean _autoDelete);
	/**	
		  Spellchecks a buffer of many words in plain text
		  format.
			 The <code>_buffer</code> is not modified.  The signal done() will be
		  sent when check() is finished and the argument will be a
		  spell-corrected version of <code>_buffer.</code>
			 The spell check may be stopped by the user before the entire buffer
		  has been checked.  You can check lastPosition() to see how far
		  in <code>_buffer</code> check() reached before stopping.
		   		@short     Spellchecks a buffer of many words in plain text   format.
	*/
	public native boolean check(String _buffer, boolean usedialog);
	public native boolean check(String _buffer);
	/**	
		 Returns the position (when using check())  or word
		 number (when using checkList()) of
		 the last word checked.
		   		@short    Returns the position (when using check())  or word  number (when using checkList()) of  the last word checked.
	*/
	public native int lastPosition();
	/**	
		 Spellchecks a list of words.
			 checkList() is more flexible than check().  You could parse
		  any type
		  of document (HTML, TeX, etc.) into a list of spell-checkable words
		  and send the list to checkList().  Sending a marked-up document
		  to check() would result in the mark-up tags being
		  spell checked.
		   		@short    Spellchecks a list of words.
	*/
	public native boolean checkList(String[] _wordlist, boolean usedialog);
	public native boolean checkList(String[] _wordlist);
	/**	
		 Spellchecks a single word.
			 checkWord() is the most flexible function.  Some applications
		  might need this flexibility but will sacrifice speed when
		  checking large numbers of words.  Consider checkList() for
		  checking many words.
			  Use this method for implementing  "online" spellchecking (i.e.,
		  spellcheck as-you-type).
			 checkWord() returns <code>false</code> if <code>buffer</code> is not a single word (e.g.
		  if it contains white space), otherwise it returns <code>true</code>;
			 If <code>usedialog</code> is set to <code>true</code>, KSpell will open the standard
		  dialog if the word is not found.  The dialog results can be queried
		  by using dlgResult() and replacement().
			  The signal corrected() is emitted when the check is
		  complete.  You can look at suggestions() to see what the
		  suggested replacements were.
		   		@short    Spellchecks a single word.
	*/
	public native boolean checkWord(String _buffer, boolean usedialog);
	public native boolean checkWord(String _buffer);
	public native boolean checkWord(String buffer, boolean _usedialog, boolean suggest);
	/**	
		 Hides the dialog box.
			 You'll need to do this when you are done with checkWord();
		   		@short    Hides the dialog box.
	*/
	public native void hide();
	/**	
		 Returns list of suggested word replacements.
			 After calling checkWord() (an in response to
		  a misspelled() signal you can
		  use this to get the list of
		  suggestions (if any were available).
		   		@short    Returns list of suggested word replacements.
	*/
	public native ArrayList suggestions();
	/**	
		 Gets the result code of the dialog box.
			 After calling checkWord, you can use this to get the dialog box's
		  result code.
		 The possible
		  values are (from kspelldlg.h):
		
			<li>
			KS_CANCEL
			</li>
			
			<li>
			KS_REPLACE
			</li>
			
			<li>
			KS_REPLACEALL
			</li>
			
			<li>
			KS_IGNORE
			</li>
			
			<li>
			KS_IGNOREALL
			</li>
			
			<li>
			KS_ADD
			</li>
			
			<li>
			KS_STOP
			</li>
				   		@short    Gets the result code of the dialog box.
	*/
	public native int dlgResult();
	/**	
		 Moves the dialog.
			 If the dialog is not currently visible, it will
		   be placed at this position when it becomes visible.
		 Use this to get the dialog out of the way of a highlighted
		 misspelled word in a document.
		   		@short    Moves the dialog.
	*/
	public native void moveDlg(int x, int y);
	/**	
		 Returns the height of the dialog box.
		   		@short    Returns the height of the dialog box.
	*/
	public native int heightDlg();
	/**	
		 Returns the width of the dialog box.
		   		@short    Returns the width of the dialog box.
	*/
	public native int widthDlg();
	/**	
		 Returns the partially spellchecked buffer.
			 You might want the full buffer in its partially-checked state.
		   		@short    Returns the partially spellchecked buffer.
	*/
	public native String intermediateBuffer();
	/**	
		 Tells ISpell/ASpell to ignore this word for the life of this KSpell instance.
				@return false if <code>word</code> is not a word or there was an error
  communicating with ISpell/ASpell.
   
		@short    Tells ISpell/ASpell to ignore this word for the life of this KSpell instance.
	*/
	public native boolean ignore(String word);
	/**	
		 Adds a word to the user's personal dictionary.
				@return false if <code>word</code>
  is not a word or there was an error communicating with ISpell/ASpell.
   
		@short    Adds a word to the user's personal dictionary.
	*/
	public native boolean addPersonal(String word);
	/**	
				@return the KSpellConfig object being used by this KSpell instance.
   
		@short
	*/
	public native KSpellConfig ksConfig();
	/**	
		 Sets the resolution (in percent) of the progress() signals.
			 E.g. setProgressResolution (10) instructs KSpell to send progress
		  signals (at most) every 10% (10%, 20%, 30%...).
		 The default is 10%.
		   		@short    Sets the resolution (in percent) of the progress() signals.
	*/
	public native void setProgressResolution(int res);
	/**	
		 Call setIgnoreUpperWords(true) to tell the spell-checker to ignore
		 words that are completely uppercase. They are spell-checked by default.
		   		@short    Call setIgnoreUpperWords(true) to tell the spell-checker to ignore  words that are completely uppercase.
	*/
	public native void setIgnoreUpperWords(boolean b);
	/**	
		 Call setIgnoreTitleCase(true) to tell the spell-checker to ignore
		 words with a 'title' case, i.e. starting with an uppercase letter.
		 They are spell-checked by default.
		   		@short    Call setIgnoreTitleCase(true) to tell the spell-checker to ignore  words with a 'title' case, i.
	*/
	public native void setIgnoreTitleCase(boolean b);
	/**	
		 Performs a synchronous spellcheck.
			 This method does not return until spellchecking is done or canceled.
		 Your application's GUI will still be updated, however.
			 This overloaded method uses the spell-check configuration passed as parameter.
		   		@short    Performs a synchronous spellcheck.
	*/
	public static native int modalCheck(StringBuffer text, KSpellConfig kcs);
	protected native int parseOneResponse(String _buffer, StringBuffer word, String[] sugg);
	protected native String funnyWord(String word);
	protected native void dialog(String word, String[] sugg, String _slot);
	protected native String replacement();
	protected native void setUpDialog(boolean reallyusedialogbox);
	protected native void setUpDialog();
	protected native void emitProgress();
	protected native boolean cleanFputs(String s, boolean appendCR);
	protected native boolean cleanFputs(String s);
	protected native boolean cleanFputsWord(String s, boolean appendCR);
	protected native boolean cleanFputsWord(String s);
	protected native void startIspell();
	protected native boolean writePersonalDictionary();
	protected native void initialize(TQWidget _parent, String _caption, TQObject arg3, String slot, KSpellConfig _ksc, boolean _progressbar, boolean _modal, int type);
	protected native void KSpell2(KProcIO arg1);
	protected native void checkWord2(KProcIO arg1);
	protected native void checkWord3();
	protected native void check2(KProcIO arg1);
	protected native void checkList2();
	protected native void checkList3a(KProcIO arg1);
	protected native void checkListReplaceCurrent();
	protected native void checkList4();
	protected native void dialog2(int dlgresult);
	protected native void check3();
	protected native void suggestWord(KProcIO arg1);
	protected native void slotStopCancel(int arg1);
	protected native void ispellExit(KProcess arg1);
	protected native void emitDeath();
	protected native void ispellErrors(KProcess arg1, String arg2, int arg3);
	protected native void checkNext();
	/** Deletes the wrapped C++ instance */
	protected native void finalize() throws InternalError;
	/** Delete the wrapped C++ instance ahead of finalize() */
	public native void dispose();
	/** Has the wrapped C++ instance been deleted? */
	public native boolean isDisposed();
}