summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-11-25 14:53:04 +0100
committerMiklos Vajna <vmiklos@collabora.com>2021-11-25 15:49:05 +0100
commit4f9f1ac33366817df61c488a9f36b09c592ee939 (patch)
treeb11c7dda23f40d60f833c0c991851d79ea4d5cc6 /sfx2
parent9bc77b5107917ffe96b7ddf2c4d6d739a5e60c5b (diff)
sw: allow viewing OLE objects in protected sections
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 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/view/ipclient.cxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx
index eef20a921171..08898ba1573f 100644
--- a/sfx2/source/view/ipclient.cxx
+++ b/sfx2/source/view/ipclient.cxx
@@ -212,7 +212,7 @@ uno::Reference < frame::XFrame > const & SfxInPlaceClient_Impl::GetFrame() const
void SAL_CALL SfxInPlaceClient_Impl::saveObject()
{
- if ( !m_bStoreObject )
+ if (!m_bStoreObject || m_pClient->IsProtected())
// client wants to discard the object (usually it means the container document is closed while an object is active
// and the user didn't request saving the changes
return;
@@ -1044,6 +1044,8 @@ void SfxInPlaceClient::FormatChanged()
// dummy implementation
}
+bool SfxInPlaceClient::IsProtected() const { return false; }
+
void SfxInPlaceClient::DeactivateObject()
{
if ( !GetObject().is() )