summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2018-05-22 19:32:25 +0300
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2018-07-04 21:10:18 +0200
commit85ba2c3193d83c84e584ea8c008fdd4019cb8e2b (patch)
tree78d085fa3378e62265154ec308c06cd9195d8430
parent58284e26fa604edc02b7598cb77a5b272c288320 (diff)
tdf#109190 sd: only MakeVisible on mouseclick-up
Since MakeVisible() is called on both mousebuttom-down and mousebuttom-up, this also eliminates useless double-processing. In the problematic use case, the user pressed Ctrl-A to select a tall table. When clicking to de-select the cells, the contents moved around in unexpected ways because the rectangle is at the end of the selection during down-click, not at the cursor location. The re-arrangment of the screen invalidates the mouse-up, so the intended cursor position shifted. In the bug's calendar example, position the screen so that items 20-31 are hidden, select the whole month, and then click on 5. Before, it would move the screen down to show 31, and the cursor would be placed at the screen position where 5 had originally been. Solved by only repositioning on mouse-click up. However, mouseButtonDown must still be honoured while selecting, otherwise you can't select off-screen content with the mouse. This backport contains part of NFC commit b25f5909, missing initialization commit 93bfc16d7d520042f58fa26968a2a9adbbe2afbe and cancel MouseSelecting commit e1bab58778fd501f2d2aff7e5dc61eefdc229c9a Change-Id: I41c90a7b113dc59a3c8c385139a5bb41993646fa Reviewed-on: https://gerrit.libreoffice.org/56262 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org> Reviewed-on: https://gerrit.libreoffice.org/56799 Tested-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-rw-r--r--sd/source/ui/inc/DrawViewShell.hxx4
-rw-r--r--sd/source/ui/view/drviews4.cxx9
-rw-r--r--sd/source/ui/view/drviewsa.cxx2
-rw-r--r--sd/source/ui/view/drviewsh.cxx5
4 files changed, 19 insertions, 1 deletions
diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx
index 1db285351c1b..92d02af8b7f9 100644
--- a/sd/source/ui/inc/DrawViewShell.hxx
+++ b/sd/source/ui/inc/DrawViewShell.hxx
@@ -116,6 +116,8 @@ public:
virtual void MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin) override;
virtual void MouseButtonDown(const MouseEvent& rMEvt, ::sd::Window* pWin) override;
virtual void Command(const CommandEvent& rCEvt, ::sd::Window* pWin) override;
+ bool IsMouseButtonDown() { return mbMouseButtonDown; }
+ bool IsMouseSelecting() { return mbMouseSelecting; }
virtual void Resize() override;
@@ -445,6 +447,8 @@ private:
css::uno::Reference< css::lang::XEventListener > mxScannerListener;
rtl::Reference<TransferableClipboardListener> mxClipEvtLstnr;
bool mbPastePossible;
+ bool mbMouseButtonDown;
+ bool mbMouseSelecting;
virtual void Notify (SfxBroadcaster& rBC, const SfxHint& rHint) override;
diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx
index a8e2621a1834..5ac6d84df981 100644
--- a/sd/source/ui/view/drviews4.cxx
+++ b/sd/source/ui/view/drviews4.cxx
@@ -269,6 +269,9 @@ void DrawViewShell::FreshNavigatrTree()
void DrawViewShell::MouseButtonDown(const MouseEvent& rMEvt,
::sd::Window* pWin)
{
+ mbMouseButtonDown = true;
+ mbMouseSelecting = false;
+
// We have to check if a context menu is shown and we have an UI
// active inplace client. In that case we have to ignore the mouse
// button down event. Otherwise we would crash (context menu has been
@@ -300,6 +303,9 @@ void DrawViewShell::MouseButtonDown(const MouseEvent& rMEvt,
void DrawViewShell::MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin)
{
+ if ( IsMouseButtonDown() )
+ mbMouseSelecting = true;
+
if ( !IsInputLocked() )
{
if ( mpDrawView->IsAction() )
@@ -409,6 +415,8 @@ void DrawViewShell::MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin)
void DrawViewShell::MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin)
{
+ mbMouseButtonDown = false;
+
if ( !IsInputLocked() )
{
bool bIsSetPageOrg = mpDrawView->IsSetPageOrg();
@@ -446,6 +454,7 @@ void DrawViewShell::MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin)
//else the corresponding entry is set false .
FreshNavigatrTree();
}
+ mbMouseSelecting = false;
}
void DrawViewShell::Command(const CommandEvent& rCEvt, ::sd::Window* pWin)
diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx
index f894b074bd8f..7b8c1ce2b194 100644
--- a/sd/source/ui/view/drviewsa.cxx
+++ b/sd/source/ui/view/drviewsa.cxx
@@ -112,6 +112,8 @@ DrawViewShell::DrawViewShell( ViewShellBase& rViewShellBase, vcl::Window* pParen
[this] () { return this->GetSidebarContextName(); },
uno::Reference<frame::XController>(&rViewShellBase.GetDrawController()),
vcl::EnumContext::Context::Default))
+ , mbMouseButtonDown(false)
+ , mbMouseSelecting(false)
{
if (pFrameViewArgument != nullptr)
mpFrameView = pFrameViewArgument;
diff --git a/sd/source/ui/view/drviewsh.cxx b/sd/source/ui/view/drviewsh.cxx
index 40454bc331c6..85195b16b51b 100644
--- a/sd/source/ui/view/drviewsh.cxx
+++ b/sd/source/ui/view/drviewsh.cxx
@@ -58,6 +58,9 @@ void DrawViewShell::GotoBookmark(const OUString& rBookmark)
void DrawViewShell::MakeVisible(const ::tools::Rectangle& rRect, vcl::Window& rWin)
{
+ if ( (IsMouseButtonDown() && !IsMouseSelecting()) || SlideShow::IsRunning( GetViewShellBase() ) )
+ return;
+
// tdf#98646 check if Rectangle which contains the bounds of the region to
// be shown eventually contains values that cause overflows when processing
// e.g. when calling GetWidth()
@@ -90,7 +93,7 @@ void DrawViewShell::MakeVisible(const ::tools::Rectangle& rRect, vcl::Window& rW
rWin.Pop();
Size aVisAreaSize(aVisArea.GetSize());
- if (!aVisArea.IsInside(rRect) && !SlideShow::IsRunning( GetViewShellBase() ) )
+ if ( !aVisArea.IsInside(rRect) )
{
// object is not entirely in visible area
sal_Int32 nFreeSpaceX(aVisAreaSize.Width() - aLogicSize.Width());