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
This commit is contained in:
Oliver-Rainer Wittmann
2014-05-19 11:37:11 +00:00
committed by Caolán McNamara
parent e0eb5fa849
commit 192abfb36b
4 changed files with 13 additions and 7 deletions

View File

@@ -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;

View File

@@ -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();

View File

@@ -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();

View File

@@ -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;