]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiSpellchecker.h
Complete the removal of the embedding stuff. Maybe. It's hard to be sure we got every...
[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 SpellBase;
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         ~GuiSpellchecker();
37
38 public Q_SLOTS:
39         void suggestionChanged(QListWidgetItem *);
40
41 private Q_SLOTS:
42         void accept();
43         void add();
44         void ignore();
45         void replace();
46         void replaceChanged(const QString &);
47         void reject();
48
49 private:
50         /// update from controller
51         void partialUpdate(int id);
52         ///
53         void updateContents();
54
55         ///
56         enum State {
57                 SPELL_PROGRESSED, //< update progress bar
58                 SPELL_FOUND_WORD //< found a bad word
59         };
60
61         ///
62         bool initialiseParams(std::string const & data);
63         ///
64         void clearParams();
65         /// Not needed here
66         void dispatchParams() {}
67         ///
68         bool isBufferDependent() const { return true; }
69         ///
70         bool exitEarly() const { return exitEarly_; }
71
72         /// replace word with replacement
73         void replace(docstring const &);
74
75         /// replace all occurances of word
76         void replaceAll(docstring const &);
77         /// insert word in personal dictionary
78         void insert();
79         /// ignore all occurances of word
80         void ignoreAll();
81         /// check text until next misspelled/unknown word
82         /// returns true when finished
83         void check();
84         /// get suggestion
85         docstring getSuggestion() const;
86         /// get word
87         docstring getWord() const;
88         /// returns progress value
89         int getProgress() const { return oldval_; }
90         /// returns word count
91         int getCount() const { return count_; }
92         /// give error message is spellchecker dies
93         bool checkAlive();
94         /// show count of checked words at normal exit
95         void showSummary();
96
97         /// set to true when spellchecking is finished
98         bool exitEarly_;
99         /// current word being checked and lang code
100         WordLangTuple word_;
101         /// values for progress
102         int oldval_;
103         int newvalue_;
104         /// word count
105         int count_;
106         /// The actual spellchecker object
107         SpellBase * speller_;
108 };
109
110 } // namespace frontend
111 } // namespace lyx
112
113 #endif // GUISPELLCHECKER_H