diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2021-11-26 08:45:24 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2021-11-26 09:33:49 +0100 |
commit | 32842d4bf250bcab281eb71a218d618485c60290 (patch) | |
tree | cfd94258eac154fea60ffc592dd7d858bc6c78f1 /embeddedobj/source/commonembedding/miscobj.cxx | |
parent | 0600affd91ca799c75354a8c63d2b40373b08996 (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 'embeddedobj/source/commonembedding/miscobj.cxx')
-rw-r--r-- | embeddedobj/source/commonembedding/miscobj.cxx | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/embeddedobj/source/commonembedding/miscobj.cxx b/embeddedobj/source/commonembedding/miscobj.cxx index 9c24185ed184..538e0b72e3da 100644 --- a/embeddedobj/source/commonembedding/miscobj.cxx +++ b/embeddedobj/source/commonembedding/miscobj.cxx @@ -39,6 +39,7 @@ #include <vcl/svapp.hxx> #include <tools/diagnose_ex.h> #include <cppuhelper/supportsservice.hxx> +#include <comphelper/sequenceashashmap.hxx> #include "persistence.hxx" @@ -398,6 +399,11 @@ uno::Any SAL_CALL OCommonEmbeddedObject::queryInterface( const uno::Type& rType void* p = static_cast<lang::XServiceInfo*>(this); return uno::Any(&p, rType); } + else if (rType == cppu::UnoType<lang::XInitialization>::get()) + { + void* p = static_cast<lang::XInitialization*>(this); + return uno::Any(&p, rType); + } else if (rType == cppu::UnoType<lang::XTypeProvider>::get()) { void* p = static_cast<lang::XTypeProvider*>(this); @@ -671,6 +677,7 @@ uno::Sequence<uno::Type> SAL_CALL OCommonEmbeddedObject::getTypes() cppu::UnoType<container::XChild>::get(), cppu::UnoType<chart2::XDefaultSizeTransmitter>::get(), cppu::UnoType<lang::XServiceInfo>::get(), + cppu::UnoType<lang::XInitialization>::get(), cppu::UnoType<lang::XTypeProvider>::get(), }; return aTypes; @@ -681,4 +688,19 @@ uno::Sequence<sal_Int8> SAL_CALL OCommonEmbeddedObject::getImplementationId() return uno::Sequence<sal_Int8>(); } +void SAL_CALL OCommonEmbeddedObject::initialize(const uno::Sequence<uno::Any>& rArguments) +{ + if (!rArguments.hasElements()) + { + return; + } + + comphelper::SequenceAsHashMap aMap(rArguments[0]); + auto it = aMap.find("ReadOnly"); + if (it != aMap.end()) + { + it->second >>= m_bReadOnly; + } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |