00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
#ifndef __KOSPELL_H__
00019
#define __KOSPELL_H__
00020
00021
#include "koSconfig.h"
00022
00023
#include <qobject.h>
00024
#include <qstringlist.h>
00025
#include <qstring.h>
00026
00027
class KOSpellDlg;
00028
00029
class KOSpell :
public QObject
00030 {
00031 Q_OBJECT
00032
public:
00033
enum spellStatus { Starting = 0, Running, Cleaning, Finished, Error, Crashed, FinishedNoMisspellingsEncountered };
00034
00048
enum KOSpellerType { Text = 0, HTML, TeX, Nroff };
00049
00050 ~KOSpell();
00051
00052
00053
static KOSpell *createKoSpell(
QWidget *parent,
const QString &caption,
QObject *receiver,
const char *slot,
KOSpellConfig *kcs,
bool modal,
bool _autocorrect, KOSpellerType type = Text);
00054
00055
static int modalCheck(
QString& text,
KOSpellConfig * kcs );
00056
00057
00065
virtual void cleanUp () {};
00066
00067
00073
int lastPosition()
const
00074
{
return lastpos;}
00075
00080
void setAutoDelete(
bool _autoDelete) { autoDelete = _autoDelete; }
00086 spellStatus status()
const {
return m_status; }
00100
virtual bool check (
const QString &_buffer,
bool usedialog = TRUE) = 0;
00101
00102
virtual QStringList resultCheckWord(
const QString &_word ) = 0;
00103
00104
00111
virtual bool ignore (
const QString & word)=0;
00112
00119
virtual bool addPersonal (
const QString & word)= 0;
00120
00125
void setIgnoreUpperWords(
bool b);
00126
00132
void setIgnoreTitleCase(
bool b);
00136
KOSpellConfig ksConfig () const;
00137
00138
QString replacement ()
const {
return dlgreplacement; }
00144
QString intermediateBuffer ()
const {
return newbuffer;}
00150
void hide ();
00154
int heightDlg () const;
00158
int widthDlg () const;
00167
void moveDlg (
int x,
int y);
00184
int dlgResult ()
const
00185
{
return dlgresult; }
00194
QStringList suggestions ()
const {
return sugg; }
00195 signals:
00196
00214
void misspelling (
const QString & originalword,
const QStringList & suggestions,
00215
unsigned int pos);
00216
00232
void corrected (
const QString & originalword,
const QString & newword,
unsigned int pos);
00233
00240
void ignoreall (
const QString & originalword);
00241
00247
void ignoreword (
const QString & originalword);
00248
00255
void addword (
const QString & originalword);
00256
00260
void replaceall(
const QString & origword ,
const QString &replacement );
00261
00262
void addAutoCorrect (
const QString & originalword,
const QString & newword);
00263
00264
00269
void ready(KOSpell *);
00270
00271
00280
void done (
const QString &buffer);
00281
00289
void done(
bool);
00290
00301
void death( );
00302
00303
00304
void spellCheckerReady();
00305
00306
private slots:
00307
virtual void slotSpellCheckerCorrected(
const QString &,
const QString &,
unsigned int ) = 0;
00308
virtual void slotModalDone(
const QString & ) = 0;
00309
virtual void slotModalSpellCheckerFinished() = 0;
00310
00311
protected:
00312
void initSpell(
KOSpellConfig *_ksc );
00313
void misspellingWord (
const QString & originalword,
const QStringList & suggestions,
unsigned int pos);
00314
00315 KOSpell(
QWidget *parent,
const QString &caption,
KOSpellConfig *kcs=0,
00316
bool modal = FALSE,
bool _autocorrect =FALSE, KOSpellerType type = Text );
00317 KOSpell(
KOSpellConfig *_ksc );
00318
00319
bool endOfResponse;
00320
bool m_bIgnoreUpperWords;
00321
bool m_bIgnoreTitleCase;
00322
bool autoDelete;
00323
bool m_bNoMisspellingsEncountered;
00324
unsigned int totalpos;
00325
unsigned int lastline;
00326
unsigned int posinline;
00327
unsigned int lastlastline;
00328
unsigned int offset;
00329
bool usedialog;
00330
static QString modaltext;
00331
static int modalreturn;
00332
00333
bool personaldict;
00334
bool dialogwillprocess;
00335
00336
KOSpellConfig *ksconfig;
00337 KOSpellerType type;
00338 spellStatus m_status;
00339
int lastpos;
00340
bool modaldlg;
00341
bool autocorrect;
00342
QString caption;
00343
QString orig;
00344
QString origbuffer;
00345
QString newbuffer;
00346
QString cwword;
00347
QString dlgorigword;
00348
QString dlgreplacement;
00349
QStringList ignorelist;
00350
QStringList replacelist;
00351
QWidget *parent;
00352 KOSpellDlg *ksdlg;
00353
QStringList *wordlist;
00354 QStringList::Iterator wlIt;
00355
QStringList sugg;
00356
QTextCodec* codec;
00357
int dlgresult;
00358 };
00359
#endif