summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-04-30 11:25:01 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-04-30 13:52:44 +0200
commitf2466b915cbf7bee03df16d0972f06155b7512de (patch)
tree6080106df1bc4d3a9f68918bce1dca2f9d26bcb2
parent37874c29b0d266b7a49978ce68a4909bc6e50fcd (diff)
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 <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sc/source/ui/miscdlgs/simpref.cxx4
-rw-r--r--sc/source/ui/view/tabview3.cxx24
2 files changed, 27 insertions, 1 deletions
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();