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