sc/source/ui/view/tabcont.cxx  |    2 ++
 sc/source/ui/view/tabvwshf.cxx |    6 ++++++
 2 files changed, 8 insertions(+)

New commits:
commit b8593ef96da5a6090a03812247a0a7c3651546a6
Author:     AhmedHamed <ahmedhamed3...@gmail.com>
AuthorDate: Thu Aug 8 22:38:11 2024 +0300
Commit:     Andreas Heinisch <andreas.heini...@yahoo.de>
CommitDate: Wed Aug 14 11:20:27 2024 +0200

    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 <heiko.tie...@documentfoundation.org>
    Reviewed-by: Heiko Tietze <heiko.tie...@documentfoundation.org>
    Reviewed-by: Andreas Heinisch <andreas.heini...@yahoo.de>

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 VclPtr<Abst
             }
         }
     }
+    rViewData.GetViewShell()->SetActive();
 }
 
 void ScTabViewShell::DoMoveTableFromDialog( SfxRequest& rReq, const 
VclPtr<AbstractScMoveTableDlg>& 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();
     }

Reply via email to