Related: tdf#136242 should only matter input ref mode is active
Change-Id: I50a64ae18e6f0d5b4544c9b7b0111ba149385177
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101704
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 2a5fec9..981b127 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -444,25 +444,26 @@ void ScTabView::SetCursor( SCCOL nPosX, SCROW nPosY, bool bNew )
SfxLokHelper::notifyDocumentSizeChanged(aViewData.GetViewShell(), sSize, pModel, false);
}
static bool lcl_IsRefDlgOpen(SfxViewFrame* pViewFrm)
static bool lcl_IsRefDlgActive(SfxViewFrame* pViewFrm)
{
ScModule* pScMod = SC_MOD();
if (!pScMod->IsRefDialogOpen())
return false;
auto nDlgId = pScMod->GetCurRefDlgId();
if (pViewFrm->HasChildWindow(nDlgId))
{
SfxChildWindow* pChild = pViewFrm->GetChildWindow(nDlgId);
if (pChild)
{
auto xDlgController = pChild->GetController();
if (xDlgController && xDlgController->getDialog()->get_visible())
return true;
}
}
if (!pViewFrm->HasChildWindow(nDlgId))
return false;
return false;
SfxChildWindow* pChild = pViewFrm->GetChildWindow(nDlgId);
if (!pChild)
return false;
auto xDlgController = pChild->GetController();
if (!xDlgController || !xDlgController->getDialog()->get_visible())
return false;
IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(xDlgController.get());
return pRefDlg && pRefDlg->IsRefInputMode();
}
void ScTabView::CheckSelectionTransfer()
@@ -486,7 +487,7 @@ void ScTabView::CheckSelectionTransfer()
// tdf#124975/tdf#136242 changing the calc selection can trigger removal of the
// selection of an open RefDlg dialog, so don't inform the
// desktop clipboard of the changed selection if that dialog is open
if (!lcl_IsRefDlgOpen(aViewData.GetViewShell()->GetViewFrame()))
if (!lcl_IsRefDlgActive(aViewData.GetViewShell()->GetViewFrame()))
pNew->CopyToSelection( GetActiveWin() ); // may delete pOld
// Log the selection change