summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-08-04 20:42:30 +0100
committerCaolán McNamara <caolanm@redhat.com>2022-08-05 13:06:41 +0200
commitf5156b9e452a81e2daa4ecc67b5533c6911f77ec (patch)
treee3aa7d45ba038b72ba1209e768a79874629d2694
parent9788bdc8c821becf54fda989d66fcba72f218ee5 (diff)
tdf#117388 use native scrollbar under gtk in impress/draw documents
Change-Id: I5dbcc14af083584fe4b73ecd4e4bf4187fb9af39 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137836 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--include/svtools/scrolladaptor.hxx2
-rw-r--r--sd/source/ui/inc/OutlineViewShell.hxx4
-rw-r--r--sd/source/ui/inc/SlideSorter.hxx17
-rw-r--r--sd/source/ui/inc/ViewShell.hxx13
-rw-r--r--sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx26
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx9
-rw-r--r--sd/source/ui/slidesorter/shell/SlideSorter.cxx12
-rw-r--r--sd/source/ui/slidesorter/view/SlideSorterView.cxx9
-rw-r--r--sd/source/ui/view/outlnvsh.cxx4
-rw-r--r--sd/source/ui/view/viewshe2.cxx12
-rw-r--r--sd/source/ui/view/viewshel.cxx4
11 files changed, 56 insertions, 56 deletions
diff --git a/include/svtools/scrolladaptor.hxx b/include/svtools/scrolladaptor.hxx
index 1214b2c854fa..f6a2cefc4d24 100644
--- a/include/svtools/scrolladaptor.hxx
+++ b/include/svtools/scrolladaptor.hxx
@@ -66,6 +66,8 @@ public:
virtual bool Inactive() const override { return !m_xScrollBar->get_sensitive(); }
+ bool HasGrab() const { return m_xScrollBar->has_grab(); }
+
ScrollAdaptor(vcl::Window* pParent, bool bHori);
virtual void dispose() override;
};
diff --git a/sd/source/ui/inc/OutlineViewShell.hxx b/sd/source/ui/inc/OutlineViewShell.hxx
index 6bc230189127..63a50a35abb0 100644
--- a/sd/source/ui/inc/OutlineViewShell.hxx
+++ b/sd/source/ui/inc/OutlineViewShell.hxx
@@ -73,8 +73,8 @@ public:
virtual bool PrepareClose( bool bUI = true ) override;
- virtual void VirtHScrollHdl(ScrollBar* pHScroll) override;
- virtual void VirtVScrollHdl(ScrollBar* pVHScroll) override;
+ virtual void VirtHScrollHdl(ScrollAdaptor* pHScroll) override;
+ virtual void VirtVScrollHdl(ScrollAdaptor* pVHScroll) override;
virtual void Activate( bool IsMDIActivate ) override;
virtual void Deactivate( bool IsMDIActivate ) override;
diff --git a/sd/source/ui/inc/SlideSorter.hxx b/sd/source/ui/inc/SlideSorter.hxx
index 9ed70cf9b8b3..4926e11583ec 100644
--- a/sd/source/ui/inc/SlideSorter.hxx
+++ b/sd/source/ui/inc/SlideSorter.hxx
@@ -20,6 +20,7 @@
#pragma once
#include <cppuhelper/weakref.hxx>
+#include <svtools/scrolladaptor.hxx>
#include <vcl/scrbar.hxx>
#include <sddllapi.h>
#include <memory>
@@ -93,8 +94,8 @@ public:
static std::shared_ptr<SlideSorter> CreateSlideSorter (
ViewShell& rViewShell,
sd::Window* pContentWindow,
- ScrollBar* pHorizontalScrollBar,
- ScrollBar* pVerticalScrollBar,
+ ScrollAdaptor* pHorizontalScrollBar,
+ ScrollAdaptor* pVerticalScrollBar,
ScrollBarBox* pScrollBarBox);
/** Create a new slide sorter that is loosely coupled to the given view
@@ -113,11 +114,11 @@ public:
/** Return the control of the vertical scroll bar.
*/
- const VclPtr<ScrollBar>& GetVerticalScrollBar() const { return mpVerticalScrollBar;}
+ const VclPtr<ScrollAdaptor>& GetVerticalScrollBar() const { return mpVerticalScrollBar;}
/** Return the control of the horizontal scroll bar.
*/
- const VclPtr<ScrollBar>& GetHorizontalScrollBar() const { return mpHorizontalScrollBar;}
+ const VclPtr<ScrollAdaptor>& GetHorizontalScrollBar() const { return mpHorizontalScrollBar;}
/** Return the scroll bar filler that paints the little square that is
enclosed by the two scroll bars.
@@ -204,8 +205,8 @@ private:
ViewShell* mpViewShell;
ViewShellBase* mpViewShellBase;
VclPtr<sd::Window> mpContentWindow;
- VclPtr<ScrollBar> mpHorizontalScrollBar;
- VclPtr<ScrollBar> mpVerticalScrollBar;
+ VclPtr<ScrollAdaptor> mpHorizontalScrollBar;
+ VclPtr<ScrollAdaptor> mpVerticalScrollBar;
VclPtr<ScrollBarBox> mpScrollBarBox;
/** Some slide sorter wide properties that are used in different
@@ -217,8 +218,8 @@ private:
SlideSorter (
ViewShell& rViewShell,
sd::Window* pContentWindow,
- ScrollBar* pHorizontalScrollBar,
- ScrollBar* pVerticalScrollBar,
+ ScrollAdaptor* pHorizontalScrollBar,
+ ScrollAdaptor* pVerticalScrollBar,
ScrollBarBox* pScrollBarBox);
SlideSorter (
ViewShellBase& rBase,
diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx
index b3fc31bbdd00..17161c049007 100644
--- a/sd/source/ui/inc/ViewShell.hxx
+++ b/sd/source/ui/inc/ViewShell.hxx
@@ -23,6 +23,7 @@
#include <sfx2/viewsh.hxx>
#include <svl/typedwhich.hxx>
+#include <svtools/scrolladaptor.hxx>
#include <vcl/prntypes.hxx>
#include <vcl/scrbar.hxx>
#include <o3tl/deleter.hxx>
@@ -434,9 +435,9 @@ protected:
VclPtr<sd::Window> mpContentWindow;
/// Horizontal scroll bar for the current slide is displayed when needed.
- VclPtr<ScrollBar> mpHorizontalScrollBar;
+ VclPtr<ScrollAdaptor> mpHorizontalScrollBar;
/// Vertical scroll bar for whole document is always visible.
- VclPtr<ScrollBar> mpVerticalScrollBar;
+ VclPtr<ScrollAdaptor> mpVerticalScrollBar;
/// Horizontal ruler is not shown by default.
VclPtr<SvxRuler> mpHorizontalRuler;
/// Vertical ruler is not shown by default.
@@ -491,12 +492,12 @@ protected:
void ImpSidUndo(SfxRequest& rReq);
void ImpSidRedo(SfxRequest& rReq);
- DECL_DLLPRIVATE_LINK( HScrollHdl, ScrollBar *, void );
- DECL_DLLPRIVATE_LINK( VScrollHdl, ScrollBar *, void );
+ DECL_DLLPRIVATE_LINK( HScrollHdl, weld::Scrollbar&, void );
+ DECL_DLLPRIVATE_LINK( VScrollHdl, weld::Scrollbar&, void );
// virtual scroll handler, here, derivative classes can add themselves here
- virtual void VirtHScrollHdl(ScrollBar* pHScroll);
- virtual void VirtVScrollHdl(ScrollBar* pVScroll);
+ virtual void VirtHScrollHdl(ScrollAdaptor* pHScroll);
+ virtual void VirtVScrollHdl(ScrollAdaptor* pVScroll);
// virtual functions ruler handling
virtual VclPtr<SvxRuler> CreateHRuler(::sd::Window* pWin);
diff --git a/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx b/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx
index 83192414f126..be3a85504af0 100644
--- a/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx
@@ -87,11 +87,11 @@ void ScrollBarManager::Disconnect()
{
if (mpVerticalScrollBar != nullptr)
{
- mpVerticalScrollBar->SetScrollHdl( Link<ScrollBar*,void>() );
+ mpVerticalScrollBar->SetScrollHdl( Link<weld::Scrollbar&,void>() );
}
if (mpHorizontalScrollBar != nullptr)
{
- mpHorizontalScrollBar->SetScrollHdl( Link<ScrollBar*,void>() );
+ mpHorizontalScrollBar->SetScrollHdl( Link<weld::Scrollbar&,void>() );
}
}
@@ -239,30 +239,24 @@ void ScrollBarManager::UpdateScrollBars(bool bUseScrolling)
}
}
-IMPL_LINK(ScrollBarManager, VerticalScrollBarHandler, ScrollBar*, pScrollBar, void)
+IMPL_LINK_NOARG(ScrollBarManager, VerticalScrollBarHandler, weld::Scrollbar&, void)
{
- if (pScrollBar!=nullptr
- && pScrollBar==mpVerticalScrollBar.get()
- && pScrollBar->IsVisible()
- && mrSlideSorter.GetContentWindow())
+ if (mpVerticalScrollBar->IsVisible() && mrSlideSorter.GetContentWindow())
{
- double nRelativePosition = double(pScrollBar->GetThumbPos())
- / double(pScrollBar->GetRange().Len());
+ double nRelativePosition = double(mpVerticalScrollBar->GetThumbPos())
+ / double(mpVerticalScrollBar->GetRange().Len());
mrSlideSorter.GetView().InvalidatePageObjectVisibilities();
mrSlideSorter.GetContentWindow()->SetVisibleXY(-1, nRelativePosition);
mrSlideSorter.GetController().GetVisibleAreaManager().DeactivateCurrentSlideTracking();
}
}
-IMPL_LINK(ScrollBarManager, HorizontalScrollBarHandler, ScrollBar*, pScrollBar, void)
+IMPL_LINK_NOARG(ScrollBarManager, HorizontalScrollBarHandler, weld::Scrollbar&, void)
{
- if (pScrollBar!=nullptr
- && pScrollBar==mpHorizontalScrollBar.get()
- && pScrollBar->IsVisible()
- && mrSlideSorter.GetContentWindow())
+ if (mpHorizontalScrollBar->IsVisible() && mrSlideSorter.GetContentWindow())
{
- double nRelativePosition = double(pScrollBar->GetThumbPos())
- / double(pScrollBar->GetRange().Len());
+ double nRelativePosition = double(mpHorizontalScrollBar->GetThumbPos())
+ / double(mpHorizontalScrollBar->GetRange().Len());
mrSlideSorter.GetView().InvalidatePageObjectVisibilities();
mrSlideSorter.GetContentWindow()->SetVisibleXY(nRelativePosition, -1);
mrSlideSorter.GetController().GetVisibleAreaManager().DeactivateCurrentSlideTracking();
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx b/sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx
index 853d98f4aeae..9d94986d91e0 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx
@@ -21,6 +21,7 @@
#include <tools/link.hxx>
#include <tools/gen.hxx>
+#include <svtools/scrolladaptor.hxx>
#include <vcl/timer.hxx>
#include <vcl/scrbar.hxx>
#include <vcl/vclptr.hxx>
@@ -163,12 +164,12 @@ private:
/** The horizontal scroll bar. Note that is used but not owned by
objects of this class. It is given to the constructor.
*/
- VclPtr<ScrollBar> mpHorizontalScrollBar;
+ VclPtr<ScrollAdaptor> mpHorizontalScrollBar;
/** The vertical scroll bar. Note that is used but not owned by
objects of this class. It is given to the constructor.
*/
- VclPtr<ScrollBar> mpVerticalScrollBar;
+ VclPtr<ScrollAdaptor> mpVerticalScrollBar;
/// Relative horizontal position of the visible area in the view.
double mnHorizontalPosition;
@@ -234,8 +235,8 @@ private:
void CalcAutoScrollOffset (const Point& rMouseWindowPosition);
bool RepeatAutoScroll();
- DECL_LINK(HorizontalScrollBarHandler, ScrollBar*, void);
- DECL_LINK(VerticalScrollBarHandler, ScrollBar*, void);
+ DECL_LINK(HorizontalScrollBarHandler, weld::Scrollbar&, void);
+ DECL_LINK(VerticalScrollBarHandler, weld::Scrollbar&, void);
DECL_LINK(AutoScrollTimeoutHandler, Timer *, void);
void PlaceHorizontalScrollBar (const ::tools::Rectangle& aArea);
diff --git a/sd/source/ui/slidesorter/shell/SlideSorter.cxx b/sd/source/ui/slidesorter/shell/SlideSorter.cxx
index 550a4046909e..570f88348252 100644
--- a/sd/source/ui/slidesorter/shell/SlideSorter.cxx
+++ b/sd/source/ui/slidesorter/shell/SlideSorter.cxx
@@ -70,8 +70,8 @@ private:
std::shared_ptr<SlideSorter> SlideSorter::CreateSlideSorter(
ViewShell& rViewShell,
sd::Window* pContentWindow,
- ScrollBar* pHorizontalScrollBar,
- ScrollBar* pVerticalScrollBar,
+ ScrollAdaptor* pHorizontalScrollBar,
+ ScrollAdaptor* pVerticalScrollBar,
ScrollBarBox* pScrollBarBox)
{
std::shared_ptr<SlideSorter> pSlideSorter(
@@ -102,8 +102,8 @@ std::shared_ptr<SlideSorter> SlideSorter::CreateSlideSorter (
SlideSorter::SlideSorter (
ViewShell& rViewShell,
sd::Window* pContentWindow,
- ScrollBar* pHorizontalScrollBar,
- ScrollBar* pVerticalScrollBar,
+ ScrollAdaptor* pHorizontalScrollBar,
+ ScrollAdaptor* pVerticalScrollBar,
ScrollBarBox* pScrollBarBox)
: mbIsValid(false),
mpViewShell(&rViewShell),
@@ -124,8 +124,8 @@ SlideSorter::SlideSorter (
mpViewShell(nullptr),
mpViewShellBase(&rBase),
mpContentWindow(VclPtr<ContentWindow>::Create(rParentWindow,*this )),
- mpHorizontalScrollBar(VclPtr<ScrollBar>::Create(&rParentWindow,WinBits(WB_HSCROLL | WB_DRAG))),
- mpVerticalScrollBar(VclPtr<ScrollBar>::Create(&rParentWindow,WinBits(WB_VSCROLL | WB_DRAG))),
+ mpHorizontalScrollBar(VclPtr<ScrollAdaptor>::Create(&rParentWindow, true)),
+ mpVerticalScrollBar(VclPtr<ScrollAdaptor>::Create(&rParentWindow, false)),
mpScrollBarBox(VclPtr<ScrollBarBox>::Create(&rParentWindow)),
mpProperties(std::make_shared<controller::Properties>()),
mpTheme(std::make_shared<view::Theme>(mpProperties))
diff --git a/sd/source/ui/slidesorter/view/SlideSorterView.cxx b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
index cf59e14d0120..b3a1a815f13f 100644
--- a/sd/source/ui/slidesorter/view/SlideSorterView.cxx
+++ b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
@@ -741,10 +741,11 @@ void SlideSorterView::DragFinished (sal_Int8 nDropAction)
void SlideSorterView::UpdatePageUnderMouse ()
{
- VclPtr<ScrollBar> pVScrollBar (mrSlideSorter.GetVerticalScrollBar());
- VclPtr<ScrollBar> pHScrollBar (mrSlideSorter.GetHorizontalScrollBar());
- if ((pVScrollBar && pVScrollBar->IsVisible() && pVScrollBar->IsTracking())
- || (pHScrollBar && pHScrollBar->IsVisible() && pHScrollBar->IsTracking()))
+ // Tracking TODO check
+ VclPtr<ScrollAdaptor> pVScrollBar (mrSlideSorter.GetVerticalScrollBar());
+ VclPtr<ScrollAdaptor> pHScrollBar (mrSlideSorter.GetHorizontalScrollBar());
+ if ((pVScrollBar && pVScrollBar->IsVisible() && pVScrollBar->HasGrab())
+ || (pHScrollBar && pHScrollBar->IsVisible() && pHScrollBar->HasGrab()))
{
// One of the scroll bars is tracking mouse movement. Do not
// highlight the slide under the mouse in this case.
diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx
index 0eb351f915b0..0e55c1f188a8 100644
--- a/sd/source/ui/view/outlnvsh.cxx
+++ b/sd/source/ui/view/outlnvsh.cxx
@@ -1050,7 +1050,7 @@ void OutlineViewShell::GetMenuState( SfxItemSet &rSet )
/**
* gets invoked when ScrollBar is used
*/
-void OutlineViewShell::VirtHScrollHdl(ScrollBar* pHScroll)
+void OutlineViewShell::VirtHScrollHdl(ScrollAdaptor* pHScroll)
{
::tools::Long nThumb = pHScroll->GetThumbPos();
::tools::Long nRange = pHScroll->GetRange().Len();
@@ -1071,7 +1071,7 @@ void OutlineViewShell::VirtHScrollHdl(ScrollBar* pHScroll)
pOutlinerView->ShowCursor(false);
}
-void OutlineViewShell::VirtVScrollHdl(ScrollBar* pVScroll)
+void OutlineViewShell::VirtVScrollHdl(ScrollAdaptor* pVScroll)
{
::tools::Long nThumb = pVScroll->GetThumbPos();
::tools::Long nRange = pVScroll->GetRange().Len();
diff --git a/sd/source/ui/view/viewshe2.cxx b/sd/source/ui/view/viewshe2.cxx
index a0f2982be152..26373b8eaba6 100644
--- a/sd/source/ui/view/viewshe2.cxx
+++ b/sd/source/ui/view/viewshe2.cxx
@@ -123,15 +123,15 @@ void ViewShell::UpdateScrollBars()
/**
* Handling for horizontal Scrollbars
*/
-IMPL_LINK(ViewShell, HScrollHdl, ScrollBar *, pHScroll, void )
+IMPL_LINK_NOARG(ViewShell, HScrollHdl, weld::Scrollbar&, void)
{
- VirtHScrollHdl(pHScroll);
+ VirtHScrollHdl(mpHorizontalScrollBar);
}
/**
* virtual scroll handler for horizontal Scrollbars
*/
-void ViewShell::VirtHScrollHdl(ScrollBar* pHScroll)
+void ViewShell::VirtHScrollHdl(ScrollAdaptor* pHScroll)
{
double fX = static_cast<double>(pHScroll->GetThumbPos()) / pHScroll->GetRange().Len();
@@ -171,15 +171,15 @@ void ViewShell::VirtHScrollHdl(ScrollBar* pHScroll)
/**
* handling for vertical Scrollbars
*/
-IMPL_LINK(ViewShell, VScrollHdl, ScrollBar *, pVScroll, void )
+IMPL_LINK_NOARG(ViewShell, VScrollHdl, weld::Scrollbar&, void)
{
- VirtVScrollHdl(pVScroll);
+ VirtVScrollHdl(mpVerticalScrollBar);
}
/**
* handling for vertical Scrollbars
*/
-void ViewShell::VirtVScrollHdl(ScrollBar* pVScroll)
+void ViewShell::VirtVScrollHdl(ScrollAdaptor* pVScroll)
{
if(IsPageFlipMode())
{
diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx
index 3f8078914016..9f28b2b47948 100644
--- a/sd/source/ui/view/viewshel.cxx
+++ b/sd/source/ui/view/viewshel.cxx
@@ -207,12 +207,12 @@ void ViewShell::construct()
if ( ! GetDocSh()->IsPreview())
{
// Create scroll bars and the filler between the scroll bars.
- mpHorizontalScrollBar.reset (VclPtr<ScrollBar>::Create(GetParentWindow(), WinBits(WB_HSCROLL | WB_DRAG)));
+ mpHorizontalScrollBar.reset (VclPtr<ScrollAdaptor>::Create(GetParentWindow(), true));
mpHorizontalScrollBar->EnableRTL (false);
mpHorizontalScrollBar->SetRange(Range(0, 32000));
mpHorizontalScrollBar->SetScrollHdl(LINK(this, ViewShell, HScrollHdl));
- mpVerticalScrollBar.reset (VclPtr<ScrollBar>::Create(GetParentWindow(), WinBits(WB_VSCROLL | WB_DRAG)));
+ mpVerticalScrollBar.reset (VclPtr<ScrollAdaptor>::Create(GetParentWindow(), false));
mpVerticalScrollBar->SetRange(Range(0, 32000));
mpVerticalScrollBar->SetScrollHdl(LINK(this, ViewShell, VScrollHdl));