• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeui
 

tdeui

tdespell.h

00001 /* This file is part of the KDE libraries
00002    Copyright (C) 1997 David Sweet <dsweet@kde.org>
00003    Copyright (C) 2003 Zack Rusin <zack@kde.org>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License version 2 as published by the Free Software Foundation.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017    Boston, MA 02110-1301, USA.
00018 */
00019 #ifndef __TDESPELL_H__
00020 #define __TDESPELL_H__
00021 
00022 #include "ksconfig.h"
00023 
00024 #include <tqobject.h>
00025 #include <tqstringlist.h>
00026 #include <tqstring.h>
00027 #include <tdelibs_export.h>
00028 
00029 class TQTextCodec;
00030 class KProcIO;
00031 class TDEProcess;
00032 class KSpellDlg;
00033 
00046 class TDEUI_EXPORT KSpell : public TQObject
00047 {
00048   Q_OBJECT
00049 
00050 public:
00051 
00065   enum spellStatus { Starting = 0, Running, Cleaning, Finished, Error, Crashed, FinishedNoMisspellingsEncountered };
00066 
00080   enum SpellerType { Text = 0, HTML, TeX, Nroff };
00081 
00099   KSpell(TQWidget *parent, const TQString &caption,
00100      TQObject *receiver, const char *slot, KSpellConfig *kcs=0,
00101      bool progressbar = true, bool modal = false);
00102 
00121   KSpell(TQWidget *parent, const TQString &caption,
00122      TQObject *receiver, const char *slot, KSpellConfig *kcs,
00123      bool progressbar, bool modal, SpellerType type);
00124 
00130   spellStatus status() const { return m_status; }
00131 
00139   virtual void cleanUp ();
00140 
00145   void setAutoDelete(bool _autoDelete) { autoDelete = _autoDelete; }
00146 
00160   virtual bool check (const TQString &_buffer, bool usedialog = true);
00161 
00167   int lastPosition() const
00168     { return lastpos;}
00169 
00180   virtual bool checkList (TQStringList *_wordlist, bool usedialog = true);
00181 
00204   virtual bool checkWord (const TQString &_buffer, bool usedialog = false);
00205   bool checkWord( const TQString & buffer, bool _usedialog, bool suggest );
00206 
00212   void hide ();
00213 
00222   TQStringList suggestions () const { return sugg; }
00223 
00240   int dlgResult () const
00241     { return dlgresult; }
00242 
00251   void moveDlg (int x, int y);
00252 
00256   int heightDlg () const;
00260   int widthDlg () const;
00261 
00267   TQString intermediateBuffer () const {return newbuffer;}
00268 
00275   virtual bool ignore (const TQString & word);
00276 
00283   virtual bool addPersonal (const TQString & word);
00284 
00288   KSpellConfig ksConfig () const;
00289 
00297   void setProgressResolution (unsigned int res);
00298 
00303   virtual ~KSpell();
00304 
00313   static int modalCheck( TQString& text ) KDE_DEPRECATED;
00314 
00323   static int modalCheck( TQString& text, KSpellConfig * kcs );
00324 
00329   void setIgnoreUpperWords(bool b);
00330 
00336   void setIgnoreTitleCase(bool b);
00337 
00338 signals:
00339 
00357   void misspelling (const TQString & originalword, const TQStringList & suggestions,
00358             unsigned int pos);
00359 
00375   void corrected (const TQString & originalword, const TQString & newword, unsigned int pos);
00376 
00383   void ignoreall (const TQString & originalword);
00384 
00390   void ignoreword (const TQString & originalword);
00391 
00398   void addword (const TQString & originalword);
00399 
00403   void replaceall( const TQString & origword ,  const TQString &replacement );
00404 
00409   void ready(KSpell *);
00410 
00415   void progress (unsigned int i);
00416 
00425   void done (const TQString &buffer);
00426 
00434   void done(bool);
00435 
00446   void death( );
00447 
00448 
00449 protected slots:
00450   /* All of those signals from KProcIO get sent here. */
00451   void KSpell2 (KProcIO *);
00452   void checkWord2 (KProcIO *);
00453   void checkWord3 ();
00454   void check2 (KProcIO *);
00455   void checkList2 ();
00456   void checkList3a (KProcIO *);
00457   void checkListReplaceCurrent ();
00458   void checkList4 ();
00459   void dialog2 (int dlgresult);
00460   void check3 ();
00461   void suggestWord( KProcIO * );
00462 
00463   void slotStopCancel (int);
00464   void ispellExit (TDEProcess *);
00465   void emitDeath();
00466   void ispellErrors (TDEProcess *, char *, int);
00467   void checkNext();
00468 
00469 private slots:
00473   void slotModalReady();
00474 
00478   void slotModalDone( const TQString & );
00479 
00483   void slotSpellCheckerCorrected( const TQString & oldText, const TQString & newText, unsigned int );
00484 
00488   void  slotModalSpellCheckerFinished( );
00489 
00490 signals:
00491   void dialog3 ();
00492 
00493 protected:
00494 
00495   KProcIO *proc;
00496   TQWidget *parent;
00497   KSpellConfig *ksconfig;
00498   KSpellDlg *ksdlg;
00499   TQStringList *wordlist;
00500   TQStringList::Iterator wlIt;
00501   TQStringList ignorelist;
00502   TQStringList replacelist;
00503   TQStringList sugg;
00504   TQTextCodec* codec;
00505 
00506   spellStatus m_status;
00507 
00508   bool usedialog;
00509   bool texmode;
00510   bool dlgon;
00511   bool personaldict;
00512   bool dialogwillprocess;
00513   bool progressbar;
00514   bool dialogsetup;
00515   bool autoDelete;
00516 
00517   TQString caption;
00518   TQString orig;
00519   TQString origbuffer;
00520   TQString newbuffer;
00521   TQString cwword;
00522   TQString dlgorigword;
00523   TQString dlgreplacement;
00524   TQString dialog3slot;
00525 
00526   int dlgresult;
00527   int trystart;
00528   int maxtrystart;
00529   int lastpos;
00530   unsigned int totalpos;
00531   unsigned int lastline;
00532   unsigned int posinline;
00533   unsigned int lastlastline;
00534   unsigned int offset;
00535   unsigned int progres;
00536   unsigned int curprog;
00537 
00541   bool modaldlg;
00542   static TQString modaltext;
00543   static int modalreturn;
00544   static TQWidget* modalWidgetHack;
00545 
00546   int parseOneResponse (const TQString &_buffer, TQString &word, TQStringList &sugg);
00547   TQString funnyWord (const TQString & word);
00548   void dialog (const TQString & word, TQStringList & sugg, const char* _slot);
00549   TQString replacement () const
00550     { return dlgreplacement; }
00551 
00552   void setUpDialog ( bool reallyusedialogbox = true);
00553 
00554   void emitProgress ();
00555   bool cleanFputs (const TQString & s, bool appendCR=true);
00556   bool cleanFputsWord (const TQString & s, bool appendCR=true);
00557   void startIspell();
00558   bool writePersonalDictionary();
00559   void initialize( TQWidget *_parent, const TQString &_caption,
00560                    TQObject *obj, const char *slot, KSpellConfig *_ksc,
00561                    bool _progressbar, bool _modal, SpellerType type );
00562 
00563 private:
00564   class KSpellPrivate;
00565   KSpellPrivate *d;
00566 };
00567 
00568 #endif

tdeui

Skip menu "tdeui"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeui

Skip menu "tdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeui by doxygen 1.6.3
This website is maintained by Timothy Pearson.