diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-11-15 15:29:02 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-11-15 16:04:34 +0000 |
commit | 306a39ec0d2cde09d7e75e726ce47622939733d7 (patch) | |
tree | ed8834177f75f9cf5b661d5069605faf4da0d8b9 | |
parent | 9db943c50519b2a36f3eb144fda7f08abe13bdb2 (diff) |
Resolves: fdo#62461 put preferred image first
with fallback after.
"Each child element of a frame is a different representation of the same
content. The order of content elements reflects the document author's
preference for rendering, with the first child element being preferred. That
means that consumers should render the first child element that they support. A
frame may contain multiple content elements, but shall contain at least one
content element."
Change-Id: If50062cad58f5b8561ad6bd8dc1a06956d2f444b
-rw-r--r-- | xmloff/source/draw/shapeexport.cxx | 51 | ||||
-rw-r--r-- | xmloff/source/text/txtparae.cxx | 44 |
2 files changed, 52 insertions, 43 deletions
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<XEventsSupplier> xEventsSupp( rPropSet, UNO_QUERY ); GetExport().GetEventExport().Export(xEventsSupp); |