From eaf7e188e1f695e4d165838b4b40414601d28591 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 18 Feb 2021 17:22:31 +0000 Subject: Resolves: tdf#143023 explicitly connect to ControlBase focus-[in/out] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit instead of listening to the generic vcl::Window/Control focus events. The thing which really gets/loses focus is now a Widget hosted inside the ControlBase. also contains... fix comment Change-Id: Ia1783aff3fded7fd73de2b04b9aced647771a92c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119998 Tested-by: Jenkins Reviewed-by: Caolán McNamara establish that DbCellControl Window member is always a ControlBase and remove resulting known redundant dynamic_casting Change-Id: I5f098ef1adee3ad5d2a2bc5fcd30523f980df2f9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119999 Tested-by: Jenkins Reviewed-by: Caolán McNamara EventWindow is always a svt::ControlBase update DataBrowser has-focus when child widget loses focus similar to tdf#135641 case, focus-out becomes an issue with the bibliography editor if focus-in is seen on clicking in a cell, then click in a GtkEntry and tab around in a circle. Without this lose-focus support focus will be grabbed back to the cell of the initial click on a circuit of the focus-cycle Change-Id: I36288ed21dc4357c077f8dee55b55abf2457c2a6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111157 Tested-by: Jenkins Reviewed-by: Caolán McNamara (cherry picked from commit 422a8c3218b484817a8723b57fe9845d6abb83f4) reportdesigner focus out handler clobbering the preexisting handler set by the databrowser, so chain one after the other Change-Id: I5aa16635031be425b9354e5a2d6b891a81d54e55 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111384 Tested-by: Jenkins Reviewed-by: Caolán McNamara (cherry picked from commit 731f08e5a84817dbc3c6be6e670025d51f39cd61) Change-Id: I012d0bea687aa6d5965a4e2f6ce3899bfc629f1b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120006 Tested-by: Jenkins Reviewed-by: Michael Stahl --- include/svtools/editbrowsebox.hxx | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'include/svtools/editbrowsebox.hxx') diff --git a/include/svtools/editbrowsebox.hxx b/include/svtools/editbrowsebox.hxx index 34696522bd78..a1badb8cce80 100644 --- a/include/svtools/editbrowsebox.hxx +++ b/include/svtools/editbrowsebox.hxx @@ -171,9 +171,26 @@ namespace svt virtual void SetEditableReadOnly(bool bReadOnly); virtual bool ProcessKey(const KeyEvent& rKEvt); + + // chain after the FocusInHdl + void SetFocusInHdl(const Link& rHdl) + { + m_aFocusInHdl = rHdl; + } + + // chain after the FocusOutHdl + void SetFocusOutHdl(const Link& rHdl) + { + m_aFocusOutHdl = rHdl; + } + protected: DECL_LINK(KeyInputHdl, const KeyEvent&, bool); DECL_LINK(FocusInHdl, weld::Widget&, void); + DECL_LINK(FocusOutHdl, weld::Widget&, void); + private: + Link m_aFocusInHdl; + Link m_aFocusOutHdl; }; class SVT_DLLPUBLIC EditControlBase : public ControlBase @@ -191,6 +208,7 @@ namespace svt weld::Entry& get_widget() { return *m_pEntry; } virtual void connect_changed(const Link& rLink) = 0; + virtual void connect_focus_out(const Link& rLink) = 0; protected: void InitEditControlBase(weld::Entry* pEntry); @@ -211,6 +229,11 @@ namespace svt m_xWidget->connect_changed(rLink); } + virtual void connect_focus_out(const Link& rLink) override + { + m_xWidget->connect_focus_out(rLink); + } + protected: std::unique_ptr m_xWidget; }; @@ -696,6 +719,7 @@ namespace svt virtual void dispose() override; virtual void connect_changed(const Link& rLink) override; + virtual void connect_focus_out(const Link& rLink) override; weld::EntryFormatter& get_formatter(); @@ -762,6 +786,7 @@ namespace svt weld::PatternFormatter& get_formatter() { return *m_xEntryFormatter; } virtual void connect_changed(const Link& rLink) override; + virtual void connect_focus_out(const Link& rLink) override; virtual void dispose() override; private: @@ -995,6 +1020,7 @@ namespace svt virtual bool ProcessKey(const KeyEvent& rEvt) override; virtual void ChildFocusIn() override; + virtual void ChildFocusOut() override; css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleCheckBoxCell(sal_Int32 _nRow, sal_uInt16 _nColumnPos,const TriState& eState); bool ControlHasFocus() const; -- cgit