Kaydet (Commit) 192abfb3 authored tarafından Oliver-Rainer Wittmann's avatar Oliver-Rainer Wittmann Kaydeden (comit) Caolán McNamara

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

of embedded graphic file during save (ODF export)

(cherry picked from commit a90c0079)

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
üst e0eb5fa8
...@@ -174,8 +174,11 @@ public: ...@@ -174,8 +174,11 @@ public:
bool SwapIn( bool bWaitForData = false ); bool SwapIn( bool bWaitForData = false );
/// Remove graphic in order to free memory. /// Remove graphic in order to free memory.
bool SwapOut(); bool SwapOut();
/// Access to storage stream-name. /// applying new stream name for embedded graphic - needed as saving the document might change this stream name
void SetStreamName( const OUString& r ) { maGrfObj.SetUserData( r ); } void ApplyNewEmbeddedStreamName(const OUString& r)
{
maGrfObj.SetUserData(r);
}
/// Is this node selected by any shell? /// Is this node selected by any shell?
bool IsSelected() const; bool IsSelected() const;
......
...@@ -2010,7 +2010,6 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName) ...@@ -2010,7 +2010,6 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName)
if(pIdx) if(pIdx)
{ {
SwNodeIndex aIdx(*pIdx, 1); SwNodeIndex aIdx(*pIdx, 1);
// SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode(); SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode();
if(!pGrfNode) if(!pGrfNode)
throw uno::RuntimeException(); throw uno::RuntimeException();
......
...@@ -197,6 +197,7 @@ void SwXMLTextParagraphExport::setTextEmbeddedGraphicURL( ...@@ -197,6 +197,7 @@ void SwXMLTextParagraphExport::setTextEmbeddedGraphicURL(
SwGrfNode *pGrfNd = GetNoTxtNode( rPropSet )->GetGrfNode(); SwGrfNode *pGrfNd = GetNoTxtNode( rPropSet )->GetGrfNode();
if (pGrfNd && !pGrfNd->IsGrfLink()) if (pGrfNd && !pGrfNd->IsGrfLink())
{ {
pGrfNd->ApplyNewEmbeddedStreamName("vnd.sun.star.Package:" + rURL);
// #i15411# save-as will swap all graphics in; we need to swap // #i15411# save-as will swap all graphics in; we need to swap
// them out again, to prevent excessive memory use // them out again, to prevent excessive memory use
pGrfNd->SwapOut(); pGrfNd->SwapOut();
......
...@@ -2247,7 +2247,6 @@ void XMLShapeExport::ImpExportGraphicObjectShape( ...@@ -2247,7 +2247,6 @@ void XMLShapeExport::ImpExportGraphicObjectShape(
if( !bIsEmptyPresObj ) if( !bIsEmptyPresObj )
{ {
OUString aStreamURL; OUString aStreamURL;
OUString aStr;
xPropSet->getPropertyValue("GraphicStreamURL") >>= aStreamURL; xPropSet->getPropertyValue("GraphicStreamURL") >>= aStreamURL;
xPropSet->getPropertyValue("GraphicURL") >>= sImageURL; xPropSet->getPropertyValue("GraphicURL") >>= sImageURL;
...@@ -2255,7 +2254,7 @@ void XMLShapeExport::ImpExportGraphicObjectShape( ...@@ -2255,7 +2254,7 @@ void XMLShapeExport::ImpExportGraphicObjectShape(
OUString aResolveURL( sImageURL ); OUString aResolveURL( sImageURL );
const OUString sPackageURL( "vnd.sun.star.Package:" ); const OUString sPackageURL( "vnd.sun.star.Package:" );
// sj: trying to preserve the filename // trying to preserve the filename
if ( aStreamURL.match( sPackageURL, 0 ) ) if ( aStreamURL.match( sPackageURL, 0 ) )
{ {
OUString sRequestedName( aStreamURL.copy( sPackageURL.getLength(), aStreamURL.getLength() - sPackageURL.getLength() ) ); OUString sRequestedName( aStreamURL.copy( sPackageURL.getLength(), aStreamURL.getLength() - sPackageURL.getLength() ) );
...@@ -2272,16 +2271,20 @@ void XMLShapeExport::ImpExportGraphicObjectShape( ...@@ -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 ); mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, aStr );
if( !aStr.isEmpty() ) if( !aStr.isEmpty() )
{ {
aStreamURL = sPackageURL;
if( aStr[ 0 ] == '#' ) if( aStr[ 0 ] == '#' )
{ {
aStreamURL = sPackageURL;
aStreamURL = aStreamURL.concat( aStr.copy( 1, aStr.getLength() - 1 ) ); aStreamURL = aStreamURL.concat( aStr.copy( 1, aStr.getLength() - 1 ) );
} }
else
{
aStreamURL = aStreamURL.concat( aStr );
}
// update stream URL for load on demand // update stream URL for load on demand
uno::Any aAny; uno::Any aAny;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment