summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMark Hung <marklh9@gmail.com>2019-01-20 20:33:26 +0800
committerMark Hung <marklh9@gmail.com>2019-02-04 01:03:00 +0100
commit8a1321362a0229a25869e4e3d0422a5a51c5b5be (patch)
tree3afb0f5d5469adb70e8a5d6ea246413c7312b2e8 /oox
parent04160a24e34beb6802cea356b947ed9d8d382d19 (diff)
tdf#44223 oox: import embedded media stream.
- Handle cTn and tgtEl of MediaNodeContext. - Setting the audio source of XAudio. - Embed the media in TimeNodeTargetElementContext. - Embed the media in SoundActionContext. - Allow avmedia::EmbedMedia to embed media from a XInputStream. Change-Id: I164ac50f97f2036db4bfa2f99adedff0bba382e2 Reviewed-on: https://gerrit.libreoffice.org/67208 Tested-by: Jenkins Reviewed-by: Mark Hung <marklh9@gmail.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/ppt/soundactioncontext.cxx12
-rw-r--r--oox/source/ppt/timenode.cxx4
-rw-r--r--oox/source/ppt/timenodelistcontext.cxx9
-rw-r--r--oox/source/ppt/timetargetelementcontext.cxx13
4 files changed, 31 insertions, 7 deletions
diff --git a/oox/source/ppt/soundactioncontext.cxx b/oox/source/ppt/soundactioncontext.cxx
index 775ebf688767..51b2c771867c 100644
--- a/oox/source/ppt/soundactioncontext.cxx
+++ b/oox/source/ppt/soundactioncontext.cxx
@@ -27,6 +27,8 @@
#include <oox/token/namespaces.hxx>
#include <oox/token/properties.hxx>
#include <oox/token/tokens.hxx>
+#include <oox/core/xmlfilterbase.hxx>
+#include <avmedia/mediaitem.hxx>
using namespace ::oox::core;
using namespace ::com::sun::star::xml::sax;
@@ -54,11 +56,15 @@ namespace oox { namespace ppt {
if( mbHasStartSound )
{
OUString url;
- // TODO this is very wrong
if ( !msSndName.isEmpty() )
{
- // try the builtIn version
- url = msSndName;
+ Reference<css::io::XInputStream>
+ xInputStream = getFilter().openInputStream(msSndName);
+ if (xInputStream.is())
+ {
+ ::avmedia::EmbedMedia(getFilter().getModel(), msSndName, url, xInputStream);
+ xInputStream->closeInput();
+ }
}
if ( !url.isEmpty() )
{
diff --git a/oox/source/ppt/timenode.cxx b/oox/source/ppt/timenode.cxx
index 9b77001aaff1..198d0391f3eb 100644
--- a/oox/source/ppt/timenode.cxx
+++ b/oox/source/ppt/timenode.cxx
@@ -27,6 +27,7 @@
#include <com/sun/star/animations/XAnimateMotion.hpp>
#include <com/sun/star/animations/XAnimateTransform.hpp>
#include <com/sun/star/animations/XCommand.hpp>
+#include <com/sun/star/animations/XAudio.hpp>
#include <com/sun/star/animations/XIterateContainer.hpp>
#include <com/sun/star/animations/XTimeContainer.hpp>
#include <com/sun/star/animations/XTransitionFilter.hpp>
@@ -294,6 +295,7 @@ namespace oox { namespace ppt {
Reference< XAnimateMotion > xAnimateMotion( xNode, UNO_QUERY );
Reference< XAnimateTransform > xAnimateTransform( xNode, UNO_QUERY );
Reference< XCommand > xCommand( xNode, UNO_QUERY );
+ Reference< XAudio > xAudio( xNode, UNO_QUERY );
Reference< XIterateContainer > xIterateContainer( xNode, UNO_QUERY );
sal_Int16 nInt16 = 0;
bool bBool = false;
@@ -334,6 +336,8 @@ namespace oox { namespace ppt {
xAnimate->setTarget(aValue);
if (xCommand.is())
xCommand->setTarget(aValue);
+ if (xAudio.is())
+ xAudio->setSource(aValue);
}
break;
case NP_SUBITEM:
diff --git a/oox/source/ppt/timenodelistcontext.cxx b/oox/source/ppt/timenodelistcontext.cxx
index cb95e38777e7..455c008dc16e 100644
--- a/oox/source/ppt/timenodelistcontext.cxx
+++ b/oox/source/ppt/timenodelistcontext.cxx
@@ -46,6 +46,7 @@
#include "commontimenodecontext.hxx"
#include "timeanimvaluecontext.hxx"
#include "animationtypes.hxx"
+#include "timetargetelementcontext.hxx"
using namespace ::oox::core;
using namespace ::oox::drawingml;
@@ -179,12 +180,14 @@ namespace oox { namespace ppt {
}
}
- virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& /*rAttribs*/ ) override
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs) override
{
switch ( aElementToken )
{
- case PPT_TOKEN( cBhvr ):
- return new CommonBehaviorContext ( *this, mpNode );
+ case PPT_TOKEN( cTn ):
+ return new CommonTimeNodeContext( *this, aElementToken, rAttribs.getFastAttributeList(), mpNode );
+ case PPT_TOKEN( tgtEl ):
+ return new TimeTargetElementContext( *this, mpNode->getTarget() );
default:
break;
}
diff --git a/oox/source/ppt/timetargetelementcontext.cxx b/oox/source/ppt/timetargetelementcontext.cxx
index 60ad3af407c1..0f17e4bf5be5 100644
--- a/oox/source/ppt/timetargetelementcontext.cxx
+++ b/oox/source/ppt/timetargetelementcontext.cxx
@@ -27,6 +27,9 @@
#include <drawingml/embeddedwavaudiofile.hxx>
#include <oox/token/namespaces.hxx>
#include <oox/token/tokens.hxx>
+#include <oox/core/xmlfilterbase.hxx>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <avmedia/mediaitem.hxx>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::xml::sax;
@@ -122,8 +125,16 @@ namespace oox { namespace ppt {
return this;
case PPT_TOKEN( sndTgt ):
{
+ OUString srcFile = drawingml::getEmbeddedWAVAudioFile(getRelations(), rAttribs);
mpTarget->mnType = XML_sndTgt;
- mpTarget->msValue = drawingml::getEmbeddedWAVAudioFile( getRelations(), rAttribs );
+ Reference<css::io::XInputStream>
+ xInputStream = getFilter().openInputStream(srcFile);
+
+ if (xInputStream.is())
+ {
+ ::avmedia::EmbedMedia(getFilter().getModel(), srcFile, mpTarget->msValue, xInputStream);
+ xInputStream->closeInput();
+ }
break;
}
case PPT_TOKEN( spTgt ):