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

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