summaryrefslogtreecommitdiff
path: root/framework/source
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@oracle.com>2010-12-01 15:30:01 +0100
committerFrank Schoenheit [fs] <frank.schoenheit@oracle.com>2010-12-01 15:30:01 +0100
commitd5a671a4b0a5fd7c33f7faf77c30790777ccf800 (patch)
treed6d5f3a14ac7df147b8687ad9c4b054608ba0fd4 /framework/source
parent06d2c4e3e229b7cd409e20fa36968efe7d3986cd (diff)
undoapi: clear the redo stack when leaving an Undo context resp. list action, not when entering it. This is a pre-requisite for Writer's upcoming migratin to SfxUndoManager
Diffstat (limited to 'framework/source')
-rwxr-xr-xframework/source/helper/undomanagerhelper.cxx13
1 files changed, 9 insertions, 4 deletions
diff --git a/framework/source/helper/undomanagerhelper.cxx b/framework/source/helper/undomanagerhelper.cxx
index e2cfd13c5bb7..d0ece6131841 100755
--- a/framework/source/helper/undomanagerhelper.cxx
+++ b/framework/source/helper/undomanagerhelper.cxx
@@ -595,6 +595,7 @@ namespace framework
const bool isHiddenContext = m_aContextVisibilities.top();;
m_aContextVisibilities.pop();
+ const bool bHadRedoActions = ( rUndoManager.GetRedoActionCount( IUndoManager::TopLevel ) > 0 );
{
::comphelper::FlagGuard aNotificationGuard( m_bAPIActionRunning );
if ( isHiddenContext )
@@ -602,11 +603,13 @@ namespace framework
else
nContextElements = rUndoManager.LeaveListAction();
}
+ const bool bHasRedoActions = ( rUndoManager.GetRedoActionCount( IUndoManager::TopLevel ) > 0 );
// prepare notification
void ( SAL_CALL XUndoManagerListener::*notificationMethod )( const UndoManagerEvent& ) = NULL;
- UndoManagerEvent aEvent( buildEvent( ::rtl::OUString() ) );
+ UndoManagerEvent aContextEvent( buildEvent( ::rtl::OUString() ) );
+ const EventObject aClearedEvent( getXUndoManager() );
if ( nContextElements == 0 )
{
notificationMethod = &XUndoManagerListener::cancelledContext;
@@ -617,14 +620,16 @@ namespace framework
}
else
{
- aEvent.UndoActionTitle = rUndoManager.GetUndoActionComment( 0, IUndoManager::CurrentLevel );
+ aContextEvent.UndoActionTitle = rUndoManager.GetUndoActionComment( 0, IUndoManager::CurrentLevel );
notificationMethod = &XUndoManagerListener::leftContext;
}
aGuard.clear();
// <--- SYNCHRONIZED
- m_aUndoListeners.notifyEach( notificationMethod, aEvent );
+ if ( bHadRedoActions && !bHasRedoActions )
+ m_aUndoListeners.notifyEach( &XUndoManagerListener::redoActionsCleared, aClearedEvent );
+ m_aUndoListeners.notifyEach( notificationMethod, aContextEvent );
impl_notifyModified();
}
@@ -702,7 +707,7 @@ namespace framework
m_aUndoListeners.notifyEach( &XUndoManagerListener::undoActionAdded, aEventAdd );
if ( bHadRedoActions && !bHasRedoActions )
- m_aUndoListeners.notifyEach( &XUndoManagerListener::redoActionsCleared , aEventClear );
+ m_aUndoListeners.notifyEach( &XUndoManagerListener::redoActionsCleared, aEventClear );
impl_notifyModified();
}