desktop/source/lib/init.cxx                        |    6 +++++-
 filter/source/storagefilterdetect/filterdetect.cxx |    7 +++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 35883e33fdc482862ea00ec0c74d5d253799ecb1
Author:     Mert Tumer <mert.tu...@collabora.com>
AuthorDate: Wed Apr 6 16:59:53 2022 +0300
Commit:     Henry Castro <hcas...@collabora.com>
CommitDate: Wed Aug 10 16:00:13 2022 +0200

    lok: load template documents as regular documents
    
    otherwise lok cannot save them directly because
    libreoffice will try to open a save-as dialog
    For odg, change the draw8_template type draw8
    
    Signed-off-by: Mert Tumer <mert.tu...@collabora.com>
    Change-Id: I34b0ed03adcac89eaa926f8ae6c57e6f622a90f0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132633
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Henry Castro <hcas...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138074

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 2847e64621b2..1533021c56a9 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2575,10 +2575,14 @@ static LibreOfficeKitDocument* 
lo_documentLoadWithOptions(LibreOfficeKit* pThis,
             document::MacroExecMode::NEVER_EXECUTE;
 #endif
 
+        // set AsTemplate explicitly false to be able to load template files
+        // as regular files, otherwise we cannot save them; it will try
+        // to bring saveas dialog which cannot work with LOK case
         uno::Sequence<css::beans::PropertyValue> aFilterOptions{
             comphelper::makePropertyValue("FilterOptions", sFilterOptions),
             comphelper::makePropertyValue("InteractionHandler", xInteraction),
-            comphelper::makePropertyValue("MacroExecutionMode", nMacroExecMode)
+            comphelper::makePropertyValue("MacroExecutionMode", 
nMacroExecMode),
+            comphelper::makePropertyValue("AsTemplate", false)
         };
 
         /* TODO
diff --git a/filter/source/storagefilterdetect/filterdetect.cxx 
b/filter/source/storagefilterdetect/filterdetect.cxx
index f45edd6cb5b6..d8e5df13b874 100644
--- a/filter/source/storagefilterdetect/filterdetect.cxx
+++ b/filter/source/storagefilterdetect/filterdetect.cxx
@@ -32,6 +32,8 @@
 #include <com/sun/star/packages/zip/ZipIOException.hpp>
 #include <com/sun/star/task/XInteractionHandler.hpp>
 
+#include <comphelper/lok.hxx>
+
 using namespace ::com::sun::star;
 using utl::MediaDescriptor;
 
@@ -102,6 +104,11 @@ OUString SAL_CALL 
StorageFilterDetect::detect(uno::Sequence<beans::PropertyValue
         OUString aMediaType;
         xStorageProperties->getPropertyValue( "MediaType" ) >>= aMediaType;
         aTypeName = getInternalFromMediaType( aMediaType );
+        if (comphelper::LibreOfficeKit::isActive() && aTypeName == 
"draw8_template")
+        {
+            // save it as draw8 instead of template format
+            aTypeName = "draw8";
+        }
     }
 
     catch( const lang::WrappedTargetException& aWrap )

Reply via email to