Blame SOURCES/0001-use-the-LinkManager-persist-to-determine-the-Referer.patch

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