Resolves: tdf#172918 allow a media link the user inserts in this session

The document-wide link update permission is decided when the document is
loaded. But media files that the users interactively inserts should be
automatically allowed.

Remember on the media object that the user picked the reference and
allow it on its own, the same way a presentation sound the user picks is
allowed. A reference that arrived with the document still needs the
document-wide permission.

since:

commit f0768394c14f928d47547408fc1195368be81f86
Date:   Tue Jul 14 19:12:01 2026 +0100

    put slideshow media links under link control

see also:

commit 0aa870b7b5a6bda50bab50c7a0a41d28fdf4f6ab
Date:   Wed Jun 17 09:37:23 2026 +0000

    bring external presentation sounds under link management

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/7939
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
(cherry picked from commit 17c0a99a0886b397d5682b87209e34c01fdcd44f)
Change-Id: I711fee12416e3e5e91fc07999ea62df32684b625
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211276
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
This commit is contained in:
Caolán McNamara
2026-09-21 12:59:37 +02:00
committed by Xisco Fauli
parent 6969b6d056
commit aafab1213b
@@ -40,7 +40,6 @@
#include <cppcanvas/canvas.hxx> #include <cppcanvas/canvas.hxx>
#include <avmedia/mediawindow.hxx> #include <avmedia/mediawindow.hxx>
#include <svx/svdobj.hxx> #include <svx/svdobj.hxx>
#include <svx/svdmodel.hxx>
#include <svx/svdomedia.hxx> #include <svx/svdomedia.hxx>
#include <com/sun/star/awt/XWindow.hpp> #include <com/sun/star/awt/XWindow.hpp>
@@ -271,16 +270,9 @@ namespace slideshow::internal
bool ViewMediaShape::implMediaLinkAllowed() const bool ViewMediaShape::implMediaLinkAllowed() const
{ {
SdrObject* pObj = SdrObject::getSdrObjectFromXShape(mxShape); SdrMediaObj* pObj
if (!pObj) = dynamic_cast<SdrMediaObj*>(SdrObject::getSdrObjectFromXShape(mxShape));
return false; return pObj && pObj->isLinkAllowed();
uno::Reference<beans::XPropertySet> xModelProps(
pObj->getSdrModelFromSdrObject().getUnoModel(), uno::UNO_QUERY);
if (!xModelProps.is())
return false;
bool bAllow = false;
xModelProps->getPropertyValue(u"AllowLinkUpdate"_ustr) >>= bAllow;
return bAllow;
} }