sw: allow viewing OLE objects in protected sections

Desktop / LibreOffice - Miklos Vajna [collabora.com] - 25 November 2021 14:49 UTC

The problem was that we don't allow even opening embedded objects in protected sections, which means the content of multi-page embedded objects can't even be viewed in protected sections, which probably goes too far.

Fix this relaxing the condition in SwEditWin::MouseButtonDown() to allow launching the OLE object on double-click, and then make sure that the native data is not updated in SfxInPlaceClient_Impl::saveObject() and the replacement image is not updated in svt::EmbedEventListener_Impl::stateChanged().

This is complicated by only the Writer layout knowing if a given OLE object is anchored in a protected frame, so pass down a callback to sfx2/ and svtools/ to check if the OLE object is protected.

Not copying the protected bit has the benefit of behaving correctly if the section turns into non-protected: copying would not work properly, as SfxInPlaceClient is created on demand, so not re-created when the protectedness of the section is changed.

Change-Id: Ib3a8f2092d27dc1ebd3ef355c95a4a473988b163 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125815

4f9f1ac33366 sw: allow viewing OLE objects in protected sections
include/sfx2/ipclient.hxx | 2 ++
include/svtools/embedhlp.hxx | 4 ++++
sfx2/source/view/ipclient.cxx | 4 +++-
svtools/source/misc/embedhlp.cxx | 21 ++++++++++++++++++++-
sw/inc/ndole.hxx | 3 +++
sw/inc/swcli.hxx | 2 ++
sw/source/core/ole/ndole.cxx | 32 ++++++++++++++++++++++++++++++++
sw/source/uibase/app/docsh.cxx | 16 ++++++++++++++++
sw/source/uibase/docvw/edtwin.cxx | 14 +++++++-------
sw/source/uibase/uiview/swcli.cxx | 25 +++++++++++++++++++++++++
10 files changed, 114 insertions(+), 9 deletions(-)

Upstream: cgit.freedesktop.org


  • Share