diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-08-04 16:32:10 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-08-05 09:52:50 +0200 |
commit | 7b20a1b0736825c9c934288428e6e581f79971e2 (patch) | |
tree | c9b534711745499fa31031f201cd8ee320b8cac4 /sc/source/ui/view/tabview.cxx | |
parent | 8c4e8818fe9f5ac1f6cdf908299cc109d67f1e50 (diff) |
tdf#117388 use native scrollbar under gtk in calc document
Change-Id: I436067b4f2b463fe9a5d6789cf96f906891757bd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137810
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc/source/ui/view/tabview.cxx')
-rw-r--r-- | sc/source/ui/view/tabview.cxx | 47 |
1 files changed, 29 insertions, 18 deletions
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index c737317764dc..45764e6cdd6d 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -176,10 +176,10 @@ ScTabView::ScTabView( vcl::Window* pParent, ScDocShell& rDocSh, ScTabViewShell* aViewData( rDocSh, pViewShell ), aFunctionSet( &aViewData ), aHdrFunc( &aViewData ), - aVScrollTop( VclPtr<ScrollBar>::Create( pFrameWin, WinBits( WB_VSCROLL | WB_DRAG ) ) ), - aVScrollBottom( VclPtr<ScrollBar>::Create( pFrameWin, WinBits( WB_VSCROLL | WB_DRAG ) ) ), - aHScrollLeft( VclPtr<ScrollBar>::Create( pFrameWin, WinBits( WB_HSCROLL | WB_DRAG ) ) ), - aHScrollRight( VclPtr<ScrollBar>::Create( pFrameWin, WinBits( WB_HSCROLL | WB_DRAG ) ) ), + aVScrollTop( VclPtr<ScrollAdaptor>::Create( pFrameWin, false ) ), + aVScrollBottom( VclPtr<ScrollAdaptor>::Create( pFrameWin, false ) ), + aHScrollLeft( VclPtr<ScrollAdaptor>::Create( pFrameWin, true ) ), + aHScrollRight( VclPtr<ScrollAdaptor>::Create( pFrameWin, true ) ), aCornerButton( VclPtr<ScCornerButton>::Create( pFrameWin, &aViewData ) ), aTopButton( VclPtr<ScCornerButton>::Create( pFrameWin, &aViewData ) ), aScrollBarBox( VclPtr<ScrollBarBox>::Create( pFrameWin, WB_SIZEABLE ) ), @@ -221,21 +221,19 @@ ScTabView::ScTabView( vcl::Window* pParent, ScDocShell& rDocSh, ScTabViewShell* Init(); } -void ScTabView::InitScrollBar( ScrollBar& rScrollBar, tools::Long nMaxVal ) +void ScTabView::InitScrollBar(ScrollAdaptor& rScrollBar, tools::Long nMaxVal, const Link<weld::Scrollbar&, void>& rLink) { rScrollBar.SetRange( Range( 0, nMaxVal ) ); rScrollBar.SetLineSize( 1 ); rScrollBar.SetPageSize( 1 ); // is queried separately rScrollBar.SetVisibleSize( 10 ); // is reset by Resize - rScrollBar.SetScrollHdl( LINK(this, ScTabView, ScrollHdl) ); - rScrollBar.SetEndScrollHdl( LINK(this, ScTabView, EndScrollHdl) ); + rScrollBar.SetScrollHdl(rLink); rScrollBar.EnableRTL( aViewData.GetDocument().IsLayoutRTL( aViewData.GetTabNo() ) ); } // Scroll-Timer - void ScTabView::SetTimer( ScGridWindow* pWin, const MouseEvent& rMEvt ) { pTimerWindow = pWin; @@ -989,24 +987,35 @@ bool ScTabView::ScrollCommand( const CommandEvent& rCEvt, ScSplitPos ePos ) { ScHSplitPos eHPos = WhichH(ePos); ScVSplitPos eVPos = WhichV(ePos); - ScrollBar* pHScroll = ( eHPos == SC_SPLIT_LEFT ) ? aHScrollLeft.get() : aHScrollRight.get(); - ScrollBar* pVScroll = ( eVPos == SC_SPLIT_TOP ) ? aVScrollTop.get() : aVScrollBottom.get(); + ScrollAdaptor* pHScroll = ( eHPos == SC_SPLIT_LEFT ) ? aHScrollLeft.get() : aHScrollRight.get(); + ScrollAdaptor* pVScroll = ( eVPos == SC_SPLIT_TOP ) ? aVScrollTop.get() : aVScrollBottom.get(); if ( pGridWin[ePos] ) bDone = pGridWin[ePos]->HandleScrollCommand( rCEvt, pHScroll, pVScroll ); } return bDone; } -IMPL_LINK_NOARG(ScTabView, EndScrollHdl, ScrollBar*, void) +IMPL_LINK_NOARG(ScTabView, HScrollLeftHdl, weld::Scrollbar&, void) { - if ( bDragging ) - { - UpdateScrollBars(); - bDragging = false; - } + ScrollHdl(aHScrollLeft.get()); } -IMPL_LINK( ScTabView, ScrollHdl, ScrollBar*, pScroll, void ) +IMPL_LINK_NOARG(ScTabView, HScrollRightHdl, weld::Scrollbar&, void) +{ + ScrollHdl(aHScrollRight.get()); +} + +IMPL_LINK_NOARG(ScTabView, VScrollTopHdl, weld::Scrollbar&, void) +{ + ScrollHdl(aVScrollTop.get()); +} + +IMPL_LINK_NOARG(ScTabView, VScrollBottomHdl, weld::Scrollbar&, void) +{ + ScrollHdl(aVScrollBottom.get()); +} + +void ScTabView::ScrollHdl(ScrollAdaptor* pScroll) { bool bHoriz = ( pScroll == aHScrollLeft.get() || pScroll == aHScrollRight.get() ); tools::Long nViewPos; @@ -1019,7 +1028,7 @@ IMPL_LINK( ScTabView, ScrollHdl, ScrollBar*, pScroll, void ) bool bLayoutRTL = aViewData.GetDocument().IsLayoutRTL( aViewData.GetTabNo() ); - ScrollType eType = pScroll->GetType(); + ScrollType eType = pScroll->GetScrollType(); if ( eType == ScrollType::Drag ) { if (!bDragging) @@ -1085,6 +1094,8 @@ IMPL_LINK( ScTabView, ScrollHdl, ScrollBar*, pScroll, void ) Help::ShowQuickHelp(pScroll->GetParent(), aRect, aHelpStr, nAlign); } } + else + bDragging = false; tools::Long nDelta(0); switch ( eType ) |