diff options
author | Thomas Lange [tl] <tl@openoffice.org> | 2010-04-30 14:33:36 +0200 |
---|---|---|
committer | Thomas Lange [tl] <tl@openoffice.org> | 2010-04-30 14:33:36 +0200 |
commit | a3defc0336a475847f218ff2fddafb240ef32e3f (patch) | |
tree | addeca51e51220e6aaf47a71813cd88684af49e7 /editeng | |
parent | 0b53c49463bbceebe4ea13d4aa9d78db6a2cab8f (diff) |
cws tl80: #i48303# fixed minor spell check problem when splitting wrong words
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/editeng/edtspell.cxx | 12 | ||||
-rw-r--r-- | editeng/source/editeng/edtspell.hxx | 8 | ||||
-rwxr-xr-x | editeng/source/editeng/impedit2.cxx | 13 |
3 files changed, 25 insertions, 8 deletions
diff --git a/editeng/source/editeng/edtspell.cxx b/editeng/source/editeng/edtspell.cxx index fed1394e5fd0..f01381a4ae62 100644 --- a/editeng/source/editeng/edtspell.cxx +++ b/editeng/source/editeng/edtspell.cxx @@ -208,6 +208,9 @@ void EditSpellWrapper::CheckSpellTo() pSpellInfo->aSpellTo.nIndex = aPaM.GetNode()->Len(); } } + +////////////////////////////////////////////////////////////////////// + SV_IMPL_VARARR( WrongRanges, WrongRange ); WrongList::WrongList() @@ -220,6 +223,14 @@ WrongList::~WrongList() { } +void WrongList::MarkInvalid( USHORT nS, USHORT nE ) +{ + if ( ( nInvalidStart == NOT_INVALID ) || ( nInvalidStart > nS ) ) + nInvalidStart = nS; + if ( nInvalidEnd < nE ) + nInvalidEnd = nE; +} + void WrongList::TextInserted( sal_uInt16 nPos, sal_uInt16 nNew, sal_Bool bPosIsSep ) { if ( !IsInvalid() ) @@ -527,6 +538,7 @@ sal_Bool WrongList::DbgIsBuggy() const } #endif +////////////////////////////////////////////////////////////////////// EdtAutoCorrDoc::EdtAutoCorrDoc( ImpEditEngine* pE, ContentNode* pN, sal_uInt16 nCrsr, xub_Unicode cIns ) diff --git a/editeng/source/editeng/edtspell.hxx b/editeng/source/editeng/edtspell.hxx index cfe0aaf57e87..851848c5ede0 100644 --- a/editeng/source/editeng/edtspell.hxx +++ b/editeng/source/editeng/edtspell.hxx @@ -97,13 +97,7 @@ public: BOOL IsInvalid() const { return nInvalidStart != NOT_INVALID; } void SetValid() { nInvalidStart = NOT_INVALID; nInvalidEnd = 0; } - void MarkInvalid( USHORT nS, USHORT nE ) - { - if ( ( nInvalidStart == NOT_INVALID ) || ( nInvalidStart > nS ) ) - nInvalidStart = nS; - if ( nInvalidEnd < nE ) - nInvalidEnd = nE; - } + void MarkInvalid( USHORT nS, USHORT nE ); USHORT Count() const { return WrongRanges::Count(); } diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 8f0ad2bc15d4..778942730e71 100755 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -2755,6 +2755,11 @@ EditPaM ImpEditEngine::ImpInsertText( EditSelection aCurSel, const XubString& rS EditPaM aCurPaM( aPaM ); // fuers Invalidieren + // 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 ) ); + XubString aText( rStr ); aText.ConvertLineEnd( LINEEND_LF ); SfxVoidItem aTabItem( EE_FEATURE_TAB ); @@ -2809,7 +2814,13 @@ EditPaM ImpEditEngine::ImpInsertText( EditSelection aCurSel, const XubString& rS } ParaPortion* pPortion = FindParaPortion( aPaM.GetNode() ); DBG_ASSERT( pPortion, "Blinde Portion in InsertText" ); - pPortion->MarkInvalid( aCurPaM.GetIndex(), aLine.Len() ); + + // 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 ( nEnd < aText.Len() ) aPaM = ImpInsertParaBreak( aPaM ); |