Resolves: #i114361# provide and accept changed URL...

of embedded graphic file during save (ODF export)

(cherry picked from commit a90c007908eb3f66e28a9ea525729065db652b6f)

Conflicts:
	sw/inc/ndgrf.hxx
	sw/source/core/graphic/ndgrf.cxx
	sw/source/core/unocore/unoframe.cxx
	sw/source/filter/xml/xmltexte.cxx
	xmloff/source/draw/shapeexport2.cxx

Change-Id: I9d4a02af2561467fe1a66f036b55d6dcf2429986
diff --git a/sw/inc/ndgrf.hxx b/sw/inc/ndgrf.hxx
index d5e3ddd..5292561 100644
--- a/sw/inc/ndgrf.hxx
+++ b/sw/inc/ndgrf.hxx
@@ -174,8 +174,11 @@ public:
    bool SwapIn( bool bWaitForData = false );
    /// Remove graphic in order to free memory.
    bool SwapOut();
    /// Access to storage stream-name.
    void SetStreamName( const OUString& r ) { maGrfObj.SetUserData( r ); }
    /// applying new stream name for embedded graphic - needed as saving the document might change this stream name
    void ApplyNewEmbeddedStreamName(const OUString& r)
    {
        maGrfObj.SetUserData(r);
    }
    /// Is this node selected by any shell?
    bool IsSelected() const;

diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index a895407..6a15f4e 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -2010,7 +2010,6 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName)
            if(pIdx)
            {
                SwNodeIndex aIdx(*pIdx, 1);
//              SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
                SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode();
                if(!pGrfNode)
                    throw uno::RuntimeException();
diff --git a/sw/source/filter/xml/xmltexte.cxx b/sw/source/filter/xml/xmltexte.cxx
index 6cbb329..c5d21ba 100644
--- a/sw/source/filter/xml/xmltexte.cxx
+++ b/sw/source/filter/xml/xmltexte.cxx
@@ -197,6 +197,7 @@ void SwXMLTextParagraphExport::setTextEmbeddedGraphicURL(
    SwGrfNode *pGrfNd = GetNoTxtNode( rPropSet )->GetGrfNode();
    if (pGrfNd && !pGrfNd->IsGrfLink())
    {
        pGrfNd->ApplyNewEmbeddedStreamName("vnd.sun.star.Package:" + rURL);
        // #i15411# save-as will swap all graphics in; we need to swap
        // them out again, to prevent excessive memory use
        pGrfNd->SwapOut();
diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx
index 9a1723b..66577ba 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -2247,7 +2247,6 @@ void XMLShapeExport::ImpExportGraphicObjectShape(
            if( !bIsEmptyPresObj )
            {
                OUString aStreamURL;
                OUString aStr;

                xPropSet->getPropertyValue("GraphicStreamURL") >>= aStreamURL;
                xPropSet->getPropertyValue("GraphicURL") >>= sImageURL;
@@ -2255,7 +2254,7 @@ void XMLShapeExport::ImpExportGraphicObjectShape(
                OUString aResolveURL( sImageURL );
                const OUString sPackageURL( "vnd.sun.star.Package:" );

                    // sj: trying to preserve the filename
                // trying to preserve the filename
                if ( aStreamURL.match( sPackageURL, 0 ) )
                {
                    OUString sRequestedName( aStreamURL.copy( sPackageURL.getLength(), aStreamURL.getLength() - sPackageURL.getLength() ) );
@@ -2272,16 +2271,20 @@ void XMLShapeExport::ImpExportGraphicObjectShape(
                    }
                }

                aStr = mrExport.AddEmbeddedGraphicObject( aResolveURL );
                const OUString aStr = mrExport.AddEmbeddedGraphicObject( aResolveURL );
                mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, aStr );

                if( !aStr.isEmpty() )
                {
                    aStreamURL = sPackageURL;
                    if( aStr[ 0 ] == '#' )
                    {
                        aStreamURL = sPackageURL;
                        aStreamURL = aStreamURL.concat( aStr.copy( 1, aStr.getLength() - 1 ) );
                    }
                    else
                    {
                        aStreamURL = aStreamURL.concat( aStr );
                    }

                    // update stream URL for load on demand
                    uno::Any aAny;