summaryrefslogtreecommitdiff
path: root/sd/source/ui/dlg/navigatr.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-02-21 17:27:53 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-02-22 09:05:07 +0100
commitf3c68cdf8f6a0273c62b493552f78af0138a44e8 (patch)
tree1a1742b280ff5d04794bf0726f2d79c097315f0f /sd/source/ui/dlg/navigatr.cxx
parent6e0f60fa4ad985b3939ce3ac26bc8cb68fb41470 (diff)
tdf#115873 sd navigator: allow selecting but not focusing on objects
There were also two cases here: - changing the selection with the keyboard or single-click only updated the selection in the navigator - pressing enter or double-click also selected the shape in the main window and gave the focus away Introduce a 3rd case for single-click: update the shape selection but doesn't give the focus away. This way double-click is not needed to sync navigator -> main doc selection but keyboard navigation should still work. An additional trick is to make sure that the current shell is the draw shell (and not the slide sorter) after navigation, so follow-up operations work with the selected object and not with the whole slide. Finally, a third related problem was that the selection jumped back to the item of the slide after clicking on a shape in the navigator. The reason for this was the navigator list was constantly cleared and re-filled in SdNavigatorWin::InitTreeLB(), as SdPageObjsTLB::IsEqualToDoc() returned false (even if the list was up to date) in case of shapes which had children but no name. Fix this by using the same SdrIterMode::Flat iteration mode that SdPageObjsTLB::AddShapeList() does, so the fill and the equality check of the navigator iterates the same way. Change-Id: I0bfc3e8b49f7ef01d5797a68284616dcd2a81c5d Reviewed-on: https://gerrit.libreoffice.org/50118 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sd/source/ui/dlg/navigatr.cxx')
-rw-r--r--sd/source/ui/dlg/navigatr.cxx27
1 files changed, 27 insertions, 0 deletions
diff --git a/sd/source/ui/dlg/navigatr.cxx b/sd/source/ui/dlg/navigatr.cxx
index 0fe0f97481c8..2761c6eed628 100644
--- a/sd/source/ui/dlg/navigatr.cxx
+++ b/sd/source/ui/dlg/navigatr.cxx
@@ -54,6 +54,7 @@
#include <slideshow.hxx>
#include <FrameView.hxx>
#include <helpids.h>
+#include <Window.hxx>
namespace {
static const sal_uInt16 nShowNamedShapesFilter=1;
@@ -215,6 +216,11 @@ NavigatorDragType SdNavigatorWin::GetNavigatorDragType()
return eDT;
}
+VclPtr<SdPageObjsTLB> SdNavigatorWin::GetObjects()
+{
+ return maTlbObjects;
+}
+
IMPL_LINK_NOARG(SdNavigatorWin, SelectToolboxHdl, ToolBox *, void)
{
sal_uInt16 nId = maToolbox->GetCurItemId();
@@ -351,6 +357,27 @@ IMPL_LINK_NOARG(SdNavigatorWin, ClickObjectHdl, SvTreeListBox*, bool)
if ( pShellWnd )
pShellWnd->GrabFocus();
}
+
+ // We navigated to an object, but the current shell may be
+ // still the slide sorter. Explicitly try to grab the draw
+ // shell focus, so follow-up operations work with the object
+ // and not with the whole slide.
+ sd::DrawDocShell* pDocShell = pInfo->mpDocShell;
+ if (pDocShell)
+ {
+ sd::ViewShell* pViewShell = pDocShell->GetViewShell();
+ if (pViewShell)
+ {
+ vcl::Window* pWindow = pViewShell->GetActiveWindow();
+ if (pWindow)
+ pWindow->GrabFocus();
+ }
+ }
+
+ if (!maTlbObjects->IsNavigationGrabsFocus())
+ // This is the case when keyboard navigation inside the
+ // navigator should continue to work.
+ maTlbObjects->GrabFocus();
}
}
}