Index: linguistic/source/spelldsp.cxx =================================================================== --- linguistic/source/spelldsp.cxx (revision 271264) +++ linguistic/source/spelldsp.cxx (working copy) @@ -279,6 +279,40 @@ } +// Hebrew is usually written without diacritics. +// However, sometimes the diacritics are written as special marks located within, above, or below consonants. +// The diacritics are represented internally as separate Unicode characters. +// Hebrew dictionaries check for words without diacritics and will continue to do so for the forseeable future +// This function filters the diacritics out of a word, before spellchecking it +// (Using breakiterator is not appropriate, since we don't want word-breaking at the diacritics) +::rtl::OUString SpellCheckerDispatcher::removeDiacritics(const ::rtl::OUString& rWord, LanguageType nLanguage) +{ + OUString tmpWord; + OUString diacritics; + // Build a string containing diacritics to be skipped + switch (nLanguage) + { + case LANGUAGE_HEBREW : + int beginDiacritics; + int endDiacritics; + beginDiacritics = 0x591; // first of Hebrew cantillation marks + endDiacritics = 0x5C5; // last of Hebrew niqqud + for (int i = beginDiacritics; i <= endDiacritics; i++) + diacritics += OUString((sal_Unicode)i); + break; + default: + return rWord; + } + // Filter the diacritics from the word + for (int i = 0; i < rWord.getLength(); i ++) + { + sal_Unicode c = rWord.getStr()[i]; + if (diacritics.indexOf(c) < 0) + tmpWord += rWord.copy(i, 1); + } + return tmpWord; +} + BOOL SpellCheckerDispatcher::isValid_Impl( const OUString& rWord, LanguageType nLanguage, @@ -304,7 +338,9 @@ } else { - OUString aChkWord( rWord ); + bool bRemoveDiacritics = + nLanguage == LANGUAGE_HEBREW ; + OUString aChkWord( bRemoveDiacritics ? removeDiacritics(rWord, nLanguage) : rWord ); Locale aLocale( CreateLocale( nLanguage ) ); // replace typographical apostroph by ascii apostroph @@ -480,7 +516,9 @@ } else { - OUString aChkWord( rWord ); + bool bRemoveDiacritics = + nLanguage == LANGUAGE_HEBREW ; + OUString aChkWord( bRemoveDiacritics ? removeDiacritics(rWord, nLanguage) : rWord ); Locale aLocale( CreateLocale( nLanguage ) ); // replace typographical apostroph by ascii apostroph Index: linguistic/source/spelldsp.hxx =================================================================== --- linguistic/source/spelldsp.hxx (revision 271264) +++ linguistic/source/spelldsp.hxx (working copy) @@ -93,6 +93,8 @@ void ClearSvcList(); + ::rtl::OUString removeDiacritics(const ::rtl::OUString& rWord, LanguageType nLanguage); + BOOL isValid_Impl(const ::rtl::OUString& aWord, LanguageType nLanguage, const ::com::sun::star::beans::PropertyValues& aProperties, BOOL bCheckDics)