]> git.lyx.org Git - lyx.git/blobdiff - src/aspell.C
Fix bug 886 and others not reported related with the document paper size.
[lyx.git] / src / aspell.C
index a59ff568717eb3cce94d849c5d2560944a93a2d7..be2dc6ae981734d7c9b29c37948c21142ffca9fc 100644 (file)
@@ -1,17 +1,16 @@
 /**
  * \file aspell.C
- * Copyright 2001 the LyX Team
- * Read the file COPYING
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
  * \author Kevin Atkinson
- * \author John Levon <levon@movementarian.org>
+ * \author John Levon
+ *
+ * Full author contact details are available in file CREDITS.
  */
 
 #include <config.h>
 
-#ifdef USE_ASPELL
-
-#include "support/LAssert.h"
 #include "debug.h"
 
 #include <aspell.h>
 #include "aspell_local.h"
 #include "WordLangTuple.h"
 
-using std::endl;
+#include <boost/assert.hpp>
+
+using std::string;
+
 
 ASpell::ASpell(BufferParams const &, string const & lang)
        : els(0), spell_error_object(0)
@@ -69,9 +71,9 @@ void ASpell::addSpeller(string const & lang)
 }
 
 
-enum ASpell::Result ASpell::check(WordLangTuple const & word)
+ASpell::Result ASpell::check(WordLangTuple const & word)
 {
-       Result res = UNKNOWN;
+       Result res = UNKNOWN_WORD;
 
        Spellers::iterator it = spellers_.find(word.lang_code());
        if (it == spellers_.end()) {
@@ -84,20 +86,20 @@ enum ASpell::Result ASpell::check(WordLangTuple const & word)
 
        AspellSpeller * m = it->second.speller;
 
-       int word_ok = aspell_speller_check(m, word.word().c_str(), -1);
-       lyx::Assert(word_ok != -1);
+       int const word_ok = aspell_speller_check(m, word.word().c_str(), -1);
+       BOOST_ASSERT(word_ok != -1);
 
        if (word_ok) {
                res = OK;
        } else {
                AspellWordList const * sugs =
                        aspell_speller_suggest(m, word.word().c_str(), -1);
-               lyx::Assert(sugs != 0);
+               BOOST_ASSERT(sugs != 0);
                els = aspell_word_list_elements(sugs);
                if (aspell_word_list_empty(sugs))
-                       res = UNKNOWN;
+                       res = UNKNOWN_WORD;
                else
-                       res = MISSED;
+                       res = SUGGESTED_WORDS;
        }
        return res;
 }
@@ -125,9 +127,8 @@ string const ASpell::nextMiss()
 
        if (els)
                str = aspell_string_enumeration_next(els);
-       if (str)
-               return str;
-       return "";
+
+       return (str ? str : "");
 }
 
 
@@ -139,9 +140,5 @@ string const ASpell::error()
                err = aspell_error_message(spell_error_object);
        }
 
-       if (err)
-               return err;
-       return "";
+       return (err ? err : "");
 }
-
-#endif // USE_ASPELL