summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
Diffstat (limited to 'svl')
-rw-r--r--svl/inc/svl/undo.hxx11
-rw-r--r--svl/source/undo/undo.cxx17
2 files changed, 14 insertions, 14 deletions
diff --git a/svl/inc/svl/undo.hxx b/svl/inc/svl/undo.hxx
index 57a26c3109ec..6cebbbb4bbb2 100644
--- a/svl/inc/svl/undo.hxx
+++ b/svl/inc/svl/undo.hxx
@@ -311,9 +311,14 @@ namespace svl
/** clears the redo stack and removes the top undo action */
virtual void RemoveLastUndoAction() = 0;
- // enables (true) or disables (false) recording of undo actions
- // If undo actions are added while undo is disabled, they are deleted.
- // Disabling undo does not clear the current undo buffer!
+ /** enables (true) or disables (false) recording of undo actions
+
+ If undo actions are added while undo is disabled, they are deleted.
+ Disabling undo does not clear the current undo buffer!
+
+ Multiple calls to <code>EnableUndo</code> are not cumulative. That is, calling <code>EnableUndo( false )</code>
+ twice, and then calling <code>EnableUndo( true )</code> means that Undo is enable afterwards.
+ */
virtual void EnableUndo( bool bEnable ) = 0;
// returns true if undo is currently enabled
diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx
index fae0250e9002..5e1e49f397b2 100644
--- a/svl/source/undo/undo.cxx
+++ b/svl/source/undo/undo.cxx
@@ -186,9 +186,9 @@ struct SVL_DLLPRIVATE SfxUndoManager_Data
SfxUndoArray* pActUndoArray;
SfxUndoArray* pFatherUndoArray;
- sal_Int32 mnLockCount;
sal_Int32 mnMarks;
sal_Int32 mnEmptyMark;
+ bool mbUndoEnabled;
bool mbDoing;
bool mbClearUntilTopLevel;
@@ -198,9 +198,9 @@ struct SVL_DLLPRIVATE SfxUndoManager_Data
:pUndoArray( new SfxUndoArray( i_nMaxUndoActionCount ) )
,pActUndoArray( NULL )
,pFatherUndoArray( NULL )
- ,mnLockCount( 0 )
,mnMarks( 0 )
,mnEmptyMark(MARK_INVALID)
+ ,mbUndoEnabled( true )
,mbDoing( false )
,mbClearUntilTopLevel( false )
{
@@ -421,14 +421,9 @@ void SfxUndoManager::EnableUndo( bool i_enable )
void SfxUndoManager::ImplEnableUndo_Lock( bool const i_enable )
{
- if ( !i_enable )
- ++m_pData->mnLockCount;
- else
- {
- OSL_PRECOND( m_pData->mnLockCount > 0, "SfxUndoManager::ImplEnableUndo_NoNotify: not disabled, so why enabling?" );
- if ( m_pData->mnLockCount > 0 )
- --m_pData->mnLockCount;
- }
+ if ( m_pData->mbUndoEnabled == i_enable )
+ return;
+ m_pData->mbUndoEnabled = i_enable;
}
//------------------------------------------------------------------------
@@ -443,7 +438,7 @@ bool SfxUndoManager::IsUndoEnabled() const
bool SfxUndoManager::ImplIsUndoEnabled_Lock() const
{
- return m_pData->mnLockCount == 0;
+ return m_pData->mbUndoEnabled;
}
//------------------------------------------------------------------------