diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-11-15 11:39:24 +0000 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-11-16 12:19:05 +0100 |
commit | e6a7537762e19fde446441edd10d301f9b37ce75 (patch) | |
tree | 4e43dab00eddfb528bdde4e21b0f94530f12c545 /sc | |
parent | 60f001962122a77863231e9cf5dc445c136aac43 (diff) |
reorg calc hyperlink check to reuse elsewhere
Change-Id: I20ae3c5df15502c3a0a366fb4a2924c06ffac3d0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159487
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/global.cxx | 32 |
1 files changed, 2 insertions, 30 deletions
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx index 72323f7630e8..c4737d1e0bce 100644 --- a/sc/source/core/data/global.cxx +++ b/sc/source/core/data/global.cxx @@ -29,9 +29,7 @@ #include <sfx2/docfile.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/objsh.hxx> -#include <sfx2/sfxresid.hxx> #include <sfx2/sfxsids.hrc> -#include <sfx2/strings.hrc> #include <sfx2/viewfrm.hxx> #include <sfx2/viewsh.hxx> #include <svl/intitem.hxx> @@ -858,34 +856,8 @@ void ScGlobal::OpenURL(const OUString& rURL, const OUString& rTarget, bool bIgno aUrlName = aNewUrlName; } - if (INetURLObject(aUrlName).IsExoticProtocol()) - { - // Default to ignoring exotic protocols - bool bAllow = false; - if (pObjShell) - { - // If the document had macros when loaded then follow the allowed macro-mode - if (pObjShell->GetHadCheckedMacrosOnLoad()) - bAllow = pObjShell->AdjustMacroMode(); - else // otherwise ask the user, defaulting to cancel - { - assert(pFrame && "if we have pObjShell we have pFrame"); - //Reuse URITools::onOpenURI warning string - std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pFrame->GetFrameWeld(), - VclMessageType::Warning, VclButtonsType::YesNo, - SfxResId(STR_DANGEROUS_TO_OPEN))); - xQueryBox->set_primary_text(xQueryBox->get_primary_text().replaceFirst("$(ARG1)", - INetURLObject::decode(aUrlName, INetURLObject::DecodeMechanism::Unambiguous))); - xQueryBox->set_default_response(RET_NO); - bAllow = xQueryBox->run() == RET_YES; - } - } - if (!bAllow) - { - SAL_WARN("sc", "ScGlobal::OpenURL ignoring: " << aUrlName); - return; - } - } + if (!SfxObjectShell::AllowedLinkProtocolFromDocument(aUrlName, pObjShell, pFrame ? pFrame->GetFrameWeld() : nullptr)) + return; SfxStringItem aUrl( SID_FILE_NAME, aUrlName ); SfxStringItem aTarget( SID_TARGETNAME, rTarget ); |