diff options
Diffstat (limited to 'embeddedobj')
-rw-r--r-- | embeddedobj/source/commonembedding/persistence.cxx | 35 | ||||
-rw-r--r-- | embeddedobj/source/inc/commonembobj.hxx | 2 |
2 files changed, 37 insertions, 0 deletions
diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx index 6859de216c24..0ce42dce7be7 100644 --- a/embeddedobj/source/commonembedding/persistence.cxx +++ b/embeddedobj/source/commonembedding/persistence.cxx @@ -362,8 +362,43 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::InitNewDocument_Impl() return xDocument; } +bool OCommonEmbeddedObject::getAllowLinkUpdate() const +{ + // assume we can update if we can't determine a parent + bool bAllowLinkUpdate(true); + + try + { + uno::Reference<container::XChild> xParent(m_xParent, uno::UNO_QUERY); + while (xParent) + { + uno::Reference<container::XChild> xGrandParent(xParent->getParent(), uno::UNO_QUERY); + if (!xGrandParent) + break; + xParent = xGrandParent; + } + + uno::Reference<beans::XPropertySet> xPropSet(xParent, uno::UNO_QUERY); + if (xPropSet.is()) + { + uno::Any aAny = xPropSet->getPropertyValue("AllowLinkUpdate"); + aAny >>= bAllowLinkUpdate; + } + } + catch (const uno::Exception&) + { + } + + SAL_WARN_IF(!bAllowLinkUpdate, "embeddedobj.common", "getAllowLinkUpdate is false"); + + return bAllowLinkUpdate; +} + uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadLink_Impl() { + if (!getAllowLinkUpdate()) + return nullptr; + sal_Int32 nLen = m_bLinkHasPassword ? 3 : 2; uno::Sequence< beans::PropertyValue > aArgs( m_aDocMediaDescriptor.getLength() + nLen ); auto pArgs = aArgs.getArray(); diff --git a/embeddedobj/source/inc/commonembobj.hxx b/embeddedobj/source/inc/commonembobj.hxx index bbd2de63ec70..ac6c27d10a11 100644 --- a/embeddedobj/source/inc/commonembobj.hxx +++ b/embeddedobj/source/inc/commonembobj.hxx @@ -254,6 +254,8 @@ private: int ShowMsgDialog(TranslateId Msg, const OUString& sFileName); + bool getAllowLinkUpdate() const; + protected: void SetInplaceActiveState(); |