[Libreoffice-commits] core.git: Branch 'aoo/trunk' - svx/inc svx/source

Armin Le Grand alg at apache.org
Tue Oct 8 07:07:52 PDT 2013


 svx/inc/svx/sdrundomanager.hxx       |    3 +++
 svx/source/svdraw/sdrundomanager.cxx |   19 +++++++++++++++++++
 2 files changed, 22 insertions(+)

New commits:
commit 81e916525fa63b188b2a3b9bb7030e4d451a4808
Author: Armin Le Grand <alg at apache.org>
Date:   Tue Oct 8 12:38:03 2013 +0000

    i123350 Added Clear() implementation to SdrUndoManager to only delete text edit part of the undo stack

diff --git a/svx/inc/svx/sdrundomanager.hxx b/svx/inc/svx/sdrundomanager.hxx
index 70f46d7..5b4b9f6 100755
--- a/svx/inc/svx/sdrundomanager.hxx
+++ b/svx/inc/svx/sdrundomanager.hxx
@@ -51,6 +51,9 @@ public:
     virtual sal_Bool Undo();
     virtual sal_Bool Redo();
 
+    // ##
+    virtual void Clear();
+
     // Call for the view which starts the interactive text edit. Use link to
     // activate (start text edit) and empty link to reset (end text edit). On
     // reset all text edit actions will be removed from this undo manager to
diff --git a/svx/source/svdraw/sdrundomanager.cxx b/svx/source/svdraw/sdrundomanager.cxx
index 3211ee2..49df4f2 100755
--- a/svx/source/svdraw/sdrundomanager.cxx
+++ b/svx/source/svdraw/sdrundomanager.cxx
@@ -85,6 +85,25 @@ sal_Bool SdrUndoManager::Redo()
     return bRetval;
 }
 
+void SdrUndoManager::Clear()
+{
+    if(isTextEditActive())
+    {
+        while(GetUndoActionCount() && mpLastUndoActionBeforeTextEdit != GetUndoAction(0))
+        {
+            RemoveLastUndoAction();
+        }
+
+        // urgently needed: RemoveLastUndoAction does NOT correct the Redo stack by itself (!)
+        ClearRedo();
+    }
+    else
+    {
+        // call parent
+        EditUndoManager::Clear();
+    }
+}
+
 void SdrUndoManager::SetEndTextEditHdl(const Link& rLink)
 {
     maEndTextEditHdl = rLink;


More information about the Libreoffice-commits mailing list