diff options
-rw-r--r-- | include/svtools/editbrowsebox.hxx | 3 | ||||
-rw-r--r-- | include/svx/fmgridif.hxx | 6 | ||||
-rw-r--r-- | svx/source/fmcomp/fmgridif.cxx | 16 |
3 files changed, 19 insertions, 6 deletions
diff --git a/include/svtools/editbrowsebox.hxx b/include/svtools/editbrowsebox.hxx index fde44b38d136..ecfd49d6d605 100644 --- a/include/svtools/editbrowsebox.hxx +++ b/include/svtools/editbrowsebox.hxx @@ -967,6 +967,7 @@ namespace svt virtual bool ProcessKey(const KeyEvent& rEvt) override; css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleCheckBoxCell(long _nRow, sal_uInt16 _nColumnPos,const TriState& eState); + bool ControlHasFocus() const; protected: // creates the accessible which wraps the active cell void implCreateActiveAccessible( ); @@ -981,8 +982,6 @@ namespace svt SVT_DLLPRIVATE void implActivateCellOnMouseEvent(const BrowserMouseEvent& _rEvt, bool _bUp); - bool ControlHasFocus() const; - DECL_DLLPRIVATE_LINK( ModifyHdl, LinkParamNone*, void ); DECL_DLLPRIVATE_LINK( StartEditHdl, void*, void ); DECL_DLLPRIVATE_LINK( EndEditHdl, void*, void ); diff --git a/include/svx/fmgridif.hxx b/include/svx/fmgridif.hxx index 1e7857dfbb94..2703b6a016d7 100644 --- a/include/svx/fmgridif.hxx +++ b/include/svx/fmgridif.hxx @@ -306,15 +306,15 @@ public: virtual void SAL_CALL addSelectionChangeListener( const css::uno::Reference< css::view::XSelectionChangeListener >& xListener ) override; virtual void SAL_CALL removeSelectionChangeListener( const css::uno::Reference< css::view::XSelectionChangeListener >& xListener ) override; +// css::awt::XWindow + virtual void SAL_CALL setFocus() override; + protected: virtual FmXGridPeer* imp_CreatePeer(vcl::Window* pParent); // ImplCreatePeer would be better, but doesn't work because it's not exported - }; - // FmXGridPeer -> Peer for the Gridcontrol - class FmGridControl; class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC FmXGridPeer: public cppu::ImplInheritanceHelper< 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 > ()); |