n747499: PPTX embedded media playback.

Currently plays the embedded audio files.
The image for the audio file seems to be
rendered bad, currently.
This commit is contained in:
Muthu Subramanian 2012-04-02 17:33:32 +05:30
parent e2786b3878
commit 8866e1986d
4 changed files with 38 additions and 5 deletions

View file

@ -440,9 +440,9 @@ void GraphicProperties::pushToPropMap( PropertyMap& rPropMap, const GraphicHelpe
if( nContrast != 0 )
rPropMap[ PROP_AdjustContrast ] <<= nContrast;
// TODO: Audio content, yet to be implemented
// Media content
if( !maAudio.msEmbed.isEmpty() )
rPropMap[ PROP_Sound ] <<= maAudio.msEmbed;
rPropMap[ PROP_MediaURL ] <<= maAudio.msEmbed;
}
// ============================================================================

View file

@ -26,6 +26,7 @@
*
************************************************************************/
#include <com/sun/star/io/XTempFile.hpp>
#include "oox/drawingml/graphicshapecontext.hxx"
#include <osl/diagnose.h>
@ -42,6 +43,9 @@
#include "oox/vml/vmlshapecontainer.hxx"
#include "oox/drawingml/fillproperties.hxx"
#include "oox/drawingml/transform2dcontext.hxx"
#include "oox/helper/binaryinputstream.hxx"
#include "oox/helper/binaryoutputstream.hxx"
#include <comphelper/processfactory.hxx>
using ::rtl::OUString;
using namespace ::com::sun::star;
@ -77,7 +81,22 @@ Reference< XFastContextHandler > GraphicShapeContext::createFastChildContext( sa
xRet.set( new BlipFillContext( *this, xAttribs, mpShapePtr->getGraphicProperties().maBlipProps ) );
break;
case XML_wavAudioFile:
getEmbeddedWAVAudioFile( getRelations(), xAttribs, mpShapePtr->getGraphicProperties().maAudio );
{
getEmbeddedWAVAudioFile( getRelations(), xAttribs, mpShapePtr->getGraphicProperties().maAudio );
if( !mpShapePtr->getGraphicProperties().maAudio.msEmbed.isEmpty() )
{
Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
Reference< XInputStream > xInStrm( getFilter().openInputStream( mpShapePtr->getGraphicProperties().maAudio.msEmbed ), UNO_SET_THROW );
Reference< XTempFile > xTempFile( xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.io.TempFile" ) ), UNO_QUERY_THROW );
Reference< XOutputStream > xOutStrm( xTempFile->getOutputStream(), UNO_SET_THROW );
BinaryXOutputStream aOutStrm( xOutStrm, false );
BinaryXInputStream aInStrm( xInStrm, false );
aInStrm.copyToStream( aOutStrm );
xTempFile->setRemoveFile( false );
mpShapePtr->getGraphicProperties().maAudio.msEmbed = xTempFile->getUri();
}
}
break;
}

View file

@ -330,11 +330,22 @@ Reference< XShape > Shape::createAndInsert(
sal_Bool bClearText,
basegfx::B2DHomMatrix& aParentTransformation )
{
bool bIsEmbMedia = false;
OSL_TRACE("Shape::createAndInsert id: %s", rtl::OUStringToOString(msId, RTL_TEXTENCODING_UTF8 ).getStr());
awt::Rectangle aShapeRectHmm( maPosition.X / 360, maPosition.Y / 360, maSize.Width / 360, maSize.Height / 360 );
OUString aServiceName = finalizeServiceName( rFilterBase, rServiceName, aShapeRectHmm );
OUString aServiceName;
if( rServiceName == OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GraphicObjectShape") ) &&
mpGraphicPropertiesPtr && !mpGraphicPropertiesPtr->maAudio.msEmbed.isEmpty() )
{
aServiceName = finalizeServiceName( rFilterBase, OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.MediaShape" ) ), aShapeRectHmm );
bIsEmbMedia = true;
}
else
{
aServiceName = finalizeServiceName( rFilterBase, rServiceName, aShapeRectHmm );
}
sal_Bool bIsCustomShape = aServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing.CustomShape" ) ) || aServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing.ConnectorShape" ) );
basegfx::B2DHomMatrix aTransformation;
@ -518,7 +529,7 @@ Reference< XShape > Shape::createAndInsert(
// applying properties
aShapeProps.assignUsed( getShapeProperties() );
aShapeProps.assignUsed( maDefaultShapeProperties );
if ( aServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.GraphicObjectShape")) )
if ( bIsEmbMedia || aServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.GraphicObjectShape")) )
mpGraphicPropertiesPtr->pushToPropMap( aShapeProps, rGraphicHelper );
if ( mpTablePropertiesPtr.get() && aServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.TableShape")) )
mpTablePropertiesPtr->pushToPropSet( rFilterBase, xSet, mpMasterTextListStyle );

View file

@ -285,6 +285,7 @@ MarkPosition
MaxFieldCount
MaxTextLen
MediaType
MediaURL
MinorTickmarks
MirroredX
MirroredY
@ -345,6 +346,8 @@ PrintDownFirst
PrintGrid
PrintHeaders
Printable
PrivateStream
PrivateTempFileURL
ProgressValueMax
ProgressValueMin
Protected