summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2013-11-20 14:43:45 +0100
committerStephan Bergmann <sbergman@redhat.com>2013-11-20 14:44:27 +0100
commit5668e73beb30b95abc6520b7432c54972ca3ab2c (patch)
treeb9772e4ab6a6f92d655c0bacbb364ce3b2a4eb18 /svx
parentba1c6c94fce9fd20e224a265475e0b80576a2dd9 (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 'svx')
-rw-r--r--svx/source/gallery2/galctrl.cxx4
-rw-r--r--svx/source/gallery2/galtheme.cxx2
-rw-r--r--svx/source/svdraw/svdomedia.cxx14
-rw-r--r--svx/source/unodraw/unomod.cxx5
-rw-r--r--svx/source/unodraw/unopage.cxx6
-rw-r--r--svx/source/unodraw/unoshap4.cxx7
6 files changed, 20 insertions, 18 deletions
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;