summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMert Tumer <mert.tumer@collabora.com>2022-04-06 16:59:53 +0300
committerGökay ŞATIR <gokaysatir@collabora.com>2022-04-06 18:36:08 +0200
commit8461a6428c8e0e4e21cd8d340a389e34b64b68de (patch)
tree261ab717f80d909704ed47cf839ae60e2b4c60d5
parentlok: avoid validation-dialog yield when saving (diff)
downloadcore-8461a6428c8e0e4e21cd8d340a389e34b64b68de.tar.gz
core-8461a6428c8e0e4e21cd8d340a389e34b64b68de.zip
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.tumer@collabora.com> Change-Id: I34b0ed03adcac89eaa926f8ae6c57e6f622a90f0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132633 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Henry Castro <hcastro@collabora.com>
-rw-r--r--desktop/source/lib/init.cxx9
-rw-r--r--filter/source/storagefilterdetect/filterdetect.cxx7
2 files changed, 15 insertions, 1 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index fdf93283101f..3e4265969053 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2540,7 +2540,7 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions(LibreOfficeKit* pThis,
Application::SetDialogCancelMode(DialogCancelMode::LOKSilent);
}
- uno::Sequence<css::beans::PropertyValue> aFilterOptions(3);
+ uno::Sequence<css::beans::PropertyValue> aFilterOptions(4);
aFilterOptions[0] = css::beans::PropertyValue( "FilterOptions",
0,
uno::makeAny(aOptions),
@@ -2587,6 +2587,13 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions(LibreOfficeKit* pThis,
aFilterOptions[3].Value <<= nUpdateDoc;
*/
+ // set this 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
+ aFilterOptions[3].Name = "AsTemplate";
+ aFilterOptions[3].Value <<= false;
+
+
const int nThisDocumentId = nDocumentIdCounter++;
SfxViewShell::SetCurrentDocId(ViewShellDocId(nThisDocumentId));
uno::Reference<lang::XComponent> xComponent = xComponentLoader->loadComponentFromURL(
diff --git a/filter/source/storagefilterdetect/filterdetect.cxx b/filter/source/storagefilterdetect/filterdetect.cxx
index f2eba546a4d3..64ee68175473 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 )