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

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