summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mst@openoffice.org>2011-01-21 16:40:34 +0100
committerMichael Stahl <mst@openoffice.org>2011-01-21 16:40:34 +0100
commit64d0cdabe4e44c928eb170739163926620ca2b83 (patch)
treea3b04590feb9acd1367ee627c3f7494f6cf2d63c
parent8bc2019cab507472a0412f47cea6e740ec697818 (diff)
undoapi: #i116552#: SwAutoCorrDoc: match StartUndo()/EndUndo() calls
-rw-r--r--sw/source/core/edit/acorrect.cxx24
-rw-r--r--sw/source/core/inc/acorrect.hxx2
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 );