diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2013-11-20 14:43:45 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-11-20 14:44:27 +0100 |
commit | 5668e73beb30b95abc6520b7432c54972ca3ab2c (patch) | |
tree | b9772e4ab6a6f92d655c0bacbb364ce3b2a4eb18 /sd | |
parent | ba1c6c94fce9fd20e224a265475e0b80576a2dd9 (diff) |
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.
Change-Id: Ib2d0c7e4f7b02c4bdec0d8a90cee5e7e1bee8325
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/filter/ppt/pptin.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/animations/CustomAnimationDialog.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/dlg/filedlg.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/func/fuinsert.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/func/fusel.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/inc/unomodel.hxx | 8 | ||||
-rw-r--r-- | sd/source/ui/slideshow/slideshowimpl.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unomodel.cxx | 31 | ||||
-rw-r--r-- | sd/source/ui/view/drviewse.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/view/sdview4.cxx | 15 |
10 files changed, 53 insertions, 17 deletions
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx index 31243f8a884c..da9428cf4c4f 100644 --- a/sd/source/filter/ppt/pptin.cxx +++ b/sd/source/filter/ppt/pptin.cxx @@ -2667,7 +2667,7 @@ SdrObject* ImplSdPPTImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi } SdrObject::Free( pObj ), pObj = pMediaObj; // SJ: hoping that pObj is not inserted in any list - pMediaObj->setURL( aMediaURL ); + pMediaObj->setURL( aMediaURL, ""/*TODO?*/ ); } } } diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx b/sd/source/ui/animations/CustomAnimationDialog.cxx index 8af343d7c95f..809f3a86856c 100644 --- a/sd/source/ui/animations/CustomAnimationDialog.cxx +++ b/sd/source/ui/animations/CustomAnimationDialog.cxx @@ -1680,7 +1680,7 @@ void CustomAnimationEffectTabPage::onSoundPreview() if( nPos >= 2 ) try { const OUString aSoundURL( maSoundList[ nPos-2 ] ); - mxPlayer.set( avmedia::MediaWindow::createPlayer( aSoundURL ), uno::UNO_QUERY_THROW ); + mxPlayer.set( avmedia::MediaWindow::createPlayer( aSoundURL, "" ), uno::UNO_QUERY_THROW ); mxPlayer->start(); } catch( uno::Exception& ) diff --git a/sd/source/ui/dlg/filedlg.cxx b/sd/source/ui/dlg/filedlg.cxx index 731fe7d37ae8..ce3eb29fa9c2 100644 --- a/sd/source/ui/dlg/filedlg.cxx +++ b/sd/source/ui/dlg/filedlg.cxx @@ -139,7 +139,7 @@ IMPL_LINK_NOARG(SdFileDialog_Imp, PlayMusicHdl) { try { - mxPlayer.set( avmedia::MediaWindow::createPlayer( aUrl ), css::uno::UNO_QUERY_THROW ); + mxPlayer.set( avmedia::MediaWindow::createPlayer( aUrl, "" ), css::uno::UNO_QUERY_THROW ); mxPlayer->start(); maUpdateTimer.SetTimeout( 100 ); maUpdateTimer.Start(); diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx index 500ca888ba60..9f507024f3c0 100644 --- a/sd/source/ui/func/fuinsert.cxx +++ b/sd/source/ui/func/fuinsert.cxx @@ -692,7 +692,7 @@ void FuInsertAVMedia::DoExecute( SfxRequest& rReq ) if( mpWindow ) mpWindow->EnterWait(); - if( !::avmedia::MediaWindow::isMediaURL( aURL, true, &aPrefSize ) ) + if( !::avmedia::MediaWindow::isMediaURL( aURL, "", true, &aPrefSize ) ) { if( mpWindow ) mpWindow->LeaveWait(); diff --git a/sd/source/ui/func/fusel.cxx b/sd/source/ui/func/fusel.cxx index 61c4597f75b4..7e95f38b816f 100644 --- a/sd/source/ui/func/fusel.cxx +++ b/sd/source/ui/func/fusel.cxx @@ -1266,7 +1266,7 @@ sal_Bool FuSelection::AnimateObj(SdrObject* pObj, const Point& rPos) { try { - mxPlayer.set( avmedia::MediaWindow::createPlayer( pInfo->GetBookmark()), uno::UNO_QUERY_THROW ); + mxPlayer.set( avmedia::MediaWindow::createPlayer( pInfo->GetBookmark(), ""/*TODO?*/), uno::UNO_QUERY_THROW ); mxPlayer->start(); } catch( uno::Exception& ) diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx index e59faa9b1cfd..dc5d8332fa26 100644 --- a/sd/source/ui/inc/unomodel.hxx +++ b/sd/source/ui/inc/unomodel.hxx @@ -87,6 +87,9 @@ private: SdDrawDocument* mpDoc; bool mbDisposed; + css::uno::Reference<css::uno::XInterface> create( + OUString const & aServiceSpecifier, OUString const & referer); + SdPage* InsertSdPage( sal_uInt16 nPage, sal_Bool bDuplicate = sal_False ) throw(); const sal_Bool mbImpressDoc; @@ -179,6 +182,11 @@ public: // XMultiServiceFactory ( SvxFmMSFactory ) virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance( const OUString& aServiceSpecifier ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual css::uno::Reference<css::uno::XInterface> SAL_CALL + createInstanceWithArguments( + OUString const & ServiceSpecifier, + css::uno::Sequence<css::uno::Any> const & Arguments) + throw (css::uno::Exception, css::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getAvailableServiceNames( ) throw(::com::sun::star::uno::RuntimeException); // XServiceInfo diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index b974ceb8671d..2630ef33a72d 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -1562,7 +1562,7 @@ void SlideshowImpl::click( const Reference< XShape >& xShape, const ::com::sun:: { try { - mxPlayer.set(avmedia::MediaWindow::createPlayer(pEvent->maStrBookmark), uno::UNO_QUERY_THROW ); + mxPlayer.set(avmedia::MediaWindow::createPlayer(pEvent->maStrBookmark, ""/*TODO?*/), uno::UNO_QUERY_THROW ); mxPlayer->start(); } catch( uno::Exception& ) diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index a03775260e37..9d2a01109349 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -815,8 +815,9 @@ uno::Reference< drawing::XDrawPage > SAL_CALL SdXImpressDocument::getHandoutMast } // XMultiServiceFactory ( SvxFmMSFactory ) -uno::Reference< uno::XInterface > SAL_CALL SdXImpressDocument::createInstance( const OUString& aServiceSpecifier ) - throw(uno::Exception, uno::RuntimeException) + +css::uno::Reference<css::uno::XInterface> SdXImpressDocument::create( + OUString const & aServiceSpecifier, OUString const & referer) { ::SolarMutexGuard aGuard; @@ -1049,7 +1050,7 @@ uno::Reference< uno::XInterface > SAL_CALL SdXImpressDocument::createInstance( c } // create the API wrapper - pShape = CreateSvxShapeByTypeAndInventor( nType, SdrInventor ); + pShape = CreateSvxShapeByTypeAndInventor( nType, SdrInventor, referer ); // set shape type if( pShape && !mbClipBoard ) @@ -1059,7 +1060,7 @@ uno::Reference< uno::XInterface > SAL_CALL SdXImpressDocument::createInstance( c } else if ( aServiceSpecifier == "com.sun.star.drawing.TableShape" ) { - SvxShape* pShape = CreateSvxShapeByTypeAndInventor( OBJ_TABLE, SdrInventor ); + SvxShape* pShape = CreateSvxShapeByTypeAndInventor( OBJ_TABLE, SdrInventor, referer ); if( pShape && !mbClipBoard ) pShape->SetShapeType(aServiceSpecifier); @@ -1082,6 +1083,28 @@ uno::Reference< uno::XInterface > SAL_CALL SdXImpressDocument::createInstance( c return xRet; } +uno::Reference< uno::XInterface > SAL_CALL SdXImpressDocument::createInstance( const OUString& aServiceSpecifier ) + throw(uno::Exception, uno::RuntimeException) +{ + return create(aServiceSpecifier, ""); +} + +css::uno::Reference<css::uno::XInterface> +SdXImpressDocument::createInstanceWithArguments( + OUString const & ServiceSpecifier, + css::uno::Sequence<css::uno::Any> const & Arguments) + throw (css::uno::Exception, css::uno::RuntimeException) +{ + OUString arg; + if (ServiceSpecifier == "com.sun.star.presentation.MediaShape" + && Arguments.getLength() == 1 && (Arguments[0] >>= arg)) + { + return create(ServiceSpecifier, arg); + } + return SvxFmMSFactory::createInstanceWithArguments( + ServiceSpecifier, Arguments); +} + uno::Sequence< OUString > SAL_CALL SdXImpressDocument::getAvailableServiceNames() throw(uno::RuntimeException) { diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx index 150b7c75df17..556b32328400 100644 --- a/sd/source/ui/view/drviewse.cxx +++ b/sd/source/ui/view/drviewse.cxx @@ -1559,7 +1559,7 @@ void DrawViewShell::InsertURLButton(const OUString& rURL, const OUString& rText, xPropSet->setPropertyValue("TargetFrame" , Any( rTarget ) ); xPropSet->setPropertyValue( "ButtonType" , Any( form::FormButtonType_URL ) ); - if ( ::avmedia::MediaWindow::isMediaURL( rURL ) ) + if ( ::avmedia::MediaWindow::isMediaURL( rURL, ""/*TODO?*/ ) ) { xPropSet->setPropertyValue( "DispatchURLInternal" , Any( sal_True ) ); } @@ -1594,7 +1594,7 @@ void DrawViewShell::InsertURLButton(const OUString& rURL, const OUString& rText, xPropSet->setPropertyValue( "TargetFrame" , Any( rTarget ) ); xPropSet->setPropertyValue( "ButtonType" , Any( form::FormButtonType_URL ) ); - if ( ::avmedia::MediaWindow::isMediaURL( rURL ) ) + if ( ::avmedia::MediaWindow::isMediaURL( rURL, ""/*TODO?*/ ) ) xPropSet->setPropertyValue( "DispatchURLInternal" , Any( sal_True ) ); Point aPos; diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx index 16e5f5507114..bd729b51d6e4 100644 --- a/sd/source/ui/view/sdview4.cxx +++ b/sd/source/ui/view/sdview4.cxx @@ -301,7 +301,7 @@ SdrMediaObj* View::InsertMediaURL( const OUString& rMediaURL, sal_Int8& rAction, if( mnAction == DND_ACTION_LINK && pPickObj && pPV && pPickObj->ISA( SdrMediaObj ) ) { pNewMediaObj = static_cast< SdrMediaObj* >( pPickObj->Clone() ); - pNewMediaObj->setURL( realURL ); + pNewMediaObj->setURL( realURL, ""/*TODO?*/ ); BegUndo(SD_RESSTR(STR_UNDO_DRAGDROP)); ReplaceObjectAtView(pPickObj, *pPV, pNewMediaObj); @@ -332,7 +332,12 @@ SdrMediaObj* View::InsertMediaURL( const OUString& rMediaURL, sal_Int8& rAction, else InsertObjectAtView( pNewMediaObj, *pPV, SDRINSERT_SETDEFLAYER ); - pNewMediaObj->setURL( realURL ); + OUString referer; + DrawDocShell * sh = GetDocSh(); + if (sh != 0 && sh->HasName()) { + referer = sh->GetMedium()->GetName(); + } + pNewMediaObj->setURL( realURL, referer ); if( pPickObj ) { @@ -379,7 +384,7 @@ IMPL_LINK_NOARG(View, DropInsertFileHdl) aCurrentDropFile = aURL.GetMainURL( INetURLObject::NO_DECODE ); - if( !::avmedia::MediaWindow::isMediaURL( aCurrentDropFile ) ) + if( !::avmedia::MediaWindow::isMediaURL( aCurrentDropFile, ""/*TODO?*/ ) ) { if( !rGraphicFilter.ImportGraphic( aGraphic, aURL ) ) { @@ -440,8 +445,8 @@ IMPL_LINK_NOARG(View, DropInsertFileHdl) { Size aPrefSize; - if( ::avmedia::MediaWindow::isMediaURL( aCurrentDropFile ) && - ::avmedia::MediaWindow::isMediaURL( aCurrentDropFile, true, &aPrefSize ) ) + if( ::avmedia::MediaWindow::isMediaURL( aCurrentDropFile, ""/*TODO?*/ ) && + ::avmedia::MediaWindow::isMediaURL( aCurrentDropFile, ""/*TODO?*/, true, &aPrefSize ) ) { if( aPrefSize.Width() && aPrefSize.Height() ) { |