xmloff/source/draw/shapeexport2.cxx | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-)
New commits: commit 9602a121b458e7456fc533dad86f434f846a72ba Author: Oliver-Rainer Wittmann <o...@apache.org> Date: Wed Jul 23 08:53:15 2014 +0000 125289: do apply possible changed <GraphicStreamURL> only for embedded images which already have its stream inside the package fixes also issue 125290 diff --git a/xmloff/source/draw/shapeexport2.cxx b/xmloff/source/draw/shapeexport2.cxx index 0014188..da20ef9 100644 --- a/xmloff/source/draw/shapeexport2.cxx +++ b/xmloff/source/draw/shapeexport2.cxx @@ -1147,9 +1147,12 @@ void XMLShapeExport::ImpExportGraphicObjectShape( OUString aResolveURL( sImageURL ); const rtl::OUString sPackageURL( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.Package:" ) ); - // sj: trying to preserve the filename + // sj: trying to preserve the filename for embedded images which already have its stream inside the package + bool bIsEmbeddedImageWithExistingStreamInPackage = false; if ( aStreamURL.match( sPackageURL, 0 ) ) { + bIsEmbeddedImageWithExistingStreamInPackage = true; + rtl::OUString sRequestedName( aStreamURL.copy( sPackageURL.getLength(), aStreamURL.getLength() - sPackageURL.getLength() ) ); sal_Int32 nLastIndex = sRequestedName.lastIndexOf( '/' ) + 1; if ( ( nLastIndex > 0 ) && ( nLastIndex < sRequestedName.getLength() ) ) @@ -1169,20 +1172,23 @@ void XMLShapeExport::ImpExportGraphicObjectShape( if ( !aStr.isEmpty() ) { - aStreamURL = sPackageURL; - if ( aStr[0] == '#' ) - { - aStreamURL = aStreamURL.concat( aStr.copy( 1, aStr.getLength() - 1 ) ); - } - else + // apply possible changed stream URL to embedded image object + if ( bIsEmbeddedImageWithExistingStreamInPackage ) { - aStreamURL = aStreamURL.concat( aStr ); - } + aStreamURL = sPackageURL; + if ( aStr[0] == '#' ) + { + aStreamURL = aStreamURL.concat( aStr.copy( 1, aStr.getLength() - 1 ) ); + } + else + { + aStreamURL = aStreamURL.concat( aStr ); + } - // update stream URL for load on demand - uno::Any aAny; - aAny <<= aStreamURL; - xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "GraphicStreamURL" ) ), aAny ); + uno::Any aAny; + aAny <<= aStreamURL; + xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "GraphicStreamURL" ) ), aAny ); + } mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE ); mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED ); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits