sc/source/core/data/document.cxx |    5 +++++
 1 file changed, 5 insertions(+)

New commits:
commit 59b3cf0cc098cefb5aa509f28e0b640f9d6679f4
Author:     Gülşah Köse <gulsah.k...@collabora.com>
AuthorDate: Thu Dec 14 12:07:48 2023 +0300
Commit:     Gülşah Köse <gulsah.k...@collabora.com>
CommitDate: Thu Jan 4 12:03:10 2024 +0100

    ONLINE: Exit cell edit mode before add a new sheet
    
    Prevents to move last edited cell to new sheet.
    
    Signed-off-by: Gülşah Köse <gulsah.k...@collabora.com>
    Change-Id: If4a4533d81ce244ae50bbdde1fae89da14f6b53a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160758
    Tested-by: Jenkins
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161583
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index e07dcf146640..aee46bad2ecc 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -507,6 +507,11 @@ void ScDocument::InvalidateStreamOnSave()
 bool ScDocument::InsertTab(
     SCTAB nPos, const OUString& rName, bool bExternalDocument, bool 
bUndoDeleteTab )
 {
+    // auto-accept any in-process input to prevent move the cell into next 
sheet in online.
+    if (comphelper::LibreOfficeKit::isActive())
+        if (!SC_MOD()->IsFormulaMode())
+            SC_MOD()->InputEnterHandler();
+
     SCTAB   nTabCount = static_cast<SCTAB>(maTabs.size());
     bool    bValid = ValidTab(nTabCount);
     if ( !bExternalDocument )   // else test rName == "'Doc'!Tab" first

Reply via email to