]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/controllers/ControlSpellchecker.h
fix crash due to invalidated iterator
[lyx.git] / src / frontends / controllers / ControlSpellchecker.h
index 67446820e3a76c9d2da9d3b00a726de16ace0b8f..c187bc5d98e53c076b536d1ddada04564f29278e 100644 (file)
 #ifndef CONTROLSPELLCHECKER_H
 #define CONTROLSPELLCHECKER_H
 
-#include <boost/scoped_ptr.hpp>
-
-#include "ControlDialog_impl.h"
-#include "LString.h"
+#include "Dialog.h"
 #include "WordLangTuple.h"
+#include <boost/scoped_ptr.hpp>
 
 class SpellBase;
 
+namespace lyx {
+namespace frontend {
+
 /** A controller for Spellchecker dialogs.
  */
-class ControlSpellchecker : public ControlDialogBD {
+class ControlSpellchecker : public Dialog::Controller {
 public:
        enum State {
                SPELL_PROGRESSED, //< update progress bar
                SPELL_FOUND_WORD //< found a bad word
        };
 
-       ControlSpellchecker(LyXView &, Dialogs &);
-
+       ControlSpellchecker(Dialog &);
        ~ControlSpellchecker();
+       ///
+       virtual bool initialiseParams(std::string const & data);
+       ///
+       virtual void clearParams();
+       /// Not needed here
+       virtual void dispatchParams() {}
+       ///
+       virtual bool isBufferDependent() const { return true; }
+       ///
+       virtual bool exitEarly() const { return exitEarly_; }
 
        /// replace word with replacement
-       void replace(string const &);
+       void replace(std::string const &);
 
        /// replace all occurances of word
-       void replaceAll(string const &);
+       void replaceAll(std::string const &);
 
        /// insert word in personal dictionary
        void insert();
@@ -50,10 +60,10 @@ public:
        void check();
 
        /// get suggestion
-       string const getSuggestion() const;
+       std::string const getSuggestion() const;
 
        /// get word
-       string const getWord() const;
+       std::string const getWord() const;
 
        /// returns progress value
        int getProgress() const { return oldval_; }
@@ -65,28 +75,17 @@ private:
        /// give error message is spellchecker dies
        bool checkAlive();
 
-       /// start a spell-checking session
-       void startSession();
-
-       /// end a spell-checking session
-       void endSession();
-
        /// show count of checked words at normal exit
        void showSummary();
 
-       /// set the params before show or update
-       void setParams();
-       /// clean-up on hide.
-       void clearParams();
-
-       /// not needed.
-       virtual void apply() {}
+private:
+       /// set to true when spellchecking is finished
+       bool exitEarly_;
 
        /// current word being checked and lang code
        WordLangTuple word_;
 
        /// values for progress
-       float newval_;
        int oldval_;
        int newvalue_;
 
@@ -97,4 +96,7 @@ private:
        boost::scoped_ptr<SpellBase> speller_;
 };
 
+} // namespace frontend
+} // namespace lyx
+
 #endif // CONTROLSPELLCHECKER_H