From 61396c713fcce8b4c6d6fd159753c58b53a55449 Mon Sep 17 00:00:00 2001 From: Henry Castro Date: Wed, 28 Jun 2017 10:26:21 -0400 Subject: sc lok: disable Undo/Redo state if conflict with other views Change-Id: I5bc5be2b17925ec3a203f9704f62a8c80ac5fc9d Reviewed-on: https://gerrit.libreoffice.org/39363 Tested-by: Jenkins Reviewed-by: Henry Castro Reviewed-on: https://gerrit.libreoffice.org/39402 Reviewed-by: Jan Holesovsky Tested-by: Jan Holesovsky --- sfx2/source/view/viewfrm.cxx | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 551cb94ae14a..840ba418e3e7 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -933,18 +933,36 @@ void SfxViewFrame::StateHistory_Impl( SfxItemSet &rSet ) if ( pShUndoMgr && pShUndoMgr->GetUndoActionCount() ) { - OUString aTmp(SvtResId(STR_UNDO).toString()); - aTmp+= pShUndoMgr->GetUndoActionComment(); - rSet.Put( SfxStringItem( SID_UNDO, aTmp ) ); + const SfxUndoAction* pAction = pShUndoMgr->GetUndoAction(); + SfxViewShell *pViewSh = GetViewShell(); + if (pViewSh && pAction->GetViewShellId() != static_cast(pViewSh->GetViewShellId())) + { + rSet.Put(SfxUInt32Item(SID_UNDO, static_cast(SID_REPAIRPACKAGE))); + } + else + { + OUString aTmp(SvtResId(STR_UNDO).toString()); + aTmp+= pShUndoMgr->GetUndoActionComment(); + rSet.Put( SfxStringItem( SID_UNDO, aTmp ) ); + } } else rSet.DisableItem( SID_UNDO ); if ( pShUndoMgr && pShUndoMgr->GetRedoActionCount() ) { - OUString aTmp(SvtResId(STR_REDO).toString()); - aTmp += pShUndoMgr->GetRedoActionComment(); - rSet.Put( SfxStringItem( SID_REDO, aTmp ) ); + const SfxUndoAction* pAction = pShUndoMgr->GetRedoAction(); + SfxViewShell *pViewSh = GetViewShell(); + if (pViewSh && pAction->GetViewShellId() != static_cast(pViewSh->GetViewShellId())) + { + rSet.Put(SfxUInt32Item(SID_REDO, static_cast(SID_REPAIRPACKAGE))); + } + else + { + OUString aTmp(SvtResId(STR_REDO).toString()); + aTmp += pShUndoMgr->GetRedoActionComment(); + rSet.Put( SfxStringItem( SID_REDO, aTmp ) ); + } } else rSet.DisableItem( SID_REDO ); -- cgit