summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail..com>2020-02-18 01:20:11 -0900
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-02-19 07:24:41 +0100
commitb7f999e75f436bb0b162e16c96b54bbaa4b0101b (patch)
treeb8620ecd5e728d1061b2a13e5fa0dead2da958a4
parent0268646db67acc08f17d5905ddea0fc8503d7e8e (diff)
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@collabora.co.uk>
-rw-r--r--sw/source/uibase/utlui/content.cxx26
1 files changed, 17 insertions, 9 deletions
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)