+
+int AspellChecker::Private::numDictionaries() const
+{
+ int result = 0;
+ Spellers::const_iterator it = spellers_.begin();
+ Spellers::const_iterator et = spellers_.end();
+
+ for (; it != et; ++it) {
+ Speller aspell = it->second;
+ result += aspell.e_speller != 0;
+ }
+ return result;
+}
+
+
+string AspellChecker::Private::toAspellWord(docstring const & word) const
+{
+ size_t mpos;
+ string word_str = to_utf8(word);
+ while ((mpos = word_str.find('-')) != word_str.npos) {
+ word_str.erase(mpos, 1);
+ }
+ return word_str;
+}
+
+
+SpellChecker::Result AspellChecker::Private::check(
+ AspellSpeller * m, WordLangTuple const & word)
+ const
+{
+ SpellChecker::Result result = WORD_OK;
+ docstring w1;
+ LYXERR(Debug::GUI, "spellCheck: \"" <<
+ word.word() << "\", lang = " << word.lang()->lang()) ;
+ docstring rest = split(word.word(), w1, '-');
+ for (; result == WORD_OK;) {
+ string const word_str = toAspellWord(w1);
+ int const word_ok = aspell_speller_check(m, word_str.c_str(), -1);
+ LASSERT(word_ok != -1, return UNKNOWN_WORD);
+ result = (word_ok) ? WORD_OK : UNKNOWN_WORD;
+ if (rest.empty())
+ break;
+ rest = split(rest, w1, '-');
+ }
+ if (result == WORD_OK)
+ return result;
+ string const word_str = toAspellWord(word.word());
+ int const word_ok = aspell_speller_check(m, word_str.c_str(), -1);
+ LASSERT(word_ok != -1, return UNKNOWN_WORD);
+ return (word_ok) ? WORD_OK : UNKNOWN_WORD;
+}
+
+void AspellChecker::Private::accept(Speller & speller, WordLangTuple const & word)
+{
+ speller.ignored_words_.push_back(word.word());
+}
+
+
+/// personal word list interface
+void AspellChecker::Private::remove(WordLangTuple const & word)
+{
+ PersonalWordList * pd = personal_[word.lang()->lang()];
+ if (!pd)
+ return;
+ pd->remove(word.word());
+ Spellers::iterator it = spellers_.find(word.lang()->lang());
+ if (it != spellers_.end()) {
+ initSessionDictionary(it->second, pd);
+ }
+}
+
+
+void AspellChecker::Private::insert(WordLangTuple const & word)
+{
+ Spellers::iterator it = spellers_.find(word.lang()->lang());
+ if (it != spellers_.end()) {
+ addToSession(it->second.e_speller, word.word());
+ PersonalWordList * pd = personal_[word.lang()->lang()];
+ if (!pd)
+ return;
+ pd->insert(word.word());