filter/source/config/cache/typedetection.cxx       |    5 ++++-
 filter/source/storagefilterdetect/filterdetect.cxx |    4 +++-
 2 files changed, 7 insertions(+), 2 deletions(-)

New commits:
commit e2aa7041b9a831bbd235f698a6485e2282b6f5ca
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Tue Nov 28 08:44:23 2023 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Tue Nov 28 09:21:06 2023 +0100

    lok: don't use template flag in more places
    
    Similar to commit e2ee3dd61ab8ea5d970d8da5df3233e7bba5909e (lok: add
    broken package interaction handler, 2023-10-02), all places of broken
    package handling should allow replacing the original document.
    
    Change-Id: I8450dfc0ab60444fa08014cc952ac857998d35ee
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160009
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/filter/source/config/cache/typedetection.cxx 
b/filter/source/config/cache/typedetection.cxx
index 15a257eef878..c411249877af 100644
--- a/filter/source/config/cache/typedetection.cxx
+++ b/filter/source/config/cache/typedetection.cxx
@@ -40,6 +40,7 @@
 #include <comphelper/diagnose_ex.hxx>
 #include <tools/urlobj.hxx>
 #include <comphelper/fileurl.hxx>
+#include <comphelper/lok.hxx>
 #include <comphelper/sequence.hxx>
 #include <utility>
 
@@ -931,8 +932,10 @@ OUString TypeDetection::impl_detectTypeFlatAndDeep(      
utl::MediaDescriptor& r
 
                         if (aRequest.isApproved())
                         {
+                            // lok: we want to overwrite file in jail, so 
don't use template flag
+                            const bool bIsLOK = 
comphelper::LibreOfficeKit::isActive();
                             
rDescriptor[utl::MediaDescriptor::PROP_DOCUMENTTITLE] <<= aDocumentTitle;
-                            rDescriptor[utl::MediaDescriptor::PROP_ASTEMPLATE] 
<<= true;
+                            rDescriptor[utl::MediaDescriptor::PROP_ASTEMPLATE] 
<<= !bIsLOK;
                             rDescriptor["RepairPackage"] <<= true;
                         }
                         else
diff --git a/filter/source/storagefilterdetect/filterdetect.cxx 
b/filter/source/storagefilterdetect/filterdetect.cxx
index 8312726e11da..c73355e02a9d 100644
--- a/filter/source/storagefilterdetect/filterdetect.cxx
+++ b/filter/source/storagefilterdetect/filterdetect.cxx
@@ -141,8 +141,10 @@ OUString SAL_CALL 
StorageFilterDetect::detect(uno::Sequence<beans::PropertyValue
                     if ( aRequest.isApproved() )
                     {
                         aTypeName = aRequestedTypeName;
+                        // lok: we want to overwrite file in jail, so don't 
use template flag
+                        const bool bIsLOK = 
comphelper::LibreOfficeKit::isActive();
                         aMediaDesc[MediaDescriptor::PROP_DOCUMENTTITLE] <<= 
aDocumentTitle;
-                        aMediaDesc[MediaDescriptor::PROP_ASTEMPLATE] <<= true;
+                        aMediaDesc[MediaDescriptor::PROP_ASTEMPLATE] <<= 
!bIsLOK;
                         aMediaDesc["RepairPackage"] <<= true;
                     }
                     else

Reply via email to