summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/source/ui/undo/undobase.cxx36
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)