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

Jim Raykowski (via logerrit) logerrit at kemper.freedesktop.org
Wed Feb 19 06:25:18 UTC 2020


 sw/source/uibase/utlui/content.cxx |   26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

New commits:
commit b7f999e75f436bb0b162e16c96b54bbaa4b0101b
Author:     Jim Raykowski <raykowj at gmail..com>
AuthorDate: Tue Feb 18 01:20:11 2020 -0900
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Feb 19 07:24:41 2020 +0100

    Keep focus in Writer Navigator after content delete
    
    When deletable content in Writer Navigator is deleted by pressing the
    delete key, focus remains in the content tree. When the delete menu item
    is used, focus changes to the document window. This patch changes focus
    behaviour of menu item use to that of key press. It keeps focus in
    Writer Navigator after content delete is done from the Writer
    Navigator.
    
    Change-Id: Ie96e3c55f0cd95c6955e65f9de5d38ddd134d30e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87171
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index 52b863602d8e..660cf16be92b 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -3051,14 +3051,7 @@ void SwContentTree::KeyInput(const KeyEvent& rEvent)
             if (static_cast<SwContent*>(pEntry->GetUserData())->GetParent()->IsDeletable() &&
                     !m_pActiveShell->GetView().GetDocShell()->IsReadOnly())
             {
-                if (static_cast<SwContent*>(pEntry->GetUserData())->GetParent()->GetType() == ContentTypeId::OUTLINE)
-                    DeleteOutlineSelections();
-                else
-                    EditEntry(pEntry, EditEntryMode::DELETE);
-                m_bViewHasChanged = true;
-                GetParentWindow()->UpdateListBox();
-                TimerUpdate(&m_aUpdTimer);
-                GrabFocus();
+                EditEntry(pEntry, EditEntryMode::DELETE);
             }
         }
     }
@@ -3394,7 +3387,8 @@ void SwContentTree::ExecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry )
         }
         break;
         case 806:
-            DeleteOutlineSelections();
+            // Delete outline selections
+            EditEntry(pFirst, EditEntryMode::DELETE);
             break;
         //Display
         default:
@@ -3548,6 +3542,13 @@ void SwContentTree::EditEntry(SvTreeListEntry const * pEntry, EditEntryMode nMod
     uno::Reference< container::XNameAccess >  xNameAccess, xSecond, xThird;
     switch(nType)
     {
+        case ContentTypeId::OUTLINE :
+            if(nMode == EditEntryMode::DELETE)
+            {
+                DeleteOutlineSelections();
+            }
+        break;
+
         case ContentTypeId::TABLE     :
             if(nMode == EditEntryMode::UNPROTECT_TABLE)
             {
@@ -3756,6 +3757,13 @@ void SwContentTree::EditEntry(SvTreeListEntry const * pEntry, EditEntryMode nMod
         pDlg->SetForbiddenChars(sForbiddenChars);
         pDlg->Execute();
     }
+    if(EditEntryMode::DELETE == nMode)
+    {
+        m_bViewHasChanged = true;
+        GetParentWindow()->UpdateListBox();
+        TimerUpdate(&m_aUpdTimer);
+        GrabFocus();
+    }
 }
 
 void SwContentTree::GotoContent(const SwContent* pCnt)


More information about the Libreoffice-commits mailing list