]> git.lyx.org Git - features.git/blobdiff - src/HunspellChecker.cpp
DocBook: add a parameter to change the namespace prefix for MathML.
[features.git] / src / HunspellChecker.cpp
index 06349c65d0a586310fd4f983d8922049e1a27456..1cac9ad09732811d37eb0a9fbf0fe8e79780b3b5 100644 (file)
@@ -70,8 +70,7 @@ struct HunspellChecker::Private
        Hunspell * speller(Language const * lang);
        Hunspell * lookup(Language const * lang);
        /// ignored words
-       bool isIgnored(WordLangTuple const & wl,
-                      std::vector<WordLangTuple> const & docdict) const;
+       bool isIgnored(WordLangTuple const & wl) const;
        /// personal word list interface
        void remove(WordLangTuple const & wl);
        void insert(WordLangTuple const & wl);
@@ -282,8 +281,7 @@ int HunspellChecker::Private::numDictionaries() const
 }
 
 
-bool HunspellChecker::Private::isIgnored(WordLangTuple const & wl,
-                                        vector<WordLangTuple> const & docdict) const
+bool HunspellChecker::Private::isIgnored(WordLangTuple const & wl) const
 {
        IgnoreList::const_iterator it = ignored_.begin();
        for (; it != ignored_.end(); ++it) {
@@ -292,13 +290,6 @@ bool HunspellChecker::Private::isIgnored(WordLangTuple const & wl,
                if (it->word() == wl.word())
                        return true;
        }
-       it = docdict.begin();
-       for (; it != docdict.end(); ++it) {
-               if (it->lang()->code() != wl.lang()->code())
-                       continue;
-               if (it->word() == wl.word())
-                       return true;
-       }
        return false;
 }
 
@@ -356,9 +347,17 @@ HunspellChecker::~HunspellChecker()
 SpellChecker::Result HunspellChecker::check(WordLangTuple const & wl,
                                            vector<WordLangTuple> const & docdict)
 {
-       if (d->isIgnored(wl, docdict))
+       if (d->isIgnored(wl))
                return WORD_OK;
 
+       IgnoreList::const_iterator it = docdict.begin();
+       for (; it != docdict.end(); ++it) {
+               if (it->lang()->code() != wl.lang()->code())
+                       continue;
+               if (it->word() == wl.word())
+                       return DOCUMENT_LEARNED_WORD;
+       }
+
        Hunspell * h = d->speller(wl.lang());
        if (!h)
                return NO_DICTIONARY;