diff options
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/misc/svxacorr.cxx | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 5d6a0458f09c..47cc1d4a6344 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -371,25 +371,27 @@ sal_Bool SvxAutoCorrect::FnCptlSttWrd( SvxAutoCorrDoc& rDoc, const String& rTxt, String sWord( rTxt.Copy( nSttPos - 1, nEndPos - nSttPos + 1 )); if( !FindInWrdSttExceptList(eLang, sWord) ) { + // Check that word isn't correctly spelled before correcting: ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSpellChecker1 > xSpeller = SvxGetSpellChecker(); - Sequence< ::com::sun::star::beans::PropertyValue > aEmptySeq; - // Check that word isn't correctly spelled before correcting - ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSpellAlternatives > xSpellAlt - = xSpeller->spell(sWord, eLang, aEmptySeq); - if(xSpellAlt.is()) + if( xSpeller->hasLanguage(eLang) ) { - sal_Unicode cSave = rTxt.GetChar( nSttPos ); - rtl::OUString sChar( cSave ); - sChar = rCC.lowercase( sChar ); - if( sChar[0] != cSave && rDoc.ReplaceRange( nSttPos, 1, sChar )) + Sequence< ::com::sun::star::beans::PropertyValue > aEmptySeq; + if (!xSpeller->spell(sWord, eLang, aEmptySeq).is()) { - if( SaveWordWrdSttLst & nFlags ) - rDoc.SaveCpltSttWord( CptlSttWrd, nSttPos, sWord, cSave ); - bRet = sal_True; + return false; } } + sal_Unicode cSave = rTxt.GetChar( nSttPos ); + rtl::OUString sChar( cSave ); + sChar = rCC.lowercase( sChar ); + if( sChar[0] != cSave && rDoc.ReplaceRange( nSttPos, 1, sChar )) + { + if( SaveWordWrdSttLst & nFlags ) + rDoc.SaveCpltSttWord( CptlSttWrd, nSttPos, sWord, cSave ); + bRet = sal_True; + } } } return bRet; |