#include <tdespell.h>
Inherits TQObject.
|
enum | spellStatus {
Starting = 0
, Running
, Cleaning
, Finished
,
Error
, Crashed
, FinishedNoMisspellingsEncountered
} |
|
enum | SpellerType { Text = 0
, HTML
, TeX
, Nroff
} |
|
|
void | misspelling (const TQString &originalword, const TQStringList &suggestions, unsigned int pos) |
|
void | corrected (const TQString &originalword, const TQString &newword, unsigned int pos) |
|
void | ignoreall (const TQString &originalword) |
|
void | ignoreword (const TQString &originalword) |
|
void | addword (const TQString &originalword) |
|
void | replaceall (const TQString &origword, const TQString &replacement) |
|
void | ready (KSpell *) |
|
void | progress (unsigned int i) |
|
void | done (const TQString &buffer) |
|
void | done (bool) |
|
void | death () |
|
void | dialog3 () |
|
|
| KSpell (TQWidget *parent, const TQString &caption, TQObject *receiver, const char *slot, KSpellConfig *kcs=0, bool progressbar=true, bool modal=false) |
|
| KSpell (TQWidget *parent, const TQString &caption, TQObject *receiver, const char *slot, KSpellConfig *kcs, bool progressbar, bool modal, SpellerType type) |
|
spellStatus | status () const |
|
virtual void | cleanUp () |
|
void | setAutoDelete (bool _autoDelete) |
|
virtual bool | check (const TQString &_buffer, bool usedialog=true) |
|
int | lastPosition () const |
|
virtual bool | checkList (TQStringList *_wordlist, bool usedialog=true) |
|
virtual bool | checkWord (const TQString &_buffer, bool usedialog=false) |
|
bool | checkWord (const TQString &buffer, bool _usedialog, bool suggest) |
|
void | hide () |
|
TQStringList | suggestions () const |
|
int | dlgResult () const |
|
void | moveDlg (int x, int y) |
|
int | heightDlg () const |
|
int | widthDlg () const |
|
TQString | intermediateBuffer () const |
|
virtual bool | ignore (const TQString &word) |
|
virtual bool | addPersonal (const TQString &word) |
|
KSpellConfig | ksConfig () const |
|
void | setProgressResolution (unsigned int res) |
|
virtual | ~KSpell () |
|
void | setIgnoreUpperWords (bool b) |
|
void | setIgnoreTitleCase (bool b) |
|
|
int | parseOneResponse (const TQString &_buffer, TQString &word, TQStringList &sugg) |
|
TQString | funnyWord (const TQString &word) |
|
void | dialog (const TQString &word, TQStringList &sugg, const char *_slot) |
|
TQString | replacement () const |
|
void | setUpDialog (bool reallyusedialogbox=true) |
|
void | emitProgress () |
|
bool | cleanFputs (const TQString &s, bool appendCR=true) |
|
bool | cleanFputsWord (const TQString &s, bool appendCR=true) |
|
void | startIspell () |
|
bool | writePersonalDictionary () |
|
void | initialize (TQWidget *_parent, const TQString &_caption, TQObject *obj, const char *slot, KSpellConfig *_ksc, bool _progressbar, bool _modal, SpellerType type) |
|
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.
- Author
- David Sweet dswee.nosp@m.t@kd.nosp@m.e.org
- See also
- KSpellConfig, KSyntaxHighlighter
Definition at line 46 of file tdespell.h.
◆ SpellerType
These are possible types of documents which the spell checker can check.
Text
- The default type, checks every word
HTML
- For HTML/SGML/XML documents, will skip the tags,
TeX
- For TeX/LaTeX documents, will skip commands,
Nroff
- For nroff/troff documents.
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.
Definition at line 80 of file tdespell.h.
◆ spellStatus
Possible states of the spell checker.
Starting
- After creation of KSpell.
Running
- After the ready signal has been emitted.
Cleaning
- After cleanUp() has been called.
Finished
- After cleanUp() has been completed.
The following error states exist:
Error
- An error occurred in the Starting
state.
Crashed
- An error occurred in the Running
state.
Definition at line 65 of file tdespell.h.
◆ KSpell() [1/2]
KSpell::KSpell |
( |
TQWidget * |
parent, |
|
|
const TQString & |
caption, |
|
|
TQObject * |
receiver, |
|
|
const char * |
slot, |
|
|
KSpellConfig * |
kcs = 0 , |
|
|
bool |
progressbar = true , |
|
|
bool |
modal = false |
|
) |
| |
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.
- Parameters
-
parent | Parent of KSpellConfig dialog.. |
caption | Caption of KSpellConfig dialog. |
receiver | Receiver object for the ready(KSpell *) signal. |
slot | Receiver's slot, will be connected to the ready(KSpell *) signal. |
kcs | Configuration for KSpell. |
progressbar | Indicates if progress bar should be shown. |
modal | Indicates modal or non-modal dialog. |
Definition at line 107 of file tdespell.cpp.
◆ KSpell() [2/2]
KSpell::KSpell |
( |
TQWidget * |
parent, |
|
|
const TQString & |
caption, |
|
|
TQObject * |
receiver, |
|
|
const char * |
slot, |
|
|
KSpellConfig * |
kcs, |
|
|
bool |
progressbar, |
|
|
bool |
modal, |
|
|
SpellerType |
type |
|
) |
| |
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.
- Parameters
-
parent | Parent of KSpellConfig dialog.. |
caption | Caption of KSpellConfig dialog. |
receiver | Receiver object for the ready(KSpell *) signal. |
slot | Receiver's slot, will be connected to the ready(KSpell *) signal. |
kcs | Configuration for KSpell. |
progressbar | Indicates if progress bar should be shown. |
modal | Indicates modal or non-modal dialog. |
type | Type of the document to check |
Definition at line 115 of file tdespell.cpp.
◆ ~KSpell()
The destructor instructs ISpell/ASpell to write out the personal dictionary and then terminates ISpell/ASpell.
Definition at line 1285 of file tdespell.cpp.
◆ addPersonal()
bool KSpell::addPersonal |
( |
const TQString & |
word | ) |
|
|
virtual |
Adds a word to the user's personal dictionary.
- Returns
- false if
word
is not a word or there was an error communicating with ISpell/ASpell.
Definition at line 391 of file tdespell.cpp.
◆ addword
void KSpell::addword |
( |
const TQString & |
originalword | ) |
|
|
signal |
Emitted when the user pressed "Add" in the dialog.
This could be used to make an external user dictionary independent of the ISpell personal dictionary.
◆ check()
bool KSpell::check |
( |
const TQString & |
_buffer, |
|
|
bool |
usedialog = true |
|
) |
| |
|
virtual |
Spellchecks a buffer of many words in plain text format.
The _buffer
is not modified. The signal done() will be sent when check() is finished and the argument will be a spell-corrected version of _buffer
.
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 _buffer
check() reached before stopping.
Definition at line 976 of file tdespell.cpp.
◆ check2
◆ check3
◆ checkList()
bool KSpell::checkList |
( |
TQStringList * |
_wordlist, |
|
|
bool |
usedialog = true |
|
) |
| |
|
virtual |
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.
Definition at line 782 of file tdespell.cpp.
◆ checkList2
void KSpell::checkList2 |
( |
| ) |
|
|
protectedslot |
◆ checkList3a
◆ checkList4
void KSpell::checkList4 |
( |
| ) |
|
|
protectedslot |
◆ checkListReplaceCurrent
void KSpell::checkListReplaceCurrent |
( |
| ) |
|
|
protectedslot |
◆ checkNext
void KSpell::checkNext |
( |
| ) |
|
|
protectedslot |
◆ checkWord() [1/2]
bool KSpell::checkWord |
( |
const TQString & |
_buffer, |
|
|
bool |
usedialog = false |
|
) |
| |
|
virtual |
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 false
if buffer
is not a single word (e.g. if it contains white space), otherwise it returns true
;
If usedialog
is set to true
, 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.
set the dialog signal handler
Definition at line 473 of file tdespell.cpp.
◆ checkWord() [2/2]
bool KSpell::checkWord |
( |
const TQString & |
buffer, |
|
|
bool |
_usedialog, |
|
|
bool |
suggest |
|
) |
| |
◆ checkWord2
◆ checkWord3
void KSpell::checkWord3 |
( |
| ) |
|
|
protectedslot |
◆ cleanFputs()
bool KSpell::cleanFputs |
( |
const TQString & |
s, |
|
|
bool |
appendCR = true |
|
) |
| |
|
protected |
◆ cleanFputsWord()
bool KSpell::cleanFputsWord |
( |
const TQString & |
s, |
|
|
bool |
appendCR = true |
|
) |
| |
|
protected |
◆ cleanUp()
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.
Definition at line 1302 of file tdespell.cpp.
◆ corrected
void KSpell::corrected |
( |
const TQString & |
originalword, |
|
|
const TQString & |
newword, |
|
|
unsigned int |
pos |
|
) |
| |
|
signal |
Emitted after the "Replace" or "Replace All" buttons of the dialog was pressed, or if the word was corrected without calling the dialog (i.e., the user previously chose "Replace All" for this word).
Results from the dialog may be checked with dlgResult() and replacement().
Note, that when using checkList() this signal can occur more then once with same list position, when checking a word with hyphens. In this case originalword
is the last replacement.
- See also
- check()
◆ death
Emitted on terminal errors and after clean up.
You can delete the KSpell object in this signal.
You can check status() to see what caused the death:
Error
- KSpell could not start.
Crashed
- KSpell encountered an unexpected error during execution.
Finished
- Clean up finished.
◆ dialog()
void KSpell::dialog |
( |
const TQString & |
word, |
|
|
TQStringList & |
sugg, |
|
|
const char * |
_slot |
|
) |
| |
|
protected |
◆ dialog2
void KSpell::dialog2 |
( |
int |
dlgresult | ) |
|
|
protectedslot |
◆ dlgResult()
int KSpell::dlgResult |
( |
| ) |
const |
|
inline |
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 tdespelldlg.h):
- KS_CANCEL
- KS_REPLACE
- KS_REPLACEALL
- KS_IGNORE
- KS_IGNOREALL
- KS_ADD
- KS_STOP
Definition at line 240 of file tdespell.h.
◆ done [1/2]
void KSpell::done |
( |
bool |
| ) |
|
|
signal |
Emitted when checkList() is done.
If the argument is true
, then you should update your text from the wordlist, otherwise not.
◆ done [2/2]
void KSpell::done |
( |
const TQString & |
buffer | ) |
|
|
signal |
Emitted when check() is done.
Be sure to copy the results of buffer
if you need them. You can only rely on the contents of buffer for the life of the slot which was signaled by done().
◆ emitDeath
void KSpell::emitDeath |
( |
| ) |
|
|
protectedslot |
◆ emitProgress()
void KSpell::emitProgress |
( |
| ) |
|
|
protected |
◆ funnyWord()
TQString KSpell::funnyWord |
( |
const TQString & |
word | ) |
|
|
protected |
◆ heightDlg()
int KSpell::heightDlg |
( |
| ) |
const |
Returns the height of the dialog box.
Definition at line 125 of file tdespell.cpp.
◆ hide()
◆ ignore()
bool KSpell::ignore |
( |
const TQString & |
word | ) |
|
|
virtual |
Tells ISpell/ASpell to ignore this word for the life of this KSpell instance.
- Returns
- false if
word
is not a word or there was an error communicating with ISpell/ASpell.
Definition at line 410 of file tdespell.cpp.
◆ ignoreall
void KSpell::ignoreall |
( |
const TQString & |
originalword | ) |
|
|
signal |
Emitted when the user pressed "Ignore All" in the dialog.
This could be used to make an application or file specific user dictionary.
◆ ignoreword
void KSpell::ignoreword |
( |
const TQString & |
originalword | ) |
|
|
signal |
Emitted when the user pressed "Ignore" in the dialog.
Don't know if this could be useful.
◆ initialize()
void KSpell::initialize |
( |
TQWidget * |
_parent, |
|
|
const TQString & |
_caption, |
|
|
TQObject * |
obj, |
|
|
const char * |
slot, |
|
|
KSpellConfig * |
_ksc, |
|
|
bool |
_progressbar, |
|
|
bool |
_modal, |
|
|
SpellerType |
type |
|
) |
| |
|
protected |
◆ intermediateBuffer()
TQString KSpell::intermediateBuffer |
( |
| ) |
const |
|
inline |
Returns the partially spellchecked buffer.
You might want the full buffer in its partially-checked state.
Definition at line 267 of file tdespell.h.
◆ ispellErrors
void KSpell::ispellErrors |
( |
TDEProcess * |
, |
|
|
char * |
buffer, |
|
|
int |
buflen |
|
) |
| |
|
protectedslot |
◆ ispellExit
◆ ksConfig()
◆ KSpell2
◆ lastPosition()
int KSpell::lastPosition |
( |
| ) |
const |
|
inline |
◆ misspelling
void KSpell::misspelling |
( |
const TQString & |
originalword, |
|
|
const TQStringList & |
suggestions, |
|
|
unsigned int |
pos |
|
) |
| |
|
signal |
Emitted whenever a misspelled word is found by check() or by checkWord().
If it is emitted by checkWord(), pos=0
. If it is emitted by check(), then pos
indicates the position of the misspelled word in the (original) _buffer
. (The first position is zero.) If it is emitted by checkList(), pos
is the index to the misspelled word in the TQStringList passed to checkList(). Note, that originalword
can be only a word part, if it's word with hyphens.
These are called before the dialog is opened, so that the calling program's GUI may be updated. (e.g. the misspelled word may be highlighted).
◆ modalCheck() [1/2]
int KSpell::modalCheck |
( |
TQString & |
text | ) |
|
|
static |
- Deprecated:
- Performs a synchronous spellcheck.
This method does not return until spellchecking is done or canceled. Your application's GUI will still be updated, however.
Definition at line 1391 of file tdespell.cpp.
◆ modalCheck() [2/2]
int KSpell::modalCheck |
( |
TQString & |
text, |
|
|
KSpellConfig * |
kcs |
|
) |
| |
|
static |
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.
Definition at line 1397 of file tdespell.cpp.
◆ moveDlg()
void KSpell::moveDlg |
( |
int |
x, |
|
|
int |
y |
|
) |
| |
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.
Definition at line 1367 of file tdespell.cpp.
◆ parseOneResponse()
int KSpell::parseOneResponse |
( |
const TQString & |
_buffer, |
|
|
TQString & |
word, |
|
|
TQStringList & |
sugg |
|
) |
| |
|
protected |
◆ progress
void KSpell::progress |
( |
unsigned int |
i | ) |
|
|
signal |
Emitted during a check().
i
is between 1 and 100.
◆ ready
void KSpell::ready |
( |
KSpell * |
| ) |
|
|
signal |
Emitted after KSpell has verified that ISpell/ASpell is running and working properly.
◆ replaceall
void KSpell::replaceall |
( |
const TQString & |
origword, |
|
|
const TQString & |
replacement |
|
) |
| |
|
signal |
Emitted when the user pressed "ReplaceAll" in the dialog.
◆ replacement()
TQString KSpell::replacement |
( |
| ) |
const |
|
inlineprotected |
◆ setAutoDelete()
void KSpell::setAutoDelete |
( |
bool |
_autoDelete | ) |
|
|
inline |
Sets the auto-delete flag.
If this is set, the KSpell object is automatically deleted after emitting death().
Definition at line 145 of file tdespell.h.
◆ setIgnoreTitleCase()
void KSpell::setIgnoreTitleCase |
( |
bool |
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.
Definition at line 1379 of file tdespell.cpp.
◆ setIgnoreUpperWords()
void KSpell::setIgnoreUpperWords |
( |
bool |
b | ) |
|
Call setIgnoreUpperWords(true) to tell the spell-checker to ignore words that are completely uppercase.
They are spell-checked by default.
Definition at line 1374 of file tdespell.cpp.
◆ setProgressResolution()
void KSpell::setProgressResolution |
( |
unsigned int |
res | ) |
|
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%.
Definition at line 1351 of file tdespell.cpp.
◆ setUpDialog()
void KSpell::setUpDialog |
( |
bool |
reallyusedialogbox = true | ) |
|
|
protected |
◆ slotStopCancel
void KSpell::slotStopCancel |
( |
int |
result | ) |
|
|
protectedslot |
◆ startIspell()
void KSpell::startIspell |
( |
| ) |
|
|
protected |
◆ status()
◆ suggestions()
TQStringList KSpell::suggestions |
( |
| ) |
const |
|
inline |
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).
Definition at line 222 of file tdespell.h.
◆ suggestWord
◆ widthDlg()
int KSpell::widthDlg |
( |
| ) |
const |
Returns the width of the dialog box.
Definition at line 126 of file tdespell.cpp.
◆ writePersonalDictionary()
bool KSpell::writePersonalDictionary |
( |
| ) |
|
|
protected |
◆ autoDelete
◆ caption
◆ codec
TQTextCodec* KSpell::codec |
|
protected |
◆ curprog
unsigned int KSpell::curprog |
|
protected |
◆ cwword
◆ dialog3slot
TQString KSpell::dialog3slot |
|
protected |
◆ dialogsetup
◆ dialogwillprocess
bool KSpell::dialogwillprocess |
|
protected |
◆ dlgon
◆ dlgorigword
TQString KSpell::dlgorigword |
|
protected |
◆ dlgreplacement
TQString KSpell::dlgreplacement |
|
protected |
◆ dlgresult
◆ ignorelist
TQStringList KSpell::ignorelist |
|
protected |
◆ ksconfig
◆ ksdlg
◆ lastlastline
unsigned int KSpell::lastlastline |
|
protected |
◆ lastline
unsigned int KSpell::lastline |
|
protected |
◆ lastpos
◆ m_status
◆ maxtrystart
◆ modaldlg
◆ modalreturn
int KSpell::modalreturn = 0 |
|
staticprotected |
◆ modaltext
TQString KSpell::modaltext |
|
staticprotected |
◆ modalWidgetHack
TQWidget * KSpell::modalWidgetHack = 0 |
|
staticprotected |
◆ newbuffer
TQString KSpell::newbuffer |
|
protected |
◆ offset
unsigned int KSpell::offset |
|
protected |
◆ orig
◆ origbuffer
TQString KSpell::origbuffer |
|
protected |
◆ parent
◆ personaldict
bool KSpell::personaldict |
|
protected |
◆ posinline
unsigned int KSpell::posinline |
|
protected |
◆ proc
◆ progres
unsigned int KSpell::progres |
|
protected |
◆ progressbar
◆ replacelist
TQStringList KSpell::replacelist |
|
protected |
◆ sugg
TQStringList KSpell::sugg |
|
protected |
◆ texmode
◆ totalpos
unsigned int KSpell::totalpos |
|
protected |
◆ trystart
◆ usedialog
◆ wlIt
TQStringList::Iterator KSpell::wlIt |
|
protected |
◆ wordlist
TQStringList* KSpell::wordlist |
|
protected |
The documentation for this class was generated from the following files: