[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - include/svtools svtools/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Sun Jan 17 20:40:18 UTC 2021


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

New commits:
commit 51c7c4ddb884703907759918f0541f9ad1f1fd98
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Jan 15 14:00:50 2021 +0000
Commit:     Adolfo Jayme Barrientos <fitojb at ubuntu.com>
CommitDate: Sun Jan 17 21:39:40 2021 +0100

    tdf#135641 update DataBrowser has-focus when child widget gains focus
    
    Change-Id: Ic5e618b50c31ebeffa1b2cc59857582804874747
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109372
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>

diff --git a/include/svtools/brwbox.hxx b/include/svtools/brwbox.hxx
index 0b0d3af6fb2e..47deb3af6755 100644
--- a/include/svtools/brwbox.hxx
+++ b/include/svtools/brwbox.hxx
@@ -507,6 +507,7 @@ public:
     bool            ReserveControlArea(sal_uInt16 nWidth = USHRT_MAX);
     tools::Rectangle       GetControlArea() const;
     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 a1a38353637e..1b9fd13aa93f 100644
--- a/include/svtools/editbrowsebox.hxx
+++ b/include/svtools/editbrowsebox.hxx
@@ -326,6 +326,7 @@ namespace svt
         virtual bool ControlHasFocus() const = 0;
     protected:
         DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
+        DECL_LINK(FocusInHdl, weld::Widget&, void);
     };
 
     //= ComboBoxControl
@@ -691,6 +692,7 @@ namespace svt
         virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint) override;
 
         css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleCheckBoxCell(long _nRow, sal_uInt16 _nColumnPos,const TriState& eState);
+        virtual void ChildFocusIn() override;
         bool ControlHasFocus() const;
     protected:
         // creates the accessible which wraps the active cell
diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx
index e9e725149020..8cd05f2daa7c 100644
--- a/svtools/source/brwbox/brwbox2.cxx
+++ b/svtools/source/brwbox/brwbox2.cxx
@@ -1698,6 +1698,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 c38025d0a13e..e5e404bb291f 100644
--- a/svtools/source/brwbox/ebbcontrols.cxx
+++ b/svtools/source/brwbox/ebbcontrols.cxx
@@ -35,6 +35,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()
@@ -116,6 +117,11 @@ namespace svt
         return static_cast<BrowserDataWin*>(GetParent())->GetParent()->ProcessKey(rKEvt);
     }
 
+    IMPL_LINK_NOARG(ControlBase, FocusInHdl, weld::Widget&, void)
+    {
+        return static_cast<BrowserDataWin*>(GetParent())->GetParent()->ChildFocusIn();
+    }
+
     //= ListBoxControl
     ListBoxControl::ListBoxControl(vcl::Window* pParent)
         : ControlBase(pParent, "svt/ui/listcontrol.ui", "ListControl")
@@ -124,6 +130,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()
diff --git a/svtools/source/brwbox/editbrowsebox.cxx b/svtools/source/brwbox/editbrowsebox.cxx
index 12ef6d6fd181..83b44d07daf1 100644
--- a/svtools/source/brwbox/editbrowsebox.cxx
+++ b/svtools/source/brwbox/editbrowsebox.cxx
@@ -194,7 +194,7 @@ namespace svt
         if (IsEditing() && Controller()->GetWindow().IsVisible())
             Controller()->GetWindow().GrabFocus();
 
-        DetermineFocus( getRealGetFocusFlags( this ) );
+        DetermineFocus(getRealGetFocusFlags(this));
     }
 
 
@@ -415,6 +415,10 @@ namespace svt
         }
     }
 
+    void EditBrowseBox::ChildFocusIn()
+    {
+        DetermineFocus(getRealGetFocusFlags(this));
+    }
 
     void EditBrowseBox::MouseButtonDown(const BrowserMouseEvent& rEvt)
     {
@@ -677,7 +681,7 @@ namespace svt
         switch (rEvt.GetType())
         {
             case MouseNotifyEvent::GETFOCUS:
-                DetermineFocus( getRealGetFocusFlags( this ) );
+                DetermineFocus(getRealGetFocusFlags(this));
                 break;
 
             case MouseNotifyEvent::LOSEFOCUS:


More information about the Libreoffice-commits mailing list