avmedia/Library_avmediaogl.mk | 2 avmedia/source/framework/mediaitem.cxx | 24 +++++++- avmedia/source/gstreamer/gstframegrabber.hxx | 5 - avmedia/source/inc/mediamisc.hxx | 7 ++ avmedia/source/opengl/oglplayer.cxx | 4 - avmedia/source/viewer/mediawindow_impl.cxx | 76 ++++++++++++++++----------- avmedia/source/viewer/mediawindow_impl.hxx | 8 ++ include/avmedia/mediaitem.hxx | 3 + include/svl/solar.hrc | 2 include/svx/svdomedia.hxx | 2 include/svx/unoshprp.hxx | 3 - sd/qa/unit/data/media_embedding.odp |binary sd/qa/unit/import-tests.cxx | 72 +++++++++---------------- sd/qa/unit/sdmodeltestbase.hxx | 3 - sd/source/ui/inc/View.hxx | 2 sd/source/ui/view/sdview4.cxx | 10 +-- svx/source/svdraw/svdomedia.cxx | 8 ++ svx/source/unodraw/unoprov.cxx | 1 svx/source/unodraw/unoshap4.cxx | 21 ++++++- xmloff/source/draw/shapeexport.cxx | 29 +++------- xmloff/source/draw/ximpshap.cxx | 2 21 files changed, 167 insertions(+), 117 deletions(-)
New commits: commit b715d83cfa220a93bb7d58ea059eab3cf07d3d5a Author: Zolnai Tamás <tamas.zol...@collabora.com> Date: Fri Apr 4 13:59:04 2014 +0200 Fix make file header Change-Id: If4e65e5ba5146e93572b314f806a617adb811df9 diff --git a/avmedia/Library_avmediaogl.mk b/avmedia/Library_avmediaogl.mk index 6257e8d..34677b5 100644 --- a/avmedia/Library_avmediaogl.mk +++ b/avmedia/Library_avmediaogl.mk @@ -1,4 +1,4 @@ -# -*- Mode: makefile; tab-width: 4; indent-tabs-mode: t -*- +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- # # This file is part of the LibreOffice project. # commit 327b0a6cc0dbc68552293c0ca9a8f61de280523e Author: Zolnai Tamás <tamas.zol...@collabora.com> Date: Thu Apr 3 20:50:59 2014 +0200 ODP filter test: embedded media and glTF model Change-Id: I2340fa5a20a5774e5db78940cf7d4dc584f09b82 diff --git a/sd/qa/unit/data/media_embedding.odp b/sd/qa/unit/data/media_embedding.odp new file mode 100644 index 0000000..14ea460 Binary files /dev/null and b/sd/qa/unit/data/media_embedding.odp differ diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index 12063c2..073169a 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -25,6 +25,7 @@ #include <svx/svdotext.hxx> #include <svx/svdoashp.hxx> #include <svx/svdogrp.hxx> +#include <svx/svdomedia.hxx> #include <animations/animationnodehelper.hxx> #include <com/sun/star/drawing/XDrawPage.hpp> @@ -68,6 +69,7 @@ public: void testN862510_3(); void testN862510_4(); void testFdo71961(); + void testMediaEmbedding(); CPPUNIT_TEST_SUITE(SdFiltersTest); CPPUNIT_TEST(testDocumentLayout); @@ -90,6 +92,7 @@ public: CPPUNIT_TEST(testN862510_3); CPPUNIT_TEST(testN862510_4); CPPUNIT_TEST(testFdo71961); + CPPUNIT_TEST(testMediaEmbedding); CPPUNIT_TEST_SUITE_END(); }; @@ -678,6 +681,29 @@ void SdFiltersTest::testFdo71961() xDocShRef->DoClose(); } +void SdFiltersTest::testMediaEmbedding() +{ + ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/media_embedding.odp")); + xDocShRef = saveAndReload( xDocShRef, ODP ); + + SdDrawDocument *pDoc = xDocShRef->GetDoc(); + CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL ); + const SdrPage *pPage = pDoc->GetPage (1); + CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL ); + + // First object is a glTF model + SdrMediaObj *pModelObj = dynamic_cast<SdrMediaObj*>( pPage->GetObj( 1 )); + CPPUNIT_ASSERT_MESSAGE( "missing model", pModelObj != NULL); + CPPUNIT_ASSERT_EQUAL( OUString( "vnd.sun.star.Package:Model/duck/duck.json" ), pModelObj->getMediaProperties().getURL()); + CPPUNIT_ASSERT_EQUAL( OUString( "application/vnd.gltf+json" ), pModelObj->getMediaProperties().getMimeType()); + + // Second object is a sound + SdrMediaObj *pMediaObj = dynamic_cast<SdrMediaObj*>( pPage->GetObj( 2 )); + CPPUNIT_ASSERT_MESSAGE( "missing media object", pMediaObj != NULL); + CPPUNIT_ASSERT_EQUAL( OUString( "vnd.sun.star.Package:Media/button-1.wav" ), pMediaObj->getMediaProperties().getURL()); + CPPUNIT_ASSERT_EQUAL( OUString( "application/vnd.sun.star.media" ), pMediaObj->getMediaProperties().getMimeType()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdFiltersTest); CPPUNIT_PLUGIN_IMPLEMENT(); commit 7d7e2a01a686c063f071318d8f5b9864b441db39 Author: Zolnai Tamás <tamas.zol...@collabora.com> Date: Thu Apr 3 16:26:15 2014 +0200 SdFiltersTest: reduce code duplication Change-Id: I95ddae64001015f911494e11fa15373dfaedd6ba diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index d532b6c..12063c2 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -156,8 +156,6 @@ void SdFiltersTest::testDocumentLayout() void SdFiltersTest::testSmoketest() { ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/smoketest.pptx")); - CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() ); - CPPUNIT_ASSERT_MESSAGE( "not in destruction", !xDocShRef->IsInDestruction() ); SdDrawDocument *pDoc = xDocShRef->GetDoc(); CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL ); @@ -186,8 +184,6 @@ void SdFiltersTest::testSmoketest() void SdFiltersTest::testN759180() { ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/n759180.pptx")); - CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() ); - CPPUNIT_ASSERT_MESSAGE( "not in destruction", !xDocShRef->IsInDestruction() ); SdDrawDocument *pDoc = xDocShRef->GetDoc(); CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL ); @@ -227,11 +223,8 @@ void SdFiltersTest::testN821567() { OUString bgImage; ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n821567.pptx") ); - CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() ); xDocShRef = saveAndReload( xDocShRef, ODP ); - CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() ); - CPPUNIT_ASSERT_MESSAGE( "in destruction", !xDocShRef->IsInDestruction() ); uno::Reference< drawing::XDrawPagesSupplier > xDoc( xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW ); CPPUNIT_ASSERT_MESSAGE( "not exactly one page", xDoc->getDrawPages()->getCount() == 1 ); @@ -255,8 +248,6 @@ void SdFiltersTest::testN821567() void SdFiltersTest::testN862510_1() { ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n862510_1.pptx") ); - CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() ); - CPPUNIT_ASSERT_MESSAGE( "in destruction", !xDocShRef->IsInDestruction() ); SdDrawDocument *pDoc = xDocShRef->GetDoc(); CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL ); @@ -282,8 +273,6 @@ void SdFiltersTest::testN862510_1() void SdFiltersTest::testN862510_2() { ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n862510_2.pptx") ); - CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() ); - CPPUNIT_ASSERT_MESSAGE( "in destruction", !xDocShRef->IsInDestruction() ); SdDrawDocument *pDoc = xDocShRef->GetDoc(); CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL ); @@ -303,8 +292,6 @@ void SdFiltersTest::testN862510_2() void SdFiltersTest::testN862510_3() { ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n862510_3.pptx") ); - CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() ); - CPPUNIT_ASSERT_MESSAGE( "in destruction", !xDocShRef->IsInDestruction() ); SdDrawDocument *pDoc = xDocShRef->GetDoc(); CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL ); @@ -324,8 +311,6 @@ void SdFiltersTest::testN862510_3() void SdFiltersTest::testN862510_4() { ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n862510_4.pptx") ); - CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() ); - CPPUNIT_ASSERT_MESSAGE( "in destruction", !xDocShRef->IsInDestruction() ); SdDrawDocument *pDoc = xDocShRef->GetDoc(); CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL ); @@ -352,11 +337,8 @@ void SdFiltersTest::testN828390() { bool bPassed = false; ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n828390.pptx") ); - CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() ); xDocShRef = saveAndReload( xDocShRef, PPTX ); - CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() ); - CPPUNIT_ASSERT_MESSAGE( "in destruction", !xDocShRef->IsInDestruction() ); SdDrawDocument *pDoc = xDocShRef->GetDoc(); CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL ); @@ -391,9 +373,6 @@ void SdFiltersTest::testN828390() void SdFiltersTest::testN828390_2() { ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n828390_2.pptx") ); - CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() ); - CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() ); - CPPUNIT_ASSERT_MESSAGE( "not in destruction", !xDocShRef->IsInDestruction() ); SdDrawDocument *pDoc = xDocShRef->GetDoc(); CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL ); @@ -414,9 +393,6 @@ void SdFiltersTest::testN828390_3() { bool bPassed = true; ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n828390_3.pptx") ); - CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() ); - CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() ); - CPPUNIT_ASSERT_MESSAGE( "not in destruction", !xDocShRef->IsInDestruction() ); SdDrawDocument *pDoc = xDocShRef->GetDoc(); CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL ); @@ -450,11 +426,8 @@ void SdFiltersTest::testN828390_4() { bool bPassed = false; ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/n828390_4.odp") ); - CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() ); xDocShRef = saveAndReload( xDocShRef, PPTX ); - CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() ); - CPPUNIT_ASSERT_MESSAGE( "not in destruction", !xDocShRef->IsInDestruction() ); SdDrawDocument *pDoc = xDocShRef->GetDoc(); CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL ); @@ -491,11 +464,8 @@ void SdFiltersTest::testN828390_4() void SdFiltersTest::testN828390_5() { ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/n828390_5.odp") ); - CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() ); xDocShRef = saveAndReload( xDocShRef, PPTX ); - CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() ); - CPPUNIT_ASSERT_MESSAGE( "not in destruction", !xDocShRef->IsInDestruction() ); SdDrawDocument *pDoc = xDocShRef->GetDoc(); CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL ); @@ -517,8 +487,6 @@ void SdFiltersTest::testN828390_5() void SdFiltersTest::testN778859() { ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/n778859.pptx")); - CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() ); - CPPUNIT_ASSERT_MESSAGE( "not in destruction", !xDocShRef->IsInDestruction() ); SdDrawDocument *pDoc = xDocShRef->GetDoc(); CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL ); @@ -538,8 +506,6 @@ void SdFiltersTest::testN778859() void SdFiltersTest::testFdo68594() { ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/ppt/fdo68594.ppt")); - CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() ); - CPPUNIT_ASSERT_MESSAGE( "not in destruction", !xDocShRef->IsInDestruction() ); SdDrawDocument *pDoc = xDocShRef->GetDoc(); CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL ); @@ -559,8 +525,6 @@ void SdFiltersTest::testFdo68594() void SdFiltersTest::testFdo72998() { ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/cshapes.pptx")); - CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() ); - CPPUNIT_ASSERT_MESSAGE( "not in destruction", !xDocShRef->IsInDestruction() ); SdDrawDocument *pDoc = xDocShRef->GetDoc(); CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL ); @@ -585,8 +549,6 @@ void SdFiltersTest::testFdo72998() void SdFiltersTest::testFdo64512() { ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/fdo64512.odp")); - CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() ); - CPPUNIT_ASSERT_MESSAGE( "not in destruction", !xDocShRef->IsInDestruction() ); uno::Reference< drawing::XDrawPagesSupplier > xDoc( xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW ); @@ -632,8 +594,6 @@ void SdFiltersTest::testFdo71075() double values[] = { 12.0, 13.0, 14.0 }; ::com::sun::star::uno::Any aAny; ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/fdo71075.odp")); - CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() ); - CPPUNIT_ASSERT_MESSAGE( "not in destruction", !xDocShRef->IsInDestruction() ); SdDrawDocument *pDoc = xDocShRef->GetDoc(); CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL ); @@ -676,8 +636,6 @@ void SdFiltersTest::testFdo71075() void SdFiltersTest::testStrictOOXML() { ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/strict_ooxml.pptx")); - CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() ); - CPPUNIT_ASSERT_MESSAGE( "not in destruction", !xDocShRef->IsInDestruction() ); SdDrawDocument *pDoc = xDocShRef->GetDoc(); CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL ); @@ -692,12 +650,8 @@ void SdFiltersTest::testStrictOOXML() void SdFiltersTest::testFdo71961() { ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/fdo71961.odp")); - CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() ); - CPPUNIT_ASSERT_MESSAGE( "not in destruction", !xDocShRef->IsInDestruction() ); xDocShRef = saveAndReload( xDocShRef, PPTX ); - CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() ); - CPPUNIT_ASSERT_MESSAGE( "not in destruction", !xDocShRef->IsInDestruction() ); SdDrawDocument *pDoc = xDocShRef->GetDoc(); CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL ); diff --git a/sd/qa/unit/sdmodeltestbase.hxx b/sd/qa/unit/sdmodeltestbase.hxx index 762f425..eec3231 100644 --- a/sd/qa/unit/sdmodeltestbase.hxx +++ b/sd/qa/unit/sdmodeltestbase.hxx @@ -110,12 +110,13 @@ protected: ::sd::DrawDocShellRef xDocShRef = new ::sd::DrawDocShell(); SfxMedium* pSrcMed = new SfxMedium(rURL, STREAM_STD_READ); pSrcMed->SetFilter(aFilter); - if ( !xDocShRef->DoLoad(pSrcMed) ) + if ( !xDocShRef->DoLoad(pSrcMed) || !xDocShRef.Is() ) { if (xDocShRef.Is()) xDocShRef->DoClose(); CPPUNIT_ASSERT_MESSAGE( OUStringToOString( "failed to load " + rURL, RTL_TEXTENCODING_UTF8 ).getStr(), false ); } + CPPUNIT_ASSERT_MESSAGE( "not in destruction", !xDocShRef->IsInDestruction() ); return xDocShRef; } commit d14f701bba44a278582a6c299a7339f876e84fd4 Author: Zolnai Tamás <tamas.zol...@collabora.com> Date: Fri Apr 4 13:17:34 2014 +0200 glTF ODF export: use mimetype to decide about file type Change-Id: Ib1837bdc7468fb19f55a38f6875e026eea8d3b24 diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index 13d1f77..655f163 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -3227,7 +3227,7 @@ void XMLShapeExport::ImpExportMediaShape( OUString const persistentURL = lcl_StoreMediaAndGetURL(GetExport(), xPropSet, aMediaURL, sMimeType); - if( aMediaURL.endsWith(".json") ) + if( sMimeType == "application/vnd.gltf+json" ) lcl_StoreJsonExternals(GetExport(), aMediaURL); mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, persistentURL ); commit 7ae4476b93b23456cef306c726db54ae3150af47 Author: Zolnai Tamás <tamas.zol...@collabora.com> Date: Thu Apr 3 11:31:06 2014 +0200 avmediagst: use boost::noncopyable Change-Id: I40d1b65a1ea6a1f70cb6f0f6aca705115c0db23c diff --git a/avmedia/source/gstreamer/gstframegrabber.hxx b/avmedia/source/gstreamer/gstframegrabber.hxx index dd05540..6d89af6 100644 --- a/avmedia/source/gstreamer/gstframegrabber.hxx +++ b/avmedia/source/gstreamer/gstframegrabber.hxx @@ -23,6 +23,7 @@ #include "gstplayer.hxx" #include <com/sun/star/media/XFrameGrabber.hpp> #include <cppuhelper/implbase2.hxx> +#include <boost/noncopyable.hpp> namespace avmedia { namespace gstreamer { @@ -33,7 +34,7 @@ namespace avmedia { namespace gstreamer { typedef ::cppu::WeakImplHelper2< ::com::sun::star::media::XFrameGrabber, ::com::sun::star::lang::XServiceInfo > FrameGrabber_BASE; -class FrameGrabber : public FrameGrabber_BASE +class FrameGrabber : public FrameGrabber_BASE, private boost::noncopyable { GstElement *mpPipeline; void disposePipeline(); @@ -53,8 +54,6 @@ public: private: FrameGrabber( const OUString &aURL ); - FrameGrabber( const FrameGrabber& ); - FrameGrabber& operator=( const FrameGrabber& ); }; } // namespace gst commit 5f27d2c1609b6760014c9f847f33324723150bc8 Author: Zolnai Tamás <tamas.zol...@collabora.com> Date: Thu Apr 3 11:28:53 2014 +0200 avmediaogl: simplify namespace Change-Id: I9cc8a865fa6079dbf9295d2ebafdb020dde5e81d diff --git a/avmedia/source/opengl/oglplayer.cxx b/avmedia/source/opengl/oglplayer.cxx index 325579f..5c68170 100644 --- a/avmedia/source/opengl/oglplayer.cxx +++ b/avmedia/source/opengl/oglplayer.cxx @@ -140,13 +140,13 @@ OUString SAL_CALL OGLPlayer::getImplementationName() } sal_Bool SAL_CALL OGLPlayer::supportsService( const OUString& rServiceName ) - throw ( ::com::sun::star::uno::RuntimeException, std::exception ) + throw ( uno::RuntimeException, std::exception ) { return cppu::supportsService(this, rServiceName); } uno::Sequence< OUString > SAL_CALL OGLPlayer::getSupportedServiceNames() - throw ( com::sun::star::uno::RuntimeException, std::exception ) + throw ( uno::RuntimeException, std::exception ) { uno::Sequence< OUString > aRet(1); aRet[0] = OUString("com.sun.star.media.Player_OpenGL"); commit 8416261a8b809a53058cd7970228012a8b3fb06d Author: Zolnai Tamás <tamas.zol...@collabora.com> Date: Fri Apr 4 13:16:02 2014 +0200 Use stored mime type for stream creation Change-Id: Iecc50f7964fa63ae028e2fb21d022de1f060c7a7 diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index 912f8c1..13d1f77 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -3085,7 +3085,7 @@ void XMLShapeExport::ImpExportPluginShape( static void lcl_CopyStream( uno::Reference<io::XInputStream> const& xInStream, uno::Reference<embed::XStorage> const& xTarget, - OUString const& rPath) + OUString const& rPath, const OUString& rMimeType) { ::comphelper::LifecycleProxy proxy; uno::Reference<io::XStream> const xStream( @@ -3104,10 +3104,7 @@ static void lcl_CopyStream( if (xStreamProps.is()) { // this is NOT supported in FileSystemStorage xStreamProps->setPropertyValue( OUString("MediaType"), - uno::makeAny(OUString( - //FIXME how to detect real media type? - //but currently xmloff has this one hardcoded anyway... - "application/vnd.sun.star.media"))); + uno::makeAny(rMimeType)); xStreamProps->setPropertyValue( // turn off compression OUString("Compressed"), uno::makeAny(sal_False)); @@ -3120,7 +3117,7 @@ static void lcl_CopyStream( static OUString lcl_StoreMediaAndGetURL(SvXMLExport & rExport, uno::Reference<beans::XPropertySet> const& xPropSet, - OUString const& rURL) + OUString const& rURL, const OUString& rMimeType) { OUString urlPath; if (rURL.startsWithIgnoreAsciiCase("vnd.sun.star.Package:", &urlPath)) @@ -3140,7 +3137,7 @@ lcl_StoreMediaAndGetURL(SvXMLExport & rExport, return OUString(); } - lcl_CopyStream(xInStream, xTarget, rURL); + lcl_CopyStream(xInStream, xTarget, rURL, rMimeType); return urlPath; } @@ -3225,8 +3222,11 @@ void XMLShapeExport::ImpExportMediaShape( // export media url OUString aMediaURL; xPropSet->getPropertyValue("MediaURL") >>= aMediaURL; + OUString sMimeType; + xPropSet->getPropertyValue("MediaMimeType") >>= sMimeType; + OUString const persistentURL = - lcl_StoreMediaAndGetURL(GetExport(), xPropSet, aMediaURL); + lcl_StoreMediaAndGetURL(GetExport(), xPropSet, aMediaURL, sMimeType); if( aMediaURL.endsWith(".json") ) lcl_StoreJsonExternals(GetExport(), aMediaURL); @@ -3236,8 +3236,6 @@ void XMLShapeExport::ImpExportMediaShape( mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD ); // export mime-type - OUString sMimeType; - xPropSet->getPropertyValue("MediaMimeType") >>= sMimeType; mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MIME_TYPE, sMimeType ); // write plugin commit f470f3c72efb3fad109e62247c4d0abebc359345 Author: Zolnai Tamás <tamas.zol...@collabora.com> Date: Fri Apr 4 13:14:45 2014 +0200 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 diff --git a/avmedia/source/framework/mediaitem.cxx b/avmedia/source/framework/mediaitem.cxx index 32f6f04..1c06ebc 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 9d04cd6..19d5edc 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 43416d3..f24c6e1 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 fd8bab7..e001863 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 7fec0bd..4ccb6fe 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 c399a1a..8978487 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 b9690e0..b8c4c67 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 665712e..40b4f64 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 85936ed..234d1f3 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 770d292..04a3c85 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 e60b446..8bc8f4d 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 61518d2..a17c36c 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 e422239..239328d 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 3a24c71..912f8c1 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 aefffce..902c179 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;
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits