From 3ee652e1c18186a5de47797aa4b02defcb29c210 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Mon, 11 May 2020 17:02:50 +0100 Subject: [PATCH] use the LinkManager persist to determine the Referer Change-Id: I4e93878972492a93af368ffa0560412132431a24 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94061 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- svx/source/svdraw/svdograf.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index 7e14a6d3bdd9..53b3e00a35fc 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -19,8 +19,10 @@ #include +#include #include #include +#include #include #include #include @@ -109,8 +111,13 @@ SdrGraphicLink::SdrGraphicLink(SdrGrafObj& rObj) { sfx2::LinkManager::GetDisplayNames( this, nullptr, &rGrafObj.aFileName, nullptr, &rGrafObj.aFilterName ); + OUString sReferer(getReferer()); + SfxObjectShell * sh = pLinkManager->GetPersist(); + if (sh != nullptr && sh->HasName()) + sReferer = sh->GetMedium()->GetName(); + Graphic aGraphic; - if (sfx2::LinkManager::GetGraphicFromAny(rMimeType, rValue, getReferer(), aGraphic, nullptr)) + if (sfx2::LinkManager::GetGraphicFromAny(rMimeType, rValue, sReferer, aGraphic, nullptr)) { rGrafObj.ImpSetLinkedGraphic(aGraphic); } -- 2.25.4