Lines 279-284
Link Here
|
279 |
} |
279 |
} |
280 |
|
280 |
|
281 |
|
281 |
|
|
|
282 |
// Hebrew is usually written without diacritics. |
283 |
// However, sometimes the diacritics are written as special marks located within, above, or below consonants. |
284 |
// The diacritics are represented internally as separate Unicode characters. |
285 |
// Hebrew dictionaries check for words without diacritics and will continue to do so for the forseeable future |
286 |
// This function filters the diacritics out of a word, before spellchecking it |
287 |
// (Using breakiterator is not appropriate, since we don't want word-breaking at the diacritics) |
288 |
::rtl::OUString SpellCheckerDispatcher::removeDiacritics(const ::rtl::OUString& rWord, LanguageType nLanguage) |
289 |
{ |
290 |
OUString tmpWord; |
291 |
OUString diacritics; |
292 |
// Build a string containing diacritics to be skipped |
293 |
switch (nLanguage) |
294 |
{ |
295 |
case LANGUAGE_HEBREW : |
296 |
int beginDiacritics; |
297 |
int endDiacritics; |
298 |
beginDiacritics = 0x591; // first of Hebrew cantillation marks |
299 |
endDiacritics = 0x5C5; // last of Hebrew niqqud |
300 |
for (int i = beginDiacritics; i <= endDiacritics; i++) |
301 |
diacritics += OUString((sal_Unicode)i); |
302 |
break; |
303 |
default: |
304 |
return rWord; |
305 |
} |
306 |
// Filter the diacritics from the word |
307 |
for (int i = 0; i < rWord.getLength(); i ++) |
308 |
{ |
309 |
sal_Unicode c = rWord.getStr()[i]; |
310 |
if (diacritics.indexOf(c) < 0) |
311 |
tmpWord += rWord.copy(i, 1); |
312 |
} |
313 |
return tmpWord; |
314 |
} |
315 |
|
282 |
BOOL SpellCheckerDispatcher::isValid_Impl( |
316 |
BOOL SpellCheckerDispatcher::isValid_Impl( |
283 |
const OUString& rWord, |
317 |
const OUString& rWord, |
284 |
LanguageType nLanguage, |
318 |
LanguageType nLanguage, |
Lines 304-310
Link Here
|
304 |
} |
338 |
} |
305 |
else |
339 |
else |
306 |
{ |
340 |
{ |
307 |
OUString aChkWord( rWord ); |
341 |
bool bRemoveDiacritics = |
|
|
342 |
nLanguage == LANGUAGE_HEBREW ; |
343 |
OUString aChkWord( bRemoveDiacritics ? removeDiacritics(rWord, nLanguage) : rWord ); |
308 |
Locale aLocale( CreateLocale( nLanguage ) ); |
344 |
Locale aLocale( CreateLocale( nLanguage ) ); |
309 |
|
345 |
|
310 |
// replace typographical apostroph by ascii apostroph |
346 |
// replace typographical apostroph by ascii apostroph |
Lines 480-486
Link Here
|
480 |
} |
516 |
} |
481 |
else |
517 |
else |
482 |
{ |
518 |
{ |
483 |
OUString aChkWord( rWord ); |
519 |
bool bRemoveDiacritics = |
|
|
520 |
nLanguage == LANGUAGE_HEBREW ; |
521 |
OUString aChkWord( bRemoveDiacritics ? removeDiacritics(rWord, nLanguage) : rWord ); |
484 |
Locale aLocale( CreateLocale( nLanguage ) ); |
522 |
Locale aLocale( CreateLocale( nLanguage ) ); |
485 |
|
523 |
|
486 |
// replace typographical apostroph by ascii apostroph |
524 |
// replace typographical apostroph by ascii apostroph |