00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
#ifndef __KSPELL_H__
00019
#define __KSPELL_H__
00020
00021
#include "ksconfig.h"
00022
00023
#include <qobject.h>
00024
#include <qstringlist.h>
00025
#include <qstring.h>
00026
00027
class QTextCodec;
00028
class KProcIO;
00029
class KProcess;
00030
00042 class KoSpell :
public QObject
00043 {
00044 Q_OBJECT
00045
00046
public:
00047
00062 enum spellStatus
00063 {
00064 Starting = 0,
00065 Running,
00066 Cleaning,
00067 Finished,
00068 Error,
00069 Crashed
00070 };
00071
00072
enum Spelling
00073 {
00074 SpellingOk,
00075 SpellingIgnore,
00076 Misspelled,
00077 SpellingError,
00078 SpellingDone
00079 };
00080
00099
KoSpell(
QWidget *parent,
QObject *receiver,
const char *slot, KSpellConfig *kcs=0);
00100
00106 spellStatus status()
const {
return m_status; }
00107
00115
virtual void cleanUp ();
00116
00130
virtual bool check(
const QString &buffer);
00131
00132 Spelling parseLine(
const QString &line,
QString &word,
int &pos);
00133
00140
virtual bool ignore (
const QString & word);
00141
00148
virtual bool addPersonal (
const QString & word);
00149
00153 KSpellConfig
ksConfig () const;
00154
00159 virtual ~
KoSpell();
00160
00165
void setIgnoreUpperWords(
bool b);
00166
00172
void setIgnoreTitleCase(
bool b);
00173
00174 signals:
00175
00193
void misspelling (const
QString & originalword,
int pos);
00194
00199
void ready(KoSpell *);
00200
00201
void done();
00202
00213
void death( );
00214
00215 static
QStringList getAvailDictsAspell ();
00216 static
QStringList getAvailDictsIspell ();
00217
00218 protected slots:
00219
00220
void KoSpell2(KProcIO *);
00221
void check2 (KProcIO *);
00222
void ispellExit (KProcess *);
00223
void emitDeath();
00224
void ispellErrors (KProcess *,
char *,
int);
00225
00226 protected:
00227
QStringList m_buffer;
00228
QStringList ignorelist;
00229
int trystart;
00230
int maxtrystart;
00231 KProcIO *proc;
00232
QWidget *parent;
00233 KSpellConfig *ksconfig;
00234
QTextCodec* codec;
00235
00236 spellStatus m_status;
00237
00238
QString funnyWord (const
QString & word);
00239
00240
void startIspell();
00241
bool writePersonalDictionary ();
00242 static
bool interpret (
QString &fname,
QString &lname,
QString &hname);
00243
00244 private:
00245 class KoSpellPrivate;
00246 KoSpellPrivate *d;
00247 };
00248
00249 #endif