lib Library API Documentation

koBgSpellCheck.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2002 David Faure <david@mandrakesoft.com>
00003                  2002 Laurent Montel <lmontel@mandrakesoft.com>
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 as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018    Boston, MA 02111-1307, USA.
00019 */
00020 
00021 #ifndef kobgspellcheck_h
00022 #define kobgspellcheck_h
00023 
00024 
00025 #include <qobject.h>
00026 #include <qstringlist.h>
00027 class KoTextObject;
00028 class KoSpell;
00029 class KoDocument;
00030 class KSpellConfig;
00031 class KOSpellConfig;
00032 class KoTextParag;
00033 
00034 class KoBgSpellCheck : public QObject
00035 {
00036     Q_OBJECT
00037 public:
00038     KoBgSpellCheck();
00039     virtual ~KoBgSpellCheck();
00040     void enableBackgroundSpellCheck( bool b );
00041 
00042     bool backgroundSpellCheckEnabled() const { return m_bSpellCheckEnabled; }
00043 
00044     void setIgnoreUpperWords( bool b);
00045     void setIgnoreTitleCase( bool b);
00046 
00047     void setKSpellConfig(const KOSpellConfig &_kspell);
00048 
00049     //repaint object when we spell check
00050     virtual void slotRepaintChanged(KoTextObject *obj)=0;
00051 
00052     virtual KoTextObject* nextTextObject( KoTextObject *obj )=0;
00053 
00054     virtual void configurateSpellChecker()=0;
00055     void addIgnoreWordAll( const QString & word);
00056     void clearIgnoreWordAll( );
00057     void addIgnoreWordAllList( const QStringList & list);
00058     void spellCheckParagraphDeleted( KoTextParag *_parag,  KoTextObject *obj);
00059     void addPersonalDictonary( const QString & word );
00060 public slots:
00061     void startBackgroundSpellCheck();
00062 
00063 protected slots:
00064     void spellCheckerReady();
00065     void spellCheckerMisspelling(const QString &, int );
00066     void spellCheckerDone();
00067     void spellCheckerFinished( );
00068     void spellCheckNextParagraph();
00069 
00070 protected:
00071     KSpellConfig* spellConfig();
00072     void nextParagraphNeedingCheck();
00073     void stopSpellChecking();
00074     // Structure holding the background spellcheck data
00075     struct KoBGSpell {
00076         KoBGSpell() : kspell(0L), currentTextObj(0L), currentParag(0L) {}
00077 
00078         // KSpell object for the background spellcheck
00079     KoSpell *kspell;
00080         // The text frameset currently being checked
00081     // TODO change current text frameset, and implementing nextTextFrameSet, see kwview.cc
00082         // TODO implement "skip unchanged framesets" and "stop timer after all checked and until
00083         // user types something again"
00084         KoTextObject *currentTextObj;
00085         // The paragraph currently being checked
00086         KoTextParag *currentParag;
00087     // Last parag was changed (word marked misspelled), we need to repaint it.
00088     bool needsRepaint;
00089     };
00090     KoBGSpell m_bgSpell;
00091 
00092 private:
00093     class KoBgSpellCheckPrivate;
00094     KoBgSpellCheckPrivate *d;
00095     QStringList m_spellListIgnoreAll;
00096     bool m_bSpellCheckEnabled;
00097     bool m_bDontCheckUpperWord;
00098     bool m_bDontCheckTitleCase;
00099     bool m_bSpellCheckConfigure;
00100 };
00101 #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 Sun Mar 20 14:25:24 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003