+ string const langmap = d->languageMap[lang->lang()];
+ bool result = !langmap.empty();
+
+ if (result)
+ return result;
+
+ result = AppleSpeller_hasLanguage(d->speller,lang->code().c_str());
+ if (result) {
+ d->languageMap[lang->lang()] = lang->code();
+ } else {
+ result = AppleSpeller_hasLanguage(d->speller,lang->lang().c_str());
+ if (result)
+ d->languageMap[lang->lang()] = lang->lang();
+ }
+ LYXERR(Debug::GUI, "has dictionary: " << lang->lang() << " = " << result) ;
+ return result;
+}
+
+
+int AppleSpellChecker::numMisspelledWords() const
+{
+ return AppleSpeller_numMisspelledWords(d->speller);
+}
+
+
+void AppleSpellChecker::misspelledWord(int index, int & start, int & length) const
+{
+ AppleSpeller_misspelledWord(d->speller, index, &start, &length);