diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index 82adf525a2a1..421b11f620ed 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -2256,29 +2256,6 @@ void XMLShapeExport::ImpExportGraphicObjectShape( { if( !bIsEmptyPresObj ) { - OUString aReplacementUrl; - xPropSet->getPropertyValue("ReplacementGraphicURL") >>= aReplacementUrl; - - // If there is no url, then then graphic is empty - if(!aReplacementUrl.isEmpty()) - { - const OUString aStr = mrExport.AddEmbeddedGraphicObject(aReplacementUrl); - - if(aStr.getLength()) - { - mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, aStr); - 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 ); - - // xlink:href for replacement, only written for Svg content - SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_IMAGE, sal_True, sal_True); - - // optional office:binary-data - mrExport.AddEmbeddedGraphicObjectAsBase64(aReplacementUrl); - } - } - OUString aStreamURL; OUString aStr; @@ -2346,6 +2323,34 @@ void XMLShapeExport::ImpExportGraphicObjectShape( if( !bIsEmptyPresObj ) ImpExportText( xShape ); } + + //Resolves: fdo#62461 put preferred image first above, followed by + //fallback here + if( !bIsEmptyPresObj ) + { + OUString aReplacementUrl; + xPropSet->getPropertyValue("ReplacementGraphicURL") >>= aReplacementUrl; + + // If there is no url, then then graphic is empty + if(!aReplacementUrl.isEmpty()) + { + const OUString aStr = mrExport.AddEmbeddedGraphicObject(aReplacementUrl); + + if(aStr.getLength()) + { + mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, aStr); + 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 ); + + // xlink:href for replacement, only written for Svg content + SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_IMAGE, sal_True, sal_True); + + // optional office:binary-data + mrExport.AddEmbeddedGraphicObjectAsBase64(aReplacementUrl); + } + } + } } ImpExportEvents( xShape ); diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index f43673c59297..755db3501381 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -3097,26 +3097,6 @@ void XMLTextParagraphExport::_exportTextGraphic( OUString sReplacementOrigURL; rPropSet->getPropertyValue( sReplacementGraphicURL ) >>= sReplacementOrigURL; - if(sReplacementOrigURL.getLength()) - { - const OUString sReplacementURL(GetExport().AddEmbeddedGraphicObject( sReplacementOrigURL )); - - // If there is no url, then then graphic is empty - if(sReplacementURL.getLength()) - { - GetExport().AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, sReplacementURL); - GetExport().AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE); - GetExport().AddAttribute(XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED); - GetExport().AddAttribute(XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD); - - // xlink:href for replacement, only written for Svg content - SvXMLElementExport aElement(GetExport(), XML_NAMESPACE_DRAW, XML_IMAGE, sal_False, sal_True); - - // optional office:binary-data - GetExport().AddEmbeddedGraphicObjectAsBase64(sReplacementURL); - } - } - // xlink:href OUString sOrigURL; rPropSet->getPropertyValue( sGraphicURL ) >>= sOrigURL; @@ -3148,6 +3128,30 @@ void XMLTextParagraphExport::_exportTextGraphic( GetExport().AddEmbeddedGraphicObjectAsBase64( sOrigURL ); } + //Resolves: fdo#62461 put preferred image first above, followed by + //fallback here + if (!sReplacementOrigURL.isEmpty()) + { + const OUString sReplacementURL(GetExport().AddEmbeddedGraphicObject( sReplacementOrigURL )); + + // If there is no url, then then graphic is empty + if(sReplacementURL.getLength()) + { + GetExport().AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, sReplacementURL); + GetExport().AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE); + GetExport().AddAttribute(XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED); + GetExport().AddAttribute(XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD); + + // xlink:href for replacement, only written for Svg content + SvXMLElementExport aElement(GetExport(), XML_NAMESPACE_DRAW, XML_IMAGE, sal_False, sal_True); + + // optional office:binary-data + GetExport().AddEmbeddedGraphicObjectAsBase64(sReplacementURL); + } + } + + + // script:events Reference xEventsSupp( rPropSet, UNO_QUERY ); GetExport().GetEventExport().Export(xEventsSupp);