desktop/qa/desktop_lib/test_desktop_lib.cxx | 6 ++- embeddedobj/source/commonembedding/persistence.cxx | 24 ++++++++----- 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, 69 insertions(+), 46 deletions(-)
New commits: commit 5d1fa34717f9a21695b1f55e85ae54a723b94fc2 Author: Thorsten Behrens <thorsten.behr...@allotropia.de> AuthorDate: Wed Dec 6 12:15:44 2023 +0100 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Thu Dec 7 13:04:28 2023 +0100 No FrameWeld yet on ViewFrame This was only added via https://gerrit.libreoffice.org/c/core/+/113795 Change-Id: Ibe7c57c83a5c6fe0fd3b6f8e7682811e3549e0bd diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx b/sw/source/uibase/wrtsh/wrtsh2.cxx index afb468011feb..459abd7f8b33 100644 --- a/sw/source/uibase/wrtsh/wrtsh2.cxx +++ b/sw/source/uibase/wrtsh/wrtsh2.cxx @@ -497,7 +497,7 @@ static void LoadURL(SwView& rView, const OUString& rURL, LoadUrlFlags nFilter, OSL_ENSURE( pDShell, "No DocShell?!"); SfxViewFrame& rViewFrame = *rView.GetViewFrame(); - if (!SfxObjectShell::AllowedLinkProtocolFromDocument(rURL, pDShell, rViewFrame.GetFrameWeld())) + if (!SfxObjectShell::AllowedLinkProtocolFromDocument(rURL, pDShell, rView.GetFrameWeld())) return; // We are doing tiledRendering, let the client handles the URL loading, commit 9b2b9bd52db660bea45edc1da228a4a23add0c6d Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Mon Nov 27 11:21:57 2023 +0100 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Thu Dec 7 10:36:39 2023 +0100 CppunitTest_desktop_lib: adjust asserts so this works again Change-Id: Id6aba3d9203e3fe4e95771a895d1de50a2030908 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159990 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> (cherry picked from commit ececb678b8362e3be8e02768ddd5e4197d87dc2a) diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 1bb185dd5b9e..f32fb09d9270 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2396,7 +2396,8 @@ void DesktopLOKTest::testInsertCertificate_PEM_ODT() } int nState = pDocument->m_pDocumentClass->getSignatureState(pDocument); - CPPUNIT_ASSERT_EQUAL(int(1), nState); + // OK or NOTVALIDATED (signature is OK, but certificate could not be validated) + CPPUNIT_ASSERT(nState == 1 || nState == 4); } void DesktopLOKTest::testInsertCertificate_PEM_DOCX() @@ -2454,7 +2455,8 @@ void DesktopLOKTest::testInsertCertificate_PEM_DOCX() } int nState = pDocument->m_pDocumentClass->getSignatureState(pDocument); - CPPUNIT_ASSERT_EQUAL(int(5), nState); + // PARTIAL_OK or NOTVALIDATED_PARTIAL_OK + CPPUNIT_ASSERT(nState == 5 || nState == 6); } void DesktopLOKTest::testSignDocument_PEM_PDF() commit 8dac6878119178a45d2ded9ddd584499b77cc26a 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: Thu Dec 7 00:48:10 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 aef0d7ee630aee82eb2c52f9cc89197dd5cafd52 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: Thu Dec 7 00:48:05 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 38c12cf7204f..afb468011feb 100644 --- a/sw/source/uibase/wrtsh/wrtsh2.cxx +++ b/sw/source/uibase/wrtsh/wrtsh2.cxx @@ -493,9 +493,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 054cc9bb0815519ead2da03fb297280cb5017861 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: Thu Dec 7 00:47:59 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 7a4088f0c497..38c12cf7204f 100644 --- a/sw/source/uibase/wrtsh/wrtsh2.cxx +++ b/sw/source/uibase/wrtsh/wrtsh2.cxx @@ -493,11 +493,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, @@ -522,7 +522,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 ); @@ -543,7 +543,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 cf520c31e23120410386a77e9d8121d6274b6546 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: Thu Dec 7 00:40:39 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 f8368eb6b389..e568b1232a71 100644 --- a/embeddedobj/source/commonembedding/persistence.cxx +++ b/embeddedobj/source/commonembedding/persistence.cxx @@ -54,10 +54,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; @@ -362,14 +363,8 @@ 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 ); @@ -392,10 +387,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 == "Referer") + { + 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 @@ -437,7 +444,6 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadLink_Impl() } - OUString OCommonEmbeddedObject::GetFilterName( sal_Int32 nVersion ) const { OUString aFilterName = GetPresetFilterName(); commit 281c1a3ef4eb4e541461cb3f582d6540d11fe8ef 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: Thu Dec 7 00:40:34 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 8922c4917760..f8368eb6b389 100644 --- a/embeddedobj/source/commonembedding/persistence.cxx +++ b/embeddedobj/source/commonembedding/persistence.cxx @@ -78,7 +78,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 d23692d09aa473b22347a9c3573b74ccf73a0ba0 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: Thu Dec 7 00:40:29 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);