configure.ac | 2 - embeddedobj/source/commonembedding/persistence.cxx | 25 ++++++++----- include/svx/unoshape.hxx | 6 ++- reportdesign/source/core/sdr/ReportDrawPage.cxx | 2 - svx/source/unodraw/shapeimpl.hxx | 7 ++- svx/source/unodraw/unomod.cxx | 6 ++- svx/source/unodraw/unopage.cxx | 14 +++---- svx/source/unodraw/unoshap4.cxx | 38 +++++++++++---------- sw/source/uibase/wrtsh/wrtsh2.cxx | 8 ++-- xmloff/source/draw/ximpshap.cxx | 4 ++ 10 files changed, 67 insertions(+), 45 deletions(-)
New commits: commit 9c4258eca006fd4524c11ab31a26d886dcad1ec7 Author: Thorsten Behrens <thorsten.behr...@allotropia.de> AuthorDate: Wed Dec 6 06:33:02 2023 +0100 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Wed Dec 6 06:33:02 2023 +0100 Bump version to 6.4.0.22 Change-Id: Ife20720d3cd9725a5bf40e4f1433261b790231cf diff --git a/configure.ac b/configure.ac index 39cc33d13928..ac34e147b005 100644 --- a/configure.ac +++ b/configure.ac @@ -9,7 +9,7 @@ dnl in order to create a configure script. # several non-alphanumeric characters, those are split off and used only for the # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea. -AC_INIT([CIB Office],[6.4.0.21],[],[],[https://www.cib.de/office/]) +AC_INIT([CIB Office],[6.4.0.22],[],[],[https://www.cib.de/office/]) dnl libnumbertext needs autoconf 2.68, but that can pick up autoconf268 just fine if it is installed dnl whereas aclocal (as run by autogen.sh) insists on using autoconf and fails hard commit 2bb9d59c9bd1c7893fccfce8e9b4034a8b4165e8 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Fri Nov 17 08:57:09 2023 +0000 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Wed Dec 6 06:22:54 2023 +0100 we can have just one LoadURL for writer Change-Id: Ia0162ee1c275292fcf200bad4662e4c2c6b7b972 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159557 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> (cherry picked from commit 521ca9cf6acbae96cf95d9740859c9682212013d) diff --git a/sw/inc/swurl.hxx b/sw/inc/swurl.hxx index ec88a639a4e9..87375f30c8b7 100644 --- a/sw/inc/swurl.hxx +++ b/sw/inc/swurl.hxx @@ -23,7 +23,6 @@ #include <o3tl/typed_flags_set.hxx> class SwViewShell; -class SwView; enum class LoadUrlFlags { NONE = 0x00, @@ -36,10 +35,6 @@ namespace o3tl { void LoadURL( SwViewShell& rSh, const OUString& rName, LoadUrlFlags nFilter, const OUString& rTargetFrameName ); -void LoadURL( SwView& rView, const OUString& rName, - LoadUrlFlags nFilter, const OUString& rTargetFrameName ); - - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx index 820b131e60b6..0e3ba07c3973 100644 --- a/sw/source/uibase/shells/drwtxtex.cxx +++ b/sw/source/uibase/shells/drwtxtex.cxx @@ -545,7 +545,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) const SvxFieldData* pField = pOLV->GetFieldAtCursor(); if (const SvxURLField* pURLField = dynamic_cast<const SvxURLField*>(pField)) { - ::LoadURL(GetView(), pURLField->GetURL(), LoadUrlFlags::NONE, + ::LoadURL(GetShell(), pURLField->GetURL(), LoadUrlFlags::NONE, pURLField->GetTargetFrame()); } } commit 2644737c313540dcd1e33e9c5c6802c6d228afa2 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Wed Nov 15 21:01:48 2023 +0000 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Wed Dec 6 06:21:58 2023 +0100 combine these hyperlink dispatchers into one call Conflicts: sw/source/uibase/shells/drwtxtex.cxx sw/source/uibase/wrtsh/wrtsh2.cxx Change-Id: Icb7822e811013de648ccf2fbb23a5f0be9e29bb0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159489 Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> (cherry picked from commit 0df175ccc6ea542bc5801f631ff72bed187042eb) diff --git a/sw/inc/swurl.hxx b/sw/inc/swurl.hxx index 87375f30c8b7..ec88a639a4e9 100644 --- a/sw/inc/swurl.hxx +++ b/sw/inc/swurl.hxx @@ -23,6 +23,7 @@ #include <o3tl/typed_flags_set.hxx> class SwViewShell; +class SwView; enum class LoadUrlFlags { NONE = 0x00, @@ -35,6 +36,10 @@ namespace o3tl { void LoadURL( SwViewShell& rSh, const OUString& rName, LoadUrlFlags nFilter, const OUString& rTargetFrameName ); +void LoadURL( SwView& rView, const OUString& rName, + LoadUrlFlags nFilter, const OUString& rTargetFrameName ); + + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx index 0e3ba07c3973..820b131e60b6 100644 --- a/sw/source/uibase/shells/drwtxtex.cxx +++ b/sw/source/uibase/shells/drwtxtex.cxx @@ -545,7 +545,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) const SvxFieldData* pField = pOLV->GetFieldAtCursor(); if (const SvxURLField* pURLField = dynamic_cast<const SvxURLField*>(pField)) { - ::LoadURL(GetShell(), pURLField->GetURL(), LoadUrlFlags::NONE, + ::LoadURL(GetView(), pURLField->GetURL(), LoadUrlFlags::NONE, pURLField->GetTargetFrame()); } } diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx b/sw/source/uibase/wrtsh/wrtsh2.cxx index 4b98417ac788..1cb9e1b46861 100644 --- a/sw/source/uibase/wrtsh/wrtsh2.cxx +++ b/sw/source/uibase/wrtsh/wrtsh2.cxx @@ -491,9 +491,9 @@ bool SwWrtShell::ClickToINetGrf( const Point& rDocPt, LoadUrlFlags nFilter ) static void LoadURL(SwView& rView, const OUString& rURL, LoadUrlFlags nFilter, const OUString& rTargetFrameName) { - SwDocShell* pDShell = rSh.GetView().GetDocShell(); + SwDocShell* pDShell = rView.GetDocShell(); OSL_ENSURE( pDShell, "No DocShell?!"); - SfxViewFrame& rViewFrame = *rSh.GetView().GetViewFrame(); + SfxViewFrame& rViewFrame = *rView.GetViewFrame(); if (!SfxObjectShell::AllowedLinkProtocolFromDocument(rURL, pDShell, rViewFrame.GetFrameWeld())) return; commit 516eabfbca8d8b8d359226297f8fd621b0a02e78 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Wed Nov 15 12:55:58 2023 +0000 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Wed Dec 6 06:16:09 2023 +0100 reuse AllowedLinkProtocolFromDocument in writer Conflicts: sw/source/uibase/wrtsh/wrtsh2.cxx Change-Id: Iacf5e313fc6ca5f7d69ca6986a036f0e1ab1f2a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159488 Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> (cherry picked from commit 32535dfa82200b54296838b52285c054fbe5e51d) diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx b/sw/source/uibase/wrtsh/wrtsh2.cxx index 543644d3b997..4b98417ac788 100644 --- a/sw/source/uibase/wrtsh/wrtsh2.cxx +++ b/sw/source/uibase/wrtsh/wrtsh2.cxx @@ -491,11 +491,11 @@ bool SwWrtShell::ClickToINetGrf( const Point& rDocPt, LoadUrlFlags nFilter ) static void LoadURL(SwView& rView, const OUString& rURL, LoadUrlFlags nFilter, const OUString& rTargetFrameName) { - SwDocShell* pDShell = rView.GetDocShell(); + SwDocShell* pDShell = rSh.GetView().GetDocShell(); OSL_ENSURE( pDShell, "No DocShell?!"); - SfxViewFrame* pViewFrame = rView.GetViewFrame(); + SfxViewFrame& rViewFrame = *rSh.GetView().GetViewFrame(); - if (!SfxObjectShell::AllowedLinkProtocolFromDocument(rURL, pDShell, pViewFrame->GetWindow().GetFrameWeld())) + if (!SfxObjectShell::AllowedLinkProtocolFromDocument(rURL, pDShell, rViewFrame.GetFrameWeld())) return; // We are doing tiledRendering, let the client handles the URL loading, @@ -520,7 +520,7 @@ static void LoadURL(SwView& rView, const OUString& rURL, LoadUrlFlags nFilter, OUString sReferer; if( pDShell && pDShell->GetMedium() ) sReferer = pDShell->GetMedium()->GetName(); - SfxFrameItem aView( SID_DOCFRAME, pViewFrame ); + SfxFrameItem aView( SID_DOCFRAME, &rViewFrame ); SfxStringItem aName( SID_FILE_NAME, rURL ); SfxStringItem aTargetFrameName( SID_TARGETNAME, sTargetFrame ); SfxStringItem aReferer( SID_REFERER, sReferer ); @@ -541,7 +541,7 @@ static void LoadURL(SwView& rView, const OUString& rURL, LoadUrlFlags nFilter, nullptr }; - pViewFrame->GetDispatcher()->GetBindings()->Execute( SID_OPENDOC, aArr, + rViewFrame.GetDispatcher()->GetBindings()->Execute( SID_OPENDOC, aArr, SfxCallMode::ASYNCHRON|SfxCallMode::RECORD ); } commit 7d99be973ad899528f6fe75db79c3b551aca967e Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Mon Oct 16 15:21:03 2023 +0100 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Wed Dec 6 05:45:06 2023 +0100 check earlier on loading ole objects if parent doc is untrusted referer Conflicts: embeddedobj/source/commonembedding/persistence.cxx Change-Id: Ib1169d5c40ca87f789c71b48124754e073895fcd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158054 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> (cherry picked from commit 7273de2730022deb37a8c7f2fedbe7fc4551f9b5) diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx index f5e7bcdd09e4..d7eec8e50232 100644 --- a/embeddedobj/source/commonembedding/persistence.cxx +++ b/embeddedobj/source/commonembedding/persistence.cxx @@ -51,10 +51,11 @@ #include <comphelper/storagehelper.hxx> #include <comphelper/mimeconfighelper.hxx> #include <comphelper/namedvaluecollection.hxx> +#include <unotools/configmgr.hxx> +#include <unotools/securityoptions.hxx> #include <tools/diagnose_ex.h> #include <sal/log.hxx> -#include <unotools/configmgr.hxx> #include "persistence.hxx" using namespace ::com::sun::star; @@ -359,20 +360,15 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::InitNewDocument_Impl() return xDocument; } - uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadLink_Impl() { - uno::Reference< util::XCloseable > xDocument( CreateDocument( m_xContext, GetDocumentServiceName(), - m_bEmbeddedScriptSupport, m_bDocumentRecoverySupport ) ); - - uno::Reference< frame::XLoadable > xLoadable( xDocument, uno::UNO_QUERY_THROW ); - sal_Int32 nLen = 2; uno::Sequence< beans::PropertyValue > aArgs( nLen ); aArgs[0].Name = "URL"; aArgs[0].Value <<= m_aLinkURL; aArgs[1].Name = "FilterName"; aArgs[1].Value <<= m_aLinkFilterName; + if ( m_bLinkHasPassword ) { aArgs.realloc( ++nLen ); @@ -383,10 +379,22 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadLink_Impl() aArgs.realloc( m_aDocMediaDescriptor.getLength() + nLen ); for ( sal_Int32 nInd = 0; nInd < m_aDocMediaDescriptor.getLength(); nInd++ ) { + // return early if this document is not trusted to open links + if (m_aDocMediaDescriptor[nInd].Name == utl::MediaDescriptor::PROP_REFERRER) + { + OUString referer; + m_aDocMediaDescriptor[nInd].Value >>= referer; + if (SvtSecurityOptions::isUntrustedReferer(referer)) + return nullptr; + } aArgs[nInd+nLen].Name = m_aDocMediaDescriptor[nInd].Name; aArgs[nInd+nLen].Value = m_aDocMediaDescriptor[nInd].Value; } + uno::Reference< util::XCloseable > xDocument( CreateDocument( m_xContext, GetDocumentServiceName(), + m_bEmbeddedScriptSupport, m_bDocumentRecoverySupport ) ); + uno::Reference< frame::XLoadable > xLoadable( xDocument, uno::UNO_QUERY_THROW ); + try { // the document is not really an embedded one, it is a link @@ -428,7 +436,6 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadLink_Impl() } - OUString OCommonEmbeddedObject::GetFilterName( sal_Int32 nVersion ) const { OUString aFilterName = GetPresetFilterName(); commit f7d2bbabe818c0fb8634f79c649b71b502081f30 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Mon Oct 16 13:25:29 2023 +0100 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Wed Dec 6 01:00:45 2023 +0100 retain Referer information available in OCommonEmbeddedObject ctor Conflicts: embeddedobj/source/commonembedding/persistence.cxx svx/source/unodraw/unoshap4.cxx Change-Id: I2cb901e81de3b7db73cd2088348ddad46ae603dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158052 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> (cherry picked from commit 267be127f2899f2e1b1f15b5a06707a9b83fcab4) diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx index f162dfef5f31..f5e7bcdd09e4 100644 --- a/embeddedobj/source/commonembedding/persistence.cxx +++ b/embeddedobj/source/commonembedding/persistence.cxx @@ -75,7 +75,7 @@ uno::Sequence< beans::PropertyValue > GetValuableArgs_Impl( const uno::Sequence< || aMedDescr[nInd].Name == "StartPresentation" || aMedDescr[nInd].Name == "RepairPackage" || aMedDescr[nInd].Name == "StatusIndicator" || aMedDescr[nInd].Name == "ViewData" || aMedDescr[nInd].Name == "ViewId" || aMedDescr[nInd].Name == "MacroExecutionMode" - || aMedDescr[nInd].Name == "UpdateDocMode" + || aMedDescr[nInd].Name == "UpdateDocMode" || aMedDescr[nInd].Name == "Referer" || (aMedDescr[nInd].Name == "DocumentBaseURL" && bCanUseDocumentBaseURL) ) { aResult.realloc( ++nResLen ); diff --git a/svx/source/unodraw/unoshap4.cxx b/svx/source/unodraw/unoshap4.cxx index 8765aa737a57..0a4f5055ee02 100644 --- a/svx/source/unodraw/unoshap4.cxx +++ b/svx/source/unodraw/unoshap4.cxx @@ -481,7 +481,7 @@ void SvxOle2Shape::createLink( const OUString& aLinkURL ) awt::Size aSz = xObj->getVisualAreaSize( pOle2Obj->GetAspect() ); aRect.SetSize( Size( aSz.Width, aSz.Height ) ); } - catch( embed::NoVisualAreaSizeException& ) + catch( const uno::Exception& ) {} pOle2Obj->SetLogicRect( aRect ); } commit 3e533861d7613cefc05b6be92ef19d53a2a82e64 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Wed Sep 6 10:05:23 2023 +0100 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Wed Dec 6 00:56:52 2023 +0100 add referer to ole objects so we can identify what document is requesting their contents extends: commit 5668e73beb30b95abc6520b7432c54972ca3ab2c Date: Wed Nov 20 14:43:45 2013 +0100 avmedia: Implement "block untrusted referer links" feature See f0a9ca24fd4bf79cac908bf0d6fdb8905dc504db "rhbz#887420 Implement 'block untrusted referer links' feature" for details. This adds some further /*TODO?*/ comments, and one known problem (marked /*TODO!*/) is that movies/sounds are not blocked during a slideshow presentation. to these objects too, namely OLE2Shape and derivatives AppletShape, FrameShape and PluginShape so in paranoid mode we won't load the contents of such objects from documents considered "untrusted". Conflicts: include/svx/unoshape.hxx reportdesign/source/core/sdr/ReportDrawPage.cxx svx/source/unodraw/shapeimpl.hxx svx/source/unodraw/unopage.cxx svx/source/unodraw/unoshap4.cxx xmloff/source/draw/ximpshap.cxx Change-Id: I6d988035d0cd09fd3fade5f6885fe336c95579ab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156598 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> (cherry picked from commit 125cf1525361c6cd699574f60b4cf12868188568) diff --git a/include/svx/unoshape.hxx b/include/svx/unoshape.hxx index 712552a55281..4b5c78b26cfa 100644 --- a/include/svx/unoshape.hxx +++ b/include/svx/unoshape.hxx @@ -581,6 +581,8 @@ public: // #i118485# changed parent to SvxShapeText to allow Text handling over UNO API class SVX_DLLPUBLIC SvxOle2Shape : public SvxShapeText { +private: + OUString referer_; protected: // override these for special property handling in subcasses. Return true if property is handled virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const css::uno::Any& rValue ) override; @@ -590,8 +592,8 @@ protected: SvGlobalName GetClassName_Impl(OUString& rHexCLSID); public: - SvxOle2Shape(SdrObject* pObj); - SvxOle2Shape(SdrObject* pObject, const SfxItemPropertyMapEntry* pPropertyMap, const SvxItemPropertySet* pPropertySet); + SvxOle2Shape(SdrObject* pObj, OUString referer); + SvxOle2Shape(SdrObject* pObject, OUString referer, const SfxItemPropertyMapEntry* pPropertyMap, const SvxItemPropertySet* pPropertySet); virtual ~SvxOle2Shape() throw() override; bool createObject( const SvGlobalName &aClassName ); diff --git a/reportdesign/source/core/sdr/ReportDrawPage.cxx b/reportdesign/source/core/sdr/ReportDrawPage.cxx index 00027a557a7b..06a088296798 100644 --- a/reportdesign/source/core/sdr/ReportDrawPage.cxx +++ b/reportdesign/source/core/sdr/ReportDrawPage.cxx @@ -128,7 +128,7 @@ uno::Reference< drawing::XShape > OReportDrawPage::CreateShape( SdrObject *pObj awt::Size aSz( aTmp.Width(), aTmp.Height() ); xObj->setVisualAreaSize( nAspect, aSz ); } - SvxOle2Shape* pShape = new SvxOle2Shape( pObj ); + SvxOle2Shape* pShape = new SvxOle2Shape( pObj, "" /*TODO?*/ ); xShape.set(*pShape,uno::UNO_QUERY); pShape->setShapeKind(pObj->GetObjIdentifier()); } diff --git a/svx/source/unodraw/shapeimpl.hxx b/svx/source/unodraw/shapeimpl.hxx index 4381094d380a..78aa366b4d88 100644 --- a/svx/source/unodraw/shapeimpl.hxx +++ b/svx/source/unodraw/shapeimpl.hxx @@ -36,7 +36,7 @@ protected: virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, css::uno::Any& rValue ) override; public: - explicit SvxPluginShape(SdrObject* pObj); + explicit SvxPluginShape(SdrObject* pObj, OUString referer); virtual ~SvxPluginShape() throw() override; virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; @@ -46,6 +46,7 @@ public: virtual void Create( SdrObject* pNewOpj, SvxDrawPage* pNewPage ) override; }; + class SvxAppletShape : public SvxOle2Shape { protected: @@ -54,7 +55,7 @@ protected: virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, css::uno::Any& rValue ) override; public: - explicit SvxAppletShape(SdrObject* pObj); + explicit SvxAppletShape(SdrObject* pObj, OUString referer); virtual ~SvxAppletShape() throw() override; virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; @@ -76,7 +77,7 @@ protected: css::uno::Any& rValue) override; public: - explicit SvxFrameShape(SdrObject* pObj); + explicit SvxFrameShape(SdrObject* pObj, OUString referer); virtual ~SvxFrameShape() throw() override; virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; diff --git a/svx/source/unodraw/unomod.cxx b/svx/source/unodraw/unomod.cxx index e3017b41ecfb..a0ee09645cd4 100644 --- a/svx/source/unodraw/unomod.cxx +++ b/svx/source/unodraw/unomod.cxx @@ -209,7 +209,11 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoDrawMSFactory::createInstanceWi { OUString arg; if ((ServiceSpecifier == "com.sun.star.drawing.GraphicObjectShape" - || ServiceSpecifier == "com.sun.star.drawing.MediaShape") + || ServiceSpecifier == "com.sun.star.drawing.AppletShape" + || ServiceSpecifier == "com.sun.star.drawing.FrameShape" + || ServiceSpecifier == "com.sun.star.drawing.OLE2Shape" + || ServiceSpecifier == "com.sun.star.drawing.MediaShape" + || ServiceSpecifier == "com.sun.star.drawing.PluginShape") && Arguments.getLength() == 1 && (Arguments[0] >>= arg)) { return create(ServiceSpecifier, arg); diff --git a/svx/source/unodraw/unopage.cxx b/svx/source/unodraw/unopage.cxx index 28082f35e75f..25f96b615fb3 100644 --- a/svx/source/unodraw/unopage.cxx +++ b/svx/source/unodraw/unopage.cxx @@ -702,13 +702,13 @@ SvxShape* SvxDrawPage::CreateShapeByTypeAndInventor( sal_uInt16 nType, SdrInvent pRet = new SvxGraphicObject( pObj ); break; case OBJ_FRAME: - pRet = new SvxFrameShape( pObj ); + pRet = new SvxFrameShape( pObj, referer ); break; case OBJ_OLE2_APPLET: - pRet = new SvxAppletShape( pObj ); + pRet = new SvxAppletShape( pObj, referer ); break; case OBJ_OLE2_PLUGIN: - pRet = new SvxPluginShape( pObj ); + pRet = new SvxPluginShape( pObj, referer ); break; case OBJ_OLE2: { @@ -736,17 +736,17 @@ SvxShape* SvxDrawPage::CreateShapeByTypeAndInventor( sal_uInt16 nType, SdrInvent if( aPluginClassId == aClassId ) { - pRet = new SvxPluginShape( pObj ); + pRet = new SvxPluginShape( pObj, referer ); nType = OBJ_OLE2_PLUGIN; } else if( aAppletClassId == aClassId ) { - pRet = new SvxAppletShape( pObj ); + pRet = new SvxAppletShape( pObj, referer ); nType = OBJ_OLE2_APPLET; } else if( aIFrameClassId == aClassId ) { - pRet = new SvxFrameShape( pObj ); + pRet = new SvxFrameShape( pObj, referer ); nType = OBJ_FRAME; } } @@ -756,7 +756,7 @@ SvxShape* SvxDrawPage::CreateShapeByTypeAndInventor( sal_uInt16 nType, SdrInvent if( pRet == nullptr ) { SvxUnoPropertyMapProvider& rSvxMapProvider = getSvxMapProvider(); - pRet = new SvxOle2Shape( pObj, rSvxMapProvider.GetMap(SVXMAP_OLE2), rSvxMapProvider.GetPropertySet(SVXMAP_OLE2, SdrObject::GetGlobalDrawObjectItemPool()) ); + pRet = new SvxOle2Shape( pObj, referer, rSvxMapProvider.GetMap(SVXMAP_OLE2), rSvxMapProvider.GetPropertySet(SVXMAP_OLE2, SdrObject::GetGlobalDrawObjectItemPool()) ); } } break; diff --git a/svx/source/unodraw/unoshap4.cxx b/svx/source/unodraw/unoshap4.cxx index 6dc18d6cf9e4..8765aa737a57 100644 --- a/svx/source/unodraw/unoshap4.cxx +++ b/svx/source/unodraw/unoshap4.cxx @@ -68,14 +68,16 @@ using namespace ::com::sun::star::container; using namespace ::com::sun::star::beans; -SvxOle2Shape::SvxOle2Shape(SdrObject* pObject) -: SvxShapeText( pObject, getSvxMapProvider().GetMap(SVXMAP_OLE2), - getSvxMapProvider().GetPropertySet(SVXMAP_OLE2,SdrObject::GetGlobalDrawObjectItemPool()) ) +SvxOle2Shape::SvxOle2Shape(SdrObject* pObject, OUString referer) + : SvxShapeText(pObject, getSvxMapProvider().GetMap(SVXMAP_OLE2), + getSvxMapProvider().GetPropertySet(SVXMAP_OLE2,SdrObject::GetGlobalDrawObjectItemPool())) + , referer_(std::move(referer)) { } -SvxOle2Shape::SvxOle2Shape(SdrObject* pObject, const SfxItemPropertyMapEntry* pPropertyMap, const SvxItemPropertySet* pPropertySet) -: SvxShapeText( pObject, pPropertyMap, pPropertySet ) +SvxOle2Shape::SvxOle2Shape(SdrObject* pObject, OUString referer, const SfxItemPropertyMapEntry* pPropertyMap, const SvxItemPropertySet* pPropertySet) + : SvxShapeText(pObject, pPropertyMap, pPropertySet) + , referer_(std::move(referer)) { } @@ -450,16 +452,18 @@ void SvxOle2Shape::createLink( const OUString& aLinkURL ) ::comphelper::IEmbeddedHelper* pPersist = GetSdrObject()->getSdrModelFromSdrObject().GetPersist(); - uno::Sequence< beans::PropertyValue > aMediaDescr( 1 ); + uno::Sequence< beans::PropertyValue > aMediaDescr( 2 ); aMediaDescr[0].Name = "URL"; aMediaDescr[0].Value <<= aLinkURL; + aMediaDescr[1].Name = "Referer"; + aMediaDescr[1].Value <<= referer_; uno::Reference< task::XInteractionHandler > xInteraction = pPersist->getInteractionHandler(); if ( xInteraction.is() ) { - aMediaDescr.realloc( 2 ); - aMediaDescr[1].Name = "InteractionHandler"; - aMediaDescr[1].Value <<= xInteraction; + aMediaDescr.realloc( 3 ); + aMediaDescr[2].Name = "InteractionHandler"; + aMediaDescr[2].Value <<= xInteraction; } //TODO/LATER: how to cope with creation failure?! @@ -560,8 +564,8 @@ OUString SvxOle2Shape::GetAndClearInitialFrameURL() return OUString(); } -SvxAppletShape::SvxAppletShape(SdrObject* pObject) - : SvxOle2Shape( pObject, getSvxMapProvider().GetMap(SVXMAP_APPLET), getSvxMapProvider().GetPropertySet(SVXMAP_APPLET, SdrObject::GetGlobalDrawObjectItemPool()) ) +SvxAppletShape::SvxAppletShape(SdrObject* pObject, OUString referer) + : SvxOle2Shape(pObject, std::move(referer), getSvxMapProvider().GetMap(SVXMAP_APPLET), getSvxMapProvider().GetPropertySet(SVXMAP_APPLET, SdrObject::GetGlobalDrawObjectItemPool())) { SetShapeType( "com.sun.star.drawing.AppletShape" ); } @@ -631,8 +635,8 @@ bool SvxAppletShape::getPropertyValueImpl( const OUString& rName, const SfxItemP } } -SvxPluginShape::SvxPluginShape(SdrObject* pObject) - : SvxOle2Shape( pObject, getSvxMapProvider().GetMap(SVXMAP_PLUGIN), getSvxMapProvider().GetPropertySet(SVXMAP_PLUGIN, SdrObject::GetGlobalDrawObjectItemPool()) ) +SvxPluginShape::SvxPluginShape(SdrObject* pObject, OUString referer) + : SvxOle2Shape(pObject, std::move(referer), getSvxMapProvider().GetMap(SVXMAP_PLUGIN), getSvxMapProvider().GetPropertySet(SVXMAP_PLUGIN, SdrObject::GetGlobalDrawObjectItemPool())) { SetShapeType( "com.sun.star.drawing.PluginShape" ); } @@ -702,9 +706,8 @@ bool SvxPluginShape::getPropertyValueImpl( const OUString& rName, const SfxItemP } } - -SvxFrameShape::SvxFrameShape(SdrObject* pObject) -: SvxOle2Shape( pObject, getSvxMapProvider().GetMap(SVXMAP_FRAME), getSvxMapProvider().GetPropertySet(SVXMAP_FRAME, SdrObject::GetGlobalDrawObjectItemPool()) ) +SvxFrameShape::SvxFrameShape(SdrObject* pObject, OUString referer) + : SvxOle2Shape(pObject, std::move(referer), getSvxMapProvider().GetMap(SVXMAP_FRAME), getSvxMapProvider().GetPropertySet(SVXMAP_FRAME, SdrObject::GetGlobalDrawObjectItemPool())) { SetShapeType( "com.sun.star.drawing.FrameShape" ); } @@ -785,6 +788,7 @@ bool SvxFrameShape::getPropertyValueImpl(const OUString& rName, const SfxItemPro return SvxOle2Shape::getPropertyValueImpl( rName, pProperty, rValue ); } } + SvxMediaShape::SvxMediaShape(SdrObject* pObj, OUString const & referer) : SvxShape( pObj, getSvxMapProvider().GetMap(SVXMAP_MEDIA), getSvxMapProvider().GetPropertySet(SVXMAP_MEDIA, SdrObject::GetGlobalDrawObjectItemPool()) ), referer_(referer) diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx index 30c303690d97..955ec011c5df 100644 --- a/xmloff/source/draw/ximpshap.cxx +++ b/xmloff/source/draw/ximpshap.cxx @@ -510,7 +510,11 @@ void SdXMLShapeContext::AddShape(OUString const & serviceName) xShape.set(xServiceFact->createInstance("com.sun.star.drawing.temporaryForXMLImportOLE2Shape"), uno::UNO_QUERY); } else if (serviceName == "com.sun.star.drawing.GraphicObjectShape" + || serviceName == "com.sun.star.drawing.AppletShape" + || serviceName == "com.sun.star.drawing.FrameShape" || serviceName == "com.sun.star.drawing.MediaShape" + || serviceName == "com.sun.star.drawing.OLE2Shape" + || serviceName == "com.sun.star.drawing.PluginShape" || serviceName == "com.sun.star.presentation.MediaShape") { css::uno::Sequence<css::uno::Any> args(1);