diff options
author | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-04-04 13:14:45 +0200 |
---|---|---|
committer | root <root@linux-3qg3.site> | 2014-04-04 19:06:11 +0200 |
commit | f470f3c72efb3fad109e62247c4d0abebc359345 (patch) | |
tree | f3a7969c13bae5d43ba5bc09935117c78deb5742 /svx | |
parent | 97b20c9deee46195357896197440cc1cc43d3452 (diff) |
Introduce a new media shape property to handle mime type
Default mime-type for all media objects:
"application/vnd.sun.star.media"
The problem of missing mime-type detection
still exists. For now only glTF model has
a concrete type.
Change-Id: I4dca26c1c47a564579bbed926bffa3aa5eda6c04
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/svdraw/svdomedia.cxx | 8 | ||||
-rw-r--r-- | svx/source/unodraw/unoprov.cxx | 1 | ||||
-rw-r--r-- | svx/source/unodraw/unoshap4.cxx | 21 |
3 files changed, 26 insertions, 4 deletions
diff --git a/svx/source/svdraw/svdomedia.cxx b/svx/source/svdraw/svdomedia.cxx index e60b44632e1b..8bc8f4ddd7ab 100644 --- a/svx/source/svdraw/svdomedia.cxx +++ b/svx/source/svdraw/svdomedia.cxx @@ -244,10 +244,11 @@ void SdrMediaObj::AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly / -void SdrMediaObj::setURL( const OUString& rURL, const OUString& rReferer ) +void SdrMediaObj::setURL( const OUString& rURL, const OUString& rReferer, const OUString& rMimeType ) { ::avmedia::MediaItem aURLItem; - + if( !rMimeType.isEmpty() ) + m_pImpl->m_MediaProperties.setMimeType(rMimeType); aURLItem.setURL( rURL, "", rReferer ); setMediaProperties( aURLItem ); } @@ -418,6 +419,9 @@ void SdrMediaObj::mediaPropertiesChanged( const ::avmedia::MediaItem& rNewProper const sal_uInt32 nMaskSet = rNewProperties.getMaskSet(); // use only a subset of MediaItem properties for own own properties + if( AVMEDIA_SETMASK_MIME_TYPE & nMaskSet ) + m_pImpl->m_MediaProperties.setMimeType( rNewProperties.getMimeType() ); + if( ( AVMEDIA_SETMASK_URL & nMaskSet ) && ( rNewProperties.getURL() != getURL() )) { diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx index 61518d2b44c8..a17c36c90987 100644 --- a/svx/source/unodraw/unoprov.cxx +++ b/svx/source/unodraw/unoprov.cxx @@ -730,6 +730,7 @@ SfxItemPropertyMapEntry const * ImplGetSvxMediaShapePropertyMap() { OUString(UNO_NAME_MISC_OBJ_DESCRIPTION), OWN_ATTR_MISC_OBJ_DESCRIPTION , ::getCppuType((const OUString*)0), 0, 0}, {OUString("PrivateStream"), OWN_ATTR_MEDIA_STREAM, cppu::UnoType<css::io::XInputStream>::get(), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, {OUString("PrivateTempFileURL"), OWN_ATTR_MEDIA_TEMPFILEURL, ::getCppuType((const OUString*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, + { OUString("MediaMimeType"), OWN_ATTR_MEDIA_MIMETYPE, ::getCppuType((const OUString*)0), 0, 0}, { OUString(), 0, css::uno::Type(), 0, 0 } }; diff --git a/svx/source/unodraw/unoshap4.cxx b/svx/source/unodraw/unoshap4.cxx index e422239cbcf4..239328d6ccab 100644 --- a/svx/source/unodraw/unoshap4.cxx +++ b/svx/source/unodraw/unoshap4.cxx @@ -805,7 +805,8 @@ SvxMediaShape::~SvxMediaShape() throw() bool SvxMediaShape::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) { - if( (pProperty->nWID >= OWN_ATTR_MEDIA_URL) && (pProperty->nWID <= OWN_ATTR_MEDIA_ZOOM) ) + if( ((pProperty->nWID >= OWN_ATTR_MEDIA_URL) && (pProperty->nWID <= OWN_ATTR_MEDIA_ZOOM)) + || (pProperty->nWID == OWN_ATTR_MEDIA_MIMETYPE) ) { SdrMediaObj* pMedia = static_cast< SdrMediaObj* >( mpObj.get() ); ::avmedia::MediaItem aItem; @@ -872,6 +873,17 @@ bool SvxMediaShape::setPropertyValueImpl( const OUString& rName, const SfxItemPr } break; + case OWN_ATTR_MEDIA_MIMETYPE: + { + OUString sMimeType; + if( rValue >>= sMimeType ) + { + bOk = true; + aItem.setMimeType( sMimeType ); + } + } + break; + default: OSL_FAIL("SvxMediaShape::setPropertyValueImpl(), unknown argument!"); } @@ -897,7 +909,8 @@ bool SvxMediaShape::getPropertyValueImpl( const OUString& rName, const SfxItemPr if ( ((pProperty->nWID >= OWN_ATTR_MEDIA_URL) && (pProperty->nWID <= OWN_ATTR_MEDIA_ZOOM)) || (pProperty->nWID == OWN_ATTR_MEDIA_STREAM) - || (pProperty->nWID == OWN_ATTR_MEDIA_TEMPFILEURL)) + || (pProperty->nWID == OWN_ATTR_MEDIA_TEMPFILEURL) + || (pProperty->nWID == OWN_ATTR_MEDIA_MIMETYPE)) { SdrMediaObj* pMedia = static_cast< SdrMediaObj* >( mpObj.get() ); const ::avmedia::MediaItem aItem( pMedia->getMediaProperties() ); @@ -932,6 +945,10 @@ bool SvxMediaShape::getPropertyValueImpl( const OUString& rName, const SfxItemPr rValue <<= aItem.getTempURL(); break; + case OWN_ATTR_MEDIA_MIMETYPE: + rValue <<= aItem.getMimeType(); + break; + default: OSL_FAIL("SvxMediaShape::getPropertyValueImpl(), unknown property!"); } |