You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by or...@apache.org on 2014/07/23 11:15:22 UTC

svn commit: r1612804 - in /openoffice/branches/AOO410: ./ main/ main/xmloff/source/draw/shapeexport2.cxx

Author: orw
Date: Wed Jul 23 09:15:22 2014
New Revision: 1612804

URL: http://svn.apache.org/r1612804
Log:
125289: do apply possible changed <GraphicStreamURL> only for embedded images which already have its stream inside the package
	fixes also issue 125290

	cherry-picked from trunk


Modified:
    openoffice/branches/AOO410/   (props changed)
    openoffice/branches/AOO410/main/   (props changed)
    openoffice/branches/AOO410/main/xmloff/source/draw/shapeexport2.cxx

Propchange: openoffice/branches/AOO410/
------------------------------------------------------------------------------
  Merged /openoffice/trunk:r1612801

Propchange: openoffice/branches/AOO410/main/
------------------------------------------------------------------------------
  Merged /openoffice/trunk/main:r1612801

Modified: openoffice/branches/AOO410/main/xmloff/source/draw/shapeexport2.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/AOO410/main/xmloff/source/draw/shapeexport2.cxx?rev=1612804&r1=1612803&r2=1612804&view=diff
==============================================================================
--- openoffice/branches/AOO410/main/xmloff/source/draw/shapeexport2.cxx (original)
+++ openoffice/branches/AOO410/main/xmloff/source/draw/shapeexport2.cxx Wed Jul 23 09:15:22 2014
@@ -1147,9 +1147,12 @@ void XMLShapeExport::ImpExportGraphicObj
                 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,21 +1172,24 @@ void XMLShapeExport::ImpExportGraphicObj
 
                 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 );
+                        }
+
+                        uno::Any aAny;
+                        aAny <<= aStreamURL;
+                        xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "GraphicStreamURL" ) ), aAny );
                     }
 
-                    // update stream URL for load on demand
-                    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 );
                     mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );