[Libreoffice-commits] core.git: sd/source

Justin Luth justin.luth at collabora.com
Mon Jul 2 07:53:45 UTC 2018


 sd/source/ui/inc/DrawViewShell.hxx |    4 ++++
 sd/source/ui/view/drviews4.cxx     |    7 +++++++
 sd/source/ui/view/drviewsh.cxx     |    2 +-
 3 files changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 6fffd09833a5bd602b0117f48656afd07fd40f41
Author: Justin Luth <justin.luth at collabora.com>
Date:   Tue May 22 19:32:25 2018 +0300

    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.
    
    Change-Id: I41c90a7b113dc59a3c8c385139a5bb41993646fa
    Reviewed-on: https://gerrit.libreoffice.org/56262
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <justin_luth at sil.org>

diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx
index 37afa1bcb039..b8f1dab8f038 100644
--- a/sd/source/ui/inc/DrawViewShell.hxx
+++ b/sd/source/ui/inc/DrawViewShell.hxx
@@ -114,6 +114,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;
 
@@ -443,6 +445,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 9356034fa8b1..41f387897f56 100644
--- a/sd/source/ui/view/drviews4.cxx
+++ b/sd/source/ui/view/drviews4.cxx
@@ -269,6 +269,7 @@ void DrawViewShell::FreshNavigatrTree()
 void DrawViewShell::MouseButtonDown(const MouseEvent& rMEvt,
     ::sd::Window* pWin)
 {
+    mbMouseButtonDown = true;
     // 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 +301,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 +413,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 +452,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/drviewsh.cxx b/sd/source/ui/view/drviewsh.cxx
index 54915188b498..bbdcc47c66da 100644
--- a/sd/source/ui/view/drviewsh.cxx
+++ b/sd/source/ui/view/drviewsh.cxx
@@ -58,7 +58,7 @@ void DrawViewShell::GotoBookmark(const OUString& rBookmark)
 
 void DrawViewShell::MakeVisible(const ::tools::Rectangle& rRect, vcl::Window& rWin)
 {
-    if ( SlideShow::IsRunning( GetViewShellBase() ) )
+    if ( (IsMouseButtonDown() && !IsMouseSelecting()) || SlideShow::IsRunning( GetViewShellBase() ) )
         return;
 
     // tdf#98646 check if Rectangle which contains the bounds of the region to


More information about the Libreoffice-commits mailing list