]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiSpellchecker.h
Simplifications
[lyx.git] / src / frontends / qt4 / GuiSpellchecker.h
1 // -*- C++ -*-
2 /**
3  * \file GuiSpellchecker.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author John Levon
8  * \author Kalle Dalheimer
9  * \author Edwin Leuven
10  *
11  * Full author contact details are available in file CREDITS.
12  */
13
14 #ifndef GUISPELLCHECKER_H
15 #define GUISPELLCHECKER_H
16
17 #include "GuiDialog.h"
18 #include "ui_SpellcheckerUi.h"
19 #include "Dialog.h"
20 #include "WordLangTuple.h"
21
22 class QListWidgetItem;
23
24 namespace lyx {
25
26 class SpellChecker;
27
28 namespace frontend {
29
30 class GuiSpellchecker : public GuiDialog, public Ui::SpellcheckerUi
31 {
32         Q_OBJECT
33
34 public:
35         GuiSpellchecker(GuiView & lv);
36
37 public Q_SLOTS:
38         void suggestionChanged(QListWidgetItem *);
39
40 private Q_SLOTS:
41         void accept();
42         void add();
43         void ignore();
44         void replace();
45         void replaceChanged(const QString &);
46         void reject();
47
48 private:
49         /// update from controller
50         void partialUpdate(int id);
51         ///
52         void updateContents();
53
54         ///
55         enum State {
56                 SPELL_PROGRESSED, //< update progress bar
57                 SPELL_FOUND_WORD //< found a bad word
58         };
59
60         ///
61         bool initialiseParams(std::string const & data);
62         ///
63         void clearParams();
64         /// Not needed here
65         void dispatchParams() {}
66         ///
67         bool isBufferDependent() const { return true; }
68         ///
69         bool exitEarly() const { return exitEarly_; }
70
71         /// replace word with replacement
72         void replace(docstring const &);
73
74         /// replace all occurances of word
75         void replaceAll(docstring const &);
76         /// insert word in personal dictionary
77         void insert();
78         /// ignore all occurances of word
79         void ignoreAll();
80         /// check text until next misspelled/unknown word
81         /// returns true when finished
82         void check();
83         /// show count of checked words at normal exit
84         void showSummary();
85
86         /// set to true when spellchecking is finished
87         bool exitEarly_;
88         /// current word being checked and lang code
89         WordLangTuple word_;
90         /// values for progress
91         int oldprogress_;
92         int newprogress_;
93         /// word count
94         int count_;
95         /// The actual spellchecker object
96         SpellChecker * speller_;
97 };
98
99 } // namespace frontend
100 } // namespace lyx
101
102 #endif // GUISPELLCHECKER_H