diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-07-06 12:29:25 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2016-07-08 20:40:01 +0000 |
commit | 06287b9c348281612854d67c4eb2e7a38dc722ca (patch) | |
tree | ed521dee939be19fbf99a1e62941b03a2ac21cec /sc/source/ui | |
parent | ab9708e179762f97bd1a0ee4c0d4b439f1dabfd5 (diff) |
Resolves: rhbz#1352881 turn off undo generation during undo
Change-Id: I6aa4ceb09b252ad0b04d8e0a89d8c3327f565b49
Reviewed-on: https://gerrit.libreoffice.org/26980
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc/source/ui')
-rw-r--r-- | sc/source/ui/undo/undobase.cxx | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/sc/source/ui/undo/undobase.cxx b/sc/source/ui/undo/undobase.cxx index b5a7e694c553..63e201d3754e 100644 --- a/sc/source/ui/undo/undobase.cxx +++ b/sc/source/ui/undo/undobase.cxx @@ -96,9 +96,36 @@ void ScSimpleUndo::BeginUndo() pDetectiveUndo->Undo(); } +namespace +{ + class DisableUndoGuard + { + private: + ScDocument& m_rDoc; + bool m_bUndoEnabled; + public: + DisableUndoGuard(ScDocShell *pDocShell) + : m_rDoc(pDocShell->GetDocument()) + , m_bUndoEnabled(m_rDoc.IsUndoEnabled()) + { + m_rDoc.EnableUndo(false); + } + + ~DisableUndoGuard() + { + m_rDoc.EnableUndo(m_bUndoEnabled); + } + }; +} + void ScSimpleUndo::EndUndo() { - pDocShell->SetDocumentModified(); + { + // rhbz#1352881 Temporarily turn off undo generation during + // SetDocumentModified + DisableUndoGuard aGuard(pDocShell); + pDocShell->SetDocumentModified(); + } ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); if (pViewShell) @@ -125,7 +152,12 @@ void ScSimpleUndo::EndRedo() if (pDetectiveUndo) pDetectiveUndo->Redo(); - pDocShell->SetDocumentModified(); + { + // rhbz#1352881 Temporarily turn off undo generation during + // SetDocumentModified + DisableUndoGuard aGuard(pDocShell); + pDocShell->SetDocumentModified(); + } ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); if (pViewShell) |