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

tdeui

  • tdeui
tdespell.h
1 /* This file is part of the KDE libraries
2  Copyright (C) 1997 David Sweet <dsweet@kde.org>
3  Copyright (C) 2003 Zack Rusin <zack@kde.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License version 2 as published by the Free Software Foundation.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 #ifndef __TDESPELL_H__
20 #define __TDESPELL_H__
21 
22 #include "ksconfig.h"
23 
24 #include <tqobject.h>
25 #include <tqstringlist.h>
26 #include <tqstring.h>
27 #include <tdelibs_export.h>
28 
29 class TQTextCodec;
30 class KProcIO;
31 class TDEProcess;
32 class KSpellDlg;
33 
46 class TDEUI_EXPORT KSpell : public TQObject
47 {
48  Q_OBJECT
49 
50 public:
51 
65  enum spellStatus { Starting = 0, Running, Cleaning, Finished, Error, Crashed, FinishedNoMisspellingsEncountered };
66 
80  enum SpellerType { Text = 0, HTML, TeX, Nroff };
81 
99  KSpell(TQWidget *parent, const TQString &caption,
100  TQObject *receiver, const char *slot, KSpellConfig *kcs=0,
101  bool progressbar = true, bool modal = false);
102 
121  KSpell(TQWidget *parent, const TQString &caption,
122  TQObject *receiver, const char *slot, KSpellConfig *kcs,
123  bool progressbar, bool modal, SpellerType type);
124 
130  spellStatus status() const { return m_status; }
131 
139  virtual void cleanUp ();
140 
145  void setAutoDelete(bool _autoDelete) { autoDelete = _autoDelete; }
146 
160  virtual bool check (const TQString &_buffer, bool usedialog = true);
161 
167  int lastPosition() const
168  { return lastpos;}
169 
180  virtual bool checkList (TQStringList *_wordlist, bool usedialog = true);
181 
204  virtual bool checkWord (const TQString &_buffer, bool usedialog = false);
205  bool checkWord( const TQString & buffer, bool _usedialog, bool suggest );
206 
212  void hide ();
213 
222  TQStringList suggestions () const { return sugg; }
223 
240  int dlgResult () const
241  { return dlgresult; }
242 
251  void moveDlg (int x, int y);
252 
256  int heightDlg () const;
260  int widthDlg () const;
261 
267  TQString intermediateBuffer () const {return newbuffer;}
268 
275  virtual bool ignore (const TQString & word);
276 
283  virtual bool addPersonal (const TQString & word);
284 
288  KSpellConfig ksConfig () const;
289 
297  void setProgressResolution (unsigned int res);
298 
303  virtual ~KSpell();
304 
313  static int modalCheck( TQString& text ) KDE_DEPRECATED;
314 
323  static int modalCheck( TQString& text, KSpellConfig * kcs );
324 
329  void setIgnoreUpperWords(bool b);
330 
336  void setIgnoreTitleCase(bool b);
337 
338 signals:
339 
357  void misspelling (const TQString & originalword, const TQStringList & suggestions,
358  unsigned int pos);
359 
375  void corrected (const TQString & originalword, const TQString & newword, unsigned int pos);
376 
383  void ignoreall (const TQString & originalword);
384 
390  void ignoreword (const TQString & originalword);
391 
398  void addword (const TQString & originalword);
399 
403  void replaceall( const TQString & origword , const TQString &replacement );
404 
409  void ready(KSpell *);
410 
415  void progress (unsigned int i);
416 
425  void done (const TQString &buffer);
426 
434  void done(bool);
435 
446  void death( );
447 
448 
449 protected slots:
450  /* All of those signals from KProcIO get sent here. */
451  void KSpell2 (KProcIO *);
452  void checkWord2 (KProcIO *);
453  void checkWord3 ();
454  void check2 (KProcIO *);
455  void checkList2 ();
456  void checkList3a (KProcIO *);
457  void checkListReplaceCurrent ();
458  void checkList4 ();
459  void dialog2 (int dlgresult);
460  void check3 ();
461  void suggestWord( KProcIO * );
462 
463  void slotStopCancel (int);
464  void ispellExit (TDEProcess *);
465  void emitDeath();
466  void ispellErrors (TDEProcess *, char *, int);
467  void checkNext();
468 
469 private slots:
473  void slotModalReady();
474 
478  void slotModalDone( const TQString & );
479 
483  void slotSpellCheckerCorrected( const TQString & oldText, const TQString & newText, unsigned int );
484 
488  void slotModalSpellCheckerFinished( );
489 
490 signals:
491  void dialog3 ();
492 
493 protected:
494 
495  KProcIO *proc;
496  TQWidget *parent;
497  KSpellConfig *ksconfig;
498  KSpellDlg *ksdlg;
499  TQStringList *wordlist;
500  TQStringList::Iterator wlIt;
501  TQStringList ignorelist;
502  TQStringList replacelist;
503  TQStringList sugg;
504  TQTextCodec* codec;
505 
506  spellStatus m_status;
507 
508  bool usedialog;
509  bool texmode;
510  bool dlgon;
511  bool personaldict;
512  bool dialogwillprocess;
513  bool progressbar;
514  bool dialogsetup;
515  bool autoDelete;
516 
517  TQString caption;
518  TQString orig;
519  TQString origbuffer;
520  TQString newbuffer;
521  TQString cwword;
522  TQString dlgorigword;
523  TQString dlgreplacement;
524  TQString dialog3slot;
525 
526  int dlgresult;
527  int trystart;
528  int maxtrystart;
529  int lastpos;
530  unsigned int totalpos;
531  unsigned int lastline;
532  unsigned int posinline;
533  unsigned int lastlastline;
534  unsigned int offset;
535  unsigned int progres;
536  unsigned int curprog;
537 
541  bool modaldlg;
542  static TQString modaltext;
543  static int modalreturn;
544  static TQWidget* modalWidgetHack;
545 
546  int parseOneResponse (const TQString &_buffer, TQString &word, TQStringList &sugg);
547  TQString funnyWord (const TQString & word);
548  void dialog (const TQString & word, TQStringList & sugg, const char* _slot);
549  TQString replacement () const
550  { return dlgreplacement; }
551 
552  void setUpDialog ( bool reallyusedialogbox = true);
553 
554  void emitProgress ();
555  bool cleanFputs (const TQString & s, bool appendCR=true);
556  bool cleanFputsWord (const TQString & s, bool appendCR=true);
557  void startIspell();
558  bool writePersonalDictionary();
559  void initialize( TQWidget *_parent, const TQString &_caption,
560  TQObject *obj, const char *slot, KSpellConfig *_ksc,
561  bool _progressbar, bool _modal, SpellerType type );
562 
563 private:
564  class KSpellPrivate;
565  KSpellPrivate *d;
566 };
567 
568 #endif
KSpell::SpellerType
SpellerType
These are possible types of documents which the spell checker can check.
Definition: tdespell.h:80
KSpell::dlgResult
int dlgResult() const
Gets the result code of the dialog box.
Definition: tdespell.h:240
KSpell::suggestions
TQStringList suggestions() const
Returns list of suggested word replacements.
Definition: tdespell.h:222
KSpell::setAutoDelete
void setAutoDelete(bool _autoDelete)
Sets the auto-delete flag.
Definition: tdespell.h:145
KSpell::modaldlg
bool modaldlg
Used for modalCheck.
Definition: tdespell.h:541
KSpell::status
spellStatus status() const
Returns the status of KSpell.
Definition: tdespell.h:130
KSpell::lastPosition
int lastPosition() const
Returns the position (when using check()) or word number (when using checkList()) of the last word ch...
Definition: tdespell.h:167
KSpellConfig
A configuration class/dialog for KSpell.
Definition: ksconfig.h:87
KSpell::intermediateBuffer
TQString intermediateBuffer() const
Returns the partially spellchecked buffer.
Definition: tdespell.h:267
TDEProcess
KSpell::spellStatus
spellStatus
Possible states of the spell checker.
Definition: tdespell.h:65
KProcIO
KSpell
KDE Spellchecker
Definition: tdespell.h:46

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
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeui by doxygen 1.8.8
This website is maintained by Timothy Pearson.