summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-11-26 08:45:24 +0100
committerMiklos Vajna <vmiklos@collabora.com>2021-11-26 09:33:49 +0100
commit32842d4bf250bcab281eb71a218d618485c60290 (patch)
treecfd94258eac154fea60ffc592dd7d858bc6c78f1 /sw
parent0600affd91ca799c75354a8c63d2b40373b08996 (diff)
sw, viewing OLE objects: also protect "common" embeded objects
Commit 4f9f1ac33366817df61c488a9f36b09c592ee939 (sw: allow viewing OLE objects in protected sections, 2021-11-25) allowed launching OLE objects in protected sections, and then made sure that changes done in "real" OLE editors (on Windows) are discarded: both the native data and preview. Extend this mechanism to also handle common embedded objects (i.e. when we load the data into an own document model, like Calc-in-Writer on Linux): there we can simply load the data read-only, so there will be no need to discard anything. This requires some way to pass down the read-only flag from sw/ to embeddedobj, implement XInitialization on OCommonEmbeddedObject to do that. Change-Id: I7b32d7514a6b0a40b4f58bed57879d292daa4ed7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125858 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw')
-rw-r--r--sw/source/uibase/wrtsh/wrtsh1.cxx10
1 files changed, 10 insertions, 0 deletions
diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx
index e74ac03bdec0..c6dee2be2ec6 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -25,6 +25,7 @@
#include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/util/XModifiable.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
#include <hintids.hxx>
#include <sot/exchange.hxx>
@@ -100,6 +101,7 @@
#include <svtools/embedhlp.hxx>
#include <svx/postattr.hxx>
#include <comphelper/lok.hxx>
+#include <comphelper/propertyvalue.hxx>
#include <memory>
#include <frmtool.hxx>
@@ -631,6 +633,14 @@ void SwWrtShell::LaunchOLEObj(sal_Int32 nVerb)
if ( !pCli )
pCli = new SwOleClient( &GetView(), &GetView().GetEditWin(), xRef );
+ uno::Reference<lang::XInitialization> xOLEInit(xRef.GetObject(), uno::UNO_QUERY);
+ if (xOLEInit.is())
+ {
+ uno::Sequence<beans::PropertyValue> aArguments
+ = { comphelper::makePropertyValue("ReadOnly", pCli->IsProtected()) };
+ xOLEInit->initialize({ uno::makeAny(aArguments) });
+ }
+
static_cast<SwOleClient*>(pCli)->SetInDoVerb( true );
CalcAndSetScale( xRef );