summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorSvante Schubert <svante.schubert@gmail.com>2020-08-26 13:44:57 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2021-03-02 13:23:17 +0100
commit9d3b39cf9fed9a305ac23d1ecaaafc8f7caaeeb0 (patch)
tree5a0242ed7b29b4359467b9de404a1a068741fcc8 /filter
parent3b7f5202cc7f799a692e6dd09e71926336727c25 (diff)
HTML XSLT: Missing paragraph BORDER of stand-alone border paragraph (@style:join-border problem)
Change-Id: I20afce950213d4d55541d66a438db14a54b6ddd1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111617 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'filter')
-rw-r--r--filter/source/xslt/odf2xhtml/export/common/styles/style_collector.xsl62
-rw-r--r--filter/source/xslt/odf2xhtml/export/xhtml/body.xsl41
2 files changed, 64 insertions, 39 deletions
diff --git a/filter/source/xslt/odf2xhtml/export/common/styles/style_collector.xsl b/filter/source/xslt/odf2xhtml/export/common/styles/style_collector.xsl
index d1c8f189be85..389be7da5638 100644
--- a/filter/source/xslt/odf2xhtml/export/common/styles/style_collector.xsl
+++ b/filter/source/xslt/odf2xhtml/export/common/styles/style_collector.xsl
@@ -514,9 +514,17 @@
<xsl:copy-of select="." />
</xsl:for-each>
+ <!-- split border into border parts for better activation-check on style:joint-border feature -->
+ <xsl:if test="*/@fo:border">
+ <xsl:attribute name="fo:border-top" select="*/@fo:border" />
+ <xsl:attribute name="fo:border-left" select="*/@fo:border" />
+ <xsl:attribute name="fo:border-bottom" select="*/@fo:border" />
+ <xsl:attribute name="fo:border-right" select="*/@fo:border" />
+ </xsl:if>
+
<!--All current attributes will override already inserted attributes of the same name
XSLT Spec: "Adding an attribute to an element replaces any existing attribute of that element with the same expanded-name." -->
- <xsl:for-each select="*/@*[name() != 'style:font-size-rel']">
+ <xsl:for-each select="*/@*[name() != 'style:font-size-rel'][name() != 'fo:border']">
<xsl:copy-of select="." />
</xsl:for-each>
@@ -702,40 +710,28 @@
<xsl:template name="writeUsedStyles2">
<xsl:param name="globalData" />
<xsl:param name="style"/>
+ <!-- activation-check on style:joint-border feature -->
<xsl:choose>
<xsl:when test="
$style/@style:family='paragraph'
and
- (
- (
(
$style/*/@fo:border-top
- or $style/*/@fo:border-bottom
- or ($style/*/@fo:border
- and
- not($style/*/@fo:border='none')
- )
+ or
+ $style/*/@fo:border-bottom
)
- and
- (
- not($style/*/@style:join-border)
- or $style/*/@style:join-border = 'true'
- )
- )
- or
- (
+ and
(
- $style/*/@fo:margin-top
- or $style/*/@fo:margin-bottom
- or $style/*/@fo:margin
+ not($style/*/@fo:border-top='none' and
+ $style/*/@fo:border-left='none' and
+ $style/*/@fo:border-right='none' and
+ $style/*/@fo:border-bottom='none')
)
- and
- ( $style/*/@fo:background-color
- and
- not($style/*/@fo:background-color='transparent')
- )
- )
- )">
+ and
+ (
+ not($style/*/@style:join-border)
+ or $style/*/@style:join-border = 'true'
+ )">
<xsl:element name="style" namespace="">
<xsl:copy-of select="$style/@style:family" />
<xsl:attribute name="style:name"><xsl:value-of select="concat($style/@style:name, '_borderStart')" /></xsl:attribute>
@@ -751,8 +747,7 @@
</xsl:element>
<xsl:element name="style" namespace="">
<xsl:copy-of select="$style/@style:family" />
- <xsl:copy-of select="$style/@style:name" />
- <xsl:attribute name="mergedBorders"><xsl:value-of select="true()" /></xsl:attribute>
+ <xsl:attribute name="style:name"><xsl:value-of select="concat($style/@style:name, '_borderSides')" /></xsl:attribute>
<xsl:element name="final-properties" namespace="">
<xsl:apply-templates select="$style/*/@*[not(name() = 'fo:border-top') and not(name() = 'fo:border-bottom')][not(name() = 'fo:padding-top') and not(name() = 'fo:padding-bottom')][not(name() = 'fo:margin-top') and not(name() = 'fo:margin-bottom')][not(name() = 'fo:margin')]">
<xsl:with-param name="globalData" select="$globalData" />
@@ -776,6 +771,17 @@
<xsl:text> border-top-style:none;</xsl:text>
</xsl:element>
</xsl:element>
+ <xsl:element name="style" namespace="">
+ <xsl:copy-of select="$style/@style:family" />
+ <xsl:copy-of select="$style/@style:name" />
+ <!-- the original name bears the trigger: 'mergedBorder' flag-->
+ <xsl:attribute name="mergedBorders"><xsl:value-of select="true()" /></xsl:attribute>
+ <xsl:element name="final-properties" namespace="">
+ <xsl:apply-templates select="$style/*/@*">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
diff --git a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
index 62a2cf613b19..53af56fa2f94 100644
--- a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
+++ b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
@@ -704,13 +704,19 @@
<xsl:with-param name="globalData" select="$globalData"/>
</xsl:apply-templates>
</xsl:when>
- <xsl:otherwise>
+ <!-- inbetween paragraphs with border/margin -->
+ <xsl:when test="$isPrecedingBorderParagraph and $isFollowingBorderParagraph">
<xsl:attribute name="class">
- <xsl:value-of select="translate(@text:style-name, '.,;: %()[]/\+', '_____________')"/>
+ <xsl:value-of select="concat(translate(@text:style-name, '.,;: %()[]/\+', '_____________'), '_borderSides')"/>
</xsl:attribute>
<xsl:apply-templates>
<xsl:with-param name="globalData" select="$globalData"/>
</xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="write-paragraph">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
@@ -1610,14 +1616,27 @@
============
The indent of a list label is not only calculated by using the text:space-before of the list level (listLevelStyle), but
- as well taking the left margin of the first paragraph (or heading) of the list into account as loy match="" name="" use=""/>ng it is not negative.
-
- | MARGIN LEFT | LABEL |
-
- | text:space-before (listlevelstyle) | text:min-label-width |
- | + fo:left-margin (firstParagraph) | |
-
- Further details beyond text:list-list...
+ as well taking the left margin of the first paragraph (or heading) of the list into account as long it is not negative.
+
+ | MARGIN LEFT | LABEL | CONTENT-PADDING
+ @text:space-before (1) | @text:min-label-width (1) | @text:min-label-distance (1)
+ | + @fo:left-margin (firstParagraph) | |
+
+
+ (1) all attributes belong to: text:list-style/$listLevelStyle/style:list-level-properties/@*
+ $listLevelStyle might be one of three choices:
+ 1) <text:list-level-style-number>
+ 2) <text:list-level-style-bullet>
+ 3) <text:list-level-style-image>
+
+ For example:
+ <text:list-style style:name="Appendix">
+ <text:list-level-style-number text:level="1" text:style-name="Zeichenformat" style:num-prefix="Appendix " style:num-suffix=". " style:num-format="A" style:num-letter-sync="true">
+ <style:list-level-properties text:min-label-width="0.762cm" text:min-label-distance="0.127cm"/>
+ </text:list-level-style-number>
+ <text:list-level-style-number text:level="2" text:style-name="Zeichenformat" style:num-suffix="." style:num-format="1" text:display-levels="2">
+ <style:list-level-properties text:min-label-width="1.016cm"/>
+ </text:list-level-style-number>
-->
<xsl:key name="listStyles" match=" /*/office:styles/text:list-style | /*/office:automatic-styles/text:list-style | /*/office:styles/style:graphic-properties/text:list-style | /*/office:automatic-styles/style:graphic-properties/text:list-style | /*/office:styles/text:list-style | /*/office:automatic-styles/text:list-style | /*/office:styles/style:graphic-properties/text:list-style | /*/office:automatic-styles/style:graphic-properties/text:list-style" use="@style:name"/>
@@ -2004,7 +2023,7 @@
<xsl:otherwise>
<xsl:variable name="listLabelWidth">
<xsl:choose>
- <xsl:when test="$minLabelWidth &gt; $minLabelDist">
+ <xsl:when test="$minLabelWidth">
<xsl:value-of select="$minLabelWidth"/>
</xsl:when>
<xsl:otherwise>