tdf#47807 Invalidate bindings to Undo Redo

This patch reverts the previous commit made for this and provides a new
fix.

Change-Id: I487ecf0a7564f1130ef9a42e893e73185701d8c9
Reviewed-on: https://gerrit.libreoffice.org/76287
Tested-by: Jenkins
Reviewed-by: Jim Raykowski <raykowj@gmail.com>
This commit is contained in:
Jim Raykowski
2019-07-25 18:05:44 +02:00
committed by Jim Raykowski
parent e354681e5d
commit 3c7efab4e7
3 changed files with 14 additions and 22 deletions
-2
View File
@@ -63,8 +63,6 @@ public:
// by a last undo during text edit
bool isEndTextEditTriggeredFromUndo() { return mbEndTextEditTriggeredFromUndo; }
void SetDocShell(SfxObjectShell* pDocShell);
virtual void AddUndoAction( std::unique_ptr<SfxUndoAction> pAction, bool bTryMerg=false ) override;
};
#endif // INCLUDED_SVX_SDRUNDOMANAGER_HXX
-20
View File
@@ -18,10 +18,7 @@
*/
#include <svx/sdrundomanager.hxx>
#include <svx/svxids.hrc>
#include <sfx2/bindings.hxx>
#include <sfx2/objsh.hxx>
#include <sfx2/viewfrm.hxx>
#include <svl/hint.hxx>
SdrUndoManager::SdrUndoManager()
@@ -149,21 +146,4 @@ void SdrUndoManager::EmptyActionsChanged()
}
}
void SdrUndoManager::AddUndoAction( std::unique_ptr<SfxUndoAction> pAction, bool bTryMerg )
{
EditUndoManager::AddUndoAction( std::move(pAction), bTryMerg);
if (m_pDocSh)
{
SfxViewFrame* pViewFrame = SfxViewFrame::GetFirst( m_pDocSh );
while ( pViewFrame )
{
pViewFrame->GetBindings().Invalidate( SID_UNDO );
pViewFrame->GetBindings().Invalidate( SID_REDO );
pViewFrame = SfxViewFrame::GetNext( *pViewFrame, m_pDocSh );
}
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+14
View File
@@ -41,6 +41,9 @@
#include <comphelper/lok.hxx>
#include <assert.h>
#include <sfx2/viewfrm.hxx>
#include <sfx2/bindings.hxx>
using namespace ::com::sun::star;
// the undo array should never grow beyond this limit:
@@ -526,6 +529,17 @@ void UndoManager::AddUndoAction(std::unique_ptr<SfxUndoAction> pAction, bool bTr
}
}
SdrUndoManager::AddUndoAction(std::move(pAction), bTryMerge);
if (m_pDocShell)
{
SfxViewFrame* pViewFrame = SfxViewFrame::GetFirst( m_pDocShell );
while ( pViewFrame )
{
pViewFrame->GetBindings().Invalidate( SID_UNDO );
pViewFrame->GetBindings().Invalidate( SID_REDO );
pViewFrame = SfxViewFrame::GetNext( *pViewFrame, m_pDocShell );
}
}
// if the undo nodes array is too large, delete some actions
while (UNDO_ACTION_LIMIT < GetUndoNodes().Count())
{