sfx2/source/doc/guisaveas.cxx |   17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

New commits:
commit d3d76fe4138f0a27306480e4e71394cda6078ee5
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Mon Dec 12 15:27:26 2022 +0100
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Tue Dec 20 03:11:33 2022 +0000

    lok: export PDF/EPUB with extension
    
    Change-Id: Ib266814d88a4f121959cb21f40293d671f242448
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143989
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144512
    Tested-by: Jenkins

diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index d95d2bb2c289..c0f951d62206 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -1089,8 +1089,21 @@ bool ModelData_Impl::OutputFileDialog( sal_Int16 
nStoreMode,
 
     // get the path from the dialog
     INetURLObject aURL( pFileDlg->GetPath() );
-    // the path should be provided outside since it might be used for further 
calls to the dialog
-    aSuggestedName = 
aURL.GetLastName(INetURLObject::DecodeMechanism::WithCharset);
+
+    if (comphelper::LibreOfficeKit::isActive())
+    {
+        // keep name with extension
+        aSuggestedName = aRecommendedName;
+        OUString aExtension;
+        if (size_t nPos = aSuggestedName.lastIndexOf('.') + 1)
+            aExtension = aSuggestedName.copy(nPos, aSuggestedName.getLength() 
- nPos);
+        aURL.SetExtension(aExtension);
+    }
+    else
+    {
+        // the path should be provided outside since it might be used for 
further calls to the dialog
+        aSuggestedName = 
aURL.GetLastName(INetURLObject::DecodeMechanism::WithCharset);
+    }
     aSuggestedDir = pFileDlg->GetDisplayDirectory();
 
     // old filter options should be cleared in case different filter is used

Reply via email to