From b8593ef96da5a6090a03812247a0a7c3651546a6 Mon Sep 17 00:00:00 2001 From: AhmedHamed Date: Thu, 8 Aug 2024 22:38:11 +0300 Subject: tdf#162069 Initial focus is in the document when creating a new sheet Change-Id: Iabd5401397bbdd5b45275da06235d879ce4ac984 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171709 Tested-by: Jenkins Tested-by: Heiko Tietze Reviewed-by: Heiko Tietze Reviewed-by: Andreas Heinisch --- sc/source/ui/view/tabcont.cxx | 2 ++ sc/source/ui/view/tabvwshf.cxx | 6 ++++++ 2 files changed, 8 insertions(+) (limited to 'sc') diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx index 2fffc87fc1b4..09507f258d69 100644 --- a/sc/source/ui/view/tabcont.cxx +++ b/sc/source/ui/view/tabcont.cxx @@ -240,6 +240,8 @@ void ScTabControl::AddTabClick() rDoc.CreateValidTabName(aName); SCTAB nTabCount = rDoc.GetTableCount(); pViewData->GetViewShell()->InsertTable(aName, nTabCount); + if (!pScMod->IsModalMode() && !pScMod->IsFormulaMode() && !IsInEditMode()) + pViewData->GetViewShell()->SetActive(); } void ScTabControl::Select() diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx index dd0a12930870..8c0d4049ffc4 100644 --- a/sc/source/ui/view/tabvwshf.cxx +++ b/sc/source/ui/view/tabvwshf.cxx @@ -880,7 +880,10 @@ void ScTabViewShell::ExecuteInsertTable(SfxRequest& rReq) } if (bOk) + { + rViewData.GetViewShell()->SetActive(); rReq.Done( *pReqArgs ); + } //! else set error } else // dialog @@ -996,6 +999,7 @@ void ScTabViewShell::DoInsertTableFromDialog(SfxRequest& rReq, const VclPtrSetActive(); } void ScTabViewShell::DoMoveTableFromDialog( SfxRequest& rReq, const VclPtr& pDlg ) @@ -1166,6 +1170,8 @@ bool ScTabViewShell::DoAppendOrRenameTableDialog(sal_Int32 nResult, const VclPtr if ( bDone ) { + if (nSlot == FID_TAB_APPEND) + rViewData.GetViewShell()->SetActive(); xReq->AppendItem( SfxStringItem( nSlot, aName ) ); xReq->Done(); } -- cgit