diff options
author | Jacobo Aragunde Pérez <jaragunde@igalia.com> | 2017-10-12 13:30:47 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2017-10-20 20:07:26 +0200 |
commit | 3e250d0a392c37e9e610bd83017a3045c4c02638 (patch) | |
tree | c3a3d3c14299e0593e79301db34f17f82a3f8caf /oox | |
parent | 451fcee7f7c2bdc5a9241662c412027672df3a1c (diff) |
tdf#112633 oox: Save backup images to proper path in document
Artistic effects on bitmap images in OOXML files create a backup file
with the original image. These were not being saved into the proper
path for PPTX files because the `/word` directory was hardcoded in the
export code.
The path saved to the relations file was incorrect too because it was
not taking into account that the relations file is saved to a subdir
in PPTX and XLSX documents.
Finally, added a unit test.
Reviewed-on: https://gerrit.libreoffice.org/43338
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
(cherry picked from commit 55641f5572f3168c09e096eb89ca563652889758)
Change-Id: I3e880ce763dc10dbc86ccf0e00871be5d36f6d88
Reviewed-on: https://gerrit.libreoffice.org/43600
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/export/drawingml.cxx | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 4b327f63d76f..48720d923144 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -3448,16 +3448,22 @@ OString DrawingML::WriteWdpPicture( const OUString& rFileId, const Sequence< sal return OUStringToOString( aCachedItem->second, RTL_TEXTENCODING_UTF8 ); OUString sFileName = "media/hdphoto" + OUString::number( mnWdpImageCounter++ ) + ".wdp"; - uno::Reference< io::XOutputStream > xOutStream = - mpFB->openFragmentStream( "word/" + sFileName, - "image/vnd.ms-photo" ); + Reference< XOutputStream > xOutStream = mpFB->openFragmentStream( OUStringBuffer() + .appendAscii( GetComponentDir() ) + .append( "/" ) + .append( sFileName ) + .makeStringAndClear(), + "image/vnd.ms-photo" ); OUString sId; xOutStream->writeBytes( rPictureData ); xOutStream->closeOutput(); sId = mpFB->addRelation( mpFS->getOutputStream(), oox::getRelationship(Relationship::HDPHOTO), - sFileName ); + OUStringBuffer() + .appendAscii( GetRelationCompPrefix() ) + .append( sFileName ) + .makeStringAndClear() ); maWdpCache[rFileId] = sId; return OUStringToOString( sId, RTL_TEXTENCODING_UTF8 ); |