diff options
43 files changed, 183 insertions, 95 deletions
diff --git a/avmedia/source/framework/mediacontrol.cxx b/avmedia/source/framework/mediacontrol.cxx index fc67309f62b5..7facb1f26f1a 100644 --- a/avmedia/source/framework/mediacontrol.cxx +++ b/avmedia/source/framework/mediacontrol.cxx @@ -494,11 +494,11 @@ IMPL_LINK( MediaControl, implSelectHdl, ToolBox*, p ) if (::avmedia::MediaWindow::executeMediaURLDialog( GetParent(), aURL, 0)) { - if( !::avmedia::MediaWindow::isMediaURL( aURL, true ) ) + if( !::avmedia::MediaWindow::isMediaURL( aURL, ""/*TODO?*/, true ) ) ::avmedia::MediaWindow::executeFormatErrorBox( this ); else { - aExecItem.setURL( aURL, "" ); + aExecItem.setURL( aURL, "", ""/*TODO?*/ ); aExecItem.setState( MEDIASTATE_PLAY ); } } diff --git a/avmedia/source/framework/mediaitem.cxx b/avmedia/source/framework/mediaitem.cxx index 98359b1b0411..b57abfecb9ce 100644 --- a/avmedia/source/framework/mediaitem.cxx +++ b/avmedia/source/framework/mediaitem.cxx @@ -53,6 +53,7 @@ struct MediaItem::Impl { OUString m_URL; OUString m_TempFileURL; + OUString m_Referer; sal_uInt32 m_nMaskSet; MediaState m_eState; double m_fTime; @@ -76,6 +77,7 @@ struct MediaItem::Impl Impl(Impl const& rOther) : m_URL( rOther.m_URL ) , m_TempFileURL( rOther.m_TempFileURL ) + , m_Referer( rOther.m_Referer ) , m_nMaskSet( rOther.m_nMaskSet ) , m_eState( rOther.m_eState ) , m_fTime( rOther.m_fTime ) @@ -118,6 +120,7 @@ int MediaItem::operator==( const SfxPoolItem& rItem ) const MediaItem const& rOther(static_cast< const MediaItem& >(rItem)); return m_pImpl->m_nMaskSet == rOther.m_pImpl->m_nMaskSet && m_pImpl->m_URL == rOther.m_pImpl->m_URL + && m_pImpl->m_Referer == rOther.m_pImpl->m_Referer && m_pImpl->m_eState == rOther.m_pImpl->m_eState && m_pImpl->m_fDuration == rOther.m_pImpl->m_fDuration && m_pImpl->m_fTime == rOther.m_pImpl->m_fTime @@ -202,7 +205,7 @@ void MediaItem::merge( const MediaItem& rMediaItem ) const sal_uInt32 nMaskSet = rMediaItem.getMaskSet(); if( AVMEDIA_SETMASK_URL & nMaskSet ) - setURL( rMediaItem.getURL(), rMediaItem.getTempURL() ); + setURL( rMediaItem.getURL(), rMediaItem.getTempURL(), rMediaItem.getReferer() ); if( AVMEDIA_SETMASK_STATE & nMaskSet ) setState( rMediaItem.getState() ); @@ -235,11 +238,12 @@ sal_uInt32 MediaItem::getMaskSet() const //------------------------------------------------------------------------ -void MediaItem::setURL( const OUString& rURL, const OUString& rTempURL ) +void MediaItem::setURL( const OUString& rURL, const OUString& rTempURL, const OUString& rReferer ) { m_pImpl->m_nMaskSet |= AVMEDIA_SETMASK_URL; m_pImpl->m_URL = rURL; m_pImpl->m_TempFileURL = rTempURL; + m_pImpl->m_Referer = rReferer; } //------------------------------------------------------------------------ @@ -254,6 +258,11 @@ const OUString& MediaItem::getTempURL() const return m_pImpl->m_TempFileURL; } +const OUString& MediaItem::getReferer() const +{ + return m_pImpl->m_Referer; +} + //------------------------------------------------------------------------ void MediaItem::setState( MediaState eState ) diff --git a/avmedia/source/framework/mediaplayer.cxx b/avmedia/source/framework/mediaplayer.cxx index e5b35d308b51..bef6fc6cdef7 100644 --- a/avmedia/source/framework/mediaplayer.cxx +++ b/avmedia/source/framework/mediaplayer.cxx @@ -116,11 +116,11 @@ void MediaFloater::ToggleFloatingMode() // ----------------------------------------------------------------------------- -void MediaFloater::setURL( const OUString& rURL, bool bPlayImmediately ) +void MediaFloater::setURL( const OUString& rURL, const OUString& rReferer, bool bPlayImmediately ) { if( mpMediaWindow ) { - mpMediaWindow->setURL( rURL ); + mpMediaWindow->setURL( rURL, rReferer ); if( mpMediaWindow->isValid() && bPlayImmediately ) mpMediaWindow->start(); diff --git a/avmedia/source/framework/soundhandler.cxx b/avmedia/source/framework/soundhandler.cxx index 06658e9ad948..e56f86b7822d 100644 --- a/avmedia/source/framework/soundhandler.cxx +++ b/avmedia/source/framework/soundhandler.cxx @@ -264,11 +264,11 @@ void SAL_CALL SoundHandler::dispatchWithNotification(const css::util::URL& // SAFE { const ::osl::MutexGuard aLock( m_aLock ); + utl::MediaDescriptor aDescriptor(lDescriptor); + { //close streams otherwise on windows we can't reopen the file in the //media player when we pass the url to directx as it'll already be open - utl::MediaDescriptor aDescriptor(lDescriptor); - css::uno::Reference< css::io::XInputStream > xInputStream = aDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_INPUTSTREAM(), css::uno::Reference< css::io::XInputStream >()); @@ -290,7 +290,7 @@ void SAL_CALL SoundHandler::dispatchWithNotification(const css::util::URL& try { m_bError = false; - m_xPlayer.set( avmedia::MediaWindow::createPlayer( aURL.Complete ), css::uno::UNO_QUERY_THROW ); + m_xPlayer.set( avmedia::MediaWindow::createPlayer( aURL.Complete, aDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_REFERRER(), OUString()) ), css::uno::UNO_QUERY_THROW ); // OK- we can start async playing ... // Count this request and initialize self-holder against dieing by uno ref count ... m_xSelfHold = css::uno::Reference< css::uno::XInterface >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY); @@ -346,10 +346,11 @@ OUString SAL_CALL SoundHandler::detect( css::uno::Sequence< css::beans::Property // Analyze given descriptor to find filename or input stream or ... utl::MediaDescriptor aDescriptor(lDescriptor); OUString sURL = aDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_URL(), OUString()); + OUString sReferer = aDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_REFERRER(), OUString()); if ( (sURL.getLength() ) && - (avmedia::MediaWindow::isMediaURL(sURL)) + (avmedia::MediaWindow::isMediaURL(sURL, sReferer)) ) { // If the file type is supported depends on the OS, so... diff --git a/avmedia/source/viewer/mediawindow.cxx b/avmedia/source/viewer/mediawindow.cxx index 45c9901035c7..2ef1f9a06ebf 100644 --- a/avmedia/source/viewer/mediawindow.cxx +++ b/avmedia/source/viewer/mediawindow.cxx @@ -56,9 +56,9 @@ MediaWindow::~MediaWindow() {} // ------------------------------------------------------------------------- -void MediaWindow::setURL( const OUString& rURL ) +void MediaWindow::setURL( const OUString& rURL, const OUString& rReferer ) { - mpImpl->setURL( rURL, OUString() ); + mpImpl->setURL( rURL, OUString(), rReferer ); } // ------------------------------------------------------------------------- @@ -328,7 +328,7 @@ void MediaWindow::executeFormatErrorBox( Window* pParent ) // ------------------------------------------------------------------------- -bool MediaWindow::isMediaURL( const OUString& rURL, bool bDeep, Size* pPreferredSizePixel ) +bool MediaWindow::isMediaURL( const OUString& rURL, const OUString& rReferer, bool bDeep, Size* pPreferredSizePixel ) { const INetURLObject aURL( rURL ); bool bRet = false; @@ -340,7 +340,8 @@ bool MediaWindow::isMediaURL( const OUString& rURL, bool bDeep, Size* pPreferred try { uno::Reference< media::XPlayer > xPlayer( priv::MediaWindowImpl::createPlayer( - aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) ) ); + aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ), + rReferer ) ); if( xPlayer.is() ) { @@ -383,18 +384,19 @@ bool MediaWindow::isMediaURL( const OUString& rURL, bool bDeep, Size* pPreferred // ------------------------------------------------------------------------- -uno::Reference< media::XPlayer > MediaWindow::createPlayer( const OUString& rURL ) +uno::Reference< media::XPlayer > MediaWindow::createPlayer( const OUString& rURL, const OUString& rReferer ) { - return priv::MediaWindowImpl::createPlayer( rURL ); + return priv::MediaWindowImpl::createPlayer( rURL, rReferer ); } // ------------------------------------------------------------------------- uno::Reference< graphic::XGraphic > MediaWindow::grabFrame( const OUString& rURL, + const OUString& rReferer, bool bAllowToCreateReplacementGraphic, double fMediaTime ) { - uno::Reference< media::XPlayer > xPlayer( createPlayer( rURL ) ); + uno::Reference< media::XPlayer > xPlayer( createPlayer( rURL, rReferer ) ); uno::Reference< graphic::XGraphic > xRet; ::std::auto_ptr< Graphic > apGraphic; diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx index 4157f7a07610..2c2239691f7d 100644 --- a/avmedia/source/viewer/mediawindow_impl.cxx +++ b/avmedia/source/viewer/mediawindow_impl.cxx @@ -29,6 +29,7 @@ #include <comphelper/processfactory.hxx> #include <osl/mutex.hxx> #include <tools/urlobj.hxx> +#include <unotools/securityoptions.hxx> #include <vcl/svapp.hxx> #include <com/sun/star/awt/SystemPointer.hpp> @@ -204,9 +205,13 @@ MediaWindowImpl::~MediaWindowImpl() delete mpMediaWindowControl; } -uno::Reference< media::XPlayer > MediaWindowImpl::createPlayer( const OUString& rURL ) +uno::Reference< media::XPlayer > MediaWindowImpl::createPlayer( const OUString& rURL, const OUString& rReferer ) { uno::Reference< media::XPlayer > xPlayer; + if (SvtSecurityOptions().isUntrustedReferer(rReferer)) { + return xPlayer; + } + uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); static const char * aServiceManagers[] = { @@ -246,7 +251,7 @@ uno::Reference< media::XPlayer > MediaWindowImpl::createPlayer( const OUString& } void MediaWindowImpl::setURL( const OUString& rURL, - OUString const& rTempURL) + OUString const& rTempURL, OUString const& rReferer) { if( rURL != getURL() ) { @@ -278,7 +283,7 @@ void MediaWindowImpl::setURL( const OUString& rURL, } mxPlayer = createPlayer( - (!mTempFileURL.isEmpty()) ? mTempFileURL : maFileURL ); + (!mTempFileURL.isEmpty()) ? mTempFileURL : maFileURL, rReferer ); onURLChanged(); } } @@ -326,7 +331,7 @@ void MediaWindowImpl::updateMediaItem( MediaItem& rItem ) const rItem.setMute( isMute() ); rItem.setVolumeDB( getVolumeDB() ); rItem.setZoom( getZoom() ); - rItem.setURL( getURL(), mTempFileURL ); + rItem.setURL( getURL(), mTempFileURL, ""/*TODO?*/ ); } void MediaWindowImpl::executeMediaItem( const MediaItem& rItem ) @@ -335,7 +340,7 @@ void MediaWindowImpl::executeMediaItem( const MediaItem& rItem ) // set URL first if( nMaskSet & AVMEDIA_SETMASK_URL ) - setURL( rItem.getURL(), rItem.getTempURL() ); + setURL( rItem.getURL(), rItem.getTempURL(), rItem.getReferer() ); // set different states next if( nMaskSet & AVMEDIA_SETMASK_TIME ) diff --git a/avmedia/source/viewer/mediawindow_impl.hxx b/avmedia/source/viewer/mediawindow_impl.hxx index 340ab128e944..42d95108b86b 100644 --- a/avmedia/source/viewer/mediawindow_impl.hxx +++ b/avmedia/source/viewer/mediawindow_impl.hxx @@ -91,9 +91,9 @@ namespace avmedia MediaWindowImpl( Window* parent, MediaWindow* pMediaWindow, bool bInternalMediaControl ); virtual ~MediaWindowImpl(); - static ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > createPlayer( const OUString& rURL ); + static ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > createPlayer( const OUString& rURL, const OUString& rReferer ); - void setURL( const OUString& rURL, OUString const& rTempURL ); + void setURL( const OUString& rURL, OUString const& rTempURL, OUString const& rReferer ); const OUString& getURL() const; diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx index ddfb173f622c..ee03268f76a0 100644 --- a/cui/source/dialogs/cuigaldlg.cxx +++ b/cui/source/dialogs/cuigaldlg.cxx @@ -1109,9 +1109,9 @@ void TPGalleryThemeProperties::DoPreview() ErrorHandler::HandleError( ERRCODE_IO_NOTEXISTSPATH ); GetParent()->EnterWait(); } - else if( ::avmedia::MediaWindow::isMediaURL( _aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) ) ) + else if( ::avmedia::MediaWindow::isMediaURL( _aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ), "" ) ) { - xMediaPlayer = ::avmedia::MediaWindow::createPlayer( _aURL.GetMainURL( INetURLObject::NO_DECODE ) ); + xMediaPlayer = ::avmedia::MediaWindow::createPlayer( _aURL.GetMainURL( INetURLObject::NO_DECODE ), "" ); if( xMediaPlayer.is() ) xMediaPlayer->start(); } diff --git a/include/avmedia/mediaitem.hxx b/include/avmedia/mediaitem.hxx index 0e39e31870d5..7304e40095d4 100644 --- a/include/avmedia/mediaitem.hxx +++ b/include/avmedia/mediaitem.hxx @@ -106,11 +106,14 @@ public: ::com::sun::star::media::ZoomLevel getZoom() const; void setURL( const OUString& rURL, - const OUString& rTempURL); + const OUString& rTempURL, + const OUString& rReferer); const OUString& getURL() const; const OUString& getTempURL() const; + const OUString& getReferer() const; + private: struct Impl; diff --git a/include/avmedia/mediaplayer.hxx b/include/avmedia/mediaplayer.hxx index bd7706c64d8b..dbcbe6fc9ba3 100644 --- a/include/avmedia/mediaplayer.hxx +++ b/include/avmedia/mediaplayer.hxx @@ -46,7 +46,7 @@ public: MediaFloater( SfxBindings* pBindings, SfxChildWindow* pCW, Window* pParent ); ~MediaFloater(); - void setURL( const OUString& rURL, bool bPlayImmediately ); + void setURL( const OUString& rURL, const OUString& rReferer, bool bPlayImmediately ); void dispatchCurrentURL(); diff --git a/include/avmedia/mediawindow.hxx b/include/avmedia/mediawindow.hxx index 74ef95da9f75..b2bca33302fe 100644 --- a/include/avmedia/mediawindow.hxx +++ b/include/avmedia/mediawindow.hxx @@ -57,7 +57,7 @@ namespace avmedia MediaWindow( Window* parent, bool bInternalMediaControl ); virtual ~MediaWindow(); - void setURL( const OUString& rURL ); + void setURL( const OUString& rURL, const OUString& rReferer ); const OUString& getURL() const; bool isValid() const; @@ -101,11 +101,11 @@ namespace avmedia static bool executeMediaURLDialog( Window* pParent, OUString& rURL, bool *const o_pbLink ); static void executeFormatErrorBox( Window* pParent ); - static bool isMediaURL( const OUString& rURL, bool bDeep = false, Size* pPreferredSizePixel = NULL ); + static bool isMediaURL( const OUString& rURL, const OUString& rReferer, bool bDeep = false, Size* pPreferredSizePixel = NULL ); - static ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > createPlayer( const OUString& rURL ); + static ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > createPlayer( const OUString& rURL, const OUString& rReferer ); - static ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > grabFrame( const OUString& rURL, + static ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > grabFrame( const OUString& rURL, const OUString& rReferer, bool bAllowToCreateReplacementGraphic = false, double fMediaTime = AVMEDIA_FRAMEGRABBER_DEFAULTFRAME ); diff --git a/include/svx/svdomedia.hxx b/include/svx/svdomedia.hxx index 849f8ef0bb90..018adfe5e2b6 100644 --- a/include/svx/svdomedia.hxx +++ b/include/svx/svdomedia.hxx @@ -60,7 +60,7 @@ public: public: - void setURL( const OUString& rURL ); + void setURL( const OUString& rURL, const OUString& rReferer ); const OUString& getURL() const; void setMediaProperties( const ::avmedia::MediaItem& rState ); diff --git a/include/svx/unoapi.hxx b/include/svx/unoapi.hxx index 3bab954c37ae..1f81aa9e218c 100644 --- a/include/svx/unoapi.hxx +++ b/include/svx/unoapi.hxx @@ -38,7 +38,7 @@ class SfxItemPool; * Creates a StarOffice API wrapper with the given type and inventor * Deprecated: This will be replaced with a function returning XShape. */ -SVX_DLLPUBLIC SvxShape* CreateSvxShapeByTypeAndInventor( sal_uInt16 nType, sal_uInt32 nInventor ) throw(); +SVX_DLLPUBLIC SvxShape* CreateSvxShapeByTypeAndInventor( sal_uInt16 nType, sal_uInt32 nInventor, OUString const & referer ) throw(); /** Returns a StarOffice API wrapper for the given SdrObject */ SVX_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > GetXShapeForSdrObject( SdrObject* pObj ) throw (); diff --git a/include/svx/unoshape.hxx b/include/svx/unoshape.hxx index f7558b834fdf..c27f8b7c6bf1 100644 --- a/include/svx/unoshape.hxx +++ b/include/svx/unoshape.hxx @@ -857,13 +857,16 @@ public: class SvxMediaShape : public SvxShape { public: - SvxMediaShape( SdrObject* pObj ) throw(); + SvxMediaShape( SdrObject* pObj, OUString const & referer ) throw(); virtual ~SvxMediaShape() throw(); protected: // overide these for special property handling in subcasses. Return true if property is handled virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + +private: + OUString referer_; }; #endif diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx index ce289d17ba0a..9be1ee22e7b3 100644 --- a/sc/inc/docuno.hxx +++ b/sc/inc/docuno.hxx @@ -106,6 +106,10 @@ private: com::sun::star::uno::Reference<com::sun::star::uno::XAggregation> GetFormatter(); void HandleCalculateEvents(); + css::uno::Reference<css::uno::XInterface> create( + OUString const & aServiceSpecifier, + css::uno::Sequence<css::uno::Any> const * arguments); + OUString maBuildId; protected: const SfxItemPropertySet& GetPropertySet() const { return aPropSet; } diff --git a/sc/source/ui/drawfunc/fuins1.cxx b/sc/source/ui/drawfunc/fuins1.cxx index f509bdc82c51..eb184d0d5d33 100644 --- a/sc/source/ui/drawfunc/fuins1.cxx +++ b/sc/source/ui/drawfunc/fuins1.cxx @@ -192,7 +192,7 @@ static void lcl_InsertMedia( const OUString& rMediaURL, bool bApi, SdrMediaObj* pObj = new SdrMediaObj( Rectangle( aInsertPos, aSize ) ); pObj->SetModel(pData->GetDocument()->GetDrawLayer()); // set before setURL - pObj->setURL( realURL ); + pObj->setURL( realURL, ""/*TODO?*/ ); pView->InsertObjectAtView( pObj, *pPV, bApi ? SDRINSERT_DONTMARK : 0 ); } @@ -338,7 +338,7 @@ FuInsertMedia::FuInsertMedia( ScTabViewShell* pViewSh, if( pWin ) pWin->EnterWait(); - if( !::avmedia::MediaWindow::isMediaURL( aURL, true, &aPrefSize ) ) + if( !::avmedia::MediaWindow::isMediaURL( aURL, ""/*TODO?*/, true, &aPrefSize ) ) { if( pWin ) pWin->LeaveWait(); diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index e55fe2119707..a1312aaa2045 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -1908,11 +1908,10 @@ SC_IMPL_DUMMY_PROPERTY_LISTENER( ScModelObj ) // XMultiServiceFactory -uno::Reference<uno::XInterface> SAL_CALL ScModelObj::createInstance( - const OUString& aServiceSpecifier ) - throw(uno::Exception, uno::RuntimeException) +css::uno::Reference<css::uno::XInterface> ScModelObj::create( + OUString const & aServiceSpecifier, + css::uno::Sequence<css::uno::Any> const * arguments) { - SolarMutexGuard aGuard; uno::Reference<uno::XInterface> xRet; OUString aNameStr(aServiceSpecifier); sal_uInt16 nType = ScServiceProvider::GetProviderType(aNameStr); @@ -1966,7 +1965,10 @@ uno::Reference<uno::XInterface> SAL_CALL ScModelObj::createInstance( try { - xRet.set(SvxFmMSFactory::createInstance(aServiceSpecifier)); + xRet = arguments == 0 + ? SvxFmMSFactory::createInstance(aServiceSpecifier) + : SvxFmMSFactory::createInstanceWithArguments( + aServiceSpecifier, *arguments); // extra block to force deletion of the temporary before ScShapeObj ctor (setDelegator) } catch ( lang::ServiceNotRegisteredException & ) @@ -1987,6 +1989,14 @@ uno::Reference<uno::XInterface> SAL_CALL ScModelObj::createInstance( return xRet; } +uno::Reference<uno::XInterface> SAL_CALL ScModelObj::createInstance( + const OUString& aServiceSpecifier ) + throw(uno::Exception, uno::RuntimeException) +{ + SolarMutexGuard aGuard; + return create(aServiceSpecifier, 0); +} + uno::Reference<uno::XInterface> SAL_CALL ScModelObj::createInstanceWithArguments( const OUString& ServiceSpecifier, const uno::Sequence<uno::Any>& aArgs ) @@ -1995,7 +2005,7 @@ uno::Reference<uno::XInterface> SAL_CALL ScModelObj::createInstanceWithArguments //! unterscheiden zwischen eigenen Services und denen vom Drawing-Layer? SolarMutexGuard aGuard; - uno::Reference<uno::XInterface> xInt(createInstance(ServiceSpecifier)); + uno::Reference<uno::XInterface> xInt(create(ServiceSpecifier, &aArgs)); if ( aArgs.getLength() ) { diff --git a/sc/source/ui/view/tabvwshg.cxx b/sc/source/ui/view/tabvwshg.cxx index 37e086262b8e..e256e55c40ca 100644 --- a/sc/source/ui/view/tabvwshg.cxx +++ b/sc/source/ui/view/tabvwshg.cxx @@ -88,7 +88,7 @@ void ScTabViewShell::InsertURLButton( const OUString& rName, const OUString& rUR aAny <<= eButtonType; xPropSet->setPropertyValue("ButtonType", aAny ); - if ( ::avmedia::MediaWindow::isMediaURL( rURL ) ) + if ( ::avmedia::MediaWindow::isMediaURL( rURL, ""/*TODO?*/ ) ) { aAny <<= sal_True; xPropSet->setPropertyValue("DispatchURLInternal", aAny ); diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx index 7217b9a3a2fc..ab8d24203ea1 100644 --- a/sc/source/ui/view/viewfun4.cxx +++ b/sc/source/ui/view/viewfun4.cxx @@ -588,7 +588,7 @@ sal_Bool ScViewFunc::PasteFile( const Point& rPos, const OUString& rFile, sal_Bo OUString aStrURL = aURL.GetMainURL( INetURLObject::NO_DECODE ); // is it a media URL? - if( ::avmedia::MediaWindow::isMediaURL( aStrURL ) ) + if( ::avmedia::MediaWindow::isMediaURL( aStrURL, ""/*TODO?*/ ) ) { const SfxStringItem aMediaURLItem( SID_INSERT_AVMEDIA, aStrURL ); return sal_Bool( 0 != GetViewData()->GetDispatcher().Execute( 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() ) { diff --git a/slideshow/source/engine/shapes/viewmediashape.cxx b/slideshow/source/engine/shapes/viewmediashape.cxx index b788a0ff6274..004dce8bad63 100644 --- a/slideshow/source/engine/shapes/viewmediashape.cxx +++ b/slideshow/source/engine/shapes/viewmediashape.cxx @@ -407,7 +407,7 @@ namespace slideshow { if( !rMediaURL.isEmpty() ) { - mxPlayer.set( avmedia::MediaWindow::createPlayer( rMediaURL ), + mxPlayer.set( avmedia::MediaWindow::createPlayer( rMediaURL, ""/*TODO!*/ ), uno::UNO_QUERY ); } } diff --git a/slideshow/source/engine/soundplayer.cxx b/slideshow/source/engine/soundplayer.cxx index 4f0eb6fb2b99..e91bf4bc490f 100644 --- a/slideshow/source/engine/soundplayer.cxx +++ b/slideshow/source/engine/soundplayer.cxx @@ -99,7 +99,7 @@ namespace slideshow { const INetURLObject aURL( rSoundURL ); mxPlayer.set( avmedia::MediaWindow::createPlayer( - aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) ), + aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ), ""/*TODO!*/ ), uno::UNO_QUERY); } catch( uno::RuntimeException& ) diff --git a/svx/source/gallery2/galctrl.cxx b/svx/source/gallery2/galctrl.cxx index f600d3dd9b32..6fd35dc5907b 100644 --- a/svx/source/gallery2/galctrl.cxx +++ b/svx/source/gallery2/galctrl.cxx @@ -73,7 +73,7 @@ bool GalleryPreview::SetGraphic( const INetURLObject& _aURL ) { bool bRet = true; Graphic aGraphic; - if( ::avmedia::MediaWindow::isMediaURL( _aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) ) ) + if( ::avmedia::MediaWindow::isMediaURL( _aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ), "" ) ) { aGraphic = BitmapEx( GAL_RES( RID_SVXBMP_GALLERY_MEDIA ) ); } @@ -254,7 +254,7 @@ void GalleryPreview::PreviewMedia( const INetURLObject& rURL ) } if( pFloater ) - pFloater->setURL( rURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ), true ); + pFloater->setURL( rURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ), "", true ); } } diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx index d82d74302ac2..8a4534d84128 100644 --- a/svx/source/gallery2/galtheme.cxx +++ b/svx/source/gallery2/galtheme.cxx @@ -1111,7 +1111,7 @@ sal_Bool GalleryTheme::InsertURL( const INetURLObject& rURL, sal_uIntPtr nInsert else pNewObj = (SgaObject*) new SgaObjectBmp( aGraphic, rURL, aFormat ); } - else if( ::avmedia::MediaWindow::isMediaURL( rURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) ) ) + else if( ::avmedia::MediaWindow::isMediaURL( rURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ), ""/*TODO?*/ ) ) pNewObj = (SgaObject*) new SgaObjectSound( rURL ); if( pNewObj && InsertObject( *pNewObj, nInsertPos ) ) diff --git a/svx/source/svdraw/svdomedia.cxx b/svx/source/svdraw/svdomedia.cxx index 292822554b64..4f994528a963 100644 --- a/svx/source/svdraw/svdomedia.cxx +++ b/svx/source/svdraw/svdomedia.cxx @@ -189,7 +189,7 @@ uno::Reference< graphic::XGraphic > SdrMediaObj::getSnapshot() OUString aRealURL = m_pImpl->m_MediaProperties.getTempURL(); if( aRealURL.isEmpty() ) aRealURL = m_pImpl->m_MediaProperties.getURL(); - m_pImpl->m_xCachedSnapshot = avmedia::MediaWindow::grabFrame( aRealURL, true ); + m_pImpl->m_xCachedSnapshot = avmedia::MediaWindow::grabFrame( aRealURL, m_pImpl->m_MediaProperties.getReferer(), true ); } return m_pImpl->m_xCachedSnapshot; } @@ -242,11 +242,11 @@ void SdrMediaObj::AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly / // ------------------------------------------------------------------------------ -void SdrMediaObj::setURL( const OUString& rURL) +void SdrMediaObj::setURL( const OUString& rURL, const OUString& rReferer ) { ::avmedia::MediaItem aURLItem; - aURLItem.setURL( rURL, "" ); + aURLItem.setURL( rURL, "", rReferer ); setMediaProperties( aURLItem ); } @@ -374,24 +374,24 @@ void SdrMediaObj::mediaPropertiesChanged( const ::avmedia::MediaItem& rNewProper if (bSuccess) { m_pImpl->m_pTempFile.reset(new MediaTempFile(tempFileURL)); - m_pImpl->m_MediaProperties.setURL(url, tempFileURL); + m_pImpl->m_MediaProperties.setURL(url, tempFileURL, rNewProperties.getReferer()); } else // this case is for Clone via operator= { m_pImpl->m_pTempFile.reset(); - m_pImpl->m_MediaProperties.setURL("", ""); + m_pImpl->m_MediaProperties.setURL("", "", ""); } } else { m_pImpl->m_MediaProperties.setURL(url, - rNewProperties.getTempURL()); + rNewProperties.getTempURL(), rNewProperties.getReferer()); } } else { m_pImpl->m_pTempFile.reset(); - m_pImpl->m_MediaProperties.setURL(url, ""); + m_pImpl->m_MediaProperties.setURL(url, "", rNewProperties.getReferer()); } bBroadcastChanged = true; } diff --git a/svx/source/unodraw/unomod.cxx b/svx/source/unodraw/unomod.cxx index fe66f10884f3..06ee08fa605f 100644 --- a/svx/source/unodraw/unomod.cxx +++ b/svx/source/unodraw/unomod.cxx @@ -216,7 +216,8 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoDrawMSFactory::createInstanceWi throw( uno::Exception, uno::RuntimeException ) { OUString arg; - if (ServiceSpecifier == "com.sun.star.drawing.GraphicObjectShape" + if ((ServiceSpecifier == "com.sun.star.drawing.GraphicObjectShape" + || ServiceSpecifier == "com.sun.star.drawing.MediaShape") && Arguments.getLength() == 1 && (Arguments[0] >>= arg)) { return create(ServiceSpecifier, arg); @@ -508,7 +509,7 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoDrawingModel::createInstance( c } // create the API wrapper - pShape = CreateSvxShapeByTypeAndInventor( nType, SdrInventor ); + pShape = CreateSvxShapeByTypeAndInventor( nType, SdrInventor, "" ); // set shape type if( pShape ) diff --git a/svx/source/unodraw/unopage.cxx b/svx/source/unodraw/unopage.cxx index 4af2f5253b1f..073ff34065a5 100644 --- a/svx/source/unodraw/unopage.cxx +++ b/svx/source/unodraw/unopage.cxx @@ -735,7 +735,7 @@ SvxShape* SvxDrawPage::CreateShapeByTypeAndInventor( sal_uInt16 nType, sal_uInt3 pRet = new SvxCustomShape( pObj ); break; case OBJ_MEDIA: - pRet = new SvxMediaShape( pObj ); + pRet = new SvxMediaShape( pObj, referer ); break; case OBJ_TABLE: pRet = new SvxTableShape( pObj ); @@ -826,9 +826,9 @@ uno::Sequence< OUString > SAL_CALL SvxDrawPage::getSupportedServiceNames() throw return aSeq; } -SvxShape* CreateSvxShapeByTypeAndInventor( sal_uInt16 nType, sal_uInt32 nInventor ) throw() +SvxShape* CreateSvxShapeByTypeAndInventor( sal_uInt16 nType, sal_uInt32 nInventor, OUString const & referer ) throw() { - return SvxDrawPage::CreateShapeByTypeAndInventor( nType, nInventor ); + return SvxDrawPage::CreateShapeByTypeAndInventor( nType, nInventor, 0, 0, referer ); } void SvxDrawPage::ChangeModel( SdrModel* pNewModel ) diff --git a/svx/source/unodraw/unoshap4.cxx b/svx/source/unodraw/unoshap4.cxx index 53b02048f409..e932821b60d0 100644 --- a/svx/source/unodraw/unoshap4.cxx +++ b/svx/source/unodraw/unoshap4.cxx @@ -789,8 +789,9 @@ bool SvxFrameShape::getPropertyValueImpl( const OUString& rName, const SfxItemPr * * ***********************************************************************/ -SvxMediaShape::SvxMediaShape( SdrObject* pObj ) throw() -: SvxShape( pObj, getSvxMapProvider().GetMap(SVXMAP_MEDIA), getSvxMapProvider().GetPropertySet(SVXMAP_MEDIA, SdrObject::GetGlobalDrawObjectItemPool()) ) +SvxMediaShape::SvxMediaShape( SdrObject* pObj, OUString const & referer ) throw() +: SvxShape( pObj, getSvxMapProvider().GetMap(SVXMAP_MEDIA), getSvxMapProvider().GetPropertySet(SVXMAP_MEDIA, SdrObject::GetGlobalDrawObjectItemPool()) ), + referer_(referer) { SetShapeType( OUString( "com.sun.star.drawing.MediaShape" ) ); } @@ -818,7 +819,7 @@ bool SvxMediaShape::setPropertyValueImpl( const OUString& rName, const SfxItemPr if( rValue >>= aURL ) { bOk = true; - aItem.setURL( aURL, "" ); + aItem.setURL( aURL, "", referer_ ); } } break; diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx index ccad770c8e83..53f3c52670dc 100644 --- a/sw/inc/unotxdoc.hxx +++ b/sw/inc/unotxdoc.hxx @@ -216,6 +216,10 @@ private: void GetBodyText(); void GetNumberFormatter(); + css::uno::Reference<css::uno::XInterface> create( + OUString const & rServiceName, + css::uno::Sequence<css::uno::Any> const * arguments); + // used for XRenderable implementation SfxViewShell * GuessViewShell( /* out */ bool &rbIsSwSrcView, const css::uno::Reference< css::frame::XController > xController = css::uno::Reference< css::frame::XController >() ); SwDoc * GetRenderDoc( SfxViewShell *&rpView, const css::uno::Any& rSelection, bool bIsPDFExport ); diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx index 3c496c70accb..045cf6c3e4e9 100644 --- a/sw/source/ui/dochdl/swdtflvr.cxx +++ b/sw/source/ui/dochdl/swdtflvr.cxx @@ -2478,7 +2478,7 @@ int SwTransferable::_PasteFileName( TransferableDataHelper& rData, aMediaURL.SetSmartURL( sFile ); const OUString aMediaURLStr( aMediaURL.GetMainURL( INetURLObject::NO_DECODE ) ); - if( ::avmedia::MediaWindow::isMediaURL( aMediaURLStr ) ) + if( ::avmedia::MediaWindow::isMediaURL( aMediaURLStr, ""/*TODO?*/ ) ) { const SfxStringItem aMediaURLItem( SID_INSERT_AVMEDIA, aMediaURLStr ); rSh.GetView().GetViewFrame()->GetDispatcher()->Execute( diff --git a/sw/source/ui/shells/grfshex.cxx b/sw/source/ui/shells/grfshex.cxx index 1c7ea14300ca..60988bac1736 100644 --- a/sw/source/ui/shells/grfshex.cxx +++ b/sw/source/ui/shells/grfshex.cxx @@ -86,7 +86,7 @@ bool SwTextShell::InsertMediaDlg( SfxRequest& rReq ) if( pWindow ) pWindow->EnterWait(); - if( !::avmedia::MediaWindow::isMediaURL( aURL, true, &aPrefSize ) ) + if( !::avmedia::MediaWindow::isMediaURL( aURL, "", true, &aPrefSize ) ) { if( pWindow ) pWindow->LeaveWait(); @@ -138,7 +138,7 @@ bool SwTextShell::InsertMediaDlg( SfxRequest& rReq ) SdrMediaObj* pObj = new SdrMediaObj( Rectangle( aPos, aSize ) ); pObj->SetModel(rSh.GetDoc()->GetDrawModel()); // set before setURL - pObj->setURL( realURL ); + pObj->setURL( realURL, "" ); rSh.EnterStdMode(); rSh.SwFEShell::InsertDrawObj( *pObj, aPos ); bRet = true; diff --git a/sw/source/ui/shells/textdrw.cxx b/sw/source/ui/shells/textdrw.cxx index a85ed464ff0f..5b49b0e4597f 100644 --- a/sw/source/ui/shells/textdrw.cxx +++ b/sw/source/ui/shells/textdrw.cxx @@ -104,7 +104,7 @@ void SwBaseShell::InsertURLButton(const OUString& rURL, const OUString& rTarget, aTmp.setValue( &eButtonType, ::getCppuType((const form::FormButtonType*)0)); xPropSet->setPropertyValue( "ButtonType", aTmp ); - if ( ::avmedia::MediaWindow::isMediaURL( rURL ) ) + if ( ::avmedia::MediaWindow::isMediaURL( rURL, ""/*TODO?*/ ) ) { // #105638# OJ aTmp <<= sal_True; diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index d14009bcc271..888109aaff1a 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -1631,8 +1631,9 @@ void SwXTextDocument::InitNewDoc() } #define COM_SUN_STAR__DRAWING_LENGTH 13 -Reference< XInterface > SwXTextDocument::createInstance(const OUString& rServiceName) - throw( Exception, RuntimeException ) +css::uno::Reference<css::uno::XInterface> SwXTextDocument::create( + OUString const & rServiceName, + css::uno::Sequence<css::uno::Any> const * arguments) { SolarMutexGuard aGuard; if(!IsValid()) @@ -1715,7 +1716,10 @@ Reference< XInterface > SwXTextDocument::createInstance(const OUString& rServic aTmpServiceName = "com.sun.star.drawing.OLE2Shape"; } //here search for the draw service - Reference< XInterface > xTmp = SvxFmMSFactory::createInstance(aTmpServiceName); + Reference< XInterface > xTmp = arguments == 0 + ? SvxFmMSFactory::createInstance(aTmpServiceName) + : SvxFmMSFactory::createInstanceWithArguments( + aTmpServiceName, *arguments); if(bShape) { nIndex = COM_SUN_STAR__DRAWING_LENGTH; @@ -1735,15 +1739,18 @@ Reference< XInterface > SwXTextDocument::createInstance(const OUString& rServic return xRet; } +Reference< XInterface > SwXTextDocument::createInstance(const OUString& rServiceName) + throw( Exception, RuntimeException ) +{ + return create(rServiceName, 0); +} + Reference< XInterface > SwXTextDocument::createInstanceWithArguments( const OUString& ServiceSpecifier, - const Sequence< Any >& /*Arguments*/) + const Sequence< Any >& Arguments) throw( Exception, RuntimeException ) { - Reference< XInterface > xInt = createInstance(ServiceSpecifier); - // The Any-Sequence is for initializing objects that are dependent - // on parameters necessarily - so far we have not. - return xInt; + return create(ServiceSpecifier, &Arguments); } Sequence< OUString > SwXTextDocument::getAvailableServiceNames(void) diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx index 001b47154f57..14a0d081c629 100644 --- a/xmloff/source/draw/ximpshap.cxx +++ b/xmloff/source/draw/ximpshap.cxx @@ -494,7 +494,9 @@ void SdXMLShapeContext::AddShape(OUString const & serviceName) { xShape = uno::Reference< drawing::XShape >(xServiceFact->createInstance("com.sun.star.drawing.temporaryForXMLImportOLE2Shape"), uno::UNO_QUERY); } - else if (serviceName == "com.sun.star.drawing.GraphicObjectShape") + else if (serviceName == "com.sun.star.drawing.GraphicObjectShape" + || serviceName == "com.sun.star.drawing.MediaShape" + || serviceName == "com.sun.star.presentation.MediaShape") { css::uno::Sequence<css::uno::Any> args(1); args[0] <<= GetImport().GetDocumentBase(); |