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
This commit is contained in:
Caolán McNamara
2013-11-15 15:29:02 +00:00
parent 9db943c505
commit 306a39ec0d
2 changed files with 52 additions and 43 deletions

View File

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

View File

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