dbaccess/source/ui/inc/JoinTableView.hxx         |   16 +++++++++-------
 dbaccess/source/ui/querydesign/JoinTableView.cxx |   21 +++++++++++++--------
 2 files changed, 22 insertions(+), 15 deletions(-)

New commits:
commit 59a2650101a0ce711151bfd39af1bbb69f71f318
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Fri Aug 5 15:51:46 2022 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Sat Aug 6 13:07:49 2022 +0200

    tdf#117388 use native scrollbar under gtk in database scrolled window
    
    Change-Id: I84486f8c8761b80fc45cdccc620485b67afdd048
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137879
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/dbaccess/source/ui/inc/JoinTableView.hxx 
b/dbaccess/source/ui/inc/JoinTableView.hxx
index 80de958ea627..4dedc70e3c6c 100644
--- a/dbaccess/source/ui/inc/JoinTableView.hxx
+++ b/dbaccess/source/ui/inc/JoinTableView.hxx
@@ -18,6 +18,7 @@
  */
 #pragma once
 
+#include <svtools/scrolladaptor.hxx>
 #include <vcl/window.hxx>
 #include <vcl/timer.hxx>
 #include <vcl/idle.hxx>
@@ -50,8 +51,8 @@ namespace dbaui
     class OJoinTableView;
     class OScrollWindowHelper : public vcl::Window
     {
-        VclPtr<ScrollBar>          m_aHScrollBar;
-        VclPtr<ScrollBar>          m_aVScrollBar;
+        VclPtr<ScrollAdaptor>      m_aHScrollBar;
+        VclPtr<ScrollAdaptor>      m_aVScrollBar;
         VclPtr<vcl::Window>        m_pCornerWindow;
         VclPtr<OJoinTableView>     m_pTableView;
 
@@ -68,8 +69,8 @@ namespace dbaui
         void resetRange(const Point& _aSize);
 
         // own methods
-        ScrollBar& GetHScrollBar() { return *m_aHScrollBar; }
-        ScrollBar& GetVScrollBar() { return *m_aVScrollBar; }
+        ScrollAdaptor& GetHScrollBar() { return *m_aHScrollBar; }
+        ScrollAdaptor& GetVScrollBar() { return *m_aVScrollBar; }
     };
 
 
@@ -121,9 +122,10 @@ namespace dbaui
         virtual css::uno::Reference< css::accessibility::XAccessible > 
CreateAccessible() override;
 
         // own methods
-        ScrollBar& GetHScrollBar() { return 
static_cast<OScrollWindowHelper*>(GetParent())->GetHScrollBar(); }
-        ScrollBar& GetVScrollBar() { return 
static_cast<OScrollWindowHelper*>(GetParent())->GetVScrollBar(); }
-        DECL_LINK( ScrollHdl, ScrollBar*, void );
+        ScrollAdaptor& GetHScrollBar() { return 
static_cast<OScrollWindowHelper*>(GetParent())->GetHScrollBar(); }
+        ScrollAdaptor& GetVScrollBar() { return 
static_cast<OScrollWindowHelper*>(GetParent())->GetVScrollBar(); }
+        DECL_LINK(VertScrollHdl, weld::Scrollbar&, void);
+        DECL_LINK(HorzScrollHdl, weld::Scrollbar&, void);
 
         void DrawConnections(vcl::RenderContext& rRenderContext, const 
tools::Rectangle& rRect);
         void InvalidateConnections();
diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx 
b/dbaccess/source/ui/querydesign/JoinTableView.cxx
index 05562813379d..5cd3ec1f41ed 100644
--- a/dbaccess/source/ui/querydesign/JoinTableView.cxx
+++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx
@@ -66,12 +66,11 @@ using namespace ::com::sun::star::lang;
 #define TABWIN_HEIGHT_STD   120
 
 OScrollWindowHelper::OScrollWindowHelper( vcl::Window* pParent) : Window( 
pParent)
-    ,m_aHScrollBar( VclPtr<ScrollBar>::Create(this, 
WB_HSCROLL|WB_REPEAT|WB_DRAG) )
-    ,m_aVScrollBar( VclPtr<ScrollBar>::Create(this, 
WB_VSCROLL|WB_REPEAT|WB_DRAG) )
+    ,m_aHScrollBar( VclPtr<ScrollAdaptor>::Create(this, true) )
+    ,m_aVScrollBar( VclPtr<ScrollAdaptor>::Create(this, false) )
     ,m_pCornerWindow(VclPtr<ScrollBarBox>::Create(this, WB_3DLOOK))
     ,m_pTableView(nullptr)
 {
-
     // ScrollBars
 
     GetHScrollBar().SetRange( Range(0, 1000) );
@@ -106,8 +105,8 @@ void OScrollWindowHelper::setTableView(OJoinTableView* 
_pTableView)
 {
     m_pTableView = _pTableView;
     // ScrollBars
-    GetHScrollBar().SetScrollHdl( LINK(m_pTableView, OJoinTableView, 
ScrollHdl) );
-    GetVScrollBar().SetScrollHdl( LINK(m_pTableView, OJoinTableView, 
ScrollHdl) );
+    GetHScrollBar().SetScrollHdl( LINK(m_pTableView, OJoinTableView, 
HorzScrollHdl) );
+    GetVScrollBar().SetScrollHdl( LINK(m_pTableView, OJoinTableView, 
VertScrollHdl) );
 }
 
 void OScrollWindowHelper::resetRange(const Point& _aSize)
@@ -201,10 +200,16 @@ void OJoinTableView::dispose()
     vcl::Window::dispose();
 }
 
-IMPL_LINK( OJoinTableView, ScrollHdl, ScrollBar*, pScrollBar, void )
+IMPL_LINK(OJoinTableView, HorzScrollHdl, weld::Scrollbar&, rScrollbar, void)
+{
+    // move all windows
+    ScrollPane(m_aScrollOffset.X() - rScrollbar.adjustment_get_value(), true, 
false);
+}
+
+IMPL_LINK(OJoinTableView, VertScrollHdl, weld::Scrollbar&, rScrollbar, void)
 {
     // move all windows
-    ScrollPane( pScrollBar->GetDelta(), (pScrollBar == &GetHScrollBar()), 
false );
+    ScrollPane(m_aScrollOffset.Y() - rScrollbar.adjustment_get_value(), false, 
false);
 }
 
 void OJoinTableView::Resize()
@@ -405,7 +410,7 @@ namespace
     bool isScrollAllowed( OJoinTableView* _pView,tools::Long nDelta, bool 
bHoriz)
     {
         // adjust ScrollBar-Positions
-        ScrollBar& rBar = bHoriz ? _pView->GetHScrollBar() : 
_pView->GetVScrollBar() ;
+        ScrollAdaptor& rBar = bHoriz ? _pView->GetHScrollBar() : 
_pView->GetVScrollBar();
 
         tools::Long nOldThumbPos = rBar.GetThumbPos();
         tools::Long nNewThumbPos = nOldThumbPos + nDelta;

Reply via email to