From 24dbe577e539798203d777802cc7027b2edd58c4 Mon Sep 17 00:00:00 2001 From: Matúš Kukan Date: Fri, 12 Sep 2014 16:57:53 +0200 Subject: Replace struct EmbeddedWAVAudioFile with simple string. Change-Id: I6659b6e1be865546f380a28e4803fbe593de0803 --- oox/inc/drawingml/embeddedwavaudiofile.hxx | 18 +++--------------- oox/inc/drawingml/graphicproperties.hxx | 5 ++--- oox/source/drawingml/embeddedwavaudiofile.cxx | 21 +++++++-------------- oox/source/drawingml/fillproperties.cxx | 5 +++-- oox/source/drawingml/graphicshapecontext.cxx | 10 +++++----- oox/source/drawingml/hyperlinkcontext.cxx | 5 ++--- oox/source/drawingml/shape.cxx | 2 +- oox/source/ppt/soundactioncontext.cxx | 5 +---- oox/source/ppt/timetargetelementcontext.cxx | 6 +----- 9 files changed, 25 insertions(+), 52 deletions(-) (limited to 'oox') diff --git a/oox/inc/drawingml/embeddedwavaudiofile.hxx b/oox/inc/drawingml/embeddedwavaudiofile.hxx index c1b199243f87..d4676543a26d 100644 --- a/oox/inc/drawingml/embeddedwavaudiofile.hxx +++ b/oox/inc/drawingml/embeddedwavaudiofile.hxx @@ -21,27 +21,15 @@ #define INCLUDED_OOX_DRAWINGML_EMBEDDEDWAVAUDIOFILE_HXX #include -#include #include +#include namespace oox { namespace drawingml { - struct EmbeddedWAVAudioFile - { - EmbeddedWAVAudioFile() - : mbBuiltIn(false) - { - } - bool mbBuiltIn; - OUString msName; - OUString msEmbed; - }; - - void getEmbeddedWAVAudioFile( + OUString getEmbeddedWAVAudioFile( const ::oox::core::Relations& rRelations, - const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs, - EmbeddedWAVAudioFile & aAudio ); + const AttributeList& rAttribs ); } } diff --git a/oox/inc/drawingml/graphicproperties.hxx b/oox/inc/drawingml/graphicproperties.hxx index 626fe5f0f9b8..27644cd683d6 100644 --- a/oox/inc/drawingml/graphicproperties.hxx +++ b/oox/inc/drawingml/graphicproperties.hxx @@ -24,7 +24,6 @@ #include #include -#include namespace oox { class GraphicHelper; @@ -36,8 +35,8 @@ namespace drawingml { struct GraphicProperties { - BlipFillProperties maBlipProps; /// Properties for the graphic. - EmbeddedWAVAudioFile maAudio; /// Audio file details + BlipFillProperties maBlipProps; ///< Properties for the graphic. + OUString msMediaTempFile; ///< Audio/Video temporary file. /** Overwrites all members that are explicitly set in rSourceProps. */ void assignUsed( const GraphicProperties& rSourceProps ); diff --git a/oox/source/drawingml/embeddedwavaudiofile.cxx b/oox/source/drawingml/embeddedwavaudiofile.cxx index c15bc7c56b5c..7ed371ed2b68 100644 --- a/oox/source/drawingml/embeddedwavaudiofile.cxx +++ b/oox/source/drawingml/embeddedwavaudiofile.cxx @@ -20,23 +20,16 @@ #include "drawingml/embeddedwavaudiofile.hxx" #include "oox/helper/attributelist.hxx" -using namespace ::oox::core; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::xml::sax; - namespace oox { namespace drawingml { // CT_EmbeddedWAVAudioFile - void getEmbeddedWAVAudioFile( const Relations& rRelations, - const Reference< XFastAttributeList >& xAttribs, EmbeddedWAVAudioFile & aAudio ) - { - AttributeList attribs(xAttribs); - - OUString sId = xAttribs->getOptionalValue( R_TOKEN( embed ) ); - aAudio.msEmbed = rRelations.getFragmentPathFromRelId( sId ); - aAudio.mbBuiltIn = attribs.getBool( XML_builtIn, false ); - aAudio.msName = xAttribs->getOptionalValue( XML_name ); - } +OUString getEmbeddedWAVAudioFile( const core::Relations& rRelations, const AttributeList& rAttribs ) +{ + if (rAttribs.getBool( XML_builtIn, false )) + return rAttribs.getString( XML_name ).get(); + else + return rRelations.getFragmentPathFromRelId( rAttribs.getString( R_TOKEN(embed) ).get() ); +} } } diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx index 109fc23a2216..80e2c25109da 100644 --- a/oox/source/drawingml/fillproperties.cxx +++ b/oox/source/drawingml/fillproperties.cxx @@ -34,6 +34,7 @@ #include #include #include +#include #include "oox/helper/graphichelper.hxx" #include "oox/drawingml/drawingmltypes.hxx" #include "oox/drawingml/shapepropertymap.hxx" @@ -752,8 +753,8 @@ void GraphicProperties::pushToPropMap( PropertyMap& rPropMap, const GraphicHelpe rPropMap.setProperty(PROP_AdjustContrast, nContrast); // Media content - if( !maAudio.msEmbed.isEmpty() ) - rPropMap.setProperty(PROP_MediaURL, maAudio.msEmbed); + if( !msMediaTempFile.isEmpty() ) + rPropMap.setProperty(PROP_MediaURL, msMediaTempFile); } bool ArtisticEffectProperties::isEmpty() const diff --git a/oox/source/drawingml/graphicshapecontext.cxx b/oox/source/drawingml/graphicshapecontext.cxx index f23ee1f003f6..a2eac1638308 100644 --- a/oox/source/drawingml/graphicshapecontext.cxx +++ b/oox/source/drawingml/graphicshapecontext.cxx @@ -19,8 +19,10 @@ #include #include "oox/drawingml/graphicshapecontext.hxx" + #include +#include #include "drawingml/fillpropertiesgroupcontext.hxx" #include "drawingml/graphicproperties.hxx" #include "drawingml/customshapeproperties.hxx" @@ -38,7 +40,6 @@ #include "oox/helper/binaryinputstream.hxx" #include "oox/helper/binaryoutputstream.hxx" #include "oox/ppt/pptshapegroupcontext.hxx" -#include using namespace ::com::sun::star; using namespace ::com::sun::star::io; @@ -85,9 +86,8 @@ ContextHandlerRef GraphicShapeContext::onCreateContext( sal_Int32 aElementToken, return new BlipFillContext( *this, rAttribs, mpShapePtr->getGraphicProperties().maBlipProps ); case XML_wavAudioFile: { - getEmbeddedWAVAudioFile( getRelations(), rAttribs.getFastAttributeList(), mpShapePtr->getGraphicProperties().maAudio ); - mpShapePtr->getGraphicProperties().maAudio.msEmbed = - lcl_CopyToTempFile( mpShapePtr->getGraphicProperties().maAudio.msEmbed, getFilter() ); + mpShapePtr->getGraphicProperties().msMediaTempFile = + lcl_CopyToTempFile( getEmbeddedWAVAudioFile(getRelations(), rAttribs), getFilter() ); } break; case XML_audioFile: @@ -95,7 +95,7 @@ ContextHandlerRef GraphicShapeContext::onCreateContext( sal_Int32 aElementToken, { OUString rPath = getRelations().getFragmentPathFromRelId( rAttribs.getString(R_TOKEN(link)).get() ); - mpShapePtr->getGraphicProperties().maAudio.msEmbed = + mpShapePtr->getGraphicProperties().msMediaTempFile = lcl_CopyToTempFile( rPath, getFilter() ); } break; diff --git a/oox/source/drawingml/hyperlinkcontext.cxx b/oox/source/drawingml/hyperlinkcontext.cxx index b2774d1784b1..a3e7254df380 100644 --- a/oox/source/drawingml/hyperlinkcontext.cxx +++ b/oox/source/drawingml/hyperlinkcontext.cxx @@ -150,15 +150,14 @@ HyperLinkContext::~HyperLinkContext() } ContextHandlerRef HyperLinkContext::onCreateContext( - ::sal_Int32 aElement, const AttributeList& rAttribs ) + ::sal_Int32 aElement, const AttributeList& ) { switch( aElement ) { case A_TOKEN( extLst ): return 0; case A_TOKEN( snd ): - EmbeddedWAVAudioFile aAudio; - getEmbeddedWAVAudioFile( getRelations(), rAttribs.getFastAttributeList(), aAudio ); + // TODO use getEmbeddedWAVAudioFile() here break; } diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 099feb0e6bc2..dbd2aa702c2c 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -405,7 +405,7 @@ Reference< XShape > Shape::createAndInsert( OUString aServiceName; if( rServiceName == "com.sun.star.drawing.GraphicObjectShape" && - mpGraphicPropertiesPtr && !mpGraphicPropertiesPtr->maAudio.msEmbed.isEmpty() ) + mpGraphicPropertiesPtr && !mpGraphicPropertiesPtr->msMediaTempFile.isEmpty() ) { aServiceName = finalizeServiceName( rFilterBase, "com.sun.star.presentation.MediaShape", aShapeRectHmm ); bIsEmbMedia = true; diff --git a/oox/source/ppt/soundactioncontext.cxx b/oox/source/ppt/soundactioncontext.cxx index 0996fdb3f947..9f1a4c0c69d3 100644 --- a/oox/source/ppt/soundactioncontext.cxx +++ b/oox/source/ppt/soundactioncontext.cxx @@ -74,10 +74,7 @@ namespace oox { namespace ppt { case PPT_TOKEN( snd ): if( mbHasStartSound ) { - drawingml::EmbeddedWAVAudioFile aAudio; - drawingml::getEmbeddedWAVAudioFile( getRelations(), rAttribs.getFastAttributeList(), aAudio); - - msSndName = ( aAudio.mbBuiltIn ? aAudio.msName : aAudio.msEmbed ); + msSndName = drawingml::getEmbeddedWAVAudioFile( getRelations(), rAttribs ); } return this; case PPT_TOKEN( endSnd ): diff --git a/oox/source/ppt/timetargetelementcontext.cxx b/oox/source/ppt/timetargetelementcontext.cxx index 230dd89558ed..225ca38de3bb 100644 --- a/oox/source/ppt/timetargetelementcontext.cxx +++ b/oox/source/ppt/timetargetelementcontext.cxx @@ -123,11 +123,7 @@ namespace oox { namespace ppt { case PPT_TOKEN( sndTgt ): { mpTarget->mnType = XML_sndTgt; - drawingml::EmbeddedWAVAudioFile aAudio; - drawingml::getEmbeddedWAVAudioFile( getRelations(), rAttribs.getFastAttributeList(), aAudio); - - OUString sSndName = ( aAudio.mbBuiltIn ? aAudio.msName : aAudio.msEmbed ); - mpTarget->msValue = sSndName; + mpTarget->msValue = drawingml::getEmbeddedWAVAudioFile( getRelations(), rAttribs ); break; } case PPT_TOKEN( spTgt ): -- cgit