[Libreoffice-commits] core.git: sw/source

Caolán McNamara caolanm at redhat.com
Thu Oct 2 08:56:45 PDT 2014


 sw/source/uibase/docvw/AnnotationWin.cxx |   12 +++++++-----
 sw/source/uibase/docvw/PostItMgr.cxx     |    8 ++++----
 2 files changed, 11 insertions(+), 9 deletions(-)

New commits:
commit 1f18b3b07832fee769e7a36c4f3503effde26f1e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Oct 2 16:33:46 2014 +0100

    Related: fdo#58277 only DelRight after a successful GotoField
    
    otherwise you're just deleting a char right after whereever
    the cursor used to be.
    
    It can be possible to not GotoField if the field in question
    is in a redline-deleted portion and show changes is not on. i.e.
    its actually already deleted
    
    Change-Id: Ic4833d82c5c33e556f3e159e9732a6db071f5622

diff --git a/sw/source/uibase/docvw/AnnotationWin.cxx b/sw/source/uibase/docvw/AnnotationWin.cxx
index 2c58a9b..f5e1f0c 100644
--- a/sw/source/uibase/docvw/AnnotationWin.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin.cxx
@@ -143,11 +143,13 @@ void SwAnnotationWin::UpdateData()
 
 void SwAnnotationWin::Delete()
 {
-    SwSidebarWin::Delete();
-    // we delete the field directly, the Mgr cleans up the PostIt by listening
-    DocView().GetWrtShellPtr()->GotoField(*mpFmtFld);
-    GrabFocusToDocument();
-    DocView().GetWrtShellPtr()->DelRight();
+    if (DocView().GetWrtShellPtr()->GotoField(*mpFmtFld))
+    {
+        SwSidebarWin::Delete();
+        // we delete the field directly, the Mgr cleans up the PostIt by listening
+        GrabFocusToDocument();
+        DocView().GetWrtShellPtr()->DelRight();
+    }
 }
 
 void SwAnnotationWin::GotoPos()
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index a2ed8db..a75a70f 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -1209,8 +1209,8 @@ void SwPostItMgr::Delete(const OUString& aAuthor)
     }
     for(std::vector<const SwFmtFld*>::iterator i = aTmp.begin(); i != aTmp.end() ; ++i)
     {
-        mpWrtShell->GotoField( *(*i) );
-        mpWrtShell->DelRight();
+        if (mpWrtShell->GotoField(*(*i)))
+            mpWrtShell->DelRight();
     }
     mpWrtShell->EndUndo();
     PrepareView();
@@ -1236,8 +1236,8 @@ void SwPostItMgr::Delete()
     }
     for(std::vector<const SwFmtFld*>::iterator i = aTmp.begin(); i != aTmp.end() ; ++i)
     {
-        mpWrtShell->GotoField( *(*i) );
-        mpWrtShell->DelRight();
+        if (mpWrtShell->GotoField(*(*i)))
+            mpWrtShell->DelRight();
     }
 
     mpWrtShell->EndUndo();


More information about the Libreoffice-commits mailing list