diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-07-13 11:41:40 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-07-13 15:29:20 +0200 |
commit | b2fd41f491af4626bc37165ef1d44b9aac859fcb (patch) | |
tree | c806ad8f8b7ac48f7970ee554e8b7e190a0b27d8 /svx/source/fmcomp | |
parent | e2acc233c46c0fcdcefc878b8594f3de564eb357 (diff) |
don't grab focus if focus is already in a subcontrol
Change-Id: I3bc377e9d9ee1ad7b6066b7a1c2d27ddd7bb6b7f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98651
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx/source/fmcomp')
-rw-r--r-- | svx/source/fmcomp/fmgridif.cxx | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx index 400e28e8b460..ea9a96ea0b27 100644 --- a/svx/source/fmcomp/fmgridif.cxx +++ b/svx/source/fmcomp/fmgridif.cxx @@ -962,6 +962,21 @@ sal_Bool SAL_CALL FmXGridControl::supportsMode(const OUString& Mode) return xPeer.is() && xPeer->supportsMode(Mode); } +void SAL_CALL FmXGridControl::setFocus() +{ + FmXGridPeer* pPeer = comphelper::getUnoTunnelImplementation<FmXGridPeer>(getPeer()); + if (pPeer) + { + VclPtr<FmGridControl> xGrid = pPeer->GetAs<FmGridControl>(); + bool bAlreadyHasFocus = xGrid->HasChildPathFocus() || xGrid->ControlHasFocus(); + // if the focus is already in the control don't grab focus again which + // would grab focus away from any native widgets hosted in the control + if (bAlreadyHasFocus) + return; + } + UnoControl::setFocus(); +} + // helper class which prevents that in the peer's header the FmGridListener must be known class FmXGridPeer::GridListenerDelegator : public FmGridListener { @@ -1055,7 +1070,6 @@ void FmXGridPeer::Create(vcl::Window* pParent, WinBits nStyle) getSupportedURLs(); } - FmXGridPeer::~FmXGridPeer() { setRowSet(Reference< XRowSet > ()); |