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