diff options
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/ui/docshell/docsh4.cxx | 17 | ||||
-rw-r--r-- | sc/source/ui/docshell/documentlinkmgr.cxx | 18 |
2 files changed, 34 insertions, 1 deletions
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 611d6537456e..1a344af959fd 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -199,8 +199,23 @@ void ScDocShell::ReloadAllLinks() m_pDocument->UpdateAreaLinks(); } -IMPL_LINK_NOARG( ScDocShell, ReloadAllLinksHdl, weld::Button&, void ) +IMPL_LINK( ScDocShell, ReloadAllLinksHdl, weld::Button&, rButton, void ) { + ScDocument& rDoc = GetDocument(); + if (rDoc.HasLinkFormulaNeedingCheck() && rDoc.GetDocLinkManager().hasExternalRefLinks()) + { + // If we have WEBSERVICE/Dde link and other external links in the document, it might indicate some + // exfiltration attempt, add *another* warning about this on top of the "Security Warning" + // shown in the infobar before they got here. + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(&rButton, + VclMessageType::Warning, VclButtonsType::YesNo, + ScResId(STR_TRUST_DOCUMENT_WARNING))); + xQueryBox->set_secondary_text(ScResId(STR_WEBSERVICE_WITH_LINKS_WARNING)); + xQueryBox->set_default_response(RET_NO); + if (xQueryBox->run() != RET_YES) + return; + } + ReloadAllLinks(); ScTabViewShell* pViewSh = GetBestViewShell(); diff --git a/sc/source/ui/docshell/documentlinkmgr.cxx b/sc/source/ui/docshell/documentlinkmgr.cxx index 79a86d08b438..0fb89cfa0d18 100644 --- a/sc/source/ui/docshell/documentlinkmgr.cxx +++ b/sc/source/ui/docshell/documentlinkmgr.cxx @@ -21,6 +21,7 @@ #include <documentlinkmgr.hxx> #include <datastream.hxx> #include <ddelink.hxx> +#include <externalrefmgr.hxx> #include <webservicelink.hxx> #include <strings.hrc> #include <scresid.hxx> @@ -153,6 +154,23 @@ bool DocumentLinkManager::hasDdeOrOleOrWebServiceLinks(bool bDde, bool bOle, boo return false; } +bool DocumentLinkManager::hasExternalRefLinks() const +{ + sfx2::LinkManager* pMgr = mpImpl->mpLinkManager; + if (!pMgr) + return false; + + const sfx2::SvBaseLinks& rLinks = pMgr->GetLinks(); + for (const auto & rLink : rLinks) + { + sfx2::SvBaseLink* pBase = rLink.get(); + if (dynamic_cast<ScExternalRefLink*>(pBase)) + return true; + } + + return false; +} + bool DocumentLinkManager::updateDdeOrOleOrWebServiceLinks(weld::Window* pWin) { sfx2::LinkManager* pMgr = mpImpl->mpLinkManager; |