diff options
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/doc/DocumentLinksAdministrationManager.cxx | 83 | ||||
-rw-r--r-- | sw/source/uibase/app/docshini.cxx | 3 |
2 files changed, 50 insertions, 36 deletions
diff --git a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx index 39a803263efe..0949aa77d582 100644 --- a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx +++ b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx @@ -199,45 +199,56 @@ const sfx2::LinkManager& DocumentLinksAdministrationManager::GetLinkManager() co // to new SwDoc::UpdateLinks(): void DocumentLinksAdministrationManager::UpdateLinks() { - SfxObjectCreateMode eMode; - sal_uInt16 nLinkMode = m_rDoc.GetDocumentSettingManager().getLinkUpdateMode( true ); - if ( m_rDoc.GetDocShell()) { - sal_uInt16 nUpdateDocMode = m_rDoc.GetDocShell()->GetUpdateDocMode(); - if( (nLinkMode != NEVER || document::UpdateDocMode::FULL_UPDATE == nUpdateDocMode) && - !GetLinkManager().GetLinks().empty() && - SfxObjectCreateMode::INTERNAL != - ( eMode = m_rDoc.GetDocShell()->GetCreateMode()) && - SfxObjectCreateMode::ORGANIZER != eMode && - SfxObjectCreateMode::PREVIEW != eMode && - !m_rDoc.GetDocShell()->IsPreview() ) + if (!m_rDoc.GetDocShell()) + return; + SfxObjectCreateMode eMode = m_rDoc.GetDocShell()->GetCreateMode(); + if (eMode == SfxObjectCreateMode::INTERNAL) + return; + if (eMode == SfxObjectCreateMode::ORGANIZER) + return; + if (eMode == SfxObjectCreateMode::PREVIEW) + return; + if (m_rDoc.GetDocShell()->IsPreview()) + return; + if (GetLinkManager().GetLinks().empty()) + return; + sal_uInt16 nLinkMode = m_rDoc.GetDocumentSettingManager().getLinkUpdateMode(true); + sal_uInt16 nUpdateDocMode = m_rDoc.GetDocShell()->GetUpdateDocMode(); + if (nLinkMode == NEVER && nUpdateDocMode != document::UpdateDocMode::FULL_UPDATE) + return; + + bool bAskUpdate = nLinkMode == MANUAL; + bool bUpdate = true; + switch(nUpdateDocMode) + { + case document::UpdateDocMode::NO_UPDATE: bUpdate = false;break; + case document::UpdateDocMode::QUIET_UPDATE:bAskUpdate = false; break; + case document::UpdateDocMode::FULL_UPDATE: bAskUpdate = true; break; + } + if (nLinkMode == AUTOMATIC && !bAskUpdate) + { + SfxMedium * medium = m_rDoc.GetDocShell()->GetMedium(); + if (!SvtSecurityOptions().isTrustedLocationUriForUpdatingLinks( + medium == nullptr ? OUString() : medium->GetName())) { - bool bAskUpdate = nLinkMode == MANUAL; - bool bUpdate = true; - switch(nUpdateDocMode) - { - case document::UpdateDocMode::NO_UPDATE: bUpdate = false;break; - case document::UpdateDocMode::QUIET_UPDATE:bAskUpdate = false; break; - case document::UpdateDocMode::FULL_UPDATE: bAskUpdate = true; break; - } - if (nLinkMode == AUTOMATIC && !bAskUpdate) - { - SfxMedium * medium = m_rDoc.GetDocShell()->GetMedium(); - if (!SvtSecurityOptions().isTrustedLocationUriForUpdatingLinks( - medium == nullptr ? OUString() : medium->GetName())) - { - bAskUpdate = true; - } - } - if( bUpdate ) - { - SfxMedium* pMedium = m_rDoc.GetDocShell()->GetMedium(); - SfxFrame* pFrame = pMedium ? pMedium->GetLoadTargetFrame() : nullptr; - vcl::Window* pDlgParent = pFrame ? &pFrame->GetWindow() : nullptr; - - GetLinkManager().UpdateAllLinks( bAskUpdate, true, false, pDlgParent ); - } + bAskUpdate = true; } } + comphelper::EmbeddedObjectContainer& rEmbeddedObjectContainer = m_rDoc.GetDocShell()->getEmbeddedObjectContainer(); + if (bUpdate) + { + rEmbeddedObjectContainer.setUserAllowsLinkUpdate(true); + + SfxMedium* pMedium = m_rDoc.GetDocShell()->GetMedium(); + SfxFrame* pFrame = pMedium ? pMedium->GetLoadTargetFrame() : nullptr; + vcl::Window* pDlgParent = pFrame ? &pFrame->GetWindow() : nullptr; + + GetLinkManager().UpdateAllLinks( bAskUpdate, true, false, pDlgParent ); + } + else + { + rEmbeddedObjectContainer.setUserAllowsLinkUpdate(false); + } } bool DocumentLinksAdministrationManager::GetData( const OUString& rItem, const OUString& rMimeType, diff --git a/sw/source/uibase/app/docshini.cxx b/sw/source/uibase/app/docshini.cxx index 92b239467b04..5be408972b3e 100644 --- a/sw/source/uibase/app/docshini.cxx +++ b/sw/source/uibase/app/docshini.cxx @@ -492,6 +492,9 @@ bool SwDocShell::Load( SfxMedium& rMedium ) bool bRet = false; if( SfxObjectShell::Load( rMedium )) { + comphelper::EmbeddedObjectContainer& rEmbeddedObjectContainer = getEmbeddedObjectContainer(); + rEmbeddedObjectContainer.setUserAllowsLinkUpdate(false); + SAL_INFO( "sw.ui", "after SfxInPlaceObject::Load" ); if (m_pDoc) // for last version!! RemoveLink(); // release the existing |