Blame SOURCES/0360-sw-lok-comments-implement-drag-of-the-scrollbar.patch

f325b2
From c440339bcd6661fe49ba148317b557d0b2e249b6 Mon Sep 17 00:00:00 2001
f325b2
From: Miklos Vajna <vmiklos@collabora.co.uk>
f325b2
Date: Tue, 24 Nov 2015 15:04:33 +0100
f325b2
Subject: [PATCH 360/398] sw lok comments: implement drag of the scrollbar
f325b2
f325b2
With this, if a comment has a vertical scrollbar, then not only the
f325b2
buttons of the scrollbar can be clicked on, but also the slider of the
f325b2
scrollbar can be dragged.
f325b2
f325b2
(cherry picked from commit d562df03098ecb91a89e91ccf69dd6a1eeb98c89)
f325b2
f325b2
Change-Id: I2e39e18bf60c42a878bb8bfd808f1d47be27eecb
f325b2
---
f325b2
 sw/source/uibase/docvw/SidebarScrollBar.cxx |  7 ++++++-
f325b2
 sw/source/uibase/docvw/SidebarScrollBar.hxx |  1 +
f325b2
 sw/source/uibase/docvw/SidebarWin.cxx       | 10 +++++-----
f325b2
 3 files changed, 12 insertions(+), 6 deletions(-)
f325b2
f325b2
diff --git a/sw/source/uibase/docvw/SidebarScrollBar.cxx b/sw/source/uibase/docvw/SidebarScrollBar.cxx
f325b2
index 909aa763dba1..7a80363693d1 100644
f325b2
--- a/sw/source/uibase/docvw/SidebarScrollBar.cxx
f325b2
+++ b/sw/source/uibase/docvw/SidebarScrollBar.cxx
f325b2
@@ -47,7 +47,7 @@ void SidebarScrollBar::LogicInvalidate(const Rectangle* pRectangle)
f325b2
         aRectangle = *pRectangle;
f325b2
 
f325b2
     // Convert from relative twips to absolute ones.
f325b2
-    vcl::Window& rParent = m_rSidebarWin.EditWin();
f325b2
+    vcl::Window& rParent = *m_rSidebarWin.EditWin();
f325b2
     Point aOffset(GetOutOffXPixel() - rParent.GetOutOffXPixel(), GetOutOffYPixel() - rParent.GetOutOffYPixel());
f325b2
     rParent.Push(PushFlags::MAPMODE);
f325b2
     rParent.EnableMapMode();
f325b2
@@ -60,6 +60,11 @@ void SidebarScrollBar::LogicInvalidate(const Rectangle* pRectangle)
f325b2
     rWrtShell.libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr());
f325b2
 }
f325b2
 
f325b2
+void SidebarScrollBar::MouseMove(const MouseEvent& rMouseEvent)
f325b2
+{
f325b2
+    TrackingEvent aEvent(rMouseEvent);
f325b2
+    Tracking(aEvent);
f325b2
+}
f325b2
 
f325b2
 SidebarScrollBar::~SidebarScrollBar()
f325b2
 {
f325b2
diff --git a/sw/source/uibase/docvw/SidebarScrollBar.hxx b/sw/source/uibase/docvw/SidebarScrollBar.hxx
f325b2
index 9543205387df..ea5639e42e92 100644
f325b2
--- a/sw/source/uibase/docvw/SidebarScrollBar.hxx
f325b2
+++ b/sw/source/uibase/docvw/SidebarScrollBar.hxx
f325b2
@@ -30,6 +30,7 @@ class SidebarScrollBar : public ScrollBar
f325b2
 protected:
f325b2
     /// @see OutputDevice::LogicInvalidate().
f325b2
     void LogicInvalidate(const Rectangle* pRectangle) override;
f325b2
+    void MouseMove(const MouseEvent& rMouseEvent) override;
f325b2
 public:
f325b2
     SidebarScrollBar(SwSidebarWin& rSidebarWin, WinBits nStyle, SwView& rView);
f325b2
     virtual ~SidebarScrollBar();
f325b2
diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx
f325b2
index 1bfab323e833..d22bdd0c245b 100644
f325b2
--- a/sw/source/uibase/docvw/SidebarWin.cxx
f325b2
+++ b/sw/source/uibase/docvw/SidebarWin.cxx
f325b2
@@ -464,15 +464,15 @@ void SwSidebarWin::KeyInput(const KeyEvent& rKeyEvent)
f325b2
 
f325b2
 void SwSidebarWin::MouseMove(const MouseEvent& rMouseEvent)
f325b2
 {
f325b2
-    if (mpSidebarTextControl)
f325b2
+    if (vcl::Window* pHit = lcl_getHitWindow(*this, rMouseEvent))
f325b2
     {
f325b2
-        mpSidebarTextControl->Push(PushFlags::MAPMODE);
f325b2
+        pHit->Push(PushFlags::MAPMODE);
f325b2
         MouseEvent aMouseEvent(rMouseEvent);
f325b2
-        lcl_translateTwips(*EditWin(), *mpSidebarTextControl, &aMouseEvent);
f325b2
+        lcl_translateTwips(*EditWin(), *pHit, &aMouseEvent);
f325b2
 
f325b2
-        mpSidebarTextControl->MouseMove(aMouseEvent);
f325b2
+        pHit->MouseMove(aMouseEvent);
f325b2
 
f325b2
-        mpSidebarTextControl->Pop();
f325b2
+        pHit->Pop();
f325b2
     }
f325b2
 }
f325b2
 
f325b2
-- 
f325b2
2.12.0
f325b2