lib Library API Documentation

koSpell.h

00001 /* This file is part of the KDE libraries 00002 Copyright (C) 2002-2003 Laurent Montel <lmontel@mandrakesoft.com> 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 __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 //slot necessary for old lib 00052 //receive used this by default 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 // emit to start spell check when we use libaspell 00304 void spellCheckerReady(); 00305 00306 private slots: 00307 virtual void slotSpellCheckerCorrected( const QString &, const QString &, unsigned int ) = 0; 00308 virtual void slotModalDone( const QString &/*_buffer*/ ) = 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
KDE Logo
This file is part of the documentation for lib Library Version 1.3.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Sep 28 04:04:01 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003