[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - oox/source
Matúš Kukan
matus.kukan at collabora.com
Wed Sep 17 03:00:03 PDT 2014
oox/source/drawingml/graphicshapecontext.cxx | 40 ++++++++++++++++++---------
1 file changed, 27 insertions(+), 13 deletions(-)
New commits:
commit 23a817342f264bde5b6d4cb6b00b298c7b930430
Author: Matúš Kukan <matus.kukan at collabora.com>
Date: Fri Sep 12 16:08:34 2014 +0200
bnc#591147: OOXML import: Import video file too.
Change-Id: Ie9b6c5ff866269e5d7a26d025cb1c0d884ff1134
(cherry picked from commit b7006f3c2f8f71f4d4721c6e5cdc122628c756f0)
Reviewed-on: https://gerrit.libreoffice.org/11468
Reviewed-by: Andras Timar <andras.timar at collabora.com>
Tested-by: Andras Timar <andras.timar at collabora.com>
diff --git a/oox/source/drawingml/graphicshapecontext.cxx b/oox/source/drawingml/graphicshapecontext.cxx
index cd4e75d..1813af4 100644
--- a/oox/source/drawingml/graphicshapecontext.cxx
+++ b/oox/source/drawingml/graphicshapecontext.cxx
@@ -47,6 +47,22 @@ using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::xml::sax;
using namespace ::oox::core;
+static OUString lcl_CopyToTempFile(const OUString& rStream, const oox::core::XmlFilterBase& rFilter)
+{
+ if (rStream.isEmpty())
+ return OUString();
+
+ Reference< XInputStream > xInStrm( rFilter.openInputStream(rStream), UNO_SET_THROW );
+ Reference< XTempFile > xTempFile( TempFile::create(rFilter.getComponentContext()) );
+ Reference< XOutputStream > xOutStrm( xTempFile->getOutputStream(), UNO_SET_THROW );
+ oox::BinaryXOutputStream aOutStrm( xOutStrm, false );
+ oox::BinaryXInputStream aInStrm( xInStrm, false );
+ aInStrm.copyToStream( aOutStrm );
+
+ xTempFile->setRemoveFile( false );
+ return xTempFile->getUri();
+}
+
namespace oox {
namespace drawingml {
@@ -70,19 +86,17 @@ ContextHandlerRef GraphicShapeContext::onCreateContext( sal_Int32 aElementToken,
case XML_wavAudioFile:
{
getEmbeddedWAVAudioFile( getRelations(), rAttribs.getFastAttributeList(), mpShapePtr->getGraphicProperties().maAudio );
- if( !mpShapePtr->getGraphicProperties().maAudio.msEmbed.isEmpty() )
- {
- Reference< XComponentContext > xContext = comphelper::getProcessComponentContext();
- Reference< XInputStream > xInStrm( getFilter().openInputStream( mpShapePtr->getGraphicProperties().maAudio.msEmbed ), UNO_SET_THROW );
- Reference< XTempFile > xTempFile( TempFile::create(xContext) );
- 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();
- }
+ mpShapePtr->getGraphicProperties().maAudio.msEmbed =
+ lcl_CopyToTempFile( mpShapePtr->getGraphicProperties().maAudio.msEmbed, getFilter() );
+ }
+ break;
+ case XML_audioFile:
+ case XML_videoFile:
+ {
+ OUString rPath = getRelations().getFragmentPathFromRelId(
+ rAttribs.getString(R_TOKEN(link)).get() );
+ mpShapePtr->getGraphicProperties().maAudio.msEmbed =
+ lcl_CopyToTempFile( rPath, getFilter() );
}
break;
}
More information about the Libreoffice-commits
mailing list