]> git.lyx.org Git - lyx.git/blobdiff - src/AspellChecker.cpp
Fairly trivial change here: Just protect against inheriting limits to
[lyx.git] / src / AspellChecker.cpp
index 642f804977c77d37ab6298a206701a855451fe73..284bcace7088c44d27870c0cdbc12feb3b1778bc 100644 (file)
@@ -61,9 +61,6 @@ struct AspellChecker::Private
        ///
        AspellSpeller * speller(Language const * lang);
 
-       /// create a unique ID from lang code and variety
-       string const spellerID(Language const * lang);
-
        bool isValidDictionary(AspellConfig * config,
                        string const & lang, string const & variety);
        bool checkAspellData(AspellConfig * config,
@@ -88,7 +85,7 @@ struct AspellChecker::Private
 
        /// the location below system/user directory
        /// there the rws files lookup will happen
-       const string dictDirectory(void) { return "dict"; }
+       const string dictDirectory(void) { return "dicts"; }
        /// there the dat+cmap files lookup will happen
        const string dataDirectory(void) { return "data"; }
        /// os package directory constants
@@ -273,14 +270,14 @@ AspellSpeller * AspellChecker::Private::addSpeller(Language const * lang)
                initSessionDictionary(m, pd);
        }
        
-       spellers_[spellerID(lang)] = m;
+       spellers_[lang->lang()] = m;
        return m.e_speller ? to_aspell_speller(m.e_speller) : 0;
 }
 
 
 AspellSpeller * AspellChecker::Private::speller(Language const * lang)
 {
-       Spellers::iterator it = spellers_.find(spellerID(lang));
+       Spellers::iterator it = spellers_.find(lang->lang());
        if (it != spellers_.end())
                return to_aspell_speller(it->second.e_speller);
        
@@ -288,12 +285,6 @@ AspellSpeller * AspellChecker::Private::speller(Language const * lang)
 }
 
 
-string const AspellChecker::Private::spellerID(Language const * lang)
-{
-       return lang->code() + "-" + lang->variety();
-}
-
-
 SpellChecker::Result AspellChecker::Private::check(
        AspellSpeller * m, string const & word) 
        const
@@ -316,7 +307,7 @@ void AspellChecker::Private::remove(WordLangTuple const & word)
        if (!pd)
                return;
        pd->remove(word.word());
-       Spellers::iterator it = spellers_.find(spellerID(word.lang()));
+       Spellers::iterator it = spellers_.find(word.lang()->lang());
        if (it != spellers_.end()) {
                initSessionDictionary(it->second, pd);
        }
@@ -325,7 +316,7 @@ void AspellChecker::Private::remove(WordLangTuple const & word)
                
 void AspellChecker::Private::insert(WordLangTuple const & word)
 {
-       Spellers::iterator it = spellers_.find(spellerID(word.lang()));
+       Spellers::iterator it = spellers_.find(word.lang()->lang());
        if (it != spellers_.end()) {
                AspellSpeller * speller = to_aspell_speller(it->second.e_speller);
                aspell_speller_add_to_session(speller, to_utf8(word.word()).c_str(), -1);
@@ -389,7 +380,7 @@ void AspellChecker::insert(WordLangTuple const & word)
 
 void AspellChecker::accept(WordLangTuple const & word)
 {
-       Spellers::iterator it = d->spellers_.find(d->spellerID(word.lang()));
+       Spellers::iterator it = d->spellers_.find(word.lang()->lang());
        if (it != d->spellers_.end()) {
                AspellSpeller * speller = to_aspell_speller(it->second.e_speller);
                aspell_speller_add_to_session(speller, to_utf8(word.word()).c_str(), -1);