]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlSpellchecker.h
Add a buffer_path arg to InsetGraphicsMailer's params2string, string2params.
[lyx.git] / src / frontends / controllers / ControlSpellchecker.h
1 // -*- C++ -*-
2 /**
3  * \file ControlSpellchecker.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Edwin Leuven
8  *
9  * Full author contact details are available in file CREDITS
10  */
11
12 #ifndef CONTROLSPELLCHECKER_H
13 #define CONTROLSPELLCHECKER_H
14
15 #include <boost/scoped_ptr.hpp>
16
17 #include "ControlDialog_impl.h"
18 #include "LString.h"
19 #include "WordLangTuple.h"
20
21 class SpellBase;
22
23 /** A controller for Spellchecker dialogs.
24  */
25 class ControlSpellchecker : public ControlDialogBD {
26 public:
27         enum State {
28                 SPELL_PROGRESSED, //< update progress bar
29                 SPELL_FOUND_WORD //< found a bad word
30         };
31
32         ControlSpellchecker(LyXView &, Dialogs &);
33
34         ~ControlSpellchecker();
35
36         /// replace word with replacement
37         void replace(string const &);
38
39         /// replace all occurances of word
40         void replaceAll(string const &);
41
42         /// insert word in personal dictionary
43         void insert();
44
45         /// ignore all occurances of word
46         void ignoreAll();
47
48         /// check text until next misspelled/unknown word
49         /// returns true when finished
50         void check();
51
52         /// get suggestion
53         string const getSuggestion() const;
54
55         /// get word
56         string const getWord() const;
57
58         /// returns progress value
59         int getProgress() const { return oldval_; }
60
61         /// returns word count
62         int getCount()  const { return count_; }
63
64 private:
65         /// give error message is spellchecker dies
66         bool checkAlive();
67
68         /// start a spell-checking session
69         void startSession();
70
71         /// end a spell-checking session
72         void endSession();
73
74         /// show count of checked words at normal exit
75         void showSummary();
76
77         /// set the params before show or update
78         void setParams();
79         /// clean-up on hide.
80         void clearParams();
81
82         /// not needed.
83         virtual void apply() {}
84
85         /// current word being checked and lang code
86         WordLangTuple word_;
87
88         /// values for progress
89         float newval_;
90         int oldval_;
91         int newvalue_;
92
93         /// word count
94         int count_;
95
96         /// The actual spellchecker object
97         boost::scoped_ptr<SpellBase> speller_;
98 };
99
100 #endif // CONTROLSPELLCHECKER_H