diff options
-rw-r--r-- | sw/source/core/edit/acorrect.cxx | 24 | ||||
-rw-r--r-- | sw/source/core/inc/acorrect.hxx | 2 |
2 files changed, 16 insertions, 10 deletions
diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx index b7e92570df42..7601afc663b3 100644 --- a/sw/source/core/edit/acorrect.cxx +++ b/sw/source/core/edit/acorrect.cxx @@ -32,9 +32,7 @@ #define _STD_VAR_ARRAYS #include <hintids.hxx> -#ifndef _SVX_SVXIDS_HRC #include <svx/svxids.hrc> -#endif #include <editeng/langitem.hxx> #include <fmtinfmt.hxx> #include <txtatr.hxx> @@ -96,17 +94,19 @@ void _PaMIntoCrsrShellRing::RemoveFromRing( SwPaM& rPam, Ring* pPrev ) SwAutoCorrDoc::SwAutoCorrDoc( SwEditShell& rEditShell, SwPaM& rPam, sal_Unicode cIns ) - : rEditSh( rEditShell ), rCrsr( rPam ), pIdx( 0 ), - nUndoId( UNDO_EMPTY ), - bUndoIdInitialized( cIns ? false : true ) + : rEditSh( rEditShell ), rCrsr( rPam ), pIdx( 0 ) + , m_nEndUndoCounter(0) + , bUndoIdInitialized( cIns ? false : true ) { } SwAutoCorrDoc::~SwAutoCorrDoc() { - if( UNDO_EMPTY != nUndoId ) - rEditSh.EndUndo( nUndoId ); + for (int i = 0; i < m_nEndUndoCounter; ++i) + { + rEditSh.EndUndo(); + } delete pIdx; } @@ -146,7 +146,10 @@ BOOL SwAutoCorrDoc::Insert( xub_StrLen nPos, const String& rTxt ) { bUndoIdInitialized = true; if( 1 == rTxt.Len() ) - rEditSh.StartUndo( nUndoId = UNDO_AUTOCORRECT ); + { + rEditSh.StartUndo( UNDO_AUTOCORRECT ); + ++m_nEndUndoCounter; + } } return TRUE; } @@ -215,7 +218,10 @@ BOOL SwAutoCorrDoc::Replace( xub_StrLen nPos, const String& rTxt ) { bUndoIdInitialized = true; if( 1 == rTxt.Len() ) - rEditSh.StartUndo( nUndoId = UNDO_AUTOCORRECT ); + { + rEditSh.StartUndo( UNDO_AUTOCORRECT ); + ++m_nEndUndoCounter; + } } } diff --git a/sw/source/core/inc/acorrect.hxx b/sw/source/core/inc/acorrect.hxx index bc2d2d4cb1f3..dcd28bfdd46d 100644 --- a/sw/source/core/inc/acorrect.hxx +++ b/sw/source/core/inc/acorrect.hxx @@ -56,7 +56,7 @@ class SwAutoCorrDoc : public SvxAutoCorrDoc SwEditShell& rEditSh; SwPaM& rCrsr; SwNodeIndex* pIdx; - SwUndoId nUndoId; + int m_nEndUndoCounter; bool bUndoIdInitialized; void DeleteSel( SwPaM& rDelPam ); |