sc/source/ui/view/tabvwsha.cxx     |    3 ++-
 sd/sdi/_docsh.sdi                  |    4 ++++
 sd/source/ui/docshell/docshel3.cxx |   21 +++++++++++++++++++++
 3 files changed, 27 insertions(+), 1 deletion(-)

New commits:
commit 2c5d2b5dba851832b31d8ce439d061a3c9d024c6
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Thu Apr 3 04:11:37 2025 +0000
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Tue Apr 8 06:33:59 2025 +0200

    Impress: implement DontTerminateEdit support
    
    Name FN_PARAM1 in calc so it is clear what it does.
    It is used as DontTerminateEdit indicator used eg. in
    LOK case when we do saving in the background. In Impress
    when we edit textbox and close presentation - sometimes it
    is not saved because we didn't press Enter to commit the change
    inside. In LOK case we want to save the content to not allow
    data loss in unexpected connection close.
    
    Change-Id: Ibcdcd4a0d52eb36e0b1004971dcb73f58c35459e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183652
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx
index ad72c49d9779..34f7d41a7038 100644
--- a/sc/source/ui/view/tabvwsha.cxx
+++ b/sc/source/ui/view/tabvwsha.cxx
@@ -812,7 +812,8 @@ void ScTabViewShell::ExecuteSave( SfxRequest& rReq )
     const SfxItemSet* pReqArgs = rReq.GetArgs();
     const SfxPoolItem* pItem;
 
-    if (pReqArgs && pReqArgs->HasItem(FN_PARAM_1, &pItem))
+    bool bHasDontTerminateEdit = pReqArgs && pReqArgs->HasItem(FN_PARAM_1, 
&pItem);
+    if (bHasDontTerminateEdit)
         bCommitChanges = !static_cast<const SfxBoolItem*>(pItem)->GetValue();
 
     // Finish entering unless 'DontTerminateEdit' is specified, even if a 
formula is being processed
diff --git a/sd/sdi/_docsh.sdi b/sd/sdi/_docsh.sdi
index 02de70858ab0..2414c07449bc 100644
--- a/sd/sdi/_docsh.sdi
+++ b/sd/sdi/_docsh.sdi
@@ -21,6 +21,10 @@ interface DrawDocument
     [
         StateMethod = GetState ;
     ]
+    SID_SAVEDOC
+    [
+        ExecMethod = Execute ;
+    ]
     SID_CLOSEDOC // ole : ?, status : ?
     [
         ExecMethod = Execute ;
diff --git a/sd/source/ui/docshell/docshel3.cxx 
b/sd/source/ui/docshell/docshel3.cxx
index f310ddcfc676..92f17dcaf414 100644
--- a/sd/source/ui/docshell/docshel3.cxx
+++ b/sd/source/ui/docshell/docshel3.cxx
@@ -231,6 +231,27 @@ void DrawDocShell::Execute( SfxRequest& rReq )
         }
         break;
 
+        case SID_SAVEDOC:
+        case SID_SAVEASDOC:
+        {
+            const SfxPoolItem* pItem;
+            bool bCommitChanges = false;
+            const SfxItemSet* pReqArgs = rReq.GetArgs();
+            bool bHasDontTerminateEdit = pReqArgs && 
pReqArgs->HasItem(FN_PARAM_1, &pItem);
+            if (bHasDontTerminateEdit)
+                bCommitChanges = !static_cast<const 
SfxBoolItem*>(pItem)->GetValue();
+
+            if (mpViewShell && bCommitChanges)
+            {
+                SdrView* pView = mpViewShell->GetView();
+                if (pView)
+                    pView->SdrEndTextEdit();
+            }
+
+            ExecuteSlot( rReq, SfxObjectShell::GetStaticInterface() );
+        }
+        break;
+
         case SID_CLOSEDOC:
         {
             ExecuteSlot(rReq, SfxObjectShell::GetStaticInterface());

Reply via email to