Kaydet (Commit) cc290073 authored tarafından Frank Schoenheit [fs]'s avatar Frank Schoenheit [fs] Kaydeden (comit) Michael Meeks

fs34b: #i117039# restore old behavior of SfxUndoManager::EnableUndo: don't count…

fs34b: #i117039# restore old behavior of SfxUndoManager::EnableUndo: don't count the calls, but maintain a simple flag.
Consequently, let sw's UndoManager simply delegate now, and change the UndoManagerHelper to maintain a lock counter itself.
üst 18f32039
......@@ -315,9 +315,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
......
......@@ -185,9 +185,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;
......@@ -197,9 +197,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 )
{
......@@ -420,14 +420,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;
}
//------------------------------------------------------------------------
......@@ -442,7 +437,7 @@ bool SfxUndoManager::IsUndoEnabled() const
bool SfxUndoManager::ImplIsUndoEnabled_Lock() const
{
return m_pData->mnLockCount == 0;
return m_pData->mbUndoEnabled;
}
//------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment