sfx2/source/doc/objserv.cxx |   11 +++++++++++
 1 file changed, 11 insertions(+)

New commits:
commit 4c76b9568a3d008219a3dc0818f2f6db2939e354
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Mon Sep 11 12:54:34 2023 +0200
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Mon Sep 18 16:28:18 2023 +0200

    lok: don't convert save request to save as
    
    Don't force save as in LOK but report that file cannot be written.
    Without that we go through save as process which is used for export
    functionality and client's browser downloads the file in the end
    instead of uploading to the storage.
    
    Signed-off-by: Szymon Kłos <szymon.k...@collabora.com>
    Change-Id: I2784bfc25055934363c304b5f5a87ae4da620a4f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156819
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Ashod Nakashian <a...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157021
    Tested-by: Jenkins

diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index a9c39b006564..6308de92e3c6 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -1039,6 +1039,17 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
                                      aDispatchArgs );
 
                 bool bForceSaveAs = nId == SID_SAVEDOC && IsReadOnlyMedium();
+
+                if (comphelper::LibreOfficeKit::isActive() && bForceSaveAs)
+                {
+                    // Don't force save as in LOK but report that file cannot 
be written
+                    // to avoid confusion with exporting for file download 
purpose
+
+                    throw task::ErrorCodeIOException(
+                        "SfxObjectShell::ExecFile_Impl: ERRCODE_IO_CANTWRITE",
+                        uno::Reference< uno::XInterface >(), 
sal_uInt32(ERRCODE_IO_CANTWRITE));
+                }
+
                 const SfxSlot* pSlot = GetModule()->GetSlotPool()->GetSlot( 
bForceSaveAs ? SID_SAVEASDOC : nId );
                 if ( !pSlot )
                     throw uno::Exception("no slot", nullptr);

Reply via email to