odt2mediawiki.xsl: reuse table cell code, check USE_DEFAULT_TABLE_CLASS, use current vbles

Change-Id: Iedaddf11604b13c7db1d2b588a5f205f691ea2b4
Reviewed-on: https://gerrit.libreoffice.org/15440
Tested-by: David Tardon <dtardon@redhat.com>
Reviewed-by: David Tardon <dtardon@redhat.com>
This commit is contained in:
Robert Antoni Buj Gelonch 2015-04-20 13:01:28 +02:00 committed by David Tardon
parent 423cfc2061
commit 50c43b030b

View File

@ -409,67 +409,26 @@
</template>
<template match="table:table-row">
<variable name="style-name" select="table:table-cell[1]/@table:style-name"/>
<variable name="total-style-name" select="count(table:table-cell/@table:style-name)"/>
<variable name="total-equal-style-name" select="count(table:table-cell[@table:style-name=$style-name])"/>
<variable name="style">
<if test="$total-equal-style-name=$total-style-name">
<variable name="style-element" select="key('style-ref', $style-name)"/>
<call-template name="translate-style-property">
<with-param name="style-name" select="'background-color'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:background-color"/>
</call-template>
<call-template name="translate-style-property">
<with-param name="style-name" select="'border'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border"/>
</call-template>
<call-template name="translate-style-property">
<with-param name="style-name" select="'border-top'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border-top"/>
</call-template>
<call-template name="translate-style-property">
<with-param name="style-name" select="'border-bottom'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border-bottom"/>
</call-template>
<call-template name="translate-style-property">
<with-param name="style-name" select="'border-left'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border-left"/>
</call-template>
<call-template name="translate-style-property">
<with-param name="style-name" select="'border-right'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border-right"/>
</call-template>
<call-template name="translate-style-property">
<with-param name="style-name" select="'padding'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding"/>
</call-template>
<call-template name="translate-style-property">
<with-param name="style-name" select="'padding-top'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding-top"/>
</call-template>
<call-template name="translate-style-property">
<with-param name="style-name" select="'padding-bottom'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding-bottom"/>
</call-template>
<call-template name="translate-style-property">
<with-param name="style-name" select="'padding-left'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding-left"/>
</call-template>
<call-template name="translate-style-property">
<with-param name="style-name" select="'padding-right'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding-right"/>
</call-template>
</if>
</variable>
<text>|-</text>
<if test="string-length($style) &gt; 0">
<text> style="</text>
<value-of select="$style"/>
<text>" </text>
<if test="not($USE_DEFAULT_TABLE_CLASS) and boolean(table:table-cell[1]/@table:style-name)">
<variable name="style-name" select="table:table-cell[1]/@table:style-name"/>
<variable name="total-style-name" select="count(table:table-cell/@table:style-name)"/>
<variable name="total-equal-style-name" select="count(table:table-cell[@table:style-name=$style-name])"/>
<variable name="style">
<if test="$total-equal-style-name=$total-style-name">
<call-template name="translate-table-cell-properties">
<with-param name="style-element" select="key('style-ref', $style-name)"/>
</call-template>
</if>
</variable>
<if test="string-length($style) &gt; 0">
<text> style="</text>
<value-of select="$style"/>
<text>"</text>
</if>
</if>
<value-of select="$NL"/>
@ -509,57 +468,14 @@
</choose>
</if>
<variable name="style-name" select="@table:style-name"/>
<if test="not($USE_DEFAULT_TABLE_CLASS) and boolean(@table:style-name)">
<variable name="style-element" select="key('style-ref', @table:style-name)"/>
<variable name="style-name" select="@table:style-name"/>
<variable name="style">
<!-- Only if cells have a different style-name -->
<if test="count(../table:table-cell/@table:style-name) != count(../table:table-cell[@table:style-name=$style-name]) and count(../table:table-cell/@table:style-name) &gt; 0">
<call-template name="translate-style-property">
<with-param name="style-name" select="'background-color'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:background-color"/>
</call-template>
<call-template name="translate-style-property">
<with-param name="style-name" select="'border'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border"/>
</call-template>
<call-template name="translate-style-property">
<with-param name="style-name" select="'border-top'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border-top"/>
</call-template>
<call-template name="translate-style-property">
<with-param name="style-name" select="'border-bottom'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border-bottom"/>
</call-template>
<call-template name="translate-style-property">
<with-param name="style-name" select="'border-left'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border-left"/>
</call-template>
<call-template name="translate-style-property">
<with-param name="style-name" select="'border-right'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border-right"/>
</call-template>
<call-template name="translate-style-property">
<with-param name="style-name" select="'padding'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding"/>
</call-template>
<call-template name="translate-style-property">
<with-param name="style-name" select="'padding-top'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding-top"/>
</call-template>
<call-template name="translate-style-property">
<with-param name="style-name" select="'padding-bottom'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding-bottom"/>
</call-template>
<call-template name="translate-style-property">
<with-param name="style-name" select="'padding-left'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding-left"/>
</call-template>
<call-template name="translate-style-property">
<with-param name="style-name" select="'padding-right'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding-right"/>
<call-template name="translate-table-cell-properties">
<with-param name="style-element" select="key('style-ref', $style-name)"/>
</call-template>
</if>
</variable>
@ -608,59 +524,16 @@
</choose>
</if>
<variable name="style-name" select="@table:style-name"/>
<if test="not($USE_DEFAULT_TABLE_CLASS) and boolean(@table:style-name)">
<variable name="style-element" select="key('style-ref', @table:style-name)"/>
<variable name="style">
<variable name="style-name" select="@table:style-name"/>
<variable name="style">
<!-- Only if cells have a different style-name -->
<if test="count(../table:table-cell/@table:style-name) != count(../table:table-cell[@table:style-name=$style-name]) and count(../table:table-cell/@table:style-name) &gt; 0">
<call-template name="translate-style-property">
<with-param name="style-name" select="'background-color'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:background-color"/>
<call-template name="translate-table-cell-properties">
<with-param name="style-element" select="key('style-ref', $style-name)"/>
</call-template>
<call-template name="translate-style-property">
<with-param name="style-name" select="'border'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border"/>
</call-template>
<call-template name="translate-style-property">
<with-param name="style-name" select="'border-top'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border-top"/>
</call-template>
<call-template name="translate-style-property">
<with-param name="style-name" select="'border-bottom'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border-bottom"/>
</call-template>
<call-template name="translate-style-property">
<with-param name="style-name" select="'border-left'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border-left"/>
</call-template>
<call-template name="translate-style-property">
<with-param name="style-name" select="'border-right'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border-right"/>
</call-template>
<call-template name="translate-style-property">
<with-param name="style-name" select="'padding'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding"/>
</call-template>
<call-template name="translate-style-property">
<with-param name="style-name" select="'padding-top'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding-top"/>
</call-template>
<call-template name="translate-style-property">
<with-param name="style-name" select="'padding-bottom'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding-bottom"/>
</call-template>
<call-template name="translate-style-property">
<with-param name="style-name" select="'padding-left'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding-left"/>
</call-template>
<call-template name="translate-style-property">
<with-param name="style-name" select="'padding-right'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding-right"/>
</call-template>
</if>
</if>
</variable>
<if test="string-length($style) &gt; 0">
@ -674,7 +547,57 @@
<value-of select="$NL"/>
</template>
<template name="translate-style-property">
<template name="translate-table-cell-properties">
<param name="style-element"/>
<call-template name="translate-style-property">
<with-param name="style-name" select="'background-color'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:background-color"/>
</call-template>
<call-template name="translate-style-property">
<with-param name="style-name" select="'border'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border"/>
</call-template>
<call-template name="translate-style-property">
<with-param name="style-name" select="'border-top'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border-top"/>
</call-template>
<call-template name="translate-style-property">
<with-param name="style-name" select="'border-bottom'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border-bottom"/>
</call-template>
<call-template name="translate-style-property">
<with-param name="style-name" select="'border-left'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border-left"/>
</call-template>
<call-template name="translate-style-property">
<with-param name="style-name" select="'border-right'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border-right"/>
</call-template>
<call-template name="translate-style-property">
<with-param name="style-name" select="'padding'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding"/>
</call-template>
<call-template name="translate-style-property">
<with-param name="style-name" select="'padding-top'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding-top"/>
</call-template>
<call-template name="translate-style-property">
<with-param name="style-name" select="'padding-bottom'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding-bottom"/>
</call-template>
<call-template name="translate-style-property">
<with-param name="style-name" select="'padding-left'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding-left"/>
</call-template>
<call-template name="translate-style-property">
<with-param name="style-name" select="'padding-right'"/>
<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding-right"/>
</call-template>
</template>
<template name="translate-style-property">
<param name="style-name"/>
<param name="style-property"/>