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

New commits:
commit 2bbf0369acd228f1dcf376c2afee5168db068979
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Mon Sep 11 12:54:34 2023 +0200
Commit:     Ashod Nakashian <a...@collabora.com>
CommitDate: Mon Sep 11 14:49:04 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>

diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 35716406cd80..b5bde70a3ca6 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -1016,6 +1016,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