summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMuthu Subramanian <sumuthu@suse.com>2012-04-02 17:33:32 +0530
committerMuthu Subramanian <sumuthu@suse.com>2012-04-02 17:35:54 +0530
commit8866e1986d354f0eb7eb26d78e6b6a22c6fda632 (patch)
tree3024278aab04e26e55c13ccf71c0fd2dc6071e20 /oox
parente2786b3878c391d8b7f4b53b40f30453dbbffbd9 (diff)
n747499: PPTX embedded media playback.
Currently plays the embedded audio files. The image for the audio file seems to be rendered bad, currently.
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/fillproperties.cxx4
-rw-r--r--oox/source/drawingml/graphicshapecontext.cxx21
-rw-r--r--oox/source/drawingml/shape.cxx15
-rw-r--r--oox/source/token/properties.txt3
4 files changed, 38 insertions, 5 deletions
diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx
index 07df75d5e59b..4a94c01fe6d6 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -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;
}
// ============================================================================
diff --git a/oox/source/drawingml/graphicshapecontext.cxx b/oox/source/drawingml/graphicshapecontext.cxx
index f01854c77103..2230a3bbe60a 100644
--- a/oox/source/drawingml/graphicshapecontext.cxx
+++ b/oox/source/drawingml/graphicshapecontext.cxx
@@ -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;
}
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index d9f30f737879..01ee8191ac41 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -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 );
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index 97555c87203b..7ad1a4c3bdb9 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -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