summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/source/ui/dbgui/validate.cxx12
-rw-r--r--sc/source/ui/view/cellsh2.cxx2
2 files changed, 11 insertions, 3 deletions
diff --git a/sc/source/ui/dbgui/validate.cxx b/sc/source/ui/dbgui/validate.cxx
index e858bdf35337..665ed3865ade 100644
--- a/sc/source/ui/dbgui/validate.cxx
+++ b/sc/source/ui/dbgui/validate.cxx
@@ -153,11 +153,21 @@ void ScTPValidationValue::RefInputDonePostHdl()
m_pBtnRef->SetParent( m_pRefGrid );
if ( ScValidationDlg *pValidationDlg = GetValidationDlg() )
+ {
pValidationDlg->get_refinput_shrink_parent()->Hide();
+ ScViewData* pViewData = pValidationDlg->GetTabViewShell()->GetViewData();
+ SCTAB nCurTab = pViewData->GetTabNo();
+ SCTAB nRefTab = pViewData->GetRefTabNo();
+ // If RefInput switched to a different sheet from the data sheet,
+ // switch back: fdo#53920
+ if ( nCurTab != nRefTab )
+ {
+ pViewData->GetViewShell()->SetTabNo( nRefTab );
+ }
+ }
if( m_pRefEdit && !m_pRefEdit->HasFocus() )
m_pRefEdit->GrabFocus();
-
}
bool ScValidationDlg::Close()
diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index 52ad408ae387..9a0fc85345a9 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -847,8 +847,6 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
assert(pDlg); //Dialog create fail!
short nResult = pDlg->Execute();
- //When picking Cell Range, other Tab may be switched. Need restore the correct tab
- pTabViewShell->SetTabNo( nTab );
if ( nResult == RET_OK )
{
const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();