summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2023-04-11 10:13:37 +0100
committerCaolán McNamara <caolan.mcnamara@collabora.com>2023-05-24 11:39:42 +0200
commitad8ccdad7f77b91c2b39b567b43da7dfc5947a02 (patch)
treec6de3a5dc4e70d6184d3524ebbcfd3b0981b59de
parentlok: Hide file linking in section (diff)
downloadcore-ad8ccdad7f77b91c2b39b567b43da7dfc5947a02.tar.gz
core-ad8ccdad7f77b91c2b39b567b43da7dfc5947a02.zip
set Referer on loading IFrames
so tools, options, security, options, "block any links from document not..." applies to their contents. Change-Id: I04839aea6b07a4a76ac147a85045939ccd9c3c79 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150221 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150751 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> (cherry picked from commit acff9ca0579333b45d10ae5f8cd48172f563dddd) (cherry picked from commit 04c8176fb40d2eb983aa0bd0a6ce65804d3f6ecd) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152110 Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
-rw-r--r--sfx2/source/doc/iframe.cxx21
1 files changed, 14 insertions, 7 deletions
diff --git a/sfx2/source/doc/iframe.cxx b/sfx2/source/doc/iframe.cxx
index 96502ce60726..b9495b8fd311 100644
--- a/sfx2/source/doc/iframe.cxx
+++ b/sfx2/source/doc/iframe.cxx
@@ -33,10 +33,12 @@
#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
#include <com/sun/star/embed/XEmbeddedObject.hpp>
+#include <comphelper/propertyvalue.hxx>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <officecfg/Office/Common.hxx>
#include <svl/itemprop.hxx>
+#include <sfx2/docfile.hxx>
#include <sfx2/frmdescr.hxx>
#include <sfx2/objsh.hxx>
#include <sfx2/sfxdlg.hxx>
@@ -164,14 +166,19 @@ sal_Bool SAL_CALL IFrameObject::load(
uno::Reference < util::XURLTransformer > xTrans( util::URLTransformer::create( mxContext ) );
xTrans->parseStrict( aTargetURL );
+ uno::Reference<frame::XFramesSupplier> xParentFrame = xFrame->getCreator();
+ SfxObjectShell* pDoc = SfxMacroLoader::GetObjectShell(xParentFrame);
+
if (INetURLObject(aTargetURL.Complete).GetProtocol() == INetProtocol::Macro)
{
- uno::Reference<frame::XFramesSupplier> xParentFrame = xFrame->getCreator();
- SfxObjectShell* pDoc = SfxMacroLoader::GetObjectShell(xParentFrame);
if (pDoc && !pDoc->AdjustMacroMode())
return false;
}
+ OUString sReferer;
+ if (pDoc && pDoc->HasName())
+ sReferer = pDoc->GetMedium()->GetName();
+
DBG_ASSERT( !mxFrame.is(), "Frame already existing!" );
VclPtr<vcl::Window> pParent = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
VclPtr<IFrameWindow_Impl> pWin = VclPtr<IFrameWindow_Impl>::Create( pParent, maFrmDescr.IsFrameBorderOn() );
@@ -194,11 +201,11 @@ sal_Bool SAL_CALL IFrameObject::load(
if ( xFramesSupplier.is() )
mxFrame->setCreator( xFramesSupplier );
- uno::Sequence < beans::PropertyValue > aProps(2);
- aProps[0].Name = "PluginMode";
- aProps[0].Value <<= sal_Int16(2);
- aProps[1].Name = "ReadOnly";
- aProps[1].Value <<= true;
+ uno::Sequence < beans::PropertyValue > aProps{
+ comphelper::makePropertyValue("PluginMode", sal_Int16(2)),
+ comphelper::makePropertyValue("ReadOnly", true),
+ comphelper::makePropertyValue("Referer", sReferer)
+ };
uno::Reference < frame::XDispatch > xDisp = mxFrame->queryDispatch( aTargetURL, "_self", 0 );
if ( xDisp.is() )
xDisp->dispatch( aTargetURL, aProps );