kbrown / rpms / libreoffice

Forked from rpms/libreoffice 2 years ago
Clone

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

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