sc/source/ui/miscdlgs/simpref.cxx |    4 ++++
 sc/source/ui/view/tabview3.cxx    |   24 +++++++++++++++++++++++-
 2 files changed, 27 insertions(+), 1 deletion(-)

New commits:
commit f2466b915cbf7bee03df16d0972f06155b7512de
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Tue Apr 30 11:25:01 2019 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Tue Apr 30 13:52:44 2019 +0200

    tdf#124975 changing the clipboard selection clears the widget selection
    
    gtk listens to the selection so realizes that the GtkEntry selection
    is not the desktop selection anymore and drops the visual selection.
    
    But we're relying on the visual selection to know what part of
    a multiselection we are modifying
    
    Change-Id: I42d5718ba029b4f94c436cb755485d05511b5708
    Reviewed-on: https://gerrit.libreoffice.org/71576
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sc/source/ui/miscdlgs/simpref.cxx 
b/sc/source/ui/miscdlgs/simpref.cxx
index 0f39e4cc6073..c1d230314133 100644
--- a/sc/source/ui/miscdlgs/simpref.cxx
+++ b/sc/source/ui/miscdlgs/simpref.cxx
@@ -165,6 +165,8 @@ void ScSimpleRefDlg::RefInputDone( bool bForced)
 
 IMPL_LINK_NOARG(ScSimpleRefDlg, OkBtnHdl, weld::Button&, void)
 {
+    if (IsClosing())
+        return;
     bAutoReOpen = false;
     OUString aResult=m_xEdAssign->GetText();
     aCloseHdl.Call(&aResult);
@@ -175,6 +177,8 @@ IMPL_LINK_NOARG(ScSimpleRefDlg, OkBtnHdl, weld::Button&, 
void)
 
 IMPL_LINK_NOARG(ScSimpleRefDlg, CancelBtnHdl, weld::Button&, void)
 {
+    if (IsClosing())
+        return;
     bAutoReOpen = false;
     OUString aResult=m_xEdAssign->GetText();
     aCloseHdl.Call(nullptr);
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 0eebfb583d2f..bfdc208bf128 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -64,6 +64,7 @@
 #include <AccessibilityHints.hxx>
 #include <rangeutl.hxx>
 #include <client.hxx>
+#include <simpref.hxx>
 #include <tabprotection.hxx>
 #include <markdata.hxx>
 #include <formula/FormulaCompiler.hxx>
@@ -436,6 +437,22 @@ void ScTabView::SetCursor( SCCOL nPosX, SCROW nPosY, bool 
bNew )
     }
 }
 
+static bool lcl_IsScSimpleRefDlgOpen(SfxViewFrame* pViewFrm)
+{
+    if (pViewFrm->HasChildWindow(WID_SIMPLE_REF))
+    {
+        SfxChildWindow* pChild = pViewFrm->GetChildWindow(WID_SIMPLE_REF);
+        if (pChild)
+        {
+            auto xDlgController = pChild->GetController();
+            if (xDlgController && xDlgController->getDialog()->get_visible())
+                return true;
+        }
+    }
+
+    return false;
+}
+
 void ScTabView::CheckSelectionTransfer()
 {
     if ( aViewData.IsActive() )     // only for active view
@@ -451,7 +468,12 @@ void ScTabView::CheckSelectionTransfer()
                 pOld->ForgetView();
 
             pScMod->SetSelectionTransfer( pNew.get() );
-            pNew->CopyToSelection( GetActiveWin() );                    // may 
delete pOld
+
+            // tdf#124975 changing the calc selection can trigger removal of 
the
+            // selection of an open ScSimpleRefDlg dialog, so don't inform the
+            // desktop clipboard of the changed selection if that dialog is 
open
+            if 
(!lcl_IsScSimpleRefDlgOpen(aViewData.GetViewShell()->GetViewFrame()))
+                pNew->CopyToSelection( GetActiveWin() );                    // 
may delete pOld
 
             // Log the selection change
             ScMarkData& rMark = aViewData.GetMarkData();
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to