summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZolnai Tamás <tamas.zolnai@collabora.com>2014-04-04 13:14:45 +0200
committerroot <root@linux-3qg3.site>2014-04-04 19:06:11 +0200
commitf470f3c72efb3fad109e62247c4d0abebc359345 (patch)
treef3a7969c13bae5d43ba5bc09935117c78deb5742
parent97b20c9deee46195357896197440cc1cc43d3452 (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
-rw-r--r--avmedia/source/framework/mediaitem.cxx24
-rw-r--r--avmedia/source/inc/mediamisc.hxx7
-rw-r--r--avmedia/source/viewer/mediawindow_impl.cxx76
-rw-r--r--avmedia/source/viewer/mediawindow_impl.hxx8
-rw-r--r--include/avmedia/mediaitem.hxx3
-rw-r--r--include/svl/solar.hrc2
-rw-r--r--include/svx/svdomedia.hxx2
-rw-r--r--include/svx/unoshprp.hxx3
-rw-r--r--sd/source/ui/inc/View.hxx2
-rw-r--r--sd/source/ui/view/sdview4.cxx10
-rw-r--r--svx/source/svdraw/svdomedia.cxx8
-rw-r--r--svx/source/unodraw/unoprov.cxx1
-rw-r--r--svx/source/unodraw/unoshap4.cxx21
-rw-r--r--xmloff/source/draw/shapeexport.cxx13
-rw-r--r--xmloff/source/draw/ximpshap.cxx2
15 files changed, 127 insertions, 55 deletions
diff --git a/avmedia/source/framework/mediaitem.cxx b/avmedia/source/framework/mediaitem.cxx
index 32f6f043ca0e..1c06ebcadf18 100644
--- a/avmedia/source/framework/mediaitem.cxx
+++ b/avmedia/source/framework/mediaitem.cxx
@@ -36,6 +36,7 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/storagehelper.hxx>
+#include "mediamisc.hxx"
using namespace ::com::sun::star;
@@ -50,6 +51,7 @@ struct MediaItem::Impl
OUString m_URL;
OUString m_TempFileURL;
OUString m_Referer;
+ OUString m_sMimeType;
sal_uInt32 m_nMaskSet;
MediaState m_eState;
double m_fTime;
@@ -74,6 +76,7 @@ struct MediaItem::Impl
: m_URL( rOther.m_URL )
, m_TempFileURL( rOther.m_TempFileURL )
, m_Referer( rOther.m_Referer )
+ , m_sMimeType( rOther.m_sMimeType )
, m_nMaskSet( rOther.m_nMaskSet )
, m_eState( rOther.m_eState )
, m_fTime( rOther.m_fTime )
@@ -109,6 +112,7 @@ bool MediaItem::operator==( const SfxPoolItem& rItem ) const
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_sMimeType == rOther.m_pImpl->m_sMimeType
&& 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
@@ -135,7 +139,7 @@ SfxItemPresentation MediaItem::GetPresentation( SfxItemPresentation,
bool MediaItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 ) const
{
- uno::Sequence< uno::Any > aSeq( 9 );
+ uno::Sequence< uno::Any > aSeq( 10 );
aSeq[ 0 ] <<= m_pImpl->m_URL;
aSeq[ 1 ] <<= m_pImpl->m_nMaskSet;
@@ -146,6 +150,7 @@ bool MediaItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 ) const
aSeq[ 6 ] <<= m_pImpl->m_bLoop;
aSeq[ 7 ] <<= m_pImpl->m_bMute;
aSeq[ 8 ] <<= m_pImpl->m_eZoom;
+ aSeq[ 9 ] <<= m_pImpl->m_sMimeType;
rVal <<= aSeq;
@@ -157,7 +162,7 @@ bool MediaItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 )
uno::Sequence< uno::Any > aSeq;
bool bRet = false;
- if( ( rVal >>= aSeq ) && ( aSeq.getLength() == 9 ) )
+ if( ( rVal >>= aSeq ) && ( aSeq.getLength() == 10 ) )
{
sal_Int32 nInt32 = 0;
@@ -171,6 +176,7 @@ bool MediaItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 )
aSeq[ 6 ] >>= m_pImpl->m_bLoop;
aSeq[ 7 ] >>= m_pImpl->m_bMute;
aSeq[ 8 ] >>= m_pImpl->m_eZoom;
+ aSeq[ 9 ] >>= m_pImpl->m_sMimeType;
bRet = true;
}
@@ -185,6 +191,9 @@ void MediaItem::merge( const MediaItem& rMediaItem )
if( AVMEDIA_SETMASK_URL & nMaskSet )
setURL( rMediaItem.getURL(), rMediaItem.getTempURL(), rMediaItem.getReferer() );
+ if( AVMEDIA_SETMASK_MIME_TYPE & nMaskSet )
+ setMimeType( rMediaItem.getMimeType() );
+
if( AVMEDIA_SETMASK_STATE & nMaskSet )
setState( rMediaItem.getState() );
@@ -235,6 +244,17 @@ const OUString& MediaItem::getReferer() const
return m_pImpl->m_Referer;
}
+void MediaItem::setMimeType( const OUString& rMimeType )
+{
+ m_pImpl->m_nMaskSet |= AVMEDIA_SETMASK_MIME_TYPE;
+ m_pImpl->m_sMimeType = rMimeType;
+}
+
+OUString MediaItem::getMimeType() const
+{
+ return !m_pImpl->m_sMimeType.isEmpty() ? m_pImpl->m_sMimeType : AVMEDIA_MIMETYPE_COMMON;
+}
+
void MediaItem::setState( MediaState eState )
{
m_pImpl->m_eState = eState;
diff --git a/avmedia/source/inc/mediamisc.hxx b/avmedia/source/inc/mediamisc.hxx
index 9d04cd662341..19d5edc7ecac 100644
--- a/avmedia/source/inc/mediamisc.hxx
+++ b/avmedia/source/inc/mediamisc.hxx
@@ -37,6 +37,13 @@ class ResMgr;
#endif
#endif
+#define AVMEDIA_OPENGL_MANAGER_SERVICE_NAME "com.sun.star.media.Manager_OpenGL"
+
+// Mime types
+#define AVMEDIA_MIMETYPE_COMMON "application/vnd.sun.star.media"
+#define AVMEDIA_MIMETYPE_JSON "application/vnd.gltf+json"
+
+
namespace avmedia
{
ResMgr* GetResMgr();
diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx
index 43416d3e760a..f24c6e18c214 100644
--- a/avmedia/source/viewer/mediawindow_impl.cxx
+++ b/avmedia/source/viewer/mediawindow_impl.cxx
@@ -205,51 +205,67 @@ MediaWindowImpl::~MediaWindowImpl()
delete mpMediaWindowControl;
}
-uno::Reference< media::XPlayer > MediaWindowImpl::createPlayer( const OUString& rURL, const OUString& rReferer )
+uno::Reference< media::XPlayer > MediaWindowImpl::createPlayer( const OUString& rURL, const OUString& rReferer, OUString* pMimeType )
{
+
uno::Reference< media::XPlayer > xPlayer;
if (SvtSecurityOptions().isUntrustedReferer(rReferer)) {
return xPlayer;
}
-
uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
- static const char * aServiceManagers[] = {
- AVMEDIA_MANAGER_SERVICE_PREFERRED,
- AVMEDIA_MANAGER_SERVICE_NAME,
+ if ( !pMimeType || *pMimeType == AVMEDIA_MIMETYPE_COMMON )
+ {
+
+ static const char * aServiceManagers[] = {
+ AVMEDIA_MANAGER_SERVICE_PREFERRED,
+ AVMEDIA_MANAGER_SERVICE_NAME,
// a fallback path just for gstreamer which has
// two significant versions deployed at once ...
#ifdef AVMEDIA_MANAGER_SERVICE_NAME_OLD
- AVMEDIA_MANAGER_SERVICE_NAME_OLD
+ AVMEDIA_MANAGER_SERVICE_NAME_OLD
#endif
- };
+ };
- for( sal_uInt32 i = 0; !xPlayer.is() && i < SAL_N_ELEMENTS( aServiceManagers ); ++i )
- {
- const OUString aServiceName( aServiceManagers[ i ],
- strlen( aServiceManagers[ i ] ),
- RTL_TEXTENCODING_ASCII_US );
-
- try {
- uno::Reference< media::XManager > xManager (
- xContext->getServiceManager()->createInstanceWithContext(aServiceName, xContext),
- uno::UNO_QUERY );
- if( xManager.is() )
- xPlayer = uno::Reference< media::XPlayer >( xManager->createPlayer( rURL ),
- uno::UNO_QUERY );
- else
- SAL_WARN( "avmedia",
- "failed to create media player service " << aServiceName );
- } catch ( const uno::Exception &e ) {
- SAL_WARN( "avmedia",
- "couldn't create media player " << aServiceName
- << ", exception '" << e.Message << '\'');
+ for( sal_uInt32 i = 0; !xPlayer.is() && i < SAL_N_ELEMENTS( aServiceManagers ); ++i )
+ {
+ const OUString aServiceName( aServiceManagers[ i ],
+ strlen( aServiceManagers[ i ] ),
+ RTL_TEXTENCODING_ASCII_US );
+
+ xPlayer = createPlayer(rURL, aServiceName, xContext);
}
}
+ else if ( *pMimeType == AVMEDIA_MIMETYPE_JSON )
+ {
+ xPlayer = createPlayer(rURL, AVMEDIA_OPENGL_MANAGER_SERVICE_NAME, xContext);
+ }
return xPlayer;
}
+uno::Reference< media::XPlayer > MediaWindowImpl::createPlayer(
+ const OUString& rURL, const OUString& rManagerServName,
+ uno::Reference< uno::XComponentContext > xContext)
+{
+ uno::Reference< media::XPlayer > xPlayer;
+ try
+ {
+ uno::Reference< media::XManager > xManager (
+ xContext->getServiceManager()->createInstanceWithContext(rManagerServName, xContext),
+ uno::UNO_QUERY );
+ if( xManager.is() )
+ xPlayer = uno::Reference< media::XPlayer >( xManager->createPlayer( rURL ), uno::UNO_QUERY );
+ else
+ SAL_WARN( "avmedia", "failed to create media player service " << rManagerServName );
+ } catch ( const uno::Exception &e )
+ {
+ SAL_WARN( "avmedia", "couldn't create media player " << rManagerServName
+ << ", exception '" << e.Message << '\'');
+ }
+ return xPlayer;
+}
+
void MediaWindowImpl::setURL( const OUString& rURL,
OUString const& rTempURL, OUString const& rReferer)
{
@@ -283,8 +299,7 @@ void MediaWindowImpl::setURL( const OUString& rURL,
maFileURL = rURL;
}
- mxPlayer = createPlayer(
- (!mTempFileURL.isEmpty()) ? mTempFileURL : maFileURL, rReferer );
+ mxPlayer = createPlayer((!mTempFileURL.isEmpty()) ? mTempFileURL : maFileURL, rReferer, &m_sMimeType );
onURLChanged();
}
}
@@ -341,7 +356,10 @@ void MediaWindowImpl::executeMediaItem( const MediaItem& rItem )
// set URL first
if( nMaskSet & AVMEDIA_SETMASK_URL )
+ {
+ m_sMimeType = rItem.getMimeType();
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 fd8bab7aa653..e0018639fc96 100644
--- a/avmedia/source/viewer/mediawindow_impl.hxx
+++ b/avmedia/source/viewer/mediawindow_impl.hxx
@@ -29,6 +29,9 @@ namespace com { namespace sun { namespace star { namespace media {
class XPlayer;
class XPlayerWindow;
} } } }
+namespace com { namespace sun { namespace star { namespace uno {
+ class XComponentContext;
+} } } }
class BitmapEx;
namespace avmedia
@@ -91,7 +94,7 @@ 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, const OUString& rReferer );
+ static ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > createPlayer( const OUString& rURL, const OUString& rReferer, OUString* pMimeType = 0 );
void setURL( const OUString& rURL, OUString const& rTempURL, OUString const& rReferer );
@@ -158,9 +161,12 @@ namespace avmedia
void onURLChanged();
+ static ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > createPlayer( const OUString& rURL, const OUString& rManagerServName, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext);
+
OUString maFileURL;
OUString mTempFileURL;
OUString maReferer;
+ OUString m_sMimeType;
::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > mxPlayer;
::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayerWindow > mxPlayerWindow;
MediaWindow* mpMediaWindow;
diff --git a/include/avmedia/mediaitem.hxx b/include/avmedia/mediaitem.hxx
index 7fec0bd63244..4ccb6feadbc2 100644
--- a/include/avmedia/mediaitem.hxx
+++ b/include/avmedia/mediaitem.hxx
@@ -38,6 +38,7 @@
#define AVMEDIA_SETMASK_VOLUMEDB ((sal_uInt32)(0x00000020))
#define AVMEDIA_SETMASK_ZOOM ((sal_uInt32)(0x00000040))
#define AVMEDIA_SETMASK_URL ((sal_uInt32)(0x00000080))
+#define AVMEDIA_SETMASK_MIME_TYPE ((sal_uInt32)(0x00000100))
#define AVMEDIA_SETMASK_ALL ((sal_uInt32)(0xffffffff))
class SvStream;
@@ -111,6 +112,8 @@ public:
const OUString& rReferer);
const OUString& getURL() const;
+ void setMimeType( const OUString& rMimeType );
+ OUString getMimeType() const;
const OUString& getTempURL() const;
const OUString& getReferer() const;
diff --git a/include/svl/solar.hrc b/include/svl/solar.hrc
index c399a1a8a595..8978487dcb93 100644
--- a/include/svl/solar.hrc
+++ b/include/svl/solar.hrc
@@ -23,7 +23,7 @@
// defines ------------------------------------------------------------------
#define OWN_ATTR_VALUE_START 3900
-#define OWN_ATTR_VALUE_END 3991
+#define OWN_ATTR_VALUE_END 3992
#define RID_SFX_START 260
// RID_SFX_END 9999
diff --git a/include/svx/svdomedia.hxx b/include/svx/svdomedia.hxx
index b9690e0f1dfc..b8c4c672927e 100644
--- a/include/svx/svdomedia.hxx
+++ b/include/svx/svdomedia.hxx
@@ -60,7 +60,7 @@ public:
public:
- void setURL( const OUString& rURL, const OUString& rReferer );
+ void setURL( const OUString& rURL, const OUString& rReferer, const OUString& rMimeType = OUString() );
const OUString& getURL() const;
void setMediaProperties( const ::avmedia::MediaItem& rState );
diff --git a/include/svx/unoshprp.hxx b/include/svx/unoshprp.hxx
index 665712e1f91c..40b4f64c6b80 100644
--- a/include/svx/unoshprp.hxx
+++ b/include/svx/unoshprp.hxx
@@ -179,7 +179,8 @@
#define OWN_ATTR_MEDIA_STREAM (OWN_ATTR_VALUE_START+89)
#define OWN_ATTR_MEDIA_TEMPFILEURL (OWN_ATTR_VALUE_START+90)
#define OWN_ATTR_INTEROPGRABBAG (OWN_ATTR_VALUE_START+91)
-// ATTENTION: maximum is OWN_ATTR_VALUE_START+91, see include/svl/solar.hrc
+#define OWN_ATTR_MEDIA_MIMETYPE (OWN_ATTR_VALUE_START+92)
+// ATTENTION: maximum is OWN_ATTR_VALUE_START+92, see include/svl/solar.hrc
// #FontWork#
#define FONTWORK_PROPERTIES \
diff --git a/sd/source/ui/inc/View.hxx b/sd/source/ui/inc/View.hxx
index 85936ed89196..234d1f363c20 100644
--- a/sd/source/ui/inc/View.hxx
+++ b/sd/source/ui/inc/View.hxx
@@ -149,7 +149,7 @@ public:
const Point& rPos, const Size& rSize,
bool const bLink );
- SdrMediaObj* InsertMediaObj( const OUString& rURL, sal_Int8& rAction,
+ SdrMediaObj* InsertMediaObj( const OUString& rURL, const OUString& rMimeType, sal_Int8& rAction,
const Point& rPos, const Size& rSize );
bool PasteRTFTable( SotStorageStreamRef xStm, SdrPage* pPage, sal_uLong nPasteOptions );
diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx
index 770d2928c340..04a3c8595ce1 100644
--- a/sd/source/ui/view/sdview4.cxx
+++ b/sd/source/ui/view/sdview4.cxx
@@ -286,7 +286,7 @@ SdrMediaObj* View::InsertMediaURL( const OUString& rMediaURL, sal_Int8& rAction,
if (!bRet) { return 0; }
}
- return InsertMediaObj( realURL, rAction, rPos, rSize );
+ return InsertMediaObj( realURL, "application/vnd.sun.star.media", rAction, rPos, rSize );
}
SdrMediaObj* View::Insert3DModelURL(
@@ -307,10 +307,10 @@ SdrMediaObj* View::Insert3DModelURL(
if (!bRet) { return 0; }
}
- return InsertMediaObj( sRealURL, rAction, rPos, rSize );
+ return InsertMediaObj( sRealURL, "application/vnd.gltf+json", rAction, rPos, rSize );
}
-SdrMediaObj* View::InsertMediaObj( const OUString& rMediaURL, sal_Int8& rAction,
+SdrMediaObj* View::InsertMediaObj( const OUString& rMediaURL, const OUString& rMimeType, sal_Int8& rAction,
const Point& rPos, const Size& rSize )
{
SdrEndTextEdit();
@@ -335,7 +335,7 @@ SdrMediaObj* View::InsertMediaObj( const OUString& rMediaURL, sal_Int8& rAction,
if( mnAction == DND_ACTION_LINK && pPickObj && pPV && pPickObj->ISA( SdrMediaObj ) )
{
pNewMediaObj = static_cast< SdrMediaObj* >( pPickObj->Clone() );
- pNewMediaObj->setURL( rMediaURL, ""/*TODO?*/ );
+ pNewMediaObj->setURL( rMediaURL, ""/*TODO?*/, rMimeType );
BegUndo(SD_RESSTR(STR_UNDO_DRAGDROP));
ReplaceObjectAtView(pPickObj, *pPV, pNewMediaObj);
@@ -371,7 +371,7 @@ SdrMediaObj* View::InsertMediaObj( const OUString& rMediaURL, sal_Int8& rAction,
if (sh != 0 && sh->HasName()) {
referer = sh->GetMedium()->GetName();
}
- pNewMediaObj->setURL( rMediaURL, referer );
+ pNewMediaObj->setURL( rMediaURL, referer, rMimeType );
if( pPickObj )
{
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!");
}
diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx
index 3a24c71e0378..912f8c1e22db 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -3205,15 +3205,6 @@ static void lcl_StoreJsonExternals(
}
}
-static OUString lcl_GetMimeType(const OUString& aMediaURL)
-{
- // TODO: Find a better way to find out the mime type, maybe via propset
- if( aMediaURL.endsWith(".json") )
- return OUString("application/vnd.gltf+json");
- else
- return OUString("application/vnd.sun.star.media");
-}
-
void XMLShapeExport::ImpExportMediaShape(
const uno::Reference< drawing::XShape >& xShape,
XmlShapeType eShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint)
@@ -3245,7 +3236,9 @@ void XMLShapeExport::ImpExportMediaShape(
mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
// export mime-type
- mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MIME_TYPE, lcl_GetMimeType(aMediaURL) );
+ OUString sMimeType;
+ xPropSet->getPropertyValue("MediaMimeType") >>= sMimeType;
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MIME_TYPE, sMimeType );
// write plugin
SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_PLUGIN, !( nFeatures & SEF_EXPORT_NO_WS ), true);
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index aefffce441c4..902c1799ed43 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -3206,6 +3206,8 @@ void SdXMLPluginShapeContext::EndElement()
OUString("MediaURL"),
uno::makeAny(maHref));
+ xProps->setPropertyValue("MediaMimeType", uno::makeAny(maMimeType) );
+
for( sal_Int32 nParam = 0; nParam < maParams.getLength(); ++nParam )
{
const OUString& rName = maParams[ nParam ].Name;