Blame SOURCES/0331-sw-lok-comments-implement-mouse-move-and-mouse-up.patch

135360
From 21874265eac2c8f10f560941079fe651e097b9d4 Mon Sep 17 00:00:00 2001
135360
From: Miklos Vajna <vmiklos@collabora.co.uk>
135360
Date: Sat, 14 Nov 2015 14:42:26 +0100
135360
Subject: [PATCH 331/398] sw lok comments: implement mouse move and mouse up
135360
135360
As long as we don't tweak the map mode of the comment widgets
135360
permanently we also have to disable the selection engine's timer, as
135360
that would emit events without the correct map mode: so disable that for
135360
the LOK case for now.
135360
135360
(cherry picked from commit b3dc0d7c72c2bb997bfceaeaf25dc9153ceca244)
135360
135360
Change-Id: If377ff2f064c30feb473f153f9d5b29b8ace7113
135360
---
135360
 sw/inc/SidebarWin.hxx                        |  2 ++
135360
 sw/source/uibase/docvw/SidebarTxtControl.hxx |  4 ++--
135360
 sw/source/uibase/docvw/SidebarWin.cxx        | 28 ++++++++++++++++++++++++++++
135360
 sw/source/uibase/docvw/edtwin.cxx            | 18 ++++++++++++++++++
135360
 vcl/source/window/seleng.cxx                 |  5 ++++-
135360
 5 files changed, 54 insertions(+), 3 deletions(-)
135360
135360
diff --git a/sw/inc/SidebarWin.hxx b/sw/inc/SidebarWin.hxx
135360
index 503f8f8a9771..e647c7aca820 100644
135360
--- a/sw/inc/SidebarWin.hxx
135360
+++ b/sw/inc/SidebarWin.hxx
135360
@@ -180,6 +180,8 @@ class SwSidebarWin : public vcl::Window
135360
         virtual void    Draw(OutputDevice* pDev, const Point&, const Size&, sal_uLong) override;
135360
         virtual void KeyInput(const KeyEvent& rKeyEvt) override;
135360
         virtual void MouseButtonDown(const MouseEvent& rMouseEvent) override;
135360
+        virtual void MouseButtonUp(const MouseEvent& rMouseEvent) override;
135360
+        virtual void MouseMove(const MouseEvent& rMouseEvent) override;
135360
         void PaintTile(vcl::RenderContext& rRenderContext, const Rectangle& rRect);
135360
         /// Is there a matching sub-widget inside this sidebar widget for rPointLogic?
135360
         bool IsHitWindow(const Point& rPointLogic);
135360
diff --git a/sw/source/uibase/docvw/SidebarTxtControl.hxx b/sw/source/uibase/docvw/SidebarTxtControl.hxx
135360
index f73b68c950ae..ab2f7406bce2 100644
135360
--- a/sw/source/uibase/docvw/SidebarTxtControl.hxx
135360
+++ b/sw/source/uibase/docvw/SidebarTxtControl.hxx
135360
@@ -42,8 +42,6 @@ class SidebarTextControl : public Control
135360
         virtual void    Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE;
135360
         /// @see OutputDevice::LogicInvalidate().
135360
         void LogicInvalidate(const Rectangle* pRectangle) override;
135360
-        virtual void    MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
135360
-        virtual void    MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE;
135360
         virtual void    Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
135360
         virtual void    LoseFocus() SAL_OVERRIDE;
135360
         virtual void    RequestHelp(const HelpEvent &rEvt) SAL_OVERRIDE;
135360
@@ -63,6 +61,8 @@ class SidebarTextControl : public Control
135360
         virtual void GetFocus() override;
135360
         virtual void KeyInput( const KeyEvent& rKeyEvt ) override;
135360
         virtual void MouseButtonDown(const MouseEvent& rMouseEvent) override;
135360
+        virtual void MouseButtonUp(const MouseEvent& rMEvt) override;
135360
+        virtual void MouseMove(const MouseEvent& rMEvt) override;
135360
 
135360
         OutlinerView* GetTextView() const;
135360
 
135360
diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx
135360
index cf803b618263..f9163a80f44b 100644
135360
--- a/sw/source/uibase/docvw/SidebarWin.cxx
135360
+++ b/sw/source/uibase/docvw/SidebarWin.cxx
135360
@@ -412,6 +412,20 @@ void SwSidebarWin::KeyInput(const KeyEvent& rKeyEvent)
135360
     }
135360
 }
135360
 
135360
+void SwSidebarWin::MouseMove(const MouseEvent& rMouseEvent)
135360
+{
135360
+    if (mpSidebarTextControl)
135360
+    {
135360
+        mpSidebarTextControl->Push(PushFlags::MAPMODE);
135360
+        MouseEvent aMouseEvent(rMouseEvent);
135360
+        lcl_translateTwips(*EditWin(), *mpSidebarTextControl, &aMouseEvent);
135360
+
135360
+        mpSidebarTextControl->MouseMove(aMouseEvent);
135360
+
135360
+        mpSidebarTextControl->Pop();
135360
+    }
135360
+}
135360
+
135360
 void SwSidebarWin::MouseButtonDown(const MouseEvent& rMouseEvent)
135360
 {
135360
     if (mpSidebarTextControl)
135360
@@ -426,6 +440,20 @@ void SwSidebarWin::MouseButtonDown(const MouseEvent& rMouseEvent)
135360
     }
135360
 }
135360
 
135360
+void SwSidebarWin::MouseButtonUp(const MouseEvent& rMouseEvent)
135360
+{
135360
+    if (mpSidebarTextControl)
135360
+    {
135360
+        mpSidebarTextControl->Push(PushFlags::MAPMODE);
135360
+        MouseEvent aMouseEvent(rMouseEvent);
135360
+        lcl_translateTwips(*EditWin(), *mpSidebarTextControl, &aMouseEvent);
135360
+
135360
+        mpSidebarTextControl->MouseButtonUp(aMouseEvent);
135360
+
135360
+        mpSidebarTextControl->Pop();
135360
+    }
135360
+}
135360
+
135360
 void SwSidebarWin::SetPosSizePixelRect(long nX, long nY, long nWidth, long nHeight,
135360
                                        const SwRect& aAnchorRect, const long aPageBorder)
135360
 {
135360
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
135360
index b9777914c5b4..cfb054a645fb 100644
135360
--- a/sw/source/uibase/docvw/edtwin.cxx
135360
+++ b/sw/source/uibase/docvw/edtwin.cxx
135360
@@ -3706,6 +3706,15 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt)
135360
 {
135360
     MouseEvent rMEvt(_rMEvt);
135360
 
135360
+    if (comphelper::LibreOfficeKit::isActive())
135360
+    {
135360
+        if (vcl::Window* pWindow = m_rView.GetPostItMgr()->IsHitSidebarWindow(rMEvt.GetPosPixel()))
135360
+        {
135360
+            pWindow->MouseMove(rMEvt);
135360
+            return;
135360
+        }
135360
+    }
135360
+
135360
     //ignore key modifiers for format paintbrush
135360
     {
135360
         bool bExecFormatPaintbrush = m_pApplyTempl && m_pApplyTempl->m_pFormatClipboard
135360
@@ -4211,6 +4220,15 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt)
135360
  */
135360
 void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt)
135360
 {
135360
+    if (comphelper::LibreOfficeKit::isActive())
135360
+    {
135360
+        if (vcl::Window* pWindow = m_rView.GetPostItMgr()->IsHitSidebarWindow(rMEvt.GetPosPixel()))
135360
+        {
135360
+            pWindow->MouseButtonUp(rMEvt);
135360
+            return;
135360
+        }
135360
+    }
135360
+
135360
     bool bCallBase = true;
135360
 
135360
     bool bCallShadowCrsr = m_bWasShdwCrsr;
135360
diff --git a/vcl/source/window/seleng.cxx b/vcl/source/window/seleng.cxx
135360
index 7999818b509c..69b220bedfcc 100644
135360
--- a/vcl/source/window/seleng.cxx
135360
+++ b/vcl/source/window/seleng.cxx
135360
@@ -20,6 +20,7 @@
135360
 #include <vcl/window.hxx>
135360
 #include <vcl/seleng.hxx>
135360
 #include <tools/debug.hxx>
135360
+#include <comphelper/lok.hxx>
135360
 
135360
 FunctionSet::~FunctionSet()
135360
 {
135360
@@ -301,7 +302,9 @@ bool SelectionEngine::SelMouseMove( const MouseEvent& rMEvt )
135360
         return true;
135360
 
135360
     aWTimer.SetTimeout( nUpdateInterval );
135360
-    aWTimer.Start();
135360
+    if (!comphelper::LibreOfficeKit::isActive())
135360
+        // Generating fake mouse moves does not work with LOK.
135360
+        aWTimer.Start();
135360
     if ( eSelMode != SINGLE_SELECTION )
135360
     {
135360
         if ( !(nFlags & SelectionEngineFlags::HAS_ANCH) )
135360
-- 
135360
2.12.0
135360