From 01fcebb5790e99aabf968d48d5915dbe736c3cb3 Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Fri, 11 Feb 2011 19:12:45 +0100 Subject: dr78: #i107201# find word boundaries in ImpInsertText only if online spelling is active --- editeng/source/editeng/impedit2.cxx | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index fe20464eb905..432ed35db2c8 100755 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -2756,7 +2756,10 @@ EditPaM ImpEditEngine::ImpInsertText( EditSelection aCurSel, const XubString& rS // get word boundaries in order to clear possible WrongList entries // and invalidate all the necessary text (everything after and including the // start of the word) - EditSelection aCurWord( SelectWord( aCurPaM, i18n::WordType::DICTIONARY_WORD ) ); + // #i107201# do the expensive SelectWord call only if online spelling is active + EditSelection aCurWord; + if ( GetStatus().DoOnlineSpelling() ) + aCurWord = SelectWord( aCurPaM, i18n::WordType::DICTIONARY_WORD ); XubString aText( rStr ); aText.ConvertLineEnd( LINEEND_LF ); @@ -2813,12 +2816,17 @@ EditPaM ImpEditEngine::ImpInsertText( EditSelection aCurSel, const XubString& rS ParaPortion* pPortion = FindParaPortion( aPaM.GetNode() ); DBG_ASSERT( pPortion, "Blinde Portion in InsertText" ); - // now remove the Wrongs (red spell check marks) from both words... - WrongList *pWrongs = aCurPaM.GetNode()->GetWrongList(); - if (pWrongs && pWrongs->HasWrongs()) - pWrongs->ClearWrongs( aCurWord.Min().GetIndex(), aPaM.GetIndex(), aPaM.GetNode() ); - // ... and mark both words as 'to be checked again' - pPortion->MarkInvalid( aCurWord.Min().GetIndex(), aLine.Len() ); + if ( GetStatus().DoOnlineSpelling() ) + { + // now remove the Wrongs (red spell check marks) from both words... + WrongList *pWrongs = aCurPaM.GetNode()->GetWrongList(); + if (pWrongs && pWrongs->HasWrongs()) + pWrongs->ClearWrongs( aCurWord.Min().GetIndex(), aPaM.GetIndex(), aPaM.GetNode() ); + // ... and mark both words as 'to be checked again' + pPortion->MarkInvalid( aCurWord.Min().GetIndex(), aLine.Len() ); + } + else + pPortion->MarkInvalid( aCurPaM.GetIndex(), aLine.Len() ); } if ( nEnd < aText.Len() ) aPaM = ImpInsertParaBreak( aPaM ); -- cgit