lib Library API Documentation

kospell.h

00001 /* This file is part of the KDE libraries
00002    Copyright (C) 1997 David Sweet <dsweet@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License version 2 as published by the Free Software Foundation.
00007 
00008    This library is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011    Library General Public License for more details.
00012 
00013    You should have received a copy of the GNU Library General Public License
00014    along with this library; see the file COPYING.LIB.  If not, write to
00015    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00016    Boston, MA 02111-1307, USA.
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     /* All of those signals from KProcIO get sent here. */
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
KDE Logo
This file is part of the documentation for lib Library Version 1.3.5.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Nov 17 13:19:25 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2003