include/svtools/brwbox.hxx              |    1 +
 include/svtools/editbrowsebox.hxx       |    3 +++
 svtools/source/brwbox/brwbox2.cxx       |    3 +++
 svtools/source/brwbox/ebbcontrols.cxx   |   10 ++++++++++
 svtools/source/brwbox/editbrowsebox.cxx |    8 ++++++--
 5 files changed, 23 insertions(+), 2 deletions(-)

New commits:
commit 405aa1b6a226c58966d319f25e4ebf2e400d5e50
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Fri Jan 15 14:00:50 2021 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Fri Jan 15 20:57:01 2021 +0100

    tdf#135641 update DataBrowser has-focus when child widget gains focus
    
    Change-Id: Ic5e618b50c31ebeffa1b2cc59857582804874747
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109369
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/include/svtools/brwbox.hxx b/include/svtools/brwbox.hxx
index f90d1a3c8932..8e7b3fc6f4dc 100644
--- a/include/svtools/brwbox.hxx
+++ b/include/svtools/brwbox.hxx
@@ -587,6 +587,7 @@ public:
     bool            ReserveControlArea(sal_uInt16 nWidth = USHRT_MAX);
     tools::Rectangle       GetControlArea() const;
     virtual bool    ProcessKey(const KeyEvent& rEvt);
+    virtual void    ChildFocusIn();
     void            Dispatch( sal_uInt16 nId );
     void            SetMode( BrowserMode nMode );
     BrowserMode     GetMode( ) const { return m_nCurrentMode; }
diff --git a/include/svtools/editbrowsebox.hxx 
b/include/svtools/editbrowsebox.hxx
index 4f212bf9de4d..46a35c203e96 100644
--- a/include/svtools/editbrowsebox.hxx
+++ b/include/svtools/editbrowsebox.hxx
@@ -173,6 +173,7 @@ namespace svt
         virtual bool ProcessKey(const KeyEvent& rKEvt);
     protected:
         DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
+        DECL_LINK(FocusInHdl, weld::Widget&, void);
     };
 
     class SVT_DLLPUBLIC EditControlBase : public ControlBase
@@ -981,6 +982,8 @@ namespace svt
 
         virtual bool ProcessKey(const KeyEvent& rEvt) override;
 
+        virtual void ChildFocusIn() override;
+
         css::uno::Reference< css::accessibility::XAccessible > 
CreateAccessibleCheckBoxCell(sal_Int32 _nRow, sal_uInt16 _nColumnPos,const 
TriState& eState);
         bool ControlHasFocus() const;
     protected:
diff --git a/svtools/source/brwbox/brwbox2.cxx 
b/svtools/source/brwbox/brwbox2.cxx
index 592042b6fae2..72830817e192 100644
--- a/svtools/source/brwbox/brwbox2.cxx
+++ b/svtools/source/brwbox/brwbox2.cxx
@@ -1686,6 +1686,9 @@ bool BrowseBox::ProcessKey( const KeyEvent& rEvt )
     return nId != BROWSER_NONE;
 }
 
+void BrowseBox::ChildFocusIn()
+{
+}
 
 void BrowseBox::Dispatch( sal_uInt16 nId )
 {
diff --git a/svtools/source/brwbox/ebbcontrols.cxx 
b/svtools/source/brwbox/ebbcontrols.cxx
index 5e22c9ba33c1..db614a86c31c 100644
--- a/svtools/source/brwbox/ebbcontrols.cxx
+++ b/svtools/source/brwbox/ebbcontrols.cxx
@@ -30,6 +30,7 @@ namespace svt
         m_xWidget->set_entry_width_chars(1); // so a smaller than default 
width can be used
         m_xWidget->connect_changed(LINK(this, ComboBoxControl, SelectHdl));
         m_xWidget->connect_key_press(LINK(this, ControlBase, KeyInputHdl));
+        m_xWidget->connect_focus_in(LINK(this, ControlBase, FocusInHdl));
     }
 
     void ComboBoxControl::dispose()
@@ -115,6 +116,7 @@ namespace svt
         m_xWidget->set_size_request(42, -1); // so a later narrow size request 
can stick
         m_xWidget->connect_changed(LINK(this, ListBoxControl, SelectHdl));
         m_xWidget->connect_key_press(LINK(this, ControlBase, KeyInputHdl));
+        m_xWidget->connect_focus_in(LINK(this, ControlBase, FocusInHdl));
     }
 
     void ListBoxControl::dispose()
@@ -183,6 +185,7 @@ namespace svt
         m_aModeState.bTriStateEnabled = true;
         InitControlBase(m_xBox.get());
         m_xBox->connect_key_press(LINK(this, ControlBase, KeyInputHdl));
+        m_xBox->connect_focus_in(LINK(this, ControlBase, FocusInHdl));
         m_xBox->connect_toggled(LINK(this, CheckBoxControl, OnToggle));
     }
 
@@ -334,6 +337,7 @@ namespace svt
         m_pEntry->show();
         m_pEntry->set_width_chars(1); // so a smaller than default width can 
be used
         m_pEntry->connect_key_press(LINK(this, ControlBase, KeyInputHdl));
+        m_pEntry->connect_focus_in(LINK(this, ControlBase, FocusInHdl));
     }
 
     bool ControlBase::ProcessKey(const KeyEvent& rKEvt)
@@ -346,6 +350,11 @@ namespace svt
         return ProcessKey(rKEvt);
     }
 
+    IMPL_LINK_NOARG(ControlBase, FocusInHdl, weld::Widget&, void)
+    {
+        return 
static_cast<BrowserDataWin*>(GetParent())->GetParent()->ChildFocusIn();
+    }
+
     void EditControlBase::dispose()
     {
         m_pEntry = nullptr;
@@ -608,6 +617,7 @@ namespace svt
     {
         InitControlBase(m_xWidget.get());
         m_xWidget->connect_key_press(LINK(this, ControlBase, KeyInputHdl));
+        m_xWidget->connect_focus_in(LINK(this, ControlBase, FocusInHdl));
         // so any the natural size doesn't have an effect
         m_xWidget->set_size_request(1, 1);
     }
diff --git a/svtools/source/brwbox/editbrowsebox.cxx 
b/svtools/source/brwbox/editbrowsebox.cxx
index 4c2559ea2742..71126b5a3f4b 100644
--- a/svtools/source/brwbox/editbrowsebox.cxx
+++ b/svtools/source/brwbox/editbrowsebox.cxx
@@ -192,7 +192,7 @@ namespace svt
         if (IsEditing() && Controller()->GetWindow().IsVisible())
             Controller()->GetWindow().GrabFocus();
 
-        DetermineFocus( getRealGetFocusFlags( this ) );
+        DetermineFocus(getRealGetFocusFlags(this));
     }
 
 
@@ -413,6 +413,10 @@ namespace svt
         }
     }
 
+    void EditBrowseBox::ChildFocusIn()
+    {
+        DetermineFocus(getRealGetFocusFlags(this));
+    }
 
     void EditBrowseBox::MouseButtonDown(const BrowserMouseEvent& rEvt)
     {
@@ -645,7 +649,7 @@ namespace svt
         switch (rEvt.GetType())
         {
             case MouseNotifyEvent::GETFOCUS:
-                DetermineFocus( getRealGetFocusFlags( this ) );
+                DetermineFocus(getRealGetFocusFlags(this));
                 break;
 
             case MouseNotifyEvent::LOSEFOCUS:
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to