Kaydet (Commit) 24dbe577 authored tarafından Matúš Kukan's avatar Matúš Kukan

Replace struct EmbeddedWAVAudioFile with simple string.

Change-Id: I6659b6e1be865546f380a28e4803fbe593de0803
üst b7006f3c
......@@ -21,27 +21,15 @@
#define INCLUDED_OOX_DRAWINGML_EMBEDDEDWAVAUDIOFILE_HXX
#include <rtl/ustring.hxx>
#include <com/sun/star/xml/sax/XFastAttributeList.hpp>
#include <oox/core/fragmenthandler.hxx>
#include <oox/helper/attributelist.hxx>
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 );
} }
......
......@@ -24,7 +24,6 @@
#include <oox/drawingml/fillproperties.hxx>
#include <oox/helper/helper.hxx>
#include <drawingml/embeddedwavaudiofile.hxx>
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 );
......
......@@ -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() );
}
} }
......
......@@ -34,6 +34,7 @@
#include <com/sun/star/drawing/Hatch.hpp>
#include <com/sun/star/drawing/RectanglePoint.hpp>
#include <com/sun/star/graphic/XGraphicTransformer.hpp>
#include <oox/core/fragmenthandler.hxx>
#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
......
......@@ -19,8 +19,10 @@
#include <com/sun/star/io/TempFile.hpp>
#include "oox/drawingml/graphicshapecontext.hxx"
#include <osl/diagnose.h>
#include <drawingml/embeddedwavaudiofile.hxx>
#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 <comphelper/processfactory.hxx>
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;
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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 ):
......
......@@ -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 ):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment