~ubuntu-branches/ubuntu/breezy/koffice/breezy

« back to all changes in this revision

Viewing changes to lib/kotext/koBgSpellCheck.h

  • Committer: Bazaar Package Importer
  • Author(s): Ben Burton
  • Date: 2004-05-09 11:33:00 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040509113300-vfrdadqsvjfuhn3b
Tags: 1:1.3.1-1
* New upstream bugfix release.
* Built against newer imagemagick (closes: #246623).
* Made koffice-libs/kformula recommend/depend on latex-xft-fonts, which
  provides mathematical fonts that the formula editor can use.  Also
  patched the kformula part to make these fonts the default.
* Changed kword menu hint from "WordProcessors" to "Word processors"
  (closes: #246209).
* Spellchecker configuration is now fixed (closes: #221256, #227568).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of the KDE project
 
2
   Copyright (C) 2002 David Faure <david@mandrakesoft.com>
 
3
                 2002 Laurent Montel <lmontel@mandrakesoft.com>
 
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 as published by the Free Software Foundation; either
 
8
   version 2 of the License, or (at your option) any later version.
 
9
 
 
10
   This library is distributed in the hope that it will be useful,
 
11
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
13
   Library General Public License for more details.
 
14
 
 
15
   You should have received a copy of the GNU Library General Public License
 
16
   along with this library; see the file COPYING.LIB.  If not, write to
 
17
   the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
18
   Boston, MA 02111-1307, USA.
 
19
*/
 
20
 
 
21
#ifndef kobgspellcheck_h
 
22
#define kobgspellcheck_h
 
23
 
 
24
 
 
25
#include <qobject.h>
 
26
#include <qstringlist.h>
 
27
class KoTextObject;
 
28
class KoSpell;
 
29
class KoDocument;
 
30
class KSpellConfig;
 
31
class KOSpellConfig;
 
32
class KoTextParag;
 
33
 
 
34
class KoBgSpellCheck : public QObject
 
35
{
 
36
    Q_OBJECT
 
37
public:
 
38
    KoBgSpellCheck();
 
39
    virtual ~KoBgSpellCheck();
 
40
    void enableBackgroundSpellCheck( bool b );
 
41
 
 
42
    bool backgroundSpellCheckEnabled() const { return m_bSpellCheckEnabled; }
 
43
 
 
44
    void setIgnoreUpperWords( bool b);
 
45
    void setIgnoreTitleCase( bool b);
 
46
 
 
47
    void setKSpellConfig(const KOSpellConfig &_kspell);
 
48
 
 
49
    //repaint object when we spell check
 
50
    virtual void slotRepaintChanged(KoTextObject *obj)=0;
 
51
 
 
52
    virtual KoTextObject* nextTextObject( KoTextObject *obj )=0;
 
53
 
 
54
    virtual void configurateSpellChecker()=0;
 
55
    void addIgnoreWordAll( const QString & word);
 
56
    void clearIgnoreWordAll( );
 
57
    void addIgnoreWordAllList( const QStringList & list);
 
58
    void spellCheckParagraphDeleted( KoTextParag *_parag,  KoTextObject *obj);
 
59
    void addPersonalDictonary( const QString & word );
 
60
public slots:
 
61
    void startBackgroundSpellCheck();
 
62
 
 
63
protected slots:
 
64
    void spellCheckerReady();
 
65
    void spellCheckerMisspelling(const QString &, int );
 
66
    void spellCheckerDone();
 
67
    void spellCheckerFinished( );
 
68
    void spellCheckNextParagraph();
 
69
 
 
70
protected:
 
71
    KSpellConfig* spellConfig();
 
72
    void nextParagraphNeedingCheck();
 
73
    void stopSpellChecking();
 
74
    // Structure holding the background spellcheck data
 
75
    struct KoBGSpell {
 
76
        KoBGSpell() : kspell(0L), currentTextObj(0L), currentParag(0L) {}
 
77
 
 
78
        // KSpell object for the background spellcheck
 
79
        KoSpell *kspell;
 
80
        // The text frameset currently being checked
 
81
        // TODO change current text frameset, and implementing nextTextFrameSet, see kwview.cc
 
82
        // TODO implement "skip unchanged framesets" and "stop timer after all checked and until
 
83
        // user types something again"
 
84
        KoTextObject *currentTextObj;
 
85
        // The paragraph currently being checked
 
86
        KoTextParag *currentParag;
 
87
        // Last parag was changed (word marked misspelled), we need to repaint it.
 
88
        bool needsRepaint;
 
89
    };
 
90
    KoBGSpell m_bgSpell;
 
91
 
 
92
private:
 
93
    class KoBgSpellCheckPrivate;
 
94
    KoBgSpellCheckPrivate *d;
 
95
    QStringList m_spellListIgnoreAll;
 
96
    bool m_bSpellCheckEnabled;
 
97
    bool m_bDontCheckUpperWord;
 
98
    bool m_bDontCheckTitleCase;
 
99
    bool m_bSpellCheckConfigure;
 
100
};
 
101
#endif