移除office-plugin, 使用新版jodconverter

This commit is contained in:
陈精华
2022-12-15 18:19:30 +08:00
parent 281a9cfbab
commit 7d3a4ebc4e
12562 changed files with 202 additions and 3641 deletions

View File

@@ -0,0 +1,209 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw">
<xsl:output method="xml" indent="no" encoding="UTF-8" version="1.0" standalone="yes"/>
<xsl:include href="../../common/measure_conversion.xsl"/>
<xsl:include href="../common/ooo2ms_docpr.xsl"/>
<xsl:include href="ooo2wordml_settings.xsl"/>
<xsl:include href="ooo2wordml_border.xsl"/>
<xsl:include href="ooo2wordml_page.xsl"/>
<xsl:include href="ooo2wordml_text.xsl"/>
<xsl:include href="ooo2wordml_list.xsl"/>
<xsl:include href="ooo2wordml_field.xsl"/>
<xsl:include href="ooo2wordml_table.xsl"/>
<xsl:include href="ooo2wordml_draw.xsl"/>
<xsl:include href="ooo2wordml_path.xsl"/>
<xsl:key name="paragraph-style" match="style:style[@style:family='paragraph']" use="@style:name"/>
<xsl:key name="text-style" match="style:style[@style:family='text']" use="@style:name"/>
<xsl:key name="section-style" match="style:style[@style:family='section']" use="@style:name"/>
<xsl:key name="master-page" match="style:master-page" use="@style:name"/>
<xsl:key name="page-layout" match="style:page-layout" use="@style:name"/>
<xsl:key name="slave-style" match="style:style[string-length(normalize-space(@style:master-page-name)) &gt; 0]" use="@style:name"/>
<xsl:key name="list-style" match="office:styles/text:list-style | office:automatic-styles/text:list-style" use="@style:name"/>
<xsl:key name="graphics-style" match="style:style[@style:family='graphic']" use="@style:name"/>
<xsl:template match="/">
<xsl:apply-templates select="office:document"/>
</xsl:template>
<xsl:template match="office:document">
<xsl:processing-instruction name="mso-application">progid="Word.Document"</xsl:processing-instruction>
<xsl:variable name="embeddedObjPresent">
<xsl:choose>
<xsl:when test="//draw:object-ole[1]">yes</xsl:when>
<xsl:otherwise>no</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<w:wordDocument xml:space="preserve" w:embeddedObjPresent="{$embeddedObjPresent}">
<xsl:apply-templates select="office:meta"/>
<xsl:apply-templates select="office:font-face-decls"/>
<xsl:if test="office:styles/text:outline-style | office:styles/text:list-style | office:automatic-styles/text:list-style">
<xsl:call-template name="ListStyles"/>
</xsl:if>
<w:styles>
<xsl:apply-templates select="office:styles"/>
<xsl:apply-templates select="office:automatic-styles"/>
<xsl:call-template name="add_hyperlink_style"/>
<!--add for hyperlink character style G.Y.-->
<xsl:call-template name="add_comments_style"/>
<!--add for comments style G.Y.-->
</w:styles>
<xsl:call-template name="export-oledata"/>
<xsl:apply-templates select="office:settings"/>
<xsl:apply-templates select="office:body"/>
</w:wordDocument>
</xsl:template>
<xsl:template match="office:body">
<xsl:call-template name="page-background"/>
<xsl:apply-templates select="office:text"/>
</xsl:template>
<xsl:template match="office:font-face-decls">
<!-- get default font from default paragraph properties -->
<w:fonts>
<xsl:variable name="default-paragraph-properties" select="/office:document/office:styles/style:default-style[@style:family = 'paragraph']/style:paragraph-properties"/>
<w:defaultFonts w:ascii="{$default-paragraph-properties/@style:font-name}" w:h-ansi="{$default-paragraph-properties/@style:font-name}" w:fareast="{$default-paragraph-properties/@style:font-name-asian}" w:cs="{$default-paragraph-properties/@style:font-name-complex}"/>
<xsl:for-each select="style:font-face">
<w:font w:name="{@style:name}">
<xsl:if test="@style:font-charset = 'x-symbol'">
<w:charset w:val="02"/>
</xsl:if>
<xsl:choose>
<xsl:when test="@style:font-family-generic = 'swiss'">
<w:family w:val="Swiss"/>
</xsl:when>
<xsl:when test="@style:font-family-generic = 'modern'">
<w:family w:val="Modern"/>
</xsl:when>
<xsl:when test="@style:font-family-generic = 'roman'">
<w:family w:val="Roman"/>
</xsl:when>
<xsl:when test="@style:font-family-generic = 'script'">
<w:family w:val="Script"/>
</xsl:when>
<xsl:when test="@style:font-family-generic = 'decorative'">
<w:family w:val="Decorative"/>
</xsl:when>
<xsl:when test="@style:font-family-generic = 'system'">
<w:family w:val="System"/>
</xsl:when>
<xsl:otherwise>
<w:family w:val="System"/>
</xsl:otherwise>
</xsl:choose>
<w:pitch w:val="{@style:font-pitch}"/>
</w:font>
</xsl:for-each>
</w:fonts>
</xsl:template>
<xsl:template match="office:styles | office:automatic-styles">
<xsl:for-each select="*[(name()='style:style' or name()='style:default-style') and (@style:family= 'paragraph' or @style:family= 'text' or @style:family='table')]">
<xsl:variable name="style-name">
<xsl:choose>
<xsl:when test="name() = 'style:default-style'">
<xsl:value-of select="concat('default-', @style:family, '-style')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@style:name"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<w:style w:styleId="{$style-name}">
<xsl:choose>
<xsl:when test="@style:family = 'paragraph'">
<xsl:attribute name="w:type">paragraph</xsl:attribute>
</xsl:when>
<xsl:when test="@style:family = 'text'">
<xsl:attribute name="w:type">character</xsl:attribute>
</xsl:when>
<xsl:when test="@style:family = 'table'">
<xsl:attribute name="w:type">table</xsl:attribute>
</xsl:when>
</xsl:choose>
<xsl:if test="name() = 'style:default-style'">
<xsl:attribute name="w:default">on</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="@style:parent-style-name">
<w:basedOn w:val="{@style:parent-style-name}"/>
</xsl:when>
<xsl:when test="name() = 'style:style' and @style:family= 'paragraph'">
<w:basedOn w:val="{concat('default-', @style:family, '-style')}"/>
</xsl:when>
</xsl:choose>
<w:name w:val="{$style-name}"/>
<xsl:if test="parent::office:automatic-styles">
<w:hidden w:val="on"/>
</xsl:if>
<xsl:if test="@style:next-style-name">
<w:next w:val="{@style:next-style-name}"/>
</xsl:if>
<xsl:choose>
<xsl:when test="@style:family = 'paragraph'">
<xsl:apply-templates select="style:paragraph-properties" mode="paragraph"/>
</xsl:when>
<xsl:when test="@style:family = 'table'">
<w:tblPr>
<xsl:apply-templates select="style:table-properties" mode="table"/>
</w:tblPr>
</xsl:when>
</xsl:choose>
<xsl:apply-templates select="style:text-properties" mode="character"/>
</w:style>
</xsl:for-each>
</xsl:template>
<xsl:template match="office:text">
<w:body>
<xsl:apply-templates select="text:p | text:h | text:section | text:unordered-list | text:ordered-list | text:list |table:table"/>
<xsl:variable name="paragraph-heading-table" select=".//*[name() = 'text:p' or name() = 'text:h' or name() = 'table:table']"/>
<xsl:variable name="page" select="$paragraph-heading-table[key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])]"/>
<w:sectPr>
<!--w:type w:val="continuous"/ -->
<xsl:apply-templates select="/office:document/office:styles/text:footnotes-configuration">
<xsl:with-param name="within-section" select="'yes'"/>
</xsl:apply-templates>
<xsl:apply-templates select="/office:document/office:styles/text:endnotes-configuration">
<xsl:with-param name="within-section" select="'yes'"/>
</xsl:apply-templates>
<xsl:choose>
<xsl:when test="count($page) &gt; 0">
<xsl:apply-templates select="key('master-page', key( 'slave-style', $page[last()]/@*[name()='text:style-name' or name()='table:style-name'])/@style:master-page-name)"/>
<xsl:if test="key( 'slave-style', $page[last()]/@*[name()='text:style-name' or name()='table:style-name'])/style:paragraph-properties/@style:page-number">
<!-- in M$ word the header and footer associate with the w:sectPr, but in StarOffice writer the header and footer associate with the style:master-page -->
<xsl:variable name="pagenumber_start">
<xsl:value-of select=" key( 'slave-style', $page[last()]/@*[name()='text:style-name' or name()='table:style-name'])/style:paragraph-properties/@style:page-number"/>
</xsl:variable>
<xsl:if test=" number($pagenumber_start) &gt; 0 ">
<w:pgNumType w:start="{$pagenumber_start}"/>
</xsl:if>
<!-- comment out the below line to enable the header and footer display normally when style:page-number =0 -->
<!-- w:pgNumType w:start="{key( 'slave-style', $page[last()]/@*[name()='text:style-name' or name()='table:style-name'])/style:paragraph-properties/@style:page-number}"/-->
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="/office:document/office:master-styles/style:master-page[1]"/>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="$paragraph-heading-table[last()]/ancestor::text:section">
<xsl:apply-templates select="key('section-style',$paragraph-heading-table[last()]/ancestor::text:section[1]/@text:style-name)" mode="section"/>
</xsl:if>
</w:sectPr>
</w:body>
</xsl:template>
<xsl:template match="text:section">
<xsl:apply-templates select="text:p | text:h | text:section | text:unordered-list | text:ordered-list | text:list | table:table"/>
</xsl:template>
</xsl:stylesheet>

View File

@@ -0,0 +1,144 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw">
<!-- multiple usage: get size, type, color of table-cell, paragraph, and page borders. -->
<xsl:template name="get-border-size">
<xsl:param name="border"/>
<xsl:param name="border-line-width"/>
<xsl:choose>
<xsl:when test="$border = 'none' or $border = 'hidden'">
<xsl:text>none;0</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="border-value">
<xsl:call-template name="convert2cm">
<xsl:with-param name="value" select="$border"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="border-style">
<xsl:choose>
<xsl:when test="contains($border,'solid')">solid</xsl:when>
<xsl:when test="contains($border,'double')">double</xsl:when>
<xsl:otherwise>none</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- MS word and SO writer borders Mapping
MS word Borders SO borders
w:val="single" w:sz="0" 0.05pt(0.002cm);solid
w:val="single" w:sz="12" 1.00pt(0.035cm);solid
w:val="single" w:sz="18" 2.50pt(0.088cm);solid
w:val="single" w:sz="36" 4.00pt(0.141cm);solid
w:val="single" w:sz="48" 5.00pt(0.176cm);solid
w:val="double" w:sz="2" 1.10pt(0.039cm);double
w:val="double" w:sz="6" 2.60pt(0.092cm);double
w:val="thin-thick-small-gap" w:sz="12" 3.00pt(0.105cm);double
w:val="thin-thick-large-gap" w:sz="18" 3.55pt(0.125cm);double
w:val="thick-thin-medium-gap" w:sz="24" 4.50pt(0.158cm);double
w:val="thin-thick-medium-gap" w:sz="24" 5.05pt(0.178cm);double
w:val="thin-thick-small-gap" w:sz="24" 6.00pt(0.211cm);double
w:val="thin-thick-medium-gap" w:sz="36" 6.55pt(0.231cm);double
w:val="double" w:sz="18" 7.50pt(0.264cm);double
w:val="thin-thick-medium-gap" w:sz="48" 9.00pt(0.317cm);double;style:border-line-width="0.088cm 0.088cm 0.141cm"
w:val="double" w:sz="24" 9.00pt(0.317cm);double;style:border-line-width="0.141cm 0.088cm 0.088cm"
we adjust the criteria by adding about 1/2 range of this current criteria and next criteria. Gary. Yang -->
<xsl:variable name="microsoft-border-style-size">
<xsl:choose>
<xsl:when test=" $border-style = 'solid'">
<xsl:choose>
<xsl:when test="$border-value &lt;= 0.018">single;0</xsl:when>
<xsl:when test="$border-value &lt;= 0.055">single;12</xsl:when>
<xsl:when test="$border-value &lt;= 0.110">single;18</xsl:when>
<xsl:when test="$border-value &lt;= 0.155">single;36</xsl:when>
<xsl:when test="$border-value &lt;= 0.198">single;48</xsl:when>
<xsl:otherwise>single;48</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="$border-style = 'double'">
<xsl:choose>
<xsl:when test="$border-value &lt; 0.064">double;2</xsl:when>
<xsl:when test="$border-value &lt; 0.098">double;6</xsl:when>
<xsl:when test="$border-value &lt; 0.115">thin-thick-small-gap;12</xsl:when>
<xsl:when test="$border-value &lt; 0.135">thin-thick-large-gap;18</xsl:when>
<xsl:when test="$border-value &lt; 0.168">thick-thin-medium-gap;24</xsl:when>
<xsl:when test="$border-value &lt; 0.190">thin-thick-medium-gap;24</xsl:when>
<xsl:when test="$border-value &lt; 0.221">thin-thick-small-gap;24</xsl:when>
<xsl:when test="$border-value &lt; 0.241">thin-thick-medium-gap;36</xsl:when>
<xsl:when test="$border-value &lt; 0.300">double;18</xsl:when>
<xsl:when test="$border-value &lt; 0.430">
<xsl:variable name="border-inner-line-value">
<xsl:call-template name="convert2cm">
<xsl:with-param name="value" select="$border-line-width"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="$border-inner-line-value &lt; 0.10">thin-thick-medium-gap;48</xsl:if>
<xsl:if test="$border-inner-line-value &gt; 0.10">double;24</xsl:if>
</xsl:when>
<xsl:otherwise>double;24</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>none;0</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="$microsoft-border-style-size"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- get bottom and right border style, size, color -->
<xsl:template name="get-border">
<xsl:param name="so-border"/>
<xsl:param name="so-border-line-width"/>
<xsl:param name="so-border-position"/>
<xsl:variable name="ms-style-width">
<xsl:call-template name="get-border-size">
<xsl:with-param name="border" select="$so-border"/>
<xsl:with-param name="border-line-width" select="$so-border-line-width"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$so-border-position = 'bottom' or $so-border-position = 'right'">
<!-- if border style is bottom or right border we need to change the thin-thick to thick-thin; Vice Versa -->
<xsl:choose>
<xsl:when test="substring-before($ms-style-width, '-')='thin'">
<xsl:attribute name="w:val"><xsl:value-of select="concat( 'thick-thin', substring-after(substring-before($ms-style-width, ';'), 'k' ))"/></xsl:attribute>
</xsl:when>
<xsl:when test="substring-before($ms-style-width, '-')='thick'">
<xsl:attribute name="w:val"><xsl:value-of select="concat( 'thin-thick', substring-after(substring-before($ms-style-width, ';'), 'n' ))"/></xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="w:val"><xsl:value-of select="substring-before($ms-style-width, ';')"/></xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:attribute name="w:sz"><xsl:value-of select="substring-after($ms-style-width,';')"/></xsl:attribute>
</xsl:when>
<xsl:when test="$so-border-position = 'top' or $so-border-position = 'left'">
<xsl:attribute name="w:val"><xsl:value-of select="substring-before($ms-style-width,';')"/></xsl:attribute>
<xsl:attribute name="w:sz"><xsl:value-of select="substring-after($ms-style-width,';')"/></xsl:attribute>
</xsl:when>
</xsl:choose>
<!--get border color -->
<xsl:choose>
<xsl:when test="contains($so-border,'#')">
<xsl:attribute name="w:color"><xsl:value-of select="substring-after($so-border, '#')"/></xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="w:color">auto</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

View File

@@ -0,0 +1,275 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw">
<xsl:template name="ooo_custom_draw2ms_word_draw_map">
<xsl:param name="ooo_predefined_type"/>
<!-- all ooo draw names are get from EnhancedCustomShapeGeometry.idl-->
<xsl:choose>
<xsl:when test="$ooo_predefined_type = 'isosceles-triangle' ">
<xsl:value-of select=" '#_x0000_t5' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'right-triangle' ">
<xsl:value-of select=" '#_x0000_t6' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'trapezoid' ">
<xsl:value-of select=" '#_x0000_t8' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'diamond' ">
<xsl:value-of select=" '#_x0000_t4' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'hexagon' ">
<xsl:value-of select=" '#_x0000_t9' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'parallelogram' ">
<xsl:value-of select=" '#_x0000_t7' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'pentagon' ">
<xsl:value-of select=" '#_x0000_t56' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'octagon' ">
<xsl:value-of select=" '#_x0000_t10' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'cross' ">
<xsl:value-of select=" '#_x0000_t11' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'ring' ">
<xsl:value-of select=" '#_x0000_t23' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'block-arc' ">
<xsl:value-of select=" '#_x0000_t95' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'can' ">
<xsl:value-of select=" '#_x0000_t22' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'cube' ">
<xsl:value-of select=" '#_x0000_t16' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'paper' ">
<xsl:value-of select=" '#_x0000_t65' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'smiley' ">
<xsl:value-of select=" '#_x0000_t96' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'sun' ">
<xsl:value-of select=" '#_x0000_t183' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'moon' ">
<xsl:value-of select=" '#_x0000_t184' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'heart' ">
<xsl:value-of select=" '#_x0000_t74' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'forbidden' ">
<xsl:value-of select=" '#_x0000_t57' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'left-bracket' ">
<xsl:value-of select=" '#_x0000_t85' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'right-bracket' ">
<xsl:value-of select=" '#_x0000_t86' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'left-brace' ">
<xsl:value-of select=" '#_x0000_t87' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'right-brace' ">
<xsl:value-of select=" '#_x0000_t88' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'bracket-pair' ">
<xsl:value-of select=" '#_x0000_t185' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'brace-pair' ">
<xsl:value-of select=" '#_x0000_t186' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'quad-bevel' ">
<xsl:value-of select=" '#_x0000_t189' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'left-arrow' ">
<xsl:value-of select=" '#_x0000_t66' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'down-arrow' ">
<xsl:value-of select=" '#_x0000_t67' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'up-arrow' ">
<xsl:value-of select=" '#_x0000_t68' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'right-arrow' ">
<xsl:value-of select=" '#_x0000_t13' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'left-right-arrow' ">
<xsl:value-of select=" '#_x0000_t69' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'up-down-arrow' ">
<xsl:value-of select=" '#_x0000_t70' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'mso-spt89' ">
<xsl:value-of select=" '#_x0000_t89' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'quad-arrow' ">
<xsl:value-of select=" '#_x0000_t76' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'notched-right-arrow' ">
<xsl:value-of select=" '#_x0000_t94' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'pentagon-right' ">
<xsl:value-of select=" '#_x0000_t177' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'chevron' ">
<xsl:value-of select=" '#_x0000_t55' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'up-arrow-callout' ">
<xsl:value-of select=" '#_x0000_t79' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'down-arrow-callout' ">
<xsl:value-of select=" '#_x0000_t80' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'up-down-arrow-callout' ">
<xsl:value-of select=" '#_x0000_t82' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'circular-arrow' ">
<xsl:value-of select=" '#_x0000_t103' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'flowchart-process' ">
<xsl:value-of select=" '#_x0000_t109' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'flowchart-alternate-process' ">
<xsl:value-of select=" '#_x0000_t116' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'flowchart-decision' ">
<xsl:value-of select=" '#_x0000_t110' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'flowchart-data' ">
<xsl:value-of select=" '#_x0000_t111' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'flowchart-predefined-process' ">
<xsl:value-of select=" '#_x0000_t112' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'flowchart-internal-storage' ">
<xsl:value-of select=" '#_x0000_t113' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'flowchart-document' ">
<xsl:value-of select=" '#_x0000_t114' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'flowchart-multidocument' ">
<xsl:value-of select=" '#_x0000_t115' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'flowchart-terminator' ">
<xsl:value-of select=" '#_x0000_t116' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'flowchart-preparation' ">
<xsl:value-of select=" '#_x0000_t117' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'flowchart-manual-input' ">
<xsl:value-of select=" '#_x0000_t118' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'flowchart-manual-operation' ">
<xsl:value-of select=" '#_x0000_t119' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'flowchart-connector' ">
<xsl:value-of select=" '#_x0000_t120' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'flowchart-off-page-connector' ">
<xsl:value-of select=" '#_x0000_t177' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'flowchart-card' ">
<xsl:value-of select=" '#_x0000_t121' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'flowchart-punched-tape' ">
<xsl:value-of select=" '#_x0000_t122' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'flowchart-summing-junction' ">
<xsl:value-of select=" '#_x0000_t123' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'flowchart-or' ">
<xsl:value-of select=" '#_x0000_t124' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'flowchart-collate' ">
<xsl:value-of select=" '#_x0000_t125' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'flowchart-sort' ">
<xsl:value-of select=" '#_x0000_t126' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'flowchart-extract' ">
<xsl:value-of select=" '#_x0000_t127' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'flowchart-merge' ">
<xsl:value-of select=" '#_x0000_t128' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'flowchart-stored-data' ">
<xsl:value-of select=" '#_x0000_t130' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'flowchart-delay' ">
<xsl:value-of select=" '#_x0000_t135' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'flowchart-sequential-access' ">
<xsl:value-of select=" '#_x0000_t131' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'flowchart-magnetic-disk' ">
<xsl:value-of select=" '#_x0000_t132' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'flowchart-direct-access-storage' ">
<xsl:value-of select=" '#_x0000_t133' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'flowchart-display' ">
<xsl:value-of select=" '#_x0000_t134' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'rectangular-callout' ">
<xsl:value-of select=" '#_x0000_t61' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'round-rectangular-callout' ">
<xsl:value-of select=" '#_x0000_t62' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'round-callout' ">
<xsl:value-of select=" '#_x0000_t63' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'cloud-callout' ">
<xsl:value-of select=" '#_x0000_t106' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'line-callout-1' ">
<xsl:value-of select=" '#_x0000_t50' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'line-callout-2' ">
<xsl:value-of select=" '#_x0000_t51' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'line-callout-3' ">
<xsl:value-of select=" '#_x0000_t47' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'bang' ">
<xsl:value-of select=" '#_x0000_t72' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'star4' ">
<xsl:value-of select=" '#_x0000_t187' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'star5' ">
<xsl:value-of select=" '#_x0000_t12' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'star8' ">
<xsl:value-of select=" '#_x0000_t58' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'star24' ">
<xsl:value-of select=" '#_x0000_t92' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'vertical-scroll' ">
<xsl:value-of select=" '#_x0000_t97' "/>
</xsl:when>
<xsl:when test="$ooo_predefined_type = 'horizontal-scroll' ">
<xsl:value-of select=" '#_x0000_t98' "/>
</xsl:when>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,347 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw">
<xsl:template name="ListStyles">
<w:lists>
<xsl:if test="descendant::text:list-level-style-image">
<xsl:call-template name="PicLists"/>
</xsl:if>
<xsl:apply-templates select="office:styles/text:outline-style | office:styles/text:list-style | office:automatic-styles/text:list-style" mode="style"/>
<xsl:for-each select="office:styles/text:outline-style | office:styles/text:list-style | office:automatic-styles/text:list-style">
<w:list w:ilfo="{position()}">
<w:ilst w:val="{position()-1}"/>
</w:list>
</xsl:for-each>
</w:lists>
</xsl:template>
<xsl:template match="text:list-style | text:outline-style" mode="style">
<w:listDef w:listDefId="{position()-1}">
<xsl:if test="name(..)='office:styles' and name()!='text:outline-style'">
<w:styleLink w:val="{@style:name}"/>
</xsl:if>
<xsl:for-each select="text:list-level-style-number | text:list-level-style-bullet | text:list-level-style-image | text:outline-level-style">
<xsl:if test="@text:level &lt; 10">
<w:lvl w:ilvl="{ @text:level - 1 }">
<xsl:if test="name()='text:outline-level-style'">
<xsl:variable name="headinglevel">
<xsl:value-of select="@text:level"/>
</xsl:variable>
<xsl:if test="/office:document/office:body//text:h[@text:level=$headinglevel and @text:style-name]">
<xsl:element name="w:pStyle">
<xsl:attribute name="w:val"><xsl:value-of select="/office:document/office:body//text:h[@text:level=$headinglevel]/@text:style-name"/></xsl:attribute>
</xsl:element>
</xsl:if>
</xsl:if>
<xsl:choose>
<xsl:when test="@text:start-value">
<w:start w:val="{@text:start-value}"/>
</xsl:when>
<xsl:otherwise>
<w:start w:val="1"/>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="@text:bullet-char">
<w:nfc w:val="23"/>
</xsl:when>
<xsl:when test="@style:num-format">
<xsl:call-template name="convert_list_number">
<xsl:with-param name="number-format" select="@style:num-format"/>
</xsl:call-template>
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="name()='text:list-level-style-image'">
<w:lvlText w:val="."/>
<w:lvlPicBulletId>
<xsl:attribute name="w:val"><xsl:value-of select="count(preceding::text:list-level-style-image)"/></xsl:attribute>
</w:lvlPicBulletId>
</xsl:when>
<xsl:when test="@text:bullet-char">
<w:lvlText w:val="{@text:bullet-char}"/>
</xsl:when>
<xsl:when test="@text:display-levels and not(../@text:consecutive-numbering='true')">
<xsl:variable name="levelText">
<xsl:call-template name="displaylevel">
<xsl:with-param name="number" select="@text:display-levels"/>
<xsl:with-param name="textlevel" select="@text:level"/>
</xsl:call-template>
</xsl:variable>
<w:lvlText w:val="{concat(@style:num-prefix, substring-after($levelText, '.'), @style:num-suffix)}"/>
</xsl:when>
<xsl:otherwise>
<w:lvlText w:val="{concat(@style:num-prefix, '%', @text:level, @style:num-suffix)}"/>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="style:list-level-properties/@fo:text-align = 'end'">
<w:lvlJc w:val="right"/>
</xsl:when>
<xsl:when test="style:list-level-properties/@fo:text-align = 'center'">
<w:lvlJc w:val="center"/>
</xsl:when>
<xsl:otherwise>
<w:lvlJc w:val="left"/>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="style:list-level-properties/@text:space-before | style:list-level-properties/@text:min-label-width | style:list-level-properties/@text:min-label-distance">
<xsl:call-template name="list_position"/>
</xsl:when>
<xsl:otherwise>
<w:suff w:val="Nothing"/>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates select="key('text-style',@text:style-name)/style:text-properties" mode="character"/>
<xsl:apply-templates select="style:text-properties" mode="character"/>
</w:lvl>
</xsl:if>
</xsl:for-each>
</w:listDef>
</xsl:template>
<xsl:template match="text:list-style" mode="count">
<xsl:value-of select="count(preceding::text:list-style | preceding::text:outline-style)+1"/>
</xsl:template>
<xsl:template match="text:unordered-list | text:ordered-list | text:list">
<xsl:apply-templates select="text:unordered-list | text:ordered-list | text:list-item | text:list-header | text:list"/>
</xsl:template>
<xsl:template match="text:list-item | text:list-header">
<xsl:apply-templates select="text:unordered-list | text:ordered-list | text:list | text:p | text:h"/>
</xsl:template>
<xsl:template name="displaylevel">
<xsl:param name="number"/>
<xsl:param name="textlevel"/>
<xsl:if test="$number &gt; 1">
<xsl:call-template name="displaylevel">
<xsl:with-param name="number" select="$number -1"/>
<xsl:with-param name="textlevel" select="number($textlevel)-1"/>
</xsl:call-template>
</xsl:if>
<xsl:value-of select="concat('.','%',$textlevel)"/>
</xsl:template>
<xsl:template name="list_position">
<xsl:variable name="spacebefore">
<xsl:choose>
<xsl:when test="style:list-level-properties/@text:space-before">
<xsl:call-template name="convert2twip">
<xsl:with-param name="value" select="style:list-level-properties/@text:space-before"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="space2text">
<xsl:choose>
<xsl:when test="style:list-level-properties/@text:min-label-width">
<xsl:call-template name="convert2twip">
<xsl:with-param name="value" select="style:list-level-properties/@text:min-label-width"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="spacedistance">
<xsl:choose>
<xsl:when test="style:list-level-properties/@text:min-label-distance">
<xsl:call-template name="convert2twip">
<xsl:with-param name="value" select="style:list-level-properties/@text:min-label-distance"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:if test="$spacedistance='0' and $space2text='0'">
<w:suff w:val="Nothing"/>
</xsl:if>
<w:pPr>
<xsl:if test="$spacedistance!='0' or $space2text!='0'">
<w:tabs>
<w:tab>
<xsl:attribute name="w:val">list</xsl:attribute>
<xsl:attribute name="w:pos"><xsl:choose><xsl:when test="number($spacedistance) &gt; number($space2text)"><xsl:value-of select="number($spacebefore)+number($spacedistance)+150"/></xsl:when><xsl:otherwise><xsl:value-of select="number($spacebefore)+number($space2text)+150"/></xsl:otherwise></xsl:choose></xsl:attribute>
<!-- Since SO MinSpaceDistance is width after number or bullet, MS TabSpaceAfter include the number or bullet width. So +150 -->
</w:tab>
</w:tabs>
</xsl:if>
<w:ind w:left="{number($space2text)+number($spacebefore)}" w:hanging="{$space2text}"/>
<!-- w:pos(MS TabSpaceAfter) = text:space-before + MAX(text:min-label-distance,text:min-label-width) + ( Symbol width ); w:left(MS IndentAt)= text:space-before + text:min-label-width; w:hanging(MS IndentAt - MS AlignedAt)=text:min-label-width -->
</w:pPr>
</xsl:template>
<xsl:template name="PicLists">
<xsl:for-each select="descendant::text:list-level-style-image">
<w:listPicBullet w:listPicBulletId="{position()-1}">
<w:pict>
<v:shape>
<xsl:variable name="Picwidth">
<xsl:call-template name="convert2pt">
<xsl:with-param name="value" select="style:list-level-properties/@fo:width"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="Picheight">
<xsl:call-template name="convert2pt">
<xsl:with-param name="value" select="style:list-level-properties/@fo:height"/>
</xsl:call-template>
</xsl:variable>
<xsl:attribute name="style"><xsl:value-of select="concat('width:', number($Picwidth*1), 'pt;height:', number($Picheight*1), 'pt')"/></xsl:attribute>
<xsl:attribute name="o:bullet">t</xsl:attribute>
<v:stroke joinstyle="miter"/>
<w:binData w:name="{concat('wordml://SOpicbullet', position(), '.gif')}">
<xsl:value-of select="office:binary-data"/>
</w:binData>
<v:imagedata src="{concat('wordml://SOpicbullet', position(), '.gif')}" o:title="{concat('SOpicbullet', position())}"/>
</v:shape>
</w:pict>
</w:listPicBullet>
</xsl:for-each>
</xsl:template>
<xsl:template name="convert_list_number">
<xsl:param name="number-format"/>
<xsl:choose>
<xsl:when test="$number-format = 'a'">
<!-- nfcLCLetter: Lowercase alpha -->
<w:nfc w:val="4"/>
</xsl:when>
<xsl:when test="$number-format = 'A'">
<!-- nfcUCLetter: Uppercase alpha -->
<w:nfc w:val="3"/>
</xsl:when>
<xsl:when test="$number-format = 'i'">
<!-- nfcLCRoman: Lowercase roman -->
<w:nfc w:val="2"/>
</xsl:when>
<xsl:when test="$number-format = 'I'">
<!-- nfcUCRoman: Uppercase roman -->
<w:nfc w:val="1"/>
</xsl:when>
<xsl:when test="$number-format = '1st'">
<!-- nfcUCOrdinal: Ordinal indicator -->
<w:nfc w:val="5"/>
</xsl:when>
<xsl:when test="$number-format = 'One'">
<!-- nfcCardText: Cardinal -->
<w:nfc w:val="6"/>
</xsl:when>
<xsl:when test="$number-format = 'First'">
<!-- nfcOrdText: Ordinal -->
<w:nfc w:val="7"/>
</xsl:when>
<xsl:when test="$number-format = ', , , ...'">
<!-- ', , , ...' also seems: decimal-full-width2 -->
<w:nfc w:val="14"/>
</xsl:when>
<xsl:when test="$number-format = '①, ②, ③, ...'">
<w:nfc w:val="18"/>
</xsl:when>
<xsl:when test="$number-format = '一, 二, 三, ...'">
<!-- ', , , ...' also seems: ideograph-digital, japanese-counting, japanese-digital-ten-thousand,
taiwanese-counting, taiwanese-counting-thousand, taiwanese-digital, chinese-counting, korean-digital2 -->
<w:nfc w:val="10"/>
</xsl:when>
<xsl:when test="$number-format = '壹, 贰, 叁, ...'">
<w:nfc w:val="38"/>
</xsl:when>
<xsl:when test="$number-format = '壹, 貳, 參, ...'">
<w:nfc w:val="34"/>
</xsl:when>
<xsl:when test="$number-format = '甲, 乙, 丙, ...'">
<w:nfc w:val="30"/>
</xsl:when>
<xsl:when test="$number-format = '子, 丑, 寅, ...'">
<w:nfc w:val="31"/>
</xsl:when>
<xsl:when test="$number-format = '壱, 弐, 参, ...'">
<w:nfc w:val="16"/>
</xsl:when>
<xsl:when test="$number-format = 'ア, イ, ウ, ...'">
<w:nfc w:val="12"/>
</xsl:when>
<xsl:when test="$number-format = 'ア, イ, ウ, ...'">
<w:nfc w:val="20"/>
</xsl:when>
<xsl:when test="$number-format = 'イ, ロ, ハ, ...'">
<w:nfc w:val="13"/>
</xsl:when>
<xsl:when test="$number-format = 'イ, ロ, ハ, ...'">
<w:nfc w:val="21"/>
</xsl:when>
<xsl:when test="$number-format = '일, 이, 삼, ...'">
<!-- ', , , ...' also seems: korean-counting -->
<w:nfc w:val="41"/>
</xsl:when>
<xsl:when test="$number-format = 'ㄱ, ㄴ, ㄷ, ...' or $number-format = '㉠, ㉡, ㉢, ...'">
<!-- mapping circled to uncircled -->
<w:nfc w:val="25"/>
</xsl:when>
<xsl:when test='$number-format = "가, 나, 다, ..." or $number-format = "㉮, ㉯, ㉰, ..."'>
<!-- mapping circled to uncircled -->
<w:nfc w:val="24"/>
</xsl:when>
<xsl:when test="$number-format ='أ, ب, ت, ...'">
<!-- 46. arabic-alpha-->
<w:nfc w:val="46"/>
</xsl:when>
<xsl:when test="$number-format = 'ก, ข, ฃ, ...'">
<!--53. thai-letters not match well !-->
<w:nfc w:val="53"/>
</xsl:when>
<xsl:when test="$number-format='א, י, ק, ...'">
<!--45. hebrew-1-->
<w:nfc w:val="45"/>
</xsl:when>
<xsl:when test="$number-format='א, ב, ג, ...'">
<!--47. hebrew-2-->
<w:nfc w:val="47"/>
</xsl:when>
<xsl:when test="string-length($number-format)=0">
<w:nfc w:val="255"/>
</xsl:when>
<xsl:when test="$number-format = 'Native Numbering'">
<xsl:variable name="locale" select="/office:document/office:meta/dc:language"/>
<xsl:choose>
<xsl:when test="starts-with($locale, 'th-')">
<!-- for Thai, mapping thai-numbers, thai-counting to thai-numbers -->
<w:nfc w:val="54"/>
</xsl:when>
<xsl:when test="starts-with($locale, 'hi-')">
<!-- for Hindi, mapping hindi-vowels, hindi-consonants, hindi-counting to hindi-numbers -->
<w:nfc w:val="51"/>
</xsl:when>
<xsl:when test="starts-with($locale, 'ar-')">
<!-- for Arabic, mapping arabic-abjad to arabic-alpha -->
<w:nfc w:val="45"/>
</xsl:when>
<xsl:when test="starts-with($locale, 'he-')">
<!-- for Hebrew, mapping hebrew-2 to -->
<w:nfc w:val="46"/>
</xsl:when>
<xsl:when test="starts-with($locale, 'ru-')">
<!-- for Russian, mapping russian-upper to russian-lower -->
<w:nfc w:val="58"/>
</xsl:when>
<xsl:when test="starts-with($locale, 'vi-')">
<!-- for Vietnamese -->
<w:nfc w:val="56"/>
</xsl:when>
</xsl:choose>
</xsl:when>
<!-- unsupported: hex, chicago, bullet, ideograph-zodiac-traditional,
chinese-not-impl, korean-legal, none -->
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

View File

@@ -0,0 +1,392 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw">
<xsl:template name="page-background">
<xsl:choose>
<xsl:when test="/office:document/office:automatic-styles/style:page-layout/style:page-layout-properties/style:background-image[string-length(office:binary-data/text()) &gt; 0]">
<w:bgPict>
<xsl:apply-templates select="/office:document/office:automatic-styles/style:page-layout/style:page-layout-properties/style:background-image[string-length(office:binary-data/text()) &gt; 0]" mode="bgPict"/>
</w:bgPict>
</xsl:when>
<xsl:when test="/office:document/office:automatic-styles/style:page-layout/style:page-layout-properties[string-length(@fo:background-color) &gt; 0]">
<w:bgPict>
<xsl:apply-templates select="/office:document/office:automatic-styles/style:page-layout/style:page-layout-properties[string-length(@fo:background-color) &gt; 0]" mode="bgPict"/>
</w:bgPict>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="style:background-image" mode="bgPict">
<xsl:variable name="binName" select="concat('wordml://',generate-id(.))"/>
<w:binData w:name="{$binName}">
<xsl:value-of select="translate(office:binary-data/text(),'&#9;&#10;&#13;&#32;','' ) "/>
</w:binData>
<w:background w:bgcolor="{parent::style:page-layout-properties/@fo:background-color}" w:background="{$binName}"/>
</xsl:template>
<xsl:template match="style:page-layout-properties" mode="bgPict">
<w:background w:bgcolor="{@fo:background-color}"/>
</xsl:template>
<xsl:template match="style:master-page">
<xsl:apply-templates select="key( 'page-layout', @style:page-layout-name)"/>
<xsl:if test="style:header">
<w:hdr w:type="odd">
<xsl:apply-templates select="style:header/text:p | style:header/table:table"/>
<!-- change style:header//text:p to style:header/text:p and add table:table here, fix for Issue 32035 -->
</w:hdr>
</xsl:if>
<xsl:if test="style:header-left">
<w:hdr w:type="even">
<xsl:apply-templates select="style:header-left/text:p | style:header-left/table:table"/>
<!-- change style:header//text:p to style:header/text:p and add table:table here, fix for Issue 32035 -->
</w:hdr>
</xsl:if>
<xsl:if test="style:footer">
<w:ftr w:type="odd">
<xsl:apply-templates select="style:footer/text:p | style:footer/table:table"/>
<!-- change style:header//text:p to style:header/text:p and add table:table here, fix for Issue 32035 -->
</w:ftr>
</xsl:if>
<xsl:if test="style:footer-left">
<w:ftr w:type="even">
<xsl:apply-templates select="style:footer-left/text:p | style:footer-left/table:table"/>
<!-- change style:header//text:p to style:header/text:p and add table:table here, fix for Issue 32035 -->
</w:ftr>
</xsl:if>
</xsl:template>
<xsl:template match="style:page-layout">
<xsl:choose>
<xsl:when test="@style:page-usage = 'left'">
<w:type w:val="even-page"/>
</xsl:when>
<xsl:when test="@style:page-usage = 'right'">
<w:type w:val="odd-page"/>
</xsl:when>
<xsl:when test="@style:page-usage = 'all'">
<w:type w:val="next-page"/>
</xsl:when>
<!-- for mirrored, and default -->
<xsl:otherwise>
<w:type w:val="next-page"/>
</xsl:otherwise>
</xsl:choose>
<xsl:variable name="page-width">
<xsl:if test="style:page-layout-properties/@fo:page-width">
<xsl:call-template name="convert2twip">
<xsl:with-param name="value" select="style:page-layout-properties/@fo:page-width"/>
</xsl:call-template>
</xsl:if>
</xsl:variable>
<xsl:variable name="margin-left">
<xsl:if test="style:page-layout-properties/@fo:margin-left">
<xsl:call-template name="convert2twip">
<xsl:with-param name="value" select="style:page-layout-properties/@fo:margin-left"/>
</xsl:call-template>
</xsl:if>
</xsl:variable>
<xsl:variable name="margin-right">
<xsl:if test="style:page-layout-properties/@fo:margin-right">
<xsl:call-template name="convert2twip">
<xsl:with-param name="value" select="style:page-layout-properties/@fo:margin-right"/>
</xsl:call-template>
</xsl:if>
</xsl:variable>
<w:pgSz>
<xsl:if test="style:page-layout-properties/@fo:page-width">
<xsl:attribute name="w:w">
<xsl:value-of select="$page-width"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="style:page-layout-properties/@fo:page-height">
<xsl:attribute name="w:h">
<xsl:call-template name="convert2twip">
<xsl:with-param name="value" select="style:page-layout-properties/@fo:page-height"/>
</xsl:call-template>
</xsl:attribute>
</xsl:if>
<xsl:if test="style:page-layout-properties/@style:print-orientation">
<xsl:attribute name="w:orient">
<xsl:value-of select="style:page-layout-properties/@style:print-orientation"/>
</xsl:attribute>
</xsl:if>
</w:pgSz>
<w:pgMar>
<xsl:if test="style:page-layout-properties/@fo:margin-top">
<xsl:variable name="top-margin">
<xsl:call-template name="convert2twip">
<xsl:with-param name="value" select="style:page-layout-properties/@fo:margin-top"/>
</xsl:call-template>
</xsl:variable>
<xsl:attribute name="w:top">
<xsl:value-of select="$top-margin"/>
</xsl:attribute>
<xsl:if test="style:header-style/style:page-layout-properties/@fo:min-height">
<xsl:variable name="header-height">
<xsl:call-template name="convert2twip">
<xsl:with-param name="value" select="style:header-style/style:page-layout-properties/@fo:min-height"/>
</xsl:call-template>
</xsl:variable>
<xsl:attribute name="w:header">
<xsl:value-of select="$top-margin - $header-height"/>
</xsl:attribute>
</xsl:if>
</xsl:if>
<xsl:if test="style:page-layout-properties/@fo:margin-bottom">
<xsl:variable name="bottom-margin">
<xsl:call-template name="convert2twip">
<xsl:with-param name="value" select="style:page-layout-properties/@fo:margin-bottom"/>
</xsl:call-template>
</xsl:variable>
<xsl:attribute name="w:bottom">
<xsl:value-of select="$bottom-margin"/>
</xsl:attribute>
<xsl:if test="style:footer-style/style:page-layout-properties/@fo:min-height">
<xsl:variable name="footer-height">
<xsl:call-template name="convert2twip">
<xsl:with-param name="value" select="style:footer-style/style:page-layout-properties/@fo:min-height"/>
</xsl:call-template>
</xsl:variable>
<xsl:attribute name="w:footer">
<xsl:value-of select="$bottom-margin - $footer-height"/>
</xsl:attribute>
</xsl:if>
</xsl:if>
<xsl:if test="style:page-layout-properties/@fo:margin-left">
<xsl:attribute name="w:left">
<xsl:value-of select="$margin-left"/>
</xsl:attribute>
<xsl:attribute name="w:gutter">
<xsl:value-of select="'0'"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="style:page-layout-properties/@fo:margin-right">
<xsl:attribute name="w:right">
<xsl:value-of select="$margin-right"/>
</xsl:attribute>
</xsl:if>
</w:pgMar>
<xsl:variable name="border-top" select="style:page-layout-properties/@fo:border-top | style:page-layout-properties/@fo:border"/>
<xsl:variable name="border-bottom" select="style:page-layout-properties/@fo:border-bottom | style:page-layout-properties/@fo:border"/>
<xsl:variable name="border-left" select="style:page-layout-properties/@fo:border-left | style:page-layout-properties/@fo:border"/>
<xsl:variable name="border-right" select="style:page-layout-properties/@fo:border-right | style:page-layout-properties/@fo:border"/>
<xsl:variable name="border-line-width-top" select="style:page-layout-properties/@style:border-line-width-top | style:page-layout-properties/@style:border-line-width "/>
<xsl:variable name="border-line-width-bottom" select="style:page-layout-properties/@style:border-line-width-bottom | style:page-layout-properties/@style:border-line-width"/>
<xsl:variable name="border-line-width-left" select="style:page-layout-properties/@style:border-line-width-left | style:page-layout-properties/@style:border-line-width"/>
<xsl:variable name="border-line-width-right" select="style:page-layout-properties/@style:border-line-width-right | style:page-layout-properties/@style:border-line-width"/>
<xsl:variable name="padding-top" select="style:page-layout-properties/@fo:padding-top | style:page-layout-properties/@fo:padding"/>
<xsl:variable name="padding-bottom" select="style:page-layout-properties/@fo:padding-bottom | style:page-layout-properties/@fo:padding"/>
<xsl:variable name="padding-left" select="style:page-layout-properties/@fo:padding-left | style:page-layout-properties/@fo:padding"/>
<xsl:variable name="padding-right" select="style:page-layout-properties/@fo:padding-right | style:page-layout-properties/@fo:padding"/>
<w:pgBorders w:offset-from="text">
<xsl:if test="$border-top">
<xsl:element name="w:top">
<xsl:call-template name="get-border">
<xsl:with-param name="so-border" select="$border-top"/>
<xsl:with-param name="so-border-line-width" select="$border-line-width-top"/>
<xsl:with-param name="so-border-position" select=" 'top' "/>
</xsl:call-template>
<xsl:attribute name="w:space">
<xsl:call-template name="convert2pt">
<xsl:with-param name="value" select="$padding-top"/>
</xsl:call-template>
</xsl:attribute>
<xsl:if test="style:page-layout-properties/@style:shadow!='none'">
<xsl:attribute name="w:shadow">on</xsl:attribute>
</xsl:if>
</xsl:element>
</xsl:if>
<xsl:if test="$border-bottom">
<xsl:element name="w:bottom">
<xsl:call-template name="get-border">
<xsl:with-param name="so-border" select="$border-bottom"/>
<xsl:with-param name="so-border-line-width" select="$border-line-width-bottom"/>
<xsl:with-param name="so-border-position" select=" 'bottom' "/>
</xsl:call-template>
<xsl:attribute name="w:space">
<xsl:call-template name="convert2pt">
<xsl:with-param name="value" select="$padding-bottom"/>
</xsl:call-template>
</xsl:attribute>
<xsl:if test="style:page-layout-properties/@style:shadow!='none'">
<xsl:attribute name="w:shadow">on</xsl:attribute>
</xsl:if>
</xsl:element>
</xsl:if>
<xsl:if test="$border-left">
<xsl:element name="w:left">
<xsl:call-template name="get-border">
<xsl:with-param name="so-border" select="$border-left"/>
<xsl:with-param name="so-border-line-width" select="$border-line-width-left"/>
<xsl:with-param name="so-border-position" select=" 'left' "/>
</xsl:call-template>
<xsl:attribute name="w:space">
<xsl:call-template name="convert2pt">
<xsl:with-param name="value" select="$padding-left"/>
</xsl:call-template>
</xsl:attribute>
<xsl:if test="style:page-layout-properties/@style:shadow!='none'">
<xsl:attribute name="w:shadow">on</xsl:attribute>
</xsl:if>
</xsl:element>
</xsl:if>
<xsl:if test="$border-right">
<xsl:element name="w:right">
<xsl:call-template name="get-border">
<xsl:with-param name="so-border" select="$border-right"/>
<xsl:with-param name="so-border-line-width" select="$border-line-width-right"/>
<xsl:with-param name="so-border-position" select=" 'right' "/>
</xsl:call-template>
<xsl:attribute name="w:space">
<xsl:call-template name="convert2pt">
<xsl:with-param name="value" select="$padding-right"/>
</xsl:call-template>
</xsl:attribute>
<xsl:if test="style:page-layout-properties/@style:shadow!='none'">
<xsl:attribute name="w:shadow">on</xsl:attribute>
</xsl:if>
</xsl:element>
</xsl:if>
</w:pgBorders>
<xsl:variable name="valid-width">
<xsl:value-of select="$page-width - $margin-left - $margin-right"/>
</xsl:variable>
<xsl:apply-templates select="style:page-layout-properties/style:columns">
<xsl:with-param name="page-width" select="$valid-width"/>
</xsl:apply-templates>
<xsl:apply-templates select="/office:document/office:styles/text:linenumbering-configuration"/>
</xsl:template>
<xsl:template match="text:linenumbering-configuration">
<xsl:if test="not(@text:number-lines = 'false')">
<xsl:element name="w:lnNumType">
<xsl:if test="@text:increment">
<xsl:attribute name="w:count-by">
<xsl:value-of select="@text:increment"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="@text:offset">
<xsl:attribute name="w:distance">
<xsl:call-template name="convert2twip">
<xsl:with-param name="value" select="@text:offset"/>
</xsl:call-template>
</xsl:attribute>
</xsl:if>
<xsl:attribute name="w:restart">continuous</xsl:attribute>
</xsl:element>
</xsl:if>
</xsl:template>
<xsl:template match="style:style" mode="section">
<xsl:param name="master-page"/>
<xsl:variable name="page-width">
<xsl:call-template name="convert2twip">
<xsl:with-param name="value" select="$master-page/style:page-layout-properties/@fo:page-width"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="margin-left">
<xsl:call-template name="convert2twip">
<xsl:with-param name="value" select="$master-page/style:page-layout-properties/@fo:margin-left"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="margin-right">
<xsl:call-template name="convert2twip">
<xsl:with-param name="value" select="$master-page/style:page-layout-properties/@fo:margin-right"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="valid-width">
<xsl:value-of select="$page-width - $margin-left - $margin-right"/>
</xsl:variable>
<w:type w:val="continuous"/>
<xsl:apply-templates select="style:section-properties/style:columns">
<xsl:with-param name="page-width" select="$valid-width"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="style:columns">
<xsl:param name="page-width"/>
<w:cols w:num="{@fo:column-count}">
<xsl:if test="@fo:column-gap">
<xsl:attribute name="w:space">
<xsl:call-template name="convert2twip">
<xsl:with-param name="value" select="@fo:column-gap"/>
</xsl:call-template>
</xsl:attribute>
</xsl:if>
<xsl:if test="style:column-sep">
<xsl:attribute name="w:sep">on</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="not(style:column)">
<xsl:attribute name="w:equalWidth">on</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="w:equalWidth">off</xsl:attribute>
<xsl:variable name="column-relative-width">
<xsl:call-template name="get-sum-column-width">
<xsl:with-param name="current-column" select="style:column[1]"/>
<xsl:with-param name="current-width" select="'0'"/>
</xsl:call-template>
</xsl:variable>
<xsl:for-each select="style:column">
<xsl:element name="w:col">
<xsl:attribute name="w:w">
<xsl:value-of select="floor(substring-before(@style:rel-width,'*') * $page-width div $column-relative-width)"/>
</xsl:attribute>
<xsl:if test="@fo:margin-right">
<xsl:variable name="margin-right">
<xsl:call-template name="convert2twip">
<xsl:with-param name="value" select="@fo:margin-right"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="following-sibling::style:column">
<xsl:variable name="margin-left">
<xsl:call-template name="convert2twip">
<xsl:with-param name="value" select="@fo:margin-left"/>
</xsl:call-template>
</xsl:variable>
<xsl:attribute name="w:space">
<xsl:value-of select="$margin-right + $margin-left"/>
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="w:space">
<xsl:value-of select="$margin-right"/>
</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:element>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</w:cols>
</xsl:template>
<xsl:template name="get-sum-column-width">
<xsl:param name="current-column"/>
<xsl:param name="current-width"/>
<xsl:variable name="new-width" select="$current-width + substring-before($current-column/@style:rel-width,'*')"/>
<xsl:choose>
<xsl:when test="$current-column/following-sibling::style:column">
<xsl:call-template name="get-sum-column-width">
<xsl:with-param name="current-column" select="$current-column/following-sibling::style:column[1]"/>
<xsl:with-param name="current-width" select="$new-width"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$new-width"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,306 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw">
<xsl:template match="office:settings">
<w:docPr>
<w:displayBackgroundShape/>
<xsl:variable name="view-settings" select="config:config-item-set[@config:name = 'view-settings']"/>
<xsl:choose>
<xsl:when test="$view-settings/config:config-item[@config:name = 'InBrowseMode'] = 'true'">
<w:view w:val="outline"/>
</xsl:when>
<xsl:otherwise>
<w:view w:val="print"/>
</xsl:otherwise>
</xsl:choose>
<xsl:variable name="views" select="$view-settings/config:config-item-map-indexed[@config:name = 'Views']"/>
<w:zoom w:percent="{$views/config:config-item-map-entry/config:config-item[@config:name = 'ZoomFactor']}">
<xsl:variable name="zoom-type" select="$views/config:config-item-map-entry/config:config-item[@config:name = 'ZoomType']"/>
<xsl:choose>
<xsl:when test="$zoom-type = '3'">
<xsl:attribute name="w:val">best-fit</xsl:attribute>
</xsl:when>
<xsl:when test="$zoom-type = '2'">
<xsl:attribute name="w:val">full-page</xsl:attribute>
</xsl:when>
<xsl:when test="$zoom-type = '1'">
<xsl:attribute name="w:val">text-fit</xsl:attribute>
</xsl:when>
</xsl:choose>
</w:zoom>
<w:defaultTabStop>
<xsl:attribute name="w:val"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="/office:document/office:styles/style:default-style[@style:family='paragraph']/style:paragraph-properties/@style:tab-stop-distance"/></xsl:call-template></xsl:attribute>
</w:defaultTabStop>
<xsl:if test="../office:master-styles/style:master-page/style:header-left">
<w:evenAndOddHeaders/>
</xsl:if>
<xsl:apply-templates select="/office:document/office:styles/text:footnotes-configuration"/>
<xsl:apply-templates select="/office:document/office:styles/text:endnotes-configuration"/>
<!-- add the variables declaration in w:docpr G.Y. Begin-->
<xsl:if test="/office:document/office:body/office:text/text:variable-decls | /office:document/office:body/office:text/text:user-field-decls |/office:document/office:body/office:text/text:sequence-decls ">
<xsl:call-template name="field_declare">
<xsl:with-param name="simple_field_variable_declares" select="/office:document/office:body/office:text/text:variable-decls"/>
<xsl:with-param name="user_field_variable_declares" select=" /office:document/office:body/office:text/text:user-field-decls"/>
<xsl:with-param name="field_sequence_declares" select="/office:document/office:body/office:text/text:sequence-decls"/>
</xsl:call-template>
</xsl:if>
<!--add the variables declaration in w:docpr G.Y. End-->
</w:docPr>
</xsl:template>
<xsl:template match="text:footnotes-configuration">
<xsl:param name="within-section"/>
<w:footnotePr>
<xsl:choose>
<xsl:when test="@text:footnotes-position = 'document'">
<w:pos w:val="beneath-text"/>
</xsl:when>
<xsl:otherwise>
<w:pos w:val="page-bottom"/>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="@text:start-value">
<w:numStart w:val="{@text:start-value + 1}"/>
</xsl:if>
<xsl:if test="@style:num-format">
<xsl:call-template name="convert-number-format">
<xsl:with-param name="number-format" select="@style:num-format"/>
<xsl:with-param name="number-prefix" select="@style:num-prefix"/>
<xsl:with-param name="number-suffix" select="@style:num-suffix"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="@text:start-numbering-at">
<xsl:choose>
<xsl:when test="@text:start-numbering-at = 'document'">
<w:numRestart w:val="continuous"/>
</xsl:when>
<xsl:when test="@text:start-numbering-at = 'page'">
<w:numRestart w:val="each-page"/>
</xsl:when>
<!-- convert "chapter" to "section" -->
<xsl:otherwise>
<w:numRestart w:val="each-sect"/>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<xsl:if test="$within-section != 'yes'">
<!-- because in SO/OOo footnote-sep is defined within every page-layout, but in Word XML footnote separator
is defined solely in docPr, so not trouble to find the proper footnote-sep definition. -->
<w:footnote w:type="separator">
<w:p>
<w:r>
<w:separator/>
</w:r>
</w:p>
</w:footnote>
<w:footnote w:type="continuation-separator">
<w:p>
<w:r>
<w:continuationSeparator/>
<xsl:if test="text:footnote-continuation-notice-backward">
<w:t>
<xsl:value-of select="text:footnote-continuation-notice-backward"/>
</w:t>
</xsl:if>
</w:r>
</w:p>
</w:footnote>
<xsl:if test="text:footnote-continuation-notice-forward">
<w:footnote w:type="continuation-notice">
<w:p>
<w:r>
<w:t>
<xsl:value-of select="text:footnote-continuation-notice-forward"/>
</w:t>
</w:r>
</w:p>
</w:footnote>
</xsl:if>
</xsl:if>
</w:footnotePr>
</xsl:template>
<xsl:template match="text:endnotes-configuration">
<xsl:param name="within-section"/>
<w:endnotePr>
<w:pos w:val="sect-end"/>
<xsl:if test="@text:start-value">
<w:numStart w:val="{@text:start-value + 1}"/>
</xsl:if>
<xsl:if test="@style:num-format">
<xsl:call-template name="convert-number-format">
<xsl:with-param name="number-format" select="@style:num-format"/>
<xsl:with-param name="number-prefix" select="@style:num-prefix"/>
<xsl:with-param name="number-suffix" select="@style:num-suffix"/>
</xsl:call-template>
</xsl:if>
<w:numRestart w:val="each-sect"/>
<xsl:if test="$within-section != 'yes'">
<w:endnote w:type="separator">
<w:p>
<w:r>
<w:separator/>
</w:r>
</w:p>
</w:endnote>
<w:endnote w:type="continuation-separator">
<w:p>
<w:r>
<w:continuationSeparator/>
</w:r>
</w:p>
</w:endnote>
</xsl:if>
</w:endnotePr>
</xsl:template>
<xsl:template name="convert-number-format">
<xsl:param name="number-format"/>
<xsl:param name="number-prefix"/>
<xsl:param name="number-suffix"/>
<xsl:choose>
<xsl:when test="$number-format = '1' and normalize-space($number-prefix) = '0'">
<w:numFmt w:val="decimal-zero"/>
</xsl:when>
<xsl:when test="$number-format = '1' and normalize-space($number-suffix) = '.'">
<w:numFmt w:val="decimal-enclosed-fullstop"/>
</xsl:when>
<xsl:when test="$number-format = '1' and normalize-space($number-prefix) = '(' and normalize-space($number-prefix) = ')'">
<w:numFmt w:val="decimal-enclosed-paren"/>
</xsl:when>
<xsl:when test="$number-format = '1' and normalize-space($number-prefix) = '-' and normalize-space($number-prefix) = '-'">
<w:numFmt w:val="number-in-dash"/>
</xsl:when>
<xsl:when test="$number-format = '1'">
<!-- '1' also seems: decimal-half-width -->
<w:numFmt w:val="decimal"/>
</xsl:when>
<xsl:when test="$number-format = 'a'">
<w:numFmt w:val="lower-letter"/>
</xsl:when>
<xsl:when test="$number-format = 'A'">
<w:numFmt w:val="upper-letter"/>
</xsl:when>
<xsl:when test="$number-format = 'i'">
<w:numFmt w:val="lower-roman"/>
</xsl:when>
<xsl:when test="$number-format = 'I'">
<w:numFmt w:val="upper-roman"/>
</xsl:when>
<xsl:when test="$number-format = ', , , ...'">
<!-- ', , , ...' also seems: decimal-full-width2 -->
<w:numFmt w:val="decimal-full-width"/>
</xsl:when>
<xsl:when test="$number-format = '①, ②, ③, ...'">
<!-- decimal-enclosed-circle seems same -->
<w:numFmt w:val="decimal-enclosed-circle-chinese"/>
</xsl:when>
<xsl:when test="$number-format = '一, 二, 三, ...' and normalize-space($number-prefix) = '(' and normalize-space($number-suffix) = ')'">
<w:numFmt w:val="ideograph-enclosed-circle"/>
</xsl:when>
<xsl:when test="$number-format = '一, 二, 三, ...'">
<!-- ', , , ...' also seems: ideograph-digital, japanese-counting, japanese-digital-ten-thousand,
taiwanese-counting, taiwanese-counting-thousand, taiwanese-digital, chinese-counting, korean-digital2 -->
<w:numFmt w:val="chinese-counting-thousand"/>
</xsl:when>
<xsl:when test="$number-format = '壹, 贰, 叁, ...'">
<w:numFmt w:val="chinese-legal-simplified"/>
</xsl:when>
<xsl:when test="$number-format = '壹, 貳, 參, ...'">
<w:numFmt w:val="ideograph-legal-traditional"/>
</xsl:when>
<xsl:when test="$number-format = '甲, 乙, 丙, ...'">
<w:numFmt w:val="ideograph-traditional"/>
</xsl:when>
<xsl:when test="$number-format = '子, 丑, 寅, ...'">
<w:numFmt w:val="ideograph-zodiac"/>
</xsl:when>
<xsl:when test="$number-format = '壱, 弐, 参, ...'">
<w:numFmt w:val="japanese-legal"/>
</xsl:when>
<xsl:when test="$number-format = 'ア, イ, ウ, ...'">
<w:numFmt w:val="aiueo-full-width"/>
</xsl:when>
<xsl:when test="$number-format = 'ア, イ, ウ, ...'">
<w:numFmt w:val="aiueo"/>
</xsl:when>
<xsl:when test="$number-format = 'イ, ロ, ハ, ...'">
<w:numFmt w:val="iroha-full-width"/>
</xsl:when>
<xsl:when test="$number-format = 'イ, ロ, ハ, ...'">
<w:numFmt w:val="iroha"/>
</xsl:when>
<xsl:when test="$number-format = '일, 이, 삼, ...'">
<!-- ', , , ...' also seems: korean-counting -->
<w:numFmt w:val="korean-digital"/>
</xsl:when>
<xsl:when test="$number-format = 'ㄱ, ㄴ, ㄷ, ...' or $number-format = '㉠, ㉡, ㉢, ...'">
<!-- mapping circled to uncircled -->
<w:numFmt w:val="chosung"/>
</xsl:when>
<xsl:when test="$number-format = '가, 나, 다, ...' or $number-format = '㉮, ㉯, ㉰, ...'">
<!-- mapping circled to uncircled -->
<w:numFmt w:val="ganada"/>
</xsl:when>
<xsl:when test="$number-format = 'أ, ب, ت, ...'">
<w:numFmt w:val="arabic-alpha"/>
</xsl:when>
<xsl:when test="$number-format = 'ก, ข, ฃ, ...'">
<w:numFmt w:val="thai-letters"/>
</xsl:when>
<xsl:when test="$number-format = 'א, י, ק, ...'">
<w:numFmt w:val="hebrew-1"/>
</xsl:when>
<xsl:when test="$number-format = 'א, ב, ג, ...'">
<w:numFmt w:val="hebrew-2"/>
</xsl:when>
<xsl:when test="$number-format = 'Native Numbering'">
<xsl:variable name="locale" select="/office:document/office:meta/dc:language"/>
<xsl:choose>
<xsl:when test="starts-with($locale, 'th-')">
<!-- for Thai, mapping thai-numbers, thai-counting to thai-letters -->
<w:numFmt w:val="thai-letters"/>
</xsl:when>
<xsl:when test="starts-with($locale, 'hi-')">
<!-- for Hindi, mapping hindi-vowels, hindi-consonants, hindi-counting to hindi-numbers -->
<w:numFmt w:val="hindi-numbers"/>
</xsl:when>
<xsl:when test="starts-with($locale, 'ar-')">
<!-- for Arabic, mapping arabic-abjad to arabic-alpha -->
<w:numFmt w:val="arabic-alpha"/>
</xsl:when>
<xsl:when test="starts-with($locale, 'he-')">
<!-- for Hebrew, mapping hebrew-2 to -->
<w:numFmt w:val="hebrew-1"/>
</xsl:when>
<xsl:when test="starts-with($locale, 'ru-')">
<!-- for Russian, mapping russian-upper to russian-lower -->
<w:numFmt w:val="russian-lower"/>
</xsl:when>
<xsl:when test="starts-with($locale, 'vi-')">
<!-- for Vietnamese -->
<w:numFmt w:val="vietnamese-counting"/>
</xsl:when>
</xsl:choose>
</xsl:when>
<!-- unsupported: ordinal, cardinal-text, ordinal-text, hex, chicago, bullet, ideograph-zodiac-traditional,
chinese-not-impl, korean-legal -->
<xsl:otherwise>
<w:numFmt w:val="decimal"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

View File

@@ -0,0 +1,407 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw">
<xsl:key name="table-style" match="style:style[@style:family='table']" use="@style:name"/>
<xsl:key name="table-column-style" match="style:style[@style:family='table-column']" use="@style:name"/>
<xsl:key name="table-row-style" match="style:style[@style:family='table-row']" use="@style:name"/>
<xsl:key name="table-cell-style" match="style:style[@style:family='table-cell']" use="@style:name"/>
<xsl:template match="style:table-properties" mode="table">
<xsl:param name="within-body"/>
<xsl:if test="$within-body = 'yes'">
<w:tblW>
<xsl:choose>
<xsl:when test="@style:rel-width">
<xsl:attribute name="w:w"><xsl:value-of select="substring-before(@style:rel-width, '%') * 50"/></xsl:attribute>
<xsl:attribute name="w:type">pct</xsl:attribute>
</xsl:when>
<xsl:when test="@style:width">
<xsl:attribute name="w:w"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="@style:width"/></xsl:call-template></xsl:attribute>
<xsl:attribute name="w:type">dxa</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="w:w">0</xsl:attribute>
<xsl:attribute name="w:type">auto</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</w:tblW>
</xsl:if>
<w:tblInd>
<xsl:choose>
<xsl:when test="@fo:margin-left">
<xsl:attribute name="w:w"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="@fo:margin-left"/></xsl:call-template></xsl:attribute>
<xsl:attribute name="w:type">dxa</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="w:w">0</xsl:attribute>
<xsl:attribute name="w:type">auto</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</w:tblInd>
<xsl:if test="@table:align">
<w:jc>
<xsl:choose>
<xsl:when test="@table:align = 'left' or @table:align= 'center' or @table:align = 'right'">
<xsl:attribute name="w:val"><xsl:value-of select="@table:align"/></xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="w:val">left</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</w:jc>
</xsl:if>
</xsl:template>
<xsl:template match="table:table">
<!--fix for issue i32030 pagebreak before-->
<xsl:if test="key('table-style', @table:style-name)/style:table-properties/@fo:break-before">
<xsl:variable name="table-break-before" select="key('table-style', @table:style-name)/style:table-properties/@fo:break-before"/>
<xsl:choose>
<xsl:when test="$table-break-before = 'page' ">
<w:p>
<w:r>
<w:br w:type="page"/>
</w:r>
</w:p>
</xsl:when>
<xsl:when test="$table-break-before = 'column' ">
<w:p>
<w:r>
<w:br w:type="column"/>
</w:r>
</w:p>
</xsl:when>
</xsl:choose>
</xsl:if>
<w:tbl>
<w:tblPr>
<xsl:if test="not (@table:is-sub-table) or (@table:is-sub-table = 'false' )">
<w:tblStyle w:val="{@table:style-name}"/>
<xsl:apply-templates select="key('table-style', @table:style-name)/style:table-properties" mode="table">
<xsl:with-param name="within-body" select="'yes'"/>
</xsl:apply-templates>
</xsl:if>
<xsl:if test="@table:is-sub-table ='true' ">
<w:tblW w:type="dxa">
<xsl:variable name="sub-table-width">
<xsl:call-template name="calculate-sub-table-width">
<xsl:with-param name="sub-table-column-node" select="table:table-column[1]"/>
<xsl:with-param name="total-sub-table-width" select="0"/>
</xsl:call-template>
</xsl:variable>
<xsl:attribute name="w:w"><xsl:value-of select="$sub-table-width"/></xsl:attribute>
</w:tblW>
<!--w:tblLayout w:type="Fixed"/-->
</xsl:if>
</w:tblPr>
<w:tblGrid>
<xsl:apply-templates select="table:table-column"/>
</w:tblGrid>
<xsl:apply-templates select="table:table-header-rows/table:table-row | table:table-row"/>
</w:tbl>
<!--fix for issue i32030 pagebreak after-->
<xsl:if test="key('table-style', @table:style-name)/style:table-properties/@fo:break-after">
<xsl:variable name="table-break-after" select=" key('table-style', @table:style-name)/style:table-properties/@fo:break-after"/>
<xsl:choose>
<xsl:when test="$table-break-after = 'page' ">
<w:p>
<w:r>
<w:br w:type="page"/>
</w:r>
</w:p>
</xsl:when>
<xsl:when test="$table-break-after = 'column' ">
<w:p>
<w:r>
<w:br w:type="column"/>
</w:r>
</w:p>
</xsl:when>
</xsl:choose>
</xsl:if>
<xsl:if test="name(..)= 'table:table-cell' ">
<w:p/>
</xsl:if>
</xsl:template>
<xsl:template name="calculate-sub-table-width">
<xsl:param name="sub-table-column-node"/>
<xsl:param name="total-sub-table-width"/>
<xsl:variable name="column-width" select="key('table-column-style', $sub-table-column-node/@table:style-name)/style:table-column-properties/@style:column-width"/>
<xsl:variable name="column-width-in-twip">
<xsl:call-template name="convert2twip">
<xsl:with-param name="value" select="$column-width"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$sub-table-column-node/following-sibling::table:table-column">
<xsl:choose>
<xsl:when test="$sub-table-column-node/@table:number-columns-repeated">
<xsl:call-template name="calculate-sub-table-width">
<xsl:with-param name="sub-table-column-node" select="$sub-table-column-node/following-sibling::table:table-column[ 1]"/>
<xsl:with-param name="total-sub-table-width" select="$total-sub-table-width + $column-width-in-twip * $sub-table-column-node/@table:number-columns-repeated"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="calculate-sub-table-width">
<xsl:with-param name="sub-table-column-node" select="$sub-table-column-node/following-sibling::table:table-column[1]"/>
<xsl:with-param name="total-sub-table-width" select="$total-sub-table-width + $column-width-in-twip "/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="$sub-table-column-node/@table:number-columns-repeated">
<xsl:value-of select="$total-sub-table-width + $column-width-in-twip * $sub-table-column-node/@table:number-columns-repeated"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$total-sub-table-width + $column-width-in-twip "/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="table:table-column">
<xsl:variable name="column-width" select="key('table-column-style', @table:style-name)/style:table-column-properties/@style:column-width"/>
<xsl:variable name="column-width-in-twip">
<xsl:call-template name="convert2twip">
<xsl:with-param name="value" select="$column-width"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<!-- if table:table-column has attribute table:number-columns-repeated, then call the recursion
temple repeat-gridcol to produce multiple w:gridCol in MS word. Gary.Yang -->
<xsl:when test="@table:number-columns-repeated">
<xsl:call-template name="repeat-gridcol">
<xsl:with-param name="grid-repeat-count" select="@table:number-columns-repeated"/>
<xsl:with-param name="column-width" select="$column-width-in-twip"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<w:gridCol w:w="{$column-width-in-twip}"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--recursion template for produce multiple w:gridCol Gary.Yang-->
<xsl:template name="repeat-gridcol">
<xsl:param name="grid-repeat-count"/>
<xsl:param name="column-width"/>
<xsl:if test="$grid-repeat-count &gt; 0">
<w:gridCol w:w="{$column-width}"/>
<xsl:call-template name="repeat-gridcol">
<xsl:with-param name="grid-repeat-count" select="$grid-repeat-count - 1"/>
<xsl:with-param name="column-width" select="$column-width"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template match="table:table-row">
<xsl:element name="w:tr">
<xsl:element name="w:trPr">
<xsl:if test="parent::table:table-header-rows">
<!-- fix for Issue 32034-->
<w:tblHeader>on</w:tblHeader>
</xsl:if>
<xsl:variable name="row-height" select="key('table-row-style', @table:style-name)/style:table-row-properties/@style:row-height"/>
<xsl:if test="$row-height">
<w:trHeight>
<xsl:attribute name="w:val"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="$row-height"/></xsl:call-template></xsl:attribute>
</w:trHeight>
</xsl:if>
</xsl:element>
<!--end of w:trPr-->
<xsl:apply-templates select="table:table-cell "/>
</xsl:element>
</xsl:template>
<xsl:template match="table:table-cell ">
<xsl:element name="w:tc">
<xsl:element name="w:tcPr">
<!-- to calculate the table-cell width Gary.Yang -->
<xsl:choose>
<!--when the table-cell contains the sub-table -->
<xsl:when test="table:table/@table:is-sub-table= 'true' ">
<xsl:variable name="table-cell-width">
<xsl:call-template name="calculate-sub-table-width">
<xsl:with-param name="sub-table-column-node" select="table:table/table:table-column[1]"/>
<xsl:with-param name="total-sub-table-width" select="0"/>
</xsl:call-template>
</xsl:variable>
<w:tcW w:type="dxa">
<xsl:attribute name="w:w"><xsl:value-of select="$table-cell-width"/></xsl:attribute>
</w:tcW>
</xsl:when>
<xsl:otherwise>
<!-- when the table-cell doesn't contain the sub-table -->
<xsl:variable name="table-cell-width">
<xsl:call-template name="calculate-table-cell-width">
<xsl:with-param name="table-cell-position" select="position()"/>
<xsl:with-param name="table-column" select="ancestor::table:table[1]/table:table-column[1]"/>
</xsl:call-template>
</xsl:variable>
<w:tcW w:type="dxa">
<xsl:attribute name="w:w"><xsl:value-of select="$table-cell-width"/></xsl:attribute>
</w:tcW>
<!-- for performance issue, we can set w:type to auto that makes the cell width auto fit the content. -->
<!--w:tcW w:w="0" w:type="auto"/-->
</xsl:otherwise>
</xsl:choose>
<xsl:if test="@table:number-columns-spanned">
<w:gridSpan w:val="{@table:number-columns-spanned}"/>
</xsl:if>
<xsl:variable name="cell-style-properties" select="key('table-cell-style', @table:style-name)/style:table-cell-properties"/>
<xsl:if test="$cell-style-properties/@fo:background-color">
<w:shd w:val="solid" w:color="{substring-after($cell-style-properties/@fo:background-color,'#')}"/>
</xsl:if>
<xsl:if test="$cell-style-properties/@fo:vertical-align">
<xsl:choose>
<xsl:when test="$cell-style-properties/@fo:vertical-align = 'middle'">
<w:vAlign w:val="center"/>
</xsl:when>
<xsl:when test="$cell-style-properties/@fo:vertical-align = 'Automatic'">
<w:vAlign w:val="both"/>
</xsl:when>
<xsl:otherwise>
<w:vAlign w:val="{$cell-style-properties/@fo:vertical-align}"/>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<w:tcMar>
<xsl:if test="$cell-style-properties/@fo:padding-top">
<w:top w:type="dxa">
<xsl:attribute name="w:w"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="$cell-style-properties/@fo:padding-top"/></xsl:call-template></xsl:attribute>
</w:top>
</xsl:if>
<xsl:if test="$cell-style-properties/@fo:padding-bottom">
<w:bottom w:type="dxa">
<xsl:attribute name="w:w"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="$cell-style-properties/@fo:padding-bottom"/></xsl:call-template></xsl:attribute>
</w:bottom>
</xsl:if>
<xsl:if test="$cell-style-properties/@fo:padding-left">
<w:left w:type="dxa">
<xsl:attribute name="w:w"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="$cell-style-properties/@fo:padding-left"/></xsl:call-template></xsl:attribute>
</w:left>
</xsl:if>
<xsl:if test="$cell-style-properties/@fo:padding-right">
<w:right w:type="dxa">
<xsl:attribute name="w:w"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="$cell-style-properties/@fo:padding-right"/></xsl:call-template></xsl:attribute>
</w:right>
</xsl:if>
</w:tcMar>
<!-- the following code is to get the cell borders if they exist -->
<xsl:variable name="border-top" select="$cell-style-properties/@fo:border-top | $cell-style-properties/@fo:border"/>
<xsl:variable name="border-bottom" select="$cell-style-properties/@fo:border-bottom | $cell-style-properties/@fo:border"/>
<xsl:variable name="border-left" select="$cell-style-properties/@fo:border-left | $cell-style-properties/@fo:border"/>
<xsl:variable name="border-right" select="$cell-style-properties/@fo:border-right | $cell-style-properties/@fo:border"/>
<xsl:variable name="border-line-width-top" select="$cell-style-properties/@style:border-line-width-top | $cell-style-properties/@style:border-line-width "/>
<xsl:variable name="border-line-width-bottom" select="$cell-style-properties/@style:border-line-width-bottom | $cell-style-properties/@style:border-line-width"/>
<xsl:variable name="border-line-width-left" select="$cell-style-properties/@style:border-line-width-left | $cell-style-properties/@style:border-line-width"/>
<xsl:variable name="border-line-width-right" select="$cell-style-properties/@style:border-line-width-right | $cell-style-properties/@style:border-line-width"/>
<xsl:element name="w:tcBorders">
<xsl:if test="$border-top">
<xsl:element name="w:top">
<xsl:call-template name="get-border">
<xsl:with-param name="so-border" select="$border-top"/>
<xsl:with-param name="so-border-line-width" select="$border-line-width-top"/>
<xsl:with-param name="so-border-position" select=" 'top' "/>
</xsl:call-template>
</xsl:element>
</xsl:if>
<xsl:if test="$border-bottom">
<xsl:element name="w:bottom">
<xsl:call-template name="get-border">
<xsl:with-param name="so-border" select="$border-bottom"/>
<xsl:with-param name="so-border-line-width" select="$border-line-width-bottom"/>
<xsl:with-param name="so-border-position" select=" 'bottom' "/>
</xsl:call-template>
</xsl:element>
</xsl:if>
<xsl:if test="$border-left">
<xsl:element name="w:left">
<xsl:call-template name="get-border">
<xsl:with-param name="so-border" select="$border-left"/>
<xsl:with-param name="so-border-line-width" select="$border-line-width-left"/>
<xsl:with-param name="so-border-position" select=" 'left' "/>
</xsl:call-template>
</xsl:element>
</xsl:if>
<xsl:if test="$border-right">
<xsl:element name="w:right">
<xsl:call-template name="get-border">
<xsl:with-param name="so-border" select="$border-right"/>
<xsl:with-param name="so-border-line-width" select="$border-line-width-right"/>
<xsl:with-param name="so-border-position" select=" 'right' "/>
</xsl:call-template>
</xsl:element>
</xsl:if>
</xsl:element>
</xsl:element>
<xsl:if test="not (*) ">
<w:p/>
</xsl:if>
<xsl:apply-templates select=" text:p | table:table | text:h | office:annotation"/>
</xsl:element>
</xsl:template>
<xsl:template name="calculate-table-cell-width">
<xsl:param name="table-cell-position"/>
<xsl:param name="table-column"/>
<xsl:choose>
<xsl:when test="$table-column/@table:number-columns-repeated">
<xsl:choose>
<xsl:when test="($table-cell-position - $table-column/@table:number-columns-repeated) &lt;= 0">
<xsl:variable name="table-cell-width" select="key('table-column-style', $table-column/@table:style-name)/style:table-column-properties/@style:column-width"/>
<xsl:variable name="table-cell-width-in-twip">
<xsl:call-template name="convert2twip">
<xsl:with-param name="value" select="$table-cell-width"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="$table-cell-width-in-twip"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="calculate-table-cell-width">
<xsl:with-param name="table-cell-position" select="$table-cell-position - $table-column/@table:number-columns-repeated"/>
<xsl:with-param name="table-column" select="$table-column/following-sibling::table:table-column[1]"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<!-- if the $table-column doesn't contain the table:number-columns-repeated attribute -->
<xsl:choose>
<xsl:when test="($table-cell-position - 1) = 0">
<xsl:variable name="table-cell-width" select="key('table-column-style', $table-column/@table:style-name)/style:table-column-properties/@style:column-width"/>
<xsl:variable name="table-cell-width-in-twip">
<xsl:call-template name="convert2twip">
<xsl:with-param name="value" select="$table-cell-width"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="$table-cell-width-in-twip"/>
</xsl:when>
<xsl:when test="($table-cell-position - 1) &gt; 0">
<xsl:call-template name="calculate-table-cell-width">
<xsl:with-param name="table-cell-position" select=" $table-cell-position - 1 "/>
<xsl:with-param name="table-column" select="$table-column/following-sibling::table:table-column[1]"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:message>
<xsl:value-of select=" 'calculate table cell width wrong ' "/>
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

File diff suppressed because it is too large Load Diff