]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/controllers/ControlSpellchecker.h
Add a buffer_path arg to InsetGraphicsMailer's params2string, string2params.
[lyx.git] / src / frontends / controllers / ControlSpellchecker.h
index eeaf11e215b690d365662a267941a73b285b3044..5e22acfeb9a7d2a178d2c3b2e97cecedd8f0457f 100644 (file)
@@ -1,34 +1,38 @@
 // -*- C++ -*-
-/* This file is part of
- * ====================================================== 
- *
- *           LyX, The Document Processor
- *
- *           Copyright 2001 The LyX Team.
+/**
+ * \file ControlSpellchecker.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- * ======================================================
+ * \author Edwin Leuven
  *
- * \file ControlSpellchecker.h
- * \author Edwin Leuven <leuven@fee.uva.nl>
+ * Full author contact details are available in file CREDITS
  */
 
 #ifndef CONTROLSPELLCHECKER_H
 #define CONTROLSPELLCHECKER_H
 
-#ifdef __GNUG__
-#pragma interface
-#endif
+#include <boost/scoped_ptr.hpp>
 
 #include "ControlDialog_impl.h"
-#include "sp_base.h"
+#include "LString.h"
+#include "WordLangTuple.h"
+
+class SpellBase;
 
 /** A controller for Spellchecker dialogs.
  */
 class ControlSpellchecker : public ControlDialogBD {
 public:
-       ///
+       enum State {
+               SPELL_PROGRESSED, //< update progress bar
+               SPELL_FOUND_WORD //< found a bad word
+       };
+
        ControlSpellchecker(LyXView &, Dialogs &);
 
+       ~ControlSpellchecker();
+
        /// replace word with replacement
        void replace(string const &);
 
@@ -40,34 +44,36 @@ public:
 
        /// ignore all occurances of word
        void ignoreAll();
-       
-       /// stop checking
-       void stop();
 
        /// check text until next misspelled/unknown word
+       /// returns true when finished
        void check();
 
-       /// spell options
-       void options();
-       
        /// get suggestion
-       string getSuggestion();
+       string const getSuggestion() const;
 
        /// get word
-       string getWord();
+       string const getWord() const;
 
        /// returns progress value
-       int getProgress() {
-               return oldval_; 
-       }
-
-       /// returns exit message
-       string getMessage() {
-               return message_;
-       }
-       
+       int getProgress() const { return oldval_; }
+
+       /// returns word count
+       int getCount()  const { return count_; }
+
 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.
@@ -76,11 +82,8 @@ private:
        /// not needed.
        virtual void apply() {}
 
-       /// right to left
-       bool rtl_;
-
-       /// current word being checked
-       string word_;
+       /// current word being checked and lang code
+       WordLangTuple word_;
 
        /// values for progress
        float newval_;
@@ -90,18 +93,8 @@ private:
        /// word count
        int count_;
 
-       /// exit message
-       string message_;
-
-       /// set to true to stop checking
-       bool stop_;
-
-       /// spellchecker status
-       enum SpellBase::spellStatus result_;
-
        /// The actual spellchecker object
-       SpellBase * speller_;
-       
+       boost::scoped_ptr<SpellBase> speller_;
 };
 
 #endif // CONTROLSPELLCHECKER_H