summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2017-11-30 15:37:02 +0100
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2017-12-04 09:20:15 +0100
commite96f95fd70c4293f85a022257c757dded6f1ec84 (patch)
treea03f9a6bdb5af284d3f5bb0a267e2d7d231cf975
parent8dae93c0b8a075dee1319efff4e81d90f3f13b2b (diff)
tdf#113696 XHTML Export: Prefer fallback graphic
Which is usually png and browsers can read that, but they can't read our internal metafile format (svm) Change-Id: Idfd82da630ead69f508b74285081e32315030825 Reviewed-on: https://gerrit.libreoffice.org/45590 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> Reviewed-on: https://gerrit.libreoffice.org/45679
-rw-r--r--filter/source/xslt/odf2xhtml/export/xhtml/body.xsl41
1 files changed, 23 insertions, 18 deletions
diff --git a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
index 1172e7efdbc3..9719932fcf2d 100644
--- a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
+++ b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
@@ -1483,27 +1483,32 @@
<xsl:template match="draw:image | draw:object-ole">
<xsl:param name="globalData"/>
- <xsl:choose>
- <xsl:when test="ancestor::text:p or parent::text:span or parent::text:h or parent::draw:a or parent::text:a or text:ruby-base">
- <!-- XHTML does not allow the mapped elements to contain paragraphs -->
- <xsl:call-template name="create-image-element">
- <xsl:with-param name="globalData" select="$globalData"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <!-- images are embedded in a paragraph, but are in CSS not able to express a horizontal alignment for themself.
- A 'div' element taking over the image style would solve that problem, but is invalid as child of a paragraph -->
- <xsl:element name="p">
- <xsl:apply-templates select="@draw:style-name">
- <xsl:with-param name="globalData" select="$globalData"/>
- </xsl:apply-templates>
-
+ <!-- If there is a replacement graphic, we take it.
+ It is a png which browsers are more likely able to render than the original graphic
+ which might have arbitrary formats. -->
+ <xsl:if test="not(following-sibling::draw:image)">
+ <xsl:choose>
+ <xsl:when test="ancestor::text:p or parent::text:span or parent::text:h or parent::draw:a or parent::text:a or text:ruby-base">
+ <!-- XHTML does not allow the mapped elements to contain paragraphs -->
<xsl:call-template name="create-image-element">
<xsl:with-param name="globalData" select="$globalData"/>
</xsl:call-template>
- </xsl:element>
- </xsl:otherwise>
- </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- images are embedded in a paragraph, but are in CSS not able to express a horizontal alignment for themself.
+ A 'div' element taking over the image style would solve that problem, but is invalid as child of a paragraph -->
+ <xsl:element name="p">
+ <xsl:apply-templates select="@draw:style-name">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+
+ <xsl:call-template name="create-image-element">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
</xsl:template>
<xsl:template name="create-image-element">