summaryrefslogtreecommitdiffstats
path: root/filters/xsltfilter
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-20 01:29:50 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-20 01:29:50 +0000
commit8362bf63dea22bbf6736609b0f49c152f975eb63 (patch)
tree0eea3928e39e50fae91d4e68b21b1e6cbae25604 /filters/xsltfilter
downloadkoffice-8362bf63dea22bbf6736609b0f49c152f975eb63.tar.gz
koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.zip
Added old abandoned KDE3 version of koffice
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1077364 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'filters/xsltfilter')
-rw-r--r--filters/xsltfilter/Makefile.am1
-rw-r--r--filters/xsltfilter/configure.in.bot19
-rw-r--r--filters/xsltfilter/configure.in.in70
-rw-r--r--filters/xsltfilter/export/Changelog5
-rw-r--r--filters/xsltfilter/export/Makefile.am27
-rw-r--r--filters/xsltfilter/export/TODO3
-rw-r--r--filters/xsltfilter/export/xsl/Makefile.am1
-rw-r--r--filters/xsltfilter/export/xsl/kword/Makefile.am1
-rw-r--r--filters/xsltfilter/export/xsl/kword/xslfo/Makefile.am2
-rw-r--r--filters/xsltfilter/export/xsl/kword/xslfo/kword2xslfo-table.xsl140
-rw-r--r--filters/xsltfilter/export/xsl/kword/xslfo/main.xsl400
-rw-r--r--filters/xsltfilter/export/xslt_export.desktop72
-rw-r--r--filters/xsltfilter/export/xsltdialog.ui221
-rw-r--r--filters/xsltfilter/export/xsltexport.cc66
-rw-r--r--filters/xsltfilter/export/xsltexport.h36
-rw-r--r--filters/xsltfilter/export/xsltexportdia.cc267
-rw-r--r--filters/xsltfilter/export/xsltexportdia.h62
-rw-r--r--filters/xsltfilter/export/xsltproc.cc309
-rw-r--r--filters/xsltfilter/export/xsltproc.h75
-rw-r--r--filters/xsltfilter/import/Changelog2
-rw-r--r--filters/xsltfilter/import/Makefile.am24
-rw-r--r--filters/xsltfilter/import/TODO3
-rw-r--r--filters/xsltfilter/import/xslt_import.desktop71
-rw-r--r--filters/xsltfilter/import/xsltdialog.ui221
-rw-r--r--filters/xsltfilter/import/xsltimport.cc68
-rw-r--r--filters/xsltfilter/import/xsltimport.h44
-rw-r--r--filters/xsltfilter/import/xsltimportdia.cc264
-rw-r--r--filters/xsltfilter/import/xsltimportdia.h64
-rw-r--r--filters/xsltfilter/import/xsltproc.cc309
-rw-r--r--filters/xsltfilter/import/xsltproc.h75
-rw-r--r--filters/xsltfilter/kword2xslfo.xsl377
-rw-r--r--filters/xsltfilter/status.html213
32 files changed, 3512 insertions, 0 deletions
diff --git a/filters/xsltfilter/Makefile.am b/filters/xsltfilter/Makefile.am
new file mode 100644
index 000000000..257d9bc87
--- /dev/null
+++ b/filters/xsltfilter/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = export import
diff --git a/filters/xsltfilter/configure.in.bot b/filters/xsltfilter/configure.in.bot
new file mode 100644
index 000000000..aaa11fe57
--- /dev/null
+++ b/filters/xsltfilter/configure.in.bot
@@ -0,0 +1,19 @@
+if test -z "$LIBXML_LIBS"; then
+ echo ""
+ echo "You're missing libxml2 (at least version 2.4.8)."
+ echo "The XSLT filters will not be compiled."
+ echo "Please download libxml2 from http://xmlsoft.org ."
+ echo ""
+ all_tests=bad
+fi
+
+if test -z "$LIBXSLT_LIBS"; then
+ echo ""
+ echo "You're missing libxslt (at least version 1.0.7)."
+ echo "The XSLT filters will not be compiled."
+# TODO: URL is not exacly right anymore
+ echo "Please download libxml2 from http://xmlsoft.org ."
+ echo ""
+ all_tests=bad
+fi
+
diff --git a/filters/xsltfilter/configure.in.in b/filters/xsltfilter/configure.in.in
new file mode 100644
index 000000000..592c1fb3c
--- /dev/null
+++ b/filters/xsltfilter/configure.in.in
@@ -0,0 +1,70 @@
+
+KDE_FIND_PATH(xml2-config, XML_CONFIG, [${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin], [
+ AC_MSG_WARN([Could not find libxml2 anywhere, check ftp://xmlsoft.org/ for libxml >= 2.4.8. (we also keep a version of it in kdesupport for CVS users' convience)])
+ HELP_SUBDIR=
+])
+
+if test -n "$XML_CONFIG"; then
+ vers=`$XML_CONFIG --version 2>/dev/null | $SED -e 's/libxml //' | $AWK 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
+ if test -n "$vers" && test "$vers" -ge 2004008
+ then
+ LIBXML_LIBS="`$XML_CONFIG --libs`"
+ LIBXML_RPATH=
+ for args in $LIBXML_LIBS; do
+ case $args in
+ -L*)
+ LIBXML_RPATH="$LIBXML_RPATH $args"
+ ;;
+ esac
+ done
+ LIBXML_RPATH=`echo $LIBXML_RPATH | $SED -e "s/-L/-R/g"`
+ LIBXML_CFLAGS="`$XML_CONFIG --cflags`"
+
+ KDE_FIND_PATH(xmllint, XMLLINT, [${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin], [XMLLINT=""])
+ AC_DEFINE_UNQUOTED(XMLLINT, "$XMLLINT", [Defines the executable of xmllint])
+ else
+ AC_MSG_WARN([You need at least libxml 2.4.8])
+ HELP_SUBDIR=
+ fi
+fi
+
+KDE_FIND_PATH(xslt-config, XSLT_CONFIG, [${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin], [
+ AC_MSG_WARN([Could not find libxslt anywhere, check ftp://xmlsoft.org/ for libxslt >= 1.0.7. (we also keep a version of it in kdesupport for CVS users' convience)])
+ HELP_SUBDIR=
+])
+
+if test -n "$XSLT_CONFIG"; then
+ vers=`$XSLT_CONFIG --version 2>/dev/null | $AWK 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
+ if test -n "$vers" && test "$vers" -ge 1000007; then
+ LIBXSLT_LIBS="`$XSLT_CONFIG --libs`"
+ LIBXSLT_RPATH=
+ for args in $LIBXSLT_LIBS; do
+ case $args in
+ -L*)
+ LIBXSLT_RPATH="$LIBXSLT_RPATH $args"
+ ;;
+ esac
+ done
+ LIBXSLT_RPATH=`echo $LIBXSLT_RPATH | $SED -e "s/-L/-R/g"`
+ LIBXSLT_CFLAGS="`$XSLT_CONFIG --cflags`"
+
+ else
+ AC_MSG_WARN([You need at least libxslt 1.0.7])
+ HELP_SUBDIR=
+ fi
+fi
+
+if test ! "$USE_RPATH" = "yes"; then
+ LIBXSLT_RPATH=
+ LIBXML_RPATH=
+fi
+
+AC_SUBST(LIBXSLT_LIBS)
+AC_SUBST(LIBXSLT_CFLAGS)
+AC_SUBST(LIBXSLT_RPATH)
+
+AC_SUBST(LIBXML_LIBS)
+AC_SUBST(LIBXML_CFLAGS)
+AC_SUBST(LIBXML_RPATH)
+
+AM_CONDITIONAL(include_XSLTFILTERS, test -n "$LIBXML_LIBS" -a -n "$LIBXSLT_LIBS")
diff --git a/filters/xsltfilter/export/Changelog b/filters/xsltfilter/export/Changelog
new file mode 100644
index 000000000..27a5bf2d0
--- /dev/null
+++ b/filters/xsltfilter/export/Changelog
@@ -0,0 +1,5 @@
+02 february 2002
+ o filter work by specifying the xslt sheet
+
+19 January 2002
+ o creation of this filter.
diff --git a/filters/xsltfilter/export/Makefile.am b/filters/xsltfilter/export/Makefile.am
new file mode 100644
index 000000000..9dd925c70
--- /dev/null
+++ b/filters/xsltfilter/export/Makefile.am
@@ -0,0 +1,27 @@
+####### General stuff
+SUBDIRS = xsl
+
+INCLUDES= -I$(srcdir) $(KOFFICE_INCLUDES) $(all_includes) $(LIBXML_CFLAGS) $(LIBXSLT_CFLAGS)
+
+####### Files
+
+kde_module_LTLIBRARIES = libxsltexport.la
+
+libxsltexport_la_SOURCES = xsltexport.cc xsltexportdia.cc xsltproc.cc xsltdialog.ui
+libxsltexport_la_LDFLAGS = $(KDE_RPATH) $(LIBXML_RPATH) $(LIBXSLT_RPATH) $(all_libraries) -module $(KDE_PLUGIN)
+libxsltexport_la_LIBADD = $(KOFFICE_LIBS) $(LIBXSLT_LIBS) $(LIBXML_LIBS)
+
+noinst_HEADERS = xsltexport.h xsltexportdia.h xsltproc.h
+
+######## Debug
+#check_PROGRAMS = xsltfilter
+#xsltfilter_SOURCES = xsltfilter.cc
+#xsltfilter_LDADD = $(LIBXSLT_LIBS) $(LIBXML_LIBS)
+#xsltfilter_LDFLAGS = $(KDE_RPATH) $(LIBXML_RPATH) $(LIBXSLT_RPATH) $(all_libraries)
+
+
+METASOURCES = AUTO
+
+service_DATA = xslt_export.desktop
+
+servicedir = $(kde_servicesdir)
diff --git a/filters/xsltfilter/export/TODO b/filters/xsltfilter/export/TODO
new file mode 100644
index 000000000..2b369522b
--- /dev/null
+++ b/filters/xsltfilter/export/TODO
@@ -0,0 +1,3 @@
+o Save all the xsl used to display in a combo box with all recent xslt;
+o Can choose common xslt (supply within koffice);
+o Add option for the xsltproc.
diff --git a/filters/xsltfilter/export/xsl/Makefile.am b/filters/xsltfilter/export/xsl/Makefile.am
new file mode 100644
index 000000000..8817bb6b0
--- /dev/null
+++ b/filters/xsltfilter/export/xsl/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = kword
diff --git a/filters/xsltfilter/export/xsl/kword/Makefile.am b/filters/xsltfilter/export/xsl/kword/Makefile.am
new file mode 100644
index 000000000..21b875318
--- /dev/null
+++ b/filters/xsltfilter/export/xsl/kword/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = xslfo
diff --git a/filters/xsltfilter/export/xsl/kword/xslfo/Makefile.am b/filters/xsltfilter/export/xsl/kword/xslfo/Makefile.am
new file mode 100644
index 000000000..6a3fb14df
--- /dev/null
+++ b/filters/xsltfilter/export/xsl/kword/xslfo/Makefile.am
@@ -0,0 +1,2 @@
+xsltfilterdir = $(kde_datadir)/xsltfilter/export/kword/xslfo
+xsltfilter_DATA = main.xsl kword2xslfo-table.xsl
diff --git a/filters/xsltfilter/export/xsl/kword/xslfo/kword2xslfo-table.xsl b/filters/xsltfilter/export/xsl/kword/xslfo/kword2xslfo-table.xsl
new file mode 100644
index 000000000..0b2906be4
--- /dev/null
+++ b/filters/xsltfilter/export/xsl/kword/xslfo/kword2xslfo-table.xsl
@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ This file is part of the KDE project
+ Copyright (C) 2002 Robert JACOLIN <rjacolin@ifrance.com>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+ This stylesheet convert kword document in xsl:fo.
+
+ -->
+
+<xsl:stylesheet version = '1.0'
+ xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
+ xmlns:fo='http://www.w3.org/1999/XSL/Format'>
+
+<!-- DOC. (DEFINITIONS, ...) -->
+<xsl:template match="ANCHOR">
+ <xsl:param name="rows">
+ <xsl:value-of select="/DOC/FRAMESETS/FRAMESET[@grpMgr=$table]/@rows"/>
+ </xsl:param>
+ <xsl:param name="cols">
+ <xsl:value-of select="/DOC/FRAMESETS/FRAMESET[@grpMgr=$table]/@cols"/>
+ </xsl:param>
+ <xsl:param name="table">param_table</xsl:param>
+ <xsl:message>Construction de la table</xsl:message>
+
+ <xsl:message><xsl:value-of select="$table"/>, Col <xsl:value-of select="$cols"/>, ligne <xsl:value-of select="$rows"/></xsl:message>
+ <fo:table>
+ <xsl:call-template name="ligne">
+ <xsl:with-param name="row">0</xsl:with-param>
+ <xsl:with-param name="rows">
+ <xsl:copy-of select="$rows"/>
+ </xsl:with-param>
+ <xsl:with-param name="cols">
+ <xsl:copy-of select="$cols"/>
+ </xsl:with-param>
+ <xsl:with-param name="table">
+ <xsl:copy-of select="$table"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </fo:table>
+</xsl:template>
+
+<xsl:template name="ligne">
+ <xsl:param name="row">param_row</xsl:param>
+ <xsl:param name="rows">param_rows</xsl:param>
+ <xsl:param name="cols">param_cols</xsl:param>
+ <xsl:param name="table">param_table</xsl:param>
+
+ <xsl:message>Ligne : <xsl:value-of select="$row"/> / <xsl:value-of select="$rows"/></xsl:message>
+ <fo:table-row>
+ <xsl:call-template name="cellule">
+ <xsl:with-param name="col">0</xsl:with-param>
+ <xsl:with-param name="cols">
+ <xsl:copy-of select="$cols"/>
+ </xsl:with-param>
+ <xsl:with-param name="row">
+ <xsl:copy-of select="$row"/>
+ </xsl:with-param>
+ <xsl:with-param name="rows">
+ <xsl:copy-of select="$rows"/>
+ </xsl:with-param>
+ <xsl:with-param name="table">
+ <xsl:copy-of select="$table"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </fo:table-row>
+
+ <xsl:if test="$row &lt; $rows">
+ <xsl:call-template name="ligne">
+ <xsl:with-param name="cols">
+ <xsl:copy-of select="$cols"/>
+ </xsl:with-param>
+ <xsl:with-param name="row">
+ <xsl:copy-of select="$row + 1"/>
+ </xsl:with-param>
+ <xsl:with-param name="rows">
+ <xsl:copy-of select="$rows"/>
+ </xsl:with-param>
+ <xsl:with-param name="table">
+ <xsl:copy-of select="$table"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:if>
+
+</xsl:template>
+
+<xsl:template name="cellule">
+ <xsl:param name="row">param_row</xsl:param>
+ <xsl:param name="rows">param_rows</xsl:param>
+ <xsl:param name="col">param_col</xsl:param>
+ <xsl:param name="cols">param_cols</xsl:param>
+ <xsl:param name="table">param_table</xsl:param>
+
+ <xsl:message>Col : <xsl:value-of select="$col"/> / <xsl:value-of select="$cols"/></xsl:message>
+ <xsl:message>Para : <xsl:value-of select="/DOC/FRAMESETS/FRAMESET[@grpMgr=$table and @row=$row and @col=$col]"/></xsl:message>
+ <fo:table-cell>
+ <xsl:call-template name="PARAS" select="/DOC/FRAMESETS/FRAMESET[@grpMgr=$table and @row=$row and @col=$col]/PARAGRAPH">
+ <xsl:with-param name="i">1</xsl:with-param>
+ <xsl:with-param name="debutListInitial">0</xsl:with-param>
+ <xsl:with-param name="nbItemInitial">0</xsl:with-param>
+ </xsl:call-template>
+ </fo:table-cell>
+
+ <xsl:if test="$col &lt; $cols">
+ <xsl:call-template name="cellule">
+ <xsl:with-param name="col">
+ <xsl:copy-of select="$col + 1"/>
+ </xsl:with-param>
+ <xsl:with-param name="cols">
+ <xsl:copy-of select="$cols"/>
+ </xsl:with-param>
+ <xsl:with-param name="row">
+ <xsl:copy-of select="$row"/>
+ </xsl:with-param>
+ <xsl:with-param name="rows">
+ <xsl:copy-of select="$rows"/>
+ </xsl:with-param>
+ <xsl:with-param name="table">
+ <xsl:copy-of select="$table"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:if>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/filters/xsltfilter/export/xsl/kword/xslfo/main.xsl b/filters/xsltfilter/export/xsl/kword/xslfo/main.xsl
new file mode 100644
index 000000000..e619bf21c
--- /dev/null
+++ b/filters/xsltfilter/export/xsl/kword/xslfo/main.xsl
@@ -0,0 +1,400 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ This file is part of the KDE project
+ Copyright (C) 2002 Robert JACOLIN <rjacolin@ifrance.com>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+ This stylesheet convert kword document in xsl:fo.
+ BUGS :
+ o list label with number :
+ o table to test.
+ -->
+
+<xsl:stylesheet version = '1.0'
+ xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
+ xmlns:fo='http://www.w3.org/1999/XSL/Format'>
+
+<xsl:include href="kword2xslfo-table.xsl"/>
+<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
+<xsl:param name="nbTotalPara" select="30"/>
+
+<!-- DOC. (DEFINITIONS, ...) -->
+<xsl:template match="DOC">
+ <xsl:comment>
+ <xsl:value-of select="@editor"/>
+ </xsl:comment>
+ <fo:root>
+ <fo:layout-master-set>
+ <fo:simple-page-master
+ margin-right="0.5cm" margin-left="0.5cm" margin-bottom="0.5cm" margin-top="0.75cm"
+ page-width="21cm" page-height="29.7cm" master-name="first">
+ <fo:region-body></fo:region-body>
+ </fo:simple-page-master>
+ <fo:simple-page-master
+ margin-right="2.5cm" margin-left="2.5cm" margin-bottom="2cm" margin-top="1cm"
+ page-width="21cm" page-height="29.7cm" master-name="rest">
+ <fo:region-body></fo:region-body>
+ </fo:simple-page-master>
+
+ <fo:page-sequence-master master-name="page">
+ <fo:repeatable-page-master-alternatives>
+ <fo:conditional-page-master-reference master-name="first"
+ page-position="first" />
+ <fo:conditional-page-master-reference master-name="rest"
+ page-position="rest" />
+ <!-- recommended fallback procedure -->
+ <fo:conditional-page-master-reference master-name="rest" />
+ </fo:repeatable-page-master-alternatives>
+ </fo:page-sequence-master>
+ </fo:layout-master-set>
+ <xsl:apply-templates select="FRAMESETS"/>
+ </fo:root>
+</xsl:template>
+
+<!-- LE DOCUMENT LUI-MEME -->
+<xsl:template match="FRAMESETS">
+ <fo:page-sequence master-name="page">
+ <xsl:if test="/DOC/ATTRIBUTES/@hasHeader='1'">
+ <xsl:apply-templates select="FRAMESET[@frameInfo=1]"/>
+ <xsl:apply-templates select="FRAMESET[@frameInfo=2]"/>
+ <xsl:apply-templates select="FRAMESET[@frameInfo=3]"/>
+ </xsl:if>
+
+ <xsl:if test="/DOC/ATTRIBUTES/@hasFooter='1'">
+ <xsl:apply-templates select="FRAMESET[@frameInfo=4]"/>
+ <xsl:apply-templates select="FRAMESET[@frameInfo=5]"/>
+ <xsl:apply-templates select="FRAMESET[@frameInfo=6]"/>
+ </xsl:if>
+
+ <xsl:apply-templates select="FRAMESET[@frameInfo=0]"/>
+ </fo:page-sequence>
+
+</xsl:template>
+
+<!-- CADRES POUR CHAQUE PARTIE D'UNE PAGE -->
+<xsl:template match="FRAMESET">
+ <xsl:if test="@grpMgr='' and @frameType='1'">
+ <xsl:if test="@frameInfo=0">
+ <fo:flow flow-name="xsl-region-body">
+ <xsl:apply-templates select="FRAME"/>
+ <xsl:call-template name="PARAS" select="PARAGRAPH">
+ <xsl:with-param name="i">1</xsl:with-param>
+ <xsl:with-param name="debutListInitial">0</xsl:with-param>
+ <xsl:with-param name="nbItemInitial">0</xsl:with-param>
+ </xsl:call-template>
+ </fo:flow>
+ </xsl:if>
+
+ <xsl:if test="@frameInfo=1">
+ <fo:static-content flow-name="xsl-region-bottom">
+ <xsl:apply-templates select="FRAME"/>
+ <xsl:apply-templates name="PARAGS" select="PARAS"/>
+ </fo:static-content>
+ </xsl:if>
+ </xsl:if>
+</xsl:template>
+
+<!-- CADRE -->
+<xsl:template match="FRAME">
+
+</xsl:template>
+
+<!-- LISTE DE PARAG. -->
+<xsl:template name="PARAS">
+ <xsl:param name="i">param_i</xsl:param>
+ <xsl:param name="nbItemInitial">param_nbItem</xsl:param>
+ <xsl:param name="debutListeInitial" select="param_debutListeInitial"/>
+
+ <xsl:message>parag. <xsl:value-of select="$i"/></xsl:message>
+
+ <!-- test si le paragraphe est une liste -->
+ <xsl:choose>
+ <xsl:when test="PARAGRAPH[position()=$i]/LAYOUT/COUNTER/@numberingtype=0">
+ <!-- si le parag. est une liste on groupe -->
+ <xsl:message>Une liste</xsl:message>
+ <xsl:variable name="nbItem" select="$nbItemInitial + 1"/>
+ <!-- Rappelle le template -->
+ <xsl:if test="($i + 1) &lt;=$nbTotalPara">
+ <xsl:message>parag. suivant </xsl:message>
+ <xsl:call-template name="PARAS">
+ <xsl:with-param name="debutListeInitial" select="$debutListeInitial"/>
+ <xsl:with-param name="i"><xsl:value-of select="$i + 1"/></xsl:with-param>
+ <xsl:with-param name="nbItemInitial" select="$nbItem"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <!-- si le parag. est normal, on le genere. -->
+ <xsl:otherwise>
+ <xsl:if test="$nbItemInitial &gt; 0">
+ <fo:list-block>
+ <xsl:variable name="startInit">
+ <xsl:choose>
+ <xsl:when test="PARAGRAPH[position()=($i - 1)]/LAYOUT/COUNTER/@start">
+ <xsl:copy-of select="PARAGRAPH[position()=$i]/LAYOUT/COUNTER/@start"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="PARAGRAPH[position()=($i - 1)]/LAYOUT/COUNTER/@type=1">
+ <xsl:copy-of select="1"/>
+ </xsl:if>
+ <xsl:if test="PARAGRAPH[position()=$i]/LAYOUT/COUNTER/@type=2">
+ <xsl:copy-of select="a"/>
+ </xsl:if>
+ <xsl:if test="PARAGRAPH[position()=$i]/LAYOUT/COUNTER/@type=3">
+ <xsl:copy-of select="A"/>
+ </xsl:if>
+ <xsl:if test="PARAGRAPH[position()=$i]/LAYOUT/COUNTER/@type=4">
+ <xsl:copy-of select="i"/>
+ </xsl:if>
+ <xsl:if test="PARAGRAPH[position()=$i]/LAYOUT/COUNTER/@type=5">
+ <xsl:copy-of select="I"/>
+ </xsl:if>
+ <xsl:if test="PARAGRAPH[position()=$i]/LAYOUT/COUNTER/@type=6">
+ <xsl:copy-of select="PARAGRAPH[position()=$i]/LAYOUT/COUNTER/@bullet"/>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="genListe">
+ <xsl:with-param name="debutListe" select="$debutListeInitial"/>
+ <xsl:with-param name="nbItem" select="$nbItemInitial"/>
+ <xsl:with-param name="i" select="$debutListeInitial"/>
+ <xsl:with-param name="start" select="$startInit"/>
+ </xsl:call-template>
+ </fo:list-block>
+ </xsl:if>
+ <xsl:variable name="nbItem">0</xsl:variable>
+ <!--<xsl:variable name="nextItem"></xsl:variable>-->
+ <xsl:message>Un parag.</xsl:message>
+ <xsl:apply-templates select="PARAGRAPH[position()=$i]"/>
+ <!-- Rappelle le template -->
+ <xsl:if test="($i + 1) &lt;=$nbTotalPara">
+ <xsl:message>parag. suivant </xsl:message>
+ <xsl:call-template name="PARAS">
+ <xsl:with-param name="debutListeInitial" select="$i + 1"/>
+ <xsl:with-param name="i"><xsl:value-of select="$i + 1"/></xsl:with-param>
+ <xsl:with-param name="nbItemInitial" select="$nbItem"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+
+</xsl:template>
+
+<xsl:template name="genListe">
+ <xsl:param name="nbItem">param_nbItem</xsl:param>
+ <xsl:param name="debutListe" select="param_debutListe"/>
+ <xsl:param name="i">param_i</xsl:param>
+ <xsl:param name="start">param_start</xsl:param>
+ <xsl:message>Generation de la liste</xsl:message>
+ <xsl:message> debut : <xsl:value-of select="$debutListe"/></xsl:message>
+ <xsl:message> courant : <xsl:value-of select="$i"/></xsl:message>
+ <xsl:message> nb : <xsl:value-of select="$nbItem"/></xsl:message>
+ <xsl:message> start : <xsl:value-of select="$start"/></xsl:message>
+ <xsl:call-template name="createItem">
+ <xsl:with-param name="i" select="$i"/>
+ <xsl:with-param name="start" select="$start"/>
+ </xsl:call-template>
+
+ <xsl:if test="($i + 1) &lt; ($debutListe + $nbItem)">
+ <xsl:variable name="nextStart">
+ <xsl:choose>
+ <xsl:when test="PARAGRAPH[position()=$i]/LAYOUT/COUNTER/@type &gt; 5">
+ <xsl:copy-of select="$start"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:copy-of select="$start"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="genListe">
+ <xsl:with-param name="debutListe" select="$debutListe"/>
+ <xsl:with-param name="nbItem" select="$nbItem"/>
+ <xsl:with-param name="i" select="$i + 1"/>
+ <xsl:with-param name="start" select="$nextStart"/>
+ </xsl:call-template>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template name="createItem">
+ <xsl:param name="i">param_i</xsl:param>
+ <xsl:param name="start">param_start</xsl:param>
+ <fo:list-item>
+ <fo:list-item-label>
+ <fo:block>
+ <xsl:variable name="format">
+ <xsl:value-of select="PARAGRAPH[position()=$i]/LAYOUT/COUNTER/@lefttext"/><xsl:value-of select="PARAGRAPH[position()=$i]/LAYOUT/COUNTER/@righttext"/>
+ </xsl:variable>
+ <xsl:message><xsl:copy-of select="$format"/></xsl:message>
+ <xsl:number format="$format" from="$start" level="multiple"/>
+ </fo:block>
+ </fo:list-item-label>
+ <fo:list-item-body>
+ <xsl:apply-templates select="PARAGRAPH[position()=$i]"/>
+ </fo:list-item-body>
+ </fo:list-item>
+</xsl:template>
+
+<!-- PARAGRAPH -->
+<xsl:template match="PARAGRAPH" name="PARAGRAPH">
+ <xsl:text>
+ </xsl:text>
+ <fo:block>
+ <!-- Formats the paragraph -->
+ <xsl:apply-templates select="LAYOUT"/>
+
+ <xsl:variable name="text"><xsl:value-of select="TEXT"/></xsl:variable>
+ <!-- Formats each part of the paragraph -->
+ <xsl:choose>
+ <xsl:when test="FORMATS">
+ <xsl:for-each select="FORMATS">
+ <xsl:call-template name="FORMATS">
+ <xsl:with-param name="text"><xsl:value-of select="$text"/></xsl:with-param>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$text"/>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ </fo:block>
+ <xsl:text>
+ </xsl:text>
+</xsl:template>
+
+<!-- FORMATS -->
+<xsl:template name="FORMATS">
+ <xsl:param name="text"/>
+
+ <xsl:variable name="pos"><xsl:value-of select="FORMAT/@pos"/></xsl:variable>
+ <!-- Add the text before the first format. -->
+ <xsl:if test="$pos != 0">
+ <xsl:value-of select="substring($text, 0, $pos + 1)"/>
+ </xsl:if>
+
+ <xsl:for-each select="FORMAT">
+ <xsl:variable name="pos"><xsl:value-of select="@pos"/></xsl:variable>
+ <xsl:variable name="len"><xsl:value-of select="@len"/></xsl:variable>
+ <!-- Add the text in a format. -->
+ <fo:inline>
+ <xsl:apply-templates select="."/>
+ <xsl:value-of select="substring($text, $pos + 1, $len)"/>
+ </fo:inline>
+ <xsl:variable name="next_pos"><xsl:value-of select="following::FORMAT/@pos"/></xsl:variable>
+ <!-- Add the text when a following format exists. -->
+ <xsl:if test="$next_pos > ($pos + $len)">
+ <xsl:value-of select="substring($text, $pos + $len + 1, $next_pos - $pos - $len)"/>
+ </xsl:if>
+ <!-- Add the text when there are no more formats. -->
+ <xsl:if test="$next_pos=0">
+ <xsl:value-of select="substring($text, $pos + $len + 1)"/>
+ </xsl:if>
+ </xsl:for-each>
+</xsl:template>
+
+<!-- FORMAT -->
+<xsl:template match="FORMAT" name="FORMAT">
+ <xsl:choose>
+ <xsl:when test="@id=1">
+ <xsl:call-template name="TEXT-FORMAT"/>
+ </xsl:when>
+ <xsl:when test="@id=6">
+ <xsl:call-template name="ANCHOR-FORMAT"/>
+ </xsl:when>
+ </xsl:choose>
+</xsl:template>
+
+<!-- TEXT-FORMAT -->
+<xsl:template name="TEXT-FORMAT">
+ <xsl:choose>
+ <xsl:when test="VERTALIGN/@value=1">
+ <xsl:attribute name="vertical-align">sub</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="VERTALIGN/@value=2">
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="FONT">
+ <xsl:attribute name="font-family"><xsl:value-of select="FONT/@name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="UNDERLINE/@value=1">
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="STRIKEOUT/@value=1">
+ <xsl:attribute name="text-decoration">line-through</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="CHARSET">
+ <!--<xsl:attribute name="charset"><xsl:value-of select="CHARSET/@value"/></xsl:attribute>-->
+ </xsl:if>
+ <xsl:if test="ITALIC/@value=1">
+ <xsl:attribute name="font-style">italic</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="WEIGHT/@value=75">
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="SIZE">
+ <xsl:attribute name="font-size"><xsl:value-of select="SIZE/@value"/>pt</xsl:attribute>
+ </xsl:if>
+</xsl:template>
+
+<!-- OTHER-FORMAT -->
+
+<!-- LAYOUT -->
+<xsl:template match="LAYOUT">
+ <xsl:if test="NAME">
+ <!-- MUST USE THE STYLE WHICH THIS NAME -->
+ <!-- TODO -->
+ <xsl:variable name="name"><xsl:value-of select="@value"/></xsl:variable>
+ <xsl:call-template name="FORMAT" select="/DOC/STYLES//STYLE/NAME[@value=$name]"/>
+ </xsl:if>
+
+ <xsl:if test="FLOW">
+ <xsl:attribute name="text-align">
+ <xsl:value-of select="FLOW/@align"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="COUNTER">
+
+ </xsl:if>
+ <xsl:if test="INDENTS/@first">
+ <xsl:attribute name="text-indent">
+ <xsl:value-of select="/@first"/>
+ </xsl:attribute>
+ </xsl:if>
+
+ <xsl:if test="FORMAT">
+ <xsl:apply-templates select="FORMAT"/>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template name="ANCHOR-FORMAT">
+ <xsl:choose>
+ <xsl:when test="ANCHOR/@type=frameset">
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>table<xsl:value-of select="name()"/></xsl:message>
+ <xsl:apply-templates select="ANCHOR">
+ <xsl:with-param name="table"><xsl:value-of select="ANCHOR/@instance"/></xsl:with-param>
+ <xsl:with-param name="col">0</xsl:with-param>
+ <xsl:with-param name="row">0</xsl:with-param>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/filters/xsltfilter/export/xslt_export.desktop b/filters/xsltfilter/export/xslt_export.desktop
new file mode 100644
index 000000000..46576c066
--- /dev/null
+++ b/filters/xsltfilter/export/xslt_export.desktop
@@ -0,0 +1,72 @@
+[Desktop Entry]
+X-KDE-Export=text/xml
+ExportDescription=XSLT
+Icon=
+X-KDE-Import=application/x-kword,application/x-kontour,application/x-kspread,application/x-kivio,application/x-kpresenter,application/x-kchart
+X-KDE-Weight=1
+X-KDE-Available=check
+ImportDescription=KWord
+Name=KOffice XSLT Export Filter
+Name[af]=Koffice Xslt Voer uit Filter
+Name[ar]=مِرْشَح تصدير XSLT لدى KOffice
+Name[bg]=Филтър за експортиране от KOffice в XSLT
+Name[br]=Sil ezporzh XSLT evit KOffice
+Name[ca]=Filtre d'exportació XSLT per a KOffice
+Name[cs]=Exportní filtr typu XSLT pro KOffice
+Name[cy]=Hidlen Allforio XSLT KOffice
+Name[da]=KOffice XSLT-eksportfilter
+Name[de]=KOffice XSLT-Exportfilter
+Name[el]=Φίλτρο εξαγωγής XSLT του KOffice
+Name[eo]=XSLT-eksportfiltrilo por KOffice
+Name[es]=Filtro de exportación XSLT de KOffice
+Name[et]=KOffice'i XSLT ekspordifilter
+Name[eu]=KOffice-en XSLT esportaziorako iragazkia
+Name[fa]=پالایۀ صادرات KOffice XSLT
+Name[fi]=KOffice XSLT-vientisuodin
+Name[fr]=Filtre d'exportation XSLT de KOffice
+Name[fy]=XSLT-Eksportfilter foar KOffice
+Name[ga]=Scagaire Easpórtála XSLT le haghaidh KOffice
+Name[gl]=Filtro de Exportación de XSLT para KOffice
+Name[he]=מסנן ייצוא מ־KOffice ל־XSLT
+Name[hi]=के-ऑफ़िस एक्सएसएलटी निर्यात फ़िल्टर
+Name[hr]=KOffice XSLT filtar izvoza
+Name[hu]=KOffice XSLT exportszűrő
+Name[is]=KOffice XSLT útflutningssía
+Name[it]=Filtro di esportazione XSLT per KOffice
+Name[ja]=KOffice XSLT エクスポートフィルタ
+Name[km]=តម្រង​នាំចេញ XSLT សម្រាប់ KOffice
+Name[lo]=ຕົວຕອງການສົ່ງອອກ XSLT ຂອງໂປຼເກມຊຸດສຳນັກງານK
+Name[lt]=KWord XSLT eksporto filtras
+Name[lv]=KOffice XSLT eksporta filtrs
+Name[ms]=Penapis Eksport KOffice XSLT
+Name[mt]=Filtru għall-esportazzjoni ta' XSLT minn KOffice
+Name[nb]=XSLT-eksportfilter for KOffice
+Name[nds]=XSLT-Exportfilter för KOffice
+Name[ne]=केडीई कार्यालय XSLT निर्यात फिल्टर
+Name[nl]=XSLT-exportfilter voor KOffice
+Name[nn]=XSLT-eksportfilter for KOffice
+Name[pl]=Filtr eksportu do formatu XSLT z KOffice
+Name[pt]=Filtro de Exportação de XSLT para o KOffice
+Name[pt_BR]=Filtro de exportação KOffice/XSLT
+Name[ro]=Filtru exportare KOffice pentru XSLT
+Name[ru]=Фильтр экспорта документов KOffice посредством XSLT
+Name[se]=KOffice:a XSLT-olggosfievrridansilli
+Name[sk]=XSLT filter pre export z KWord
+Name[sl]=Izvozni filter XLST za KOffice
+Name[sr]=KOffice-ов филтер за извоз у XSLT
+Name[sr@Latn]=KOffice-ov filter za izvoz u XSLT
+Name[sv]=Koffice XSLT-exportfilter
+Name[ta]=Koffice XSLTஏற்றுமதி வடிகட்டி
+Name[tg]=Филтри Содироти KOffice XSLT
+Name[th]=ตัวกรองการส่งออก XSLT ของโปรแกรมชุดสำนักงาน K
+Name[tr]=KOffice XSLT Aktarma Filtresi
+Name[uk]=Фільтр експорту XSLT для KOffice
+Name[uz]=KOffice XSLT eksport filteri
+Name[uz@cyrillic]=KOffice XSLT экспорт филтери
+Name[wa]=Passete XSLT di rexhowe po KOffice
+Name[xh]=Isihluzi Sokurhweba ngaphandle se KOffice XSLT
+Name[zh_CN]=KOffice XSLT 导出过滤器
+Name[zh_TW]=KOffice XSLT 匯出過濾程式
+ServiceTypes=KOfficeFilter
+Type=Service
+X-KDE-Library=libxsltexport
diff --git a/filters/xsltfilter/export/xsltdialog.ui b/filters/xsltfilter/export/xsltdialog.ui
new file mode 100644
index 000000000..ac4bc72b8
--- /dev/null
+++ b/filters/xsltfilter/export/xsltdialog.ui
@@ -0,0 +1,221 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>XSLTDialog</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>XSLTDialog</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>373</width>
+ <height>389</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Export XSLT Configuration</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>false</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>GroupBox1</cstring>
+ </property>
+ <property name="title">
+ <string>Common xslt Files</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QListBox">
+ <property name="name">
+ <cstring>xsltList</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>200</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>GroupBox2</cstring>
+ </property>
+ <property name="title">
+ <string>Personal xslt Files</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QComboBox">
+ <property name="name">
+ <cstring>recentBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name" stdset="0">
+ <cstring>Spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Minimum</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>chooseBtn</cstring>
+ </property>
+ <property name="text">
+ <string>Choose...</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout37</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name" stdset="0">
+ <cstring>Spacer57</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>OkBtn</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>CancelBtn</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>OkBtn</sender>
+ <signal>clicked()</signal>
+ <receiver>XSLTDialog</receiver>
+ <slot>okSlot()</slot>
+ </connection>
+ <connection>
+ <sender>CancelBtn</sender>
+ <signal>clicked()</signal>
+ <receiver>XSLTDialog</receiver>
+ <slot>cancelSlot()</slot>
+ </connection>
+ <connection>
+ <sender>chooseBtn</sender>
+ <signal>clicked()</signal>
+ <receiver>XSLTDialog</receiver>
+ <slot>chooseSlot()</slot>
+ </connection>
+ <connection>
+ <sender>recentBox</sender>
+ <signal>activated(const QString&amp;)</signal>
+ <receiver>XSLTDialog</receiver>
+ <slot>chooseRecentSlot()</slot>
+ </connection>
+ <connection>
+ <sender>xsltList</sender>
+ <signal>selectionChanged()</signal>
+ <receiver>XSLTDialog</receiver>
+ <slot>chooseCommonSlot()</slot>
+ </connection>
+</connections>
+<includes>
+ <include location="local" impldecl="in implementation">xsltdialog.ui.h</include>
+</includes>
+<slots>
+ <slot>cancelSlot()</slot>
+ <slot>chooseRecentSlot()</slot>
+ <slot>chooseSlot()</slot>
+ <slot>chooseCommonSlot()</slot>
+ <slot>okSlot()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/filters/xsltfilter/export/xsltexport.cc b/filters/xsltfilter/export/xsltexport.cc
new file mode 100644
index 000000000..50d40ffb8
--- /dev/null
+++ b/filters/xsltfilter/export/xsltexport.cc
@@ -0,0 +1,66 @@
+/* This file is part of the KDE project
+ Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+
+#include <xsltexport.h>
+
+#include <kdebug.h>
+#include <KoFilterChain.h>
+#include <kgenericfactory.h>
+
+#include <xsltexportdia.h>
+
+typedef KGenericFactory<XSLTExport, KoFilter> XSLTExportFactory;
+K_EXPORT_COMPONENT_FACTORY( libxsltexport, XSLTExportFactory( "kofficefilters" ) )
+
+// Check for XSLT files
+extern "C" {
+ int check_libxsltexport() {
+ return 0;
+ }
+}
+
+
+XSLTExport::XSLTExport(KoFilter *, const char *, const QStringList&) :
+ KoFilter() {
+}
+
+KoFilter::ConversionStatus XSLTExport::convert( const QCString& from, const QCString&)
+{
+ if(from != "application/x-kword" &&
+ from != "application/x-kontour" && from != "application/x-kspread" &&
+ from != "application/x-kivio" && from != "application/x-kchart" &&
+ from != "application/x-kpresenter")
+ return KoFilter::NotImplemented;
+ kdDebug() << "In the xslt filter" << endl;
+
+ KoStoreDevice* in = m_chain->storageFile("root", KoStore::Read);
+
+ if(!in) {
+ kdError() << "Unable to open input file!" << endl;
+ return KoFilter::FileNotFound;
+ }
+
+ XSLTExportDia* dialog = new XSLTExportDia(in, from, 0, "Exportation", true);
+ dialog->setOutputFile(m_chain->outputFile());
+ dialog->exec();
+ delete dialog;
+ return KoFilter::OK;
+}
+
+#include <xsltexport.moc>
diff --git a/filters/xsltfilter/export/xsltexport.h b/filters/xsltfilter/export/xsltexport.h
new file mode 100644
index 000000000..3ecbaed04
--- /dev/null
+++ b/filters/xsltfilter/export/xsltexport.h
@@ -0,0 +1,36 @@
+/* This file is part of the KDE project
+ Copyright (C) 2000 Robert JACOLIN <rjacolin@ifrance.com>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+
+#ifndef __XSLTEXPORT_H__
+#define __XSLTEXPORT_H__
+
+#include <KoFilter.h>
+
+class XSLTExport : public KoFilter
+{
+
+ Q_OBJECT
+
+public:
+ XSLTExport(KoFilter *parent, const char *name, const QStringList&);
+ virtual ~XSLTExport() {}
+
+ virtual KoFilter::ConversionStatus convert( const QCString& from, const QCString& to );
+};
+#endif /* __XSLTEXPORT_H__ */
diff --git a/filters/xsltfilter/export/xsltexportdia.cc b/filters/xsltfilter/export/xsltexportdia.cc
new file mode 100644
index 000000000..02aab19ca
--- /dev/null
+++ b/filters/xsltfilter/export/xsltexportdia.cc
@@ -0,0 +1,267 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Robert JACOLIN <rjacolin@ifrance.com>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ This file use code from koTemplateOpenDia for the method chooseSlot.
+*/
+
+#include <xsltexportdia.h>
+#include <xsltproc.h>
+
+#include <qdir.h>
+#include <qcombobox.h>
+
+#include <kapplication.h>
+#include <kglobal.h>
+#include <klocale.h>
+#include <kconfig.h>
+#include <kdeversion.h>
+#include <kstandarddirs.h>
+#include <krecentdocument.h>
+#include <ktempfile.h>
+#include <kfiledialog.h>
+#include <kdebug.h>
+#include <KoFilterManager.h>
+#include <KoStoreDevice.h>
+
+/*#ifdef __FreeBSD__
+#include <unistd.h>
+#endif*/
+
+/*
+ * Constructs a XSLTExportDia which is a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'.
+ *
+ * The dialog will by default be modeless, unless you set 'modal' to
+ * TRUE to construct a modal dialog.
+ */
+XSLTExportDia::XSLTExportDia(KoStoreDevice* in, const QCString &format, QWidget* parent, const char* name_, bool modal, WFlags fl )
+ : XSLTDialog( parent, name_, modal, fl )
+{
+ int i = 0;
+ _in = in;
+ _format = format;
+ setCaption(i18n("Export XSLT Configuration"));
+
+ kapp->restoreOverrideCursor();
+
+ /* Recent files */
+ _config = new KConfig("xsltdialog");
+ _config->setGroup( "XSLT export filter" );
+ QString value;
+ while(i < 10)
+ {
+ value = _config->readPathEntry( QString("Recent%1").arg(i) );
+ kdDebug() << "recent : " << value << endl;
+ if(!value.isEmpty())
+ {
+ _recentList.append( value );
+ recentBox->insertItem(value);
+ }
+ else
+ i = 10;
+ i = i + 1;
+ }
+
+ /* Common xslt files box */
+ QString appName = (const char*) KGlobal::instance()->instanceName();
+ kdDebug() << "app name = " << appName << endl;
+
+ QString filenames = QString("xsltfilter") + QDir::separator() + QString("export") +
+ QDir::separator() + appName + QDir::separator() + "*/*.xsl";
+ QStringList commonFilesList = KGlobal::dirs()->findAllResources("data", filenames, true);
+ kdDebug() << "There are " << commonFilesList.size() << " entries like " << filenames << endl;
+
+ QStringList tempList;
+ QString name;
+ QString file;
+
+ for(QStringList::Iterator it = commonFilesList.begin(); it != commonFilesList.end(); ++it)
+ {
+ tempList = QStringList::split("/", (*it));
+ file = tempList.last();
+ tempList.pop_back();
+ name = tempList.last();
+ tempList.pop_back();
+ kdDebug() << name << " " << file << endl;
+ if(!_namesList.contains(name) && file == "main.xsl")
+ {
+ _filesList.append(file);
+ _namesList.append(name);
+ _dirsList.append(tempList.join("/"));
+ kdDebug() << file << " get" << endl;
+ }
+ }
+
+ xsltList->insertStringList(_namesList);
+}
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+XSLTExportDia::~XSLTExportDia()
+{
+ delete _config;
+}
+
+/**
+ * Called when thecancel button is clicked.
+ * Close the dialog box.
+ */
+void XSLTExportDia::cancelSlot()
+{
+ kdDebug() << "export cancelled" << endl;
+ reject();
+}
+
+/**
+ * Called when the choose button is clicked. A file dialog is open to allow to choose
+ * the xslt to use.
+ * Change the value of the current file.
+ */
+void XSLTExportDia::chooseSlot()
+{
+
+ /* Use dir from currently selected file */
+ QString dir = QString::null;
+ if ( _currentFile.isLocalFile() && QFile::exists( _currentFile.path() ) )
+ dir = QFileInfo( _currentFile.path() ).absFilePath();
+
+ KFileDialog *dialog = new KFileDialog(dir, QString::null, 0L, "file dialog", true);
+ dialog->setCaption( i18n("Open Document") );
+ dialog->setMimeFilter( KoFilterManager::mimeFilter( _format, KoFilterManager::Export ) );
+ KURL u;
+
+ if(dialog->exec() == QDialog::Accepted)
+ {
+ u = dialog->selectedURL();
+ KRecentDocument::add(dialog->selectedURL().url(), !dialog->selectedURL().isLocalFile());
+ } else //revert state
+ {
+ //if (bEmpty) openEmpty();
+ //if (bTemplates) openTemplate();
+ }
+
+ delete dialog;
+
+ QString filename = u.path();
+ QString url = u.url();
+ bool local = u.isLocalFile();
+
+ bool ok = !url.isEmpty();
+ if (local) // additional checks for local files
+ ok = ok && (QFileInfo( filename ).isFile() ||
+ (QFileInfo( filename ).isSymLink() &&
+ !QFileInfo( filename ).readLink().isEmpty() &&
+ QFileInfo( QFileInfo( filename ).readLink() ).isFile() ) );
+
+ if ( ok )
+ {
+ _currentFile = u;
+ okSlot();
+ }
+}
+
+/**
+ * Called when the user clic on an element in the recent list.
+ * Change the value of the current file.
+ */
+void XSLTExportDia::chooseRecentSlot()
+{
+ kdDebug() << "recent slot : " << recentBox->currentText() << endl;
+ _currentFile = recentBox->currentText();
+}
+
+/**
+ * Called when teh user clic on an element in the common list of xslt sheet.
+ * Change the value of the current file.
+ */
+void XSLTExportDia::chooseCommonSlot()
+{
+ int num = xsltList->currentItem();
+ _currentFile = QDir::separator() + _dirsList[num] + QDir::separator() +
+ xsltList->currentText() + QDir::separator() + _filesList[num];
+ kdDebug() << "common slot : " << _currentFile.url() << endl;
+}
+
+/**
+ * Called when the user clic on the ok button. The xslt sheet is put on the recent list which is
+ * saved, then the xslt processor is called to export the document.
+ */
+void XSLTExportDia::okSlot()
+{
+ hide();
+ if(_currentFile.url().isEmpty())
+ return;
+ kdDebug() << "XSLT FILTER --> BEGIN" << endl;
+ QString stylesheet = _currentFile.directory() + QDir::separator() + _currentFile.fileName();
+
+ /* Add the current file in the recent list if is not and save the list. */
+ if(_recentList.contains(stylesheet) == 0)
+ {
+ kdDebug() << "Style sheet add to recent list" << endl;
+ /* Remove the older stylesheet used */
+ if(_recentList.size() >= 10)
+ _recentList.pop_back();
+
+ /* Add the new */
+ _recentList.prepend(stylesheet);
+
+ /* Save the new list */
+ kdDebug() << "Recent list save " << _recentList.size() << " entrie(s)" << endl;
+ int i = 0;
+ while(_recentList.size() > 0)
+ {
+ kdDebug() << "save : " << _recentList.first() << endl;
+#if KDE_IS_VERSION(3,1,3)
+ _config->writePathEntry( QString("Recent%1").arg(i), _recentList.first());
+#else
+ _config->writeEntry( QString("Recent%1").arg(i), _recentList.first());
+#endif
+ _recentList.pop_front();
+ i = i + 1;
+ }
+ /* Write config on disk */
+ _config->sync();
+ }
+
+ /* Temp file */
+ KTempFile temp("xsltexport-", "kwd");
+ temp.setAutoDelete(true);
+ QFile* tempFile = temp.file();
+
+ const Q_LONG buflen = 4096;
+ char buffer[ buflen ];
+ Q_LONG readBytes = _in->readBlock( buffer, buflen );
+
+ while ( readBytes > 0 )
+ {
+ tempFile->writeBlock( buffer, readBytes );
+ readBytes = _in->readBlock( buffer, buflen );
+ }
+ temp.close();
+
+ kdDebug() << stylesheet << endl;
+ XSLTProc* xsltproc = new XSLTProc(temp.name(), _fileOut, stylesheet);
+ xsltproc->parse();
+
+ delete xsltproc;
+
+ kdDebug() << "XSLT FILTER --> END" << endl;
+ reject(); // ###### accept() ? (Werner)
+}
+
+#include <xsltexportdia.moc>
diff --git a/filters/xsltfilter/export/xsltexportdia.h b/filters/xsltfilter/export/xsltexportdia.h
new file mode 100644
index 000000000..b79c429b3
--- /dev/null
+++ b/filters/xsltfilter/export/xsltexportdia.h
@@ -0,0 +1,62 @@
+/* This file is part of the KDE project
+ Copyright (C) 2000 Robert JACOLIN <rjacolin@ifrance.com>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+
+#ifndef __XSLTEXPORTDIA_H__
+#define __XSLTEXPORTDIA_H__
+
+#include <xsltdialog.h>
+#include <qstringlist.h>
+#include <kurl.h>
+
+class KoStoreDevice;
+class KConfig;
+
+class XSLTExportDia : public XSLTDialog
+{
+ Q_OBJECT
+
+ QString _fileOut;
+ KoStoreDevice* _in;
+ /** xslt file current */
+ KURL _currentFile;
+ QCString _format;
+ KConfig* _config;
+ /** List of the most recent xslt file used. */
+ QStringList _recentList;
+
+ /** Lits use for common xslt files. */
+ QStringList _dirsList;
+ QStringList _filesList;
+ QStringList _namesList;
+
+public:
+ XSLTExportDia( KoStoreDevice*, const QCString &format, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+ ~XSLTExportDia();
+
+ void setOutputFile(QString file) { _fileOut = file; }
+
+public slots:
+ virtual void cancelSlot();
+ virtual void chooseSlot();
+ virtual void chooseRecentSlot();
+ virtual void chooseCommonSlot();
+ virtual void okSlot();
+};
+
+#endif /* __XSLTEXPORTDIA_H__ */
diff --git a/filters/xsltfilter/export/xsltproc.cc b/filters/xsltfilter/export/xsltproc.cc
new file mode 100644
index 000000000..592c849a2
--- /dev/null
+++ b/filters/xsltfilter/export/xsltproc.cc
@@ -0,0 +1,309 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Robert JACOLIN <rjacolin@ifrance.com>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ This file has been made from xsltproc.c from libxslt.
+*/
+
+/*
+ * xsltproc.c: user program for the XSL Transformation 1.0 engine
+ *
+ * See Copyright for the status of this software.
+ *
+ * daniel@veillard.com
+ */
+#include "xsltproc.h"
+
+#include <qfile.h>
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#include <libxml/debugXML.h>
+#include <libxml/xmlIO.h>
+#include <libxml/parserInternals.h>
+
+#include <libexslt/exsltconfig.h>
+
+#ifdef WIN32
+#ifdef _MSC_VER
+#include <winsock2.h>
+#pragma comment(lib, "ws2_32.lib")
+#define gettimeofday(p1,p2)
+#endif /* _MS_VER */
+#else /* WIN32 */
+#endif /* WIN32 */
+
+#ifndef HAVE_STAT
+# ifdef HAVE__STAT
+ /* MS C library seems to define stat and _stat. The definition
+ * is identical. Still, mapping them to each other causes a warning. */
+# ifndef _MSC_VER
+# define stat(x,y) _stat(x,y)
+# endif
+# define HAVE_STAT
+# endif
+#endif
+
+xmlParserInputPtr xmlNoNetExternalEntityLoader(const char *URL,
+ const char *ID,
+ xmlParserCtxtPtr ctxt);
+
+#if 0
+XSLTProc::XSLTProc(const char* fileIn, const char* fileOut, const char* xsltsheet)
+{
+ _fileIn = fileIn;
+ _fileOut = fileOut;
+ _stylesheet = xsltsheet;
+ nbparams = 0;
+ debug = 0;
+ repeat = 0;
+ novalid = 0;
+ output = NULL;
+}
+#endif
+
+XSLTProc::XSLTProc(QString fileIn, QString fileOut, QString xsltsheet)
+{
+ _fileIn = QFile::encodeName(fileIn);
+ _fileOut = QFile::encodeName(fileOut);
+ _stylesheet = QFile::encodeName(xsltsheet);
+ nbparams = 0;
+ debug = 0;
+ repeat = 0;
+ novalid = 0;
+ output = NULL;
+}
+
+/*static int debug = 0;
+static int repeat = 0;
+static int novalid = 0;*/
+
+/*const char *XSLTProc::params[16 + 1];
+int XSLTProc::nbparams = 0;
+static const char *output = NULL;*/
+
+void
+XSLTProc::xsltProcess(xmlDocPtr doc, xsltStylesheetPtr cur, const char *filename)
+{
+ xmlDocPtr res;
+
+ if (output == NULL)
+ {
+
+ if (repeat)
+ {
+ int j;
+
+ for (j = 1; j < repeat; j++)
+ {
+ res = xsltApplyStylesheet(cur, doc, params);
+ xmlFreeDoc(res);
+ xmlFreeDoc(doc);
+ doc = xmlParseFile(filename);
+ }
+ }
+ res = xsltApplyStylesheet(cur, doc, params);
+ xmlFreeDoc(doc);
+
+ if (res == NULL)
+ {
+ fprintf(stderr, "no result for %s\n", filename);
+ return;
+ }
+#ifdef LIBXML_DEBUG_ENABLED
+ if (debug)
+ xmlDebugDumpDocument(stdout, res);
+ else
+ {
+#endif
+ if (cur->methodURI == NULL)
+ {
+ xsltSaveResultToFile(stdout, res, cur);
+ }
+ else
+ {
+ if (xmlStrEqual
+ (cur->method, (const xmlChar *) "xhtml"))
+ {
+ fprintf(stderr, "non standard output xhtml\n");
+ xsltSaveResultToFile(stdout, res, cur);
+ }
+ else
+ {
+ fprintf(stderr,
+ "Unsupported non standard output %s\n",
+ cur->method);
+ }
+ }
+#ifdef LIBXML_DEBUG_ENABLED
+ }
+#endif
+ xmlFreeDoc(res);
+ }
+ else
+ {
+ xsltRunStylesheet(cur, doc, params, output, NULL, NULL);
+ xmlFreeDoc(doc);
+ }
+}
+
+/*static void usage(const char *name) {
+ printf("Usage: %s [options] stylesheet file [file ...]\n", name);
+ printf(" Options:\n");
+ printf(" --version or -V: show the version of libxml and libxslt used\n");
+ printf(" --verbose or -v: show logs of what's happening\n");
+ printf(" --output file or -o file: save to a given file\n");
+ printf(" --timing: display the time used\n");
+ printf(" --repeat: run the transformation 20 times\n");
+ printf(" --debug: dump the tree of the result instead\n");
+ printf(" --novalid: skip the Dtd loading phase\n");
+ printf(" --noout: do not dump the result\n");
+ printf(" --maxdepth val : increase the maximum depth\n");
+#ifdef LIBXML_HTML_ENABLED
+ printf(" --html: the input document is(are) an HTML file(s)\n");
+#endif
+#ifdef LIBXML_DOCB_ENABLED
+ printf(" --docbook: the input document is SGML docbook\n");
+#endif
+ printf(" --param name value : pass a (parameter,value) pair\n");
+ printf(" string values must be quoted like \"'string'\"\n");
+ printf(" --nonet refuse to fetch DTDs or entities over network\n");
+#ifdef LIBXML_CATALOG_ENABLED
+ printf(" --catalogs : use the catalogs from $SGML_CATALOG_FILES\n");
+#endif
+#ifdef LIBXML_XINCLUDE_ENABLED
+ printf(" --xinclude : do XInclude processing on document intput\n");
+#endif
+ printf(" --profile or --norman : dump profiling informations \n");
+}*/
+
+void XSLTProc::addParam(QString name, QString value)
+{
+ if(nbparams < NB_PARAMETER_MAX)
+ {
+ params[nbparams] = strdup(name.latin1());
+ params[nbparams + 1] = strdup(value.latin1());
+ fprintf(stderr, "%s => ", params[0]);
+ fprintf(stderr, "%s\n", params[1]);
+ nbparams = nbparams + 2;
+ }
+}
+
+int XSLTProc::parse()
+{
+ int i = 0;
+ xsltStylesheetPtr cur = NULL;
+ xmlDocPtr doc, style;
+
+ xmlInitMemory();
+
+ LIBXML_TEST_VERSION
+
+ //xmlLineNumbersDefault(1);
+
+ if (novalid == 0)
+ xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
+ else
+ xmlLoadExtDtdDefaultValue = 0;
+
+ /* Options */
+ debug = debug + 1;
+ novalid = novalid + 1;
+ output = _fileOut;
+ repeat = 20;
+ xsltMaxDepth = 5;
+ params[nbparams] = NULL;
+
+ /*
+ * Replace entities with their content.
+ */
+ xmlSubstituteEntitiesDefault(1);
+
+ /*
+ * Register the EXSLT extensions and the test module
+ */
+ //exsltRegisterAll();
+ xsltRegisterTestModule();
+
+
+ style = xmlParseFile((const char *) _stylesheet);
+ if (style == NULL)
+ {
+ fprintf(stderr, "cannot parse %s\n", _stylesheet.data());
+ cur = NULL;
+ }
+ else
+ {
+ cur = xsltLoadStylesheetPI(style);
+ if (cur != NULL)
+ {
+ /* it is an embedded stylesheet */
+ xsltProcess(style, cur, _stylesheet);
+ xsltFreeStylesheet(cur);
+ goto done;
+ }
+ cur = xsltParseStylesheetDoc(style);
+ if (cur != NULL)
+ {
+ if (cur->indent == 1)
+ xmlIndentTreeOutput = 1;
+ else
+ xmlIndentTreeOutput = 0;
+ i++;
+ }
+ else
+ {
+ xmlFreeDoc(style);
+ goto done;
+ }
+ }
+
+ /*
+ * disable CDATA from being built in the document tree
+ */
+ xmlDefaultSAXHandlerInit();
+ xmlDefaultSAXHandler.cdataBlock = NULL;
+
+ if ((cur != NULL) && (cur->errors == 0))
+ {
+ doc = NULL;
+ doc = xmlParseFile(_fileIn);
+ if (doc == NULL)
+ fprintf(stderr, "unable to parse %s\n", _fileIn.data());
+ else
+ xsltProcess(doc, cur, _fileIn);
+ }
+ if (cur != NULL)
+ xsltFreeStylesheet(cur);
+done:
+ xsltCleanupGlobals();
+ xmlCleanupParser();
+ xmlMemoryDump();
+ return (0);
+}
+
diff --git a/filters/xsltfilter/export/xsltproc.h b/filters/xsltfilter/export/xsltproc.h
new file mode 100644
index 000000000..9469b5023
--- /dev/null
+++ b/filters/xsltfilter/export/xsltproc.h
@@ -0,0 +1,75 @@
+/* This file is part of the KDE project
+ Copyright (C) 2000 Robert JACOLIN <rjacolin@ifrance.com>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+
+#ifndef __XSLTPROC_H__
+#define __XSLTPROC_H__
+
+#include <qstring.h>
+
+#include <libexslt/exslt.h>
+#include <libxslt/xsltconfig.h>
+#include <libxslt/xslt.h>
+#include <libxslt/xsltInternals.h>
+#include <libxslt/transform.h>
+#include <libxslt/xsltutils.h>
+#include <libxslt/extensions.h>
+
+#define NB_PARAMETER_MAX 16
+
+class XSLTProc
+{
+ QCString _fileIn;
+ QCString _fileOut;
+ QCString _stylesheet;
+
+ const char *params[NB_PARAMETER_MAX + 1];
+ int nbparams;
+ int debug;
+ int repeat;
+ int novalid;
+ const char *output;
+
+ public:
+ /**
+ * Create a new xslt processor
+ * @param fileIn file to parse.
+ * @param fileOut file to generate.
+ * @param stylesheet xsl file to convert fileIn in fileOut.
+ */
+ XSLTProc(const char* fileIn, const char* fileOut, const char *stylesheet);
+
+ XSLTProc(QString fileIn, QString fileOut, QString stylesheet);
+
+ /**
+ * Destroy the processor
+ */
+ virtual ~XSLTProc() {}
+
+ void addParam(QString name, QString value);
+
+ /** Process fileIn through the stylesheet.
+ * @return return 0 if no error occurred
+ */
+ int parse();
+
+ private:
+ void xsltProcess(xmlDocPtr doc, xsltStylesheetPtr cur,
+ const char *filename);
+};
+#endif /* __XSLTPROC_H__ */
diff --git a/filters/xsltfilter/import/Changelog b/filters/xsltfilter/import/Changelog
new file mode 100644
index 000000000..5cada6d3a
--- /dev/null
+++ b/filters/xsltfilter/import/Changelog
@@ -0,0 +1,2 @@
+19 January 2002
+ o creation of this filter.
diff --git a/filters/xsltfilter/import/Makefile.am b/filters/xsltfilter/import/Makefile.am
new file mode 100644
index 000000000..34b876aca
--- /dev/null
+++ b/filters/xsltfilter/import/Makefile.am
@@ -0,0 +1,24 @@
+####### General stuff
+
+INCLUDES= -I$(srcdir) $(KOFFICE_INCLUDES) $(all_includes) $(LIBXML_CFLAGS) $(LIBXSLT_CFLAGS)
+
+####### Files
+
+kde_module_LTLIBRARIES = libxsltimport.la
+
+libxsltimport_la_SOURCES = xsltimport.cc xsltimportdia.cc xsltproc.cc xsltdialog.ui
+libxsltimport_la_LDFLAGS = $(KDE_RPATH) $(LIBXML_RPATH) $(LIBXSLT_RPATH) $(all_libraries) -module $(KDE_PLUGIN)
+libxsltimport_la_LIBADD = $(KOFFICE_LIBS) $(LIBXSLT_LIBS) $(LIBXML_LIBS)
+
+noinst_HEADERS = xsltimport.h xsltimportdia.h xsltproc.h
+
+######## Debug
+#check_PROGRAMS = xsltfilter
+#xsltfilter_SOURCES = xsltfilter.c
+#xsltfilter_LDADD = $(LIBXSLT_LIBS) $(LIBXML_LIBS)
+#xsltfilter_LDFLAGS = $(KDE_RPATH) $(LIBXML_RPATH) $(LIBXSLT_RPATH) $(all_libraries)
+
+METASOURCES = AUTO
+
+service_DATA = xslt_import.desktop
+servicedir = $(kde_servicesdir)
diff --git a/filters/xsltfilter/import/TODO b/filters/xsltfilter/import/TODO
new file mode 100644
index 000000000..ebf54735c
--- /dev/null
+++ b/filters/xsltfilter/import/TODO
@@ -0,0 +1,3 @@
+o Save all the xsl used to display in a combo box with all recent xslt;
+o Can choose special xslt (supply within koffice);
+o Add option for the xsltproc.
diff --git a/filters/xsltfilter/import/xslt_import.desktop b/filters/xsltfilter/import/xslt_import.desktop
new file mode 100644
index 000000000..6d17677f5
--- /dev/null
+++ b/filters/xsltfilter/import/xslt_import.desktop
@@ -0,0 +1,71 @@
+[Desktop Entry]
+X-KDE-Export=application/x-kword,application/x-kontour,application/x-kpresenter,application/x-kivio,application/x-kchart
+ExportDescription=KOffice
+Icon=
+X-KDE-Import=text/xml
+X-KDE-Weight=1
+ImportDescription=XSLT
+Name=KOffice XSLT Import Filter
+Name[af]=Koffice Xslt In voer Filter
+Name[ar]=مِرْشَح استيراد XSLT لدى KOffice
+Name[bg]=Филтър за импортиране от XSLT в KOffice
+Name[br]=Sil enporzh XSLT evit KOffice
+Name[ca]=Filtre d'importació XSLT per a KOffice
+Name[cs]=Importní filtr typu XSLT pro KOffice
+Name[cy]=Hidlen Fewnforio XSLT KOffice
+Name[da]=KOffice XSLT-importfilter
+Name[de]=KOffice XSLT-Importfilter
+Name[el]=Φίλτρο εισαγωγής XSLT του KOffice
+Name[eo]=XSLT-importfiltrilo por KOffice
+Name[es]=Filtro de importación XSLT de KOffice
+Name[et]=KOffice'i XSLT impordifilter
+Name[eu]=KWord-en XSLT inportaziorako iragazkia
+Name[fa]=پالایۀ واردات KOffice XSLT
+Name[fi]=KOffice XSLT-tuontisuodin
+Name[fr]=Filtre d'importation XSLT de KOffice
+Name[fy]=XSLT-Ymportfilter foar KOffice
+Name[ga]=Scagaire Iompórtála XSLT le haghaidh KOffice
+Name[gl]=Filtro de Importación de XSLT para KWord
+Name[he]=מסנן ייבוא מ־XSLT ל־KOffice
+Name[hi]=के-ऑफ़िस एक्सएसएलटी निर्यात फ़िल्टर
+Name[hr]=KOffice XSLT filtar uvoza
+Name[hu]=KOffice XSLT importszűrő
+Name[is]=KOffice XSLT innflutningssía
+Name[it]=Filtro di importazione XSLT per KOffice
+Name[ja]=KOffice XSLT インポートフィルタ
+Name[km]=តម្រង​នាំចូល XSLT សម្រាប់ KOffice
+Name[lo]=ຕົວຕອງການນຳເຂົ້າ XSLT ຂອງໂປຼເກມຼຊຸດສຳນັກງານ K
+Name[lt]=KWord XSLT importo filtras
+Name[lv]=KOffice XSLT importa filtrs
+Name[ms]=Penapis Import KOffice XSLT
+Name[mt]=Filtru għall-importazzjoni ta' XSLT ġo KOffice
+Name[nb]=XSLT-importfilter for KOffice
+Name[nds]=XSLT-Importfilter för KOffice
+Name[ne]=केडीई कार्यालय XSLT आयात फिल्टर
+Name[nl]=XSLT-importfilter voor KOffice
+Name[nn]=XSLT-importfilter for KOffice
+Name[pl]=Filtr importu formatu XSLT do KOffice
+Name[pt]=Filtro de Importação de XSLT para o KWord
+Name[pt_BR]=Filtro de importação KOffice/XSLT
+Name[ro]=Filtru importare KOffice pentru XSLT
+Name[ru]=Фильтр импорта документов KOffice посредством XSLT
+Name[se]=KOffice:a XSLT-sisafievrridansilli
+Name[sk]=XSLT filter pre import do KWord
+Name[sl]=Uvozni filter XSLT za KOffice
+Name[sr]=KOffice-ов филтер за увоз из XSLT-а
+Name[sr@Latn]=KOffice-ov filter za uvoz iz XSLT-a
+Name[sv]=Koffice XSLT-importfilter
+Name[ta]=Koffice XSLT இறக்குமதி வடிகட்டி
+Name[tg]=Филтри Воридоти KOffice XSLT
+Name[th]=ตัวกรองการนำเข้า XSLT ของโปรแกรมชุดสำนักงาน K
+Name[tr]=KOffice XSLT Alma Filtresi
+Name[uk]=Фільтр експорту XSLT для KOffice
+Name[uz]=KOffice XSLT import filteri
+Name[uz@cyrillic]=KOffice XSLT импорт филтери
+Name[wa]=Passete XSLT d' intrêye po KOffice
+Name[xh]=Isihluzi Sokurhweba se KOffice XSLT
+Name[zh_CN]=KOffice XSLT 导入过滤器
+Name[zh_TW]=KOffice XSLT 匯入過濾程式
+ServiceTypes=KOfficeFilter
+Type=Service
+X-KDE-Library=libxsltimport
diff --git a/filters/xsltfilter/import/xsltdialog.ui b/filters/xsltfilter/import/xsltdialog.ui
new file mode 100644
index 000000000..ac4bc72b8
--- /dev/null
+++ b/filters/xsltfilter/import/xsltdialog.ui
@@ -0,0 +1,221 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>XSLTDialog</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>XSLTDialog</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>373</width>
+ <height>389</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Export XSLT Configuration</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>false</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>GroupBox1</cstring>
+ </property>
+ <property name="title">
+ <string>Common xslt Files</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QListBox">
+ <property name="name">
+ <cstring>xsltList</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>200</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>GroupBox2</cstring>
+ </property>
+ <property name="title">
+ <string>Personal xslt Files</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QComboBox">
+ <property name="name">
+ <cstring>recentBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name" stdset="0">
+ <cstring>Spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Minimum</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>chooseBtn</cstring>
+ </property>
+ <property name="text">
+ <string>Choose...</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout37</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name" stdset="0">
+ <cstring>Spacer57</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>OkBtn</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>CancelBtn</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>OkBtn</sender>
+ <signal>clicked()</signal>
+ <receiver>XSLTDialog</receiver>
+ <slot>okSlot()</slot>
+ </connection>
+ <connection>
+ <sender>CancelBtn</sender>
+ <signal>clicked()</signal>
+ <receiver>XSLTDialog</receiver>
+ <slot>cancelSlot()</slot>
+ </connection>
+ <connection>
+ <sender>chooseBtn</sender>
+ <signal>clicked()</signal>
+ <receiver>XSLTDialog</receiver>
+ <slot>chooseSlot()</slot>
+ </connection>
+ <connection>
+ <sender>recentBox</sender>
+ <signal>activated(const QString&amp;)</signal>
+ <receiver>XSLTDialog</receiver>
+ <slot>chooseRecentSlot()</slot>
+ </connection>
+ <connection>
+ <sender>xsltList</sender>
+ <signal>selectionChanged()</signal>
+ <receiver>XSLTDialog</receiver>
+ <slot>chooseCommonSlot()</slot>
+ </connection>
+</connections>
+<includes>
+ <include location="local" impldecl="in implementation">xsltdialog.ui.h</include>
+</includes>
+<slots>
+ <slot>cancelSlot()</slot>
+ <slot>chooseRecentSlot()</slot>
+ <slot>chooseSlot()</slot>
+ <slot>chooseCommonSlot()</slot>
+ <slot>okSlot()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/filters/xsltfilter/import/xsltimport.cc b/filters/xsltfilter/import/xsltimport.cc
new file mode 100644
index 000000000..e60208ca9
--- /dev/null
+++ b/filters/xsltfilter/import/xsltimport.cc
@@ -0,0 +1,68 @@
+/* This file is part of the KDE project
+ Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+
+#include <xsltimport.h>
+#include <xsltimport.moc>
+#include <kdebug.h>
+#include <KoFilterChain.h>
+#include <kgenericfactory.h>
+#include <kglobal.h>
+#include <klocale.h>
+#include <qtextcodec.h>
+#include "xsltimportdia.h"
+
+
+typedef KGenericFactory<XSLTImport, KoFilter> XSLTImportFactory;
+K_EXPORT_COMPONENT_FACTORY( libxsltimport, XSLTImportFactory( "kofficefilters" ) )
+
+
+XSLTImport::XSLTImport(KoFilter *, const char *, const QStringList&) :
+ KoFilter() {
+}
+
+KoFilter::ConversionStatus XSLTImport::convert( const QCString&, const QCString& to )
+{
+ QString config;
+
+ if(to != "application/x-kword" &&
+ to != "application/x-kontour" && to != "application/x-kspread" &&
+ to != "application/x-kivio" && to != "application/x-kchart" &&
+ to != "application/x-kpresenter")
+ return KoFilter::NotImplemented;
+
+ // ## missing appIdentification
+ KoStore* out = KoStore::createStore(QString(m_chain->outputFile()), KoStore::Write);
+ if(!out || !out->open("root"))
+ {
+ kdError() << "Unable to create output file!" << endl;
+ delete out;
+ return KoFilter::FileNotFound;
+ }
+ /* input file Reading */
+ out->close();
+ kdDebug() << "here" << endl;
+ XSLTImportDia* dialog = new XSLTImportDia(out, to, 0, "Importation", true);
+ dialog->setInputFile(m_chain->inputFile());
+
+ dialog->exec();
+ delete dialog;
+ delete out;
+
+ return KoFilter::OK;
+}
diff --git a/filters/xsltfilter/import/xsltimport.h b/filters/xsltfilter/import/xsltimport.h
new file mode 100644
index 000000000..8ec64364b
--- /dev/null
+++ b/filters/xsltfilter/import/xsltimport.h
@@ -0,0 +1,44 @@
+/* This file is part of the KDE project
+ Copyright (C) 2000 Robert JACOLIN <rjacolin@ifrance.com>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+
+#ifndef __XSLTIMPORT_H__
+#define __XSLTIMPORT_H__
+
+#include <qstring.h>
+#include <qtextstream.h>
+#include <qfile.h>
+#include <qobject.h>
+
+#include <KoFilter.h>
+#include <KoStore.h>
+
+class XSLTImport : public KoFilter
+{
+
+ Q_OBJECT
+
+ public:
+ XSLTImport(KoFilter *parent, const char *name, const QStringList&);
+ virtual ~XSLTImport() {}
+
+ virtual KoFilter::ConversionStatus convert( const QCString& from,
+ const QCString& to );
+};
+
+#endif /* __XSLTIMPORT_H__ */
diff --git a/filters/xsltfilter/import/xsltimportdia.cc b/filters/xsltfilter/import/xsltimportdia.cc
new file mode 100644
index 000000000..0486b84ed
--- /dev/null
+++ b/filters/xsltfilter/import/xsltimportdia.cc
@@ -0,0 +1,264 @@
+/* This file is part of the KDE project
+ Copyright (C) 2000 Robert JACOLIN <rjacolin@ifrance.com>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+
+#include "xsltimportdia.h"
+#include "xsltimportdia.moc"
+
+//#include <stdio.h>
+
+#include <qcombobox.h>
+#include <qcursor.h>
+#include <qstringlist.h>
+#include <qdir.h>
+
+#include <kapplication.h>
+#include <klocale.h>
+#include <kstandarddirs.h>
+#include <kglobal.h>
+#include <krecentdocument.h>
+#include <KoFilterManager.h>
+#include <ktempfile.h>
+#include <kdebug.h>
+
+#include <xsltproc.h>
+
+/*
+ * Constructs a XSLTImportDia which is a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'.
+ *
+ * The dialog will by default be modeless, unless you set 'modal' to
+ * TRUE to construct a modal dialog.
+ */
+XSLTImportDia::XSLTImportDia(KoStore* out, const QCString &format, QWidget* parent, const char* name_, bool modal, WFlags fl )
+ : XSLTDialog( parent, name_, modal, fl )
+{
+ int i = 0;
+ _out = out;
+ _format = format;
+ setCaption(i18n("Import XSLT Configuration"));
+
+ /* Recent files */
+ _config = new KConfig("xsltdialog");
+ _config->setGroup( "XSLT import filter" );
+ QString value;
+ while(i < 10)
+ {
+ value = _config->readPathEntry( QString("Recent%1").arg(i) );
+ kdDebug() << "recent : " << value << endl;
+ if(!value.isEmpty())
+ {
+ _recentList.append( value );
+ recentBox->insertItem(value);
+ }
+ else
+ i = 10;
+ i = i + 1;
+ }
+
+ /* Common xslt files box */
+ QString appName = (const char*) KGlobal::instance()->instanceName();
+ kdDebug() << "app name = " << appName << endl;
+
+ QString filenames = QString("xsltfilter") + QDir::separator() + QString("import") +
+ QDir::separator() + appName + QDir::separator() + "*/*.xsl";
+ QStringList commonFilesList = KGlobal::dirs()->findAllResources("data", filenames, true);
+ kdDebug() << "There are " << commonFilesList.size() << " entries like " << filenames << endl;
+
+ QStringList tempList;
+ QString name;
+ QString file;
+
+ for(QStringList::Iterator it = commonFilesList.begin(); it != commonFilesList.end(); ++it)
+ {
+ tempList = QStringList::split("/", (*it));
+ file = tempList.last();
+ tempList.pop_back();
+ name = tempList.last();
+ tempList.pop_back();
+ kdDebug() << name << " " << file << endl;
+ if(!_namesList.contains(name) && file == "main.xsl")
+ {
+ _filesList.append(file);
+ _namesList.append(name);
+ _dirsList.append(tempList.join("/"));
+ kdDebug() << file << " get" << endl;
+ }
+ }
+
+ xsltList->insertStringList(_namesList);
+ kapp->restoreOverrideCursor();
+}
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+XSLTImportDia::~XSLTImportDia()
+{
+ // no need to delete child widgets, Qt does it all for us
+ delete _config;
+}
+
+/**
+ * Called when thecancel button is clicked.
+ * Close the dialog box.
+ */
+void XSLTImportDia::cancelSlot()
+{
+ kdDebug() << "import cancelled" << endl;
+ reject();
+}
+
+/**
+ * Called when the choose button is clicked. A file dialog is open to allow to choose
+ * the xslt to use.
+ * Change the value of the current file.
+ */
+void XSLTImportDia::chooseSlot()
+{
+
+ /* Use dir from currently selected file */
+ QString dir = QString::null;
+ if ( _currentFile.isLocalFile() && QFile::exists( _currentFile.path() ) )
+ dir = QFileInfo( _currentFile.path() ).absFilePath();
+
+ KFileDialog *dialog = new KFileDialog(dir, QString::null, 0L, "file dialog", true);
+ dialog->setCaption( i18n("Open Document") );
+ dialog->setMimeFilter( KoFilterManager::mimeFilter( _format, KoFilterManager::Import ) );
+ KURL u;
+
+ if(dialog->exec() == QDialog::Accepted)
+ {
+ u = dialog->selectedURL();
+ KRecentDocument::add(dialog->selectedURL().url(), !dialog->selectedURL().isLocalFile());
+ } else //revert state
+ {
+ //if (bEmpty) openEmpty();
+ //if (bTemplates) openTemplate();
+ }
+
+ delete dialog;
+
+ QString filename = u.path();
+ QString url = u.url();
+ bool local = u.isLocalFile();
+
+ bool ok = !url.isEmpty();
+ if (local) // additional checks for local files
+ ok = ok && (QFileInfo( filename ).isFile() ||
+ (QFileInfo( filename ).isSymLink() &&
+ !QFileInfo( filename ).readLink().isEmpty() &&
+ QFileInfo( QFileInfo( filename ).readLink() ).isFile() ) );
+
+ if ( ok )
+ {
+ _currentFile = u;
+ okSlot();
+ }
+}
+
+/**
+ * Called when the user clic on an element in the recent list.
+ * Change the value of the current file.
+ */
+void XSLTImportDia::chooseRecentSlot()
+{
+ kdDebug() << "recent slot : " << recentBox->currentText() << endl;
+ _currentFile = recentBox->currentText();
+}
+
+/**
+ * Called when teh user clic on an element in the common list of xslt sheet.
+ * Change the value of the current file.
+ */
+void XSLTImportDia::chooseCommonSlot()
+{
+ int num = xsltList->currentItem();
+ _currentFile = QDir::separator() + _dirsList[num] + QDir::separator() +
+ xsltList->currentText() + QDir::separator() + _filesList[num];
+ kdDebug() << "common slot : " << _currentFile.url() << endl;
+}
+
+/**
+ * Called when the user clic on the ok button. The xslt sheet is put on the recent list which is
+ * saved, then the xslt processor is called to export the document.
+ */
+void XSLTImportDia::okSlot()
+{
+ kapp->setOverrideCursor(QCursor(Qt::WaitCursor));
+ hide();
+ if(_currentFile.url().isEmpty())
+ return;
+ kdDebug() << "XSLT FILTER --> BEGIN" << endl;
+ _out->open("root");
+ QString stylesheet = _currentFile.directory() + "/" + _currentFile.fileName();
+
+ /* Add the current file in the recent list if is not and save the list. */
+ if(_recentList.contains(stylesheet) == 0)
+ {
+ kdDebug() << "Style sheet add to recent list" << endl;
+ /* Remove the older stylesheet used */
+ if(_recentList.size() >= 10)
+ _recentList.pop_back();
+
+ /* Add the new */
+ _recentList.prepend(stylesheet);
+
+ /* Save the new list */
+ kdDebug() << "Recent list save " << _recentList.size() << " entrie(s)" << endl;
+ int i = 0;
+ while(_recentList.size() > 0)
+ {
+ kdDebug() << "save : " << _recentList.first() << endl;
+#if KDE_IS_VERSION(3,1,3)
+ _config->writePathEntry( QString("Recent%1").arg(i), _recentList.first());
+#else
+ _config->writeEntry( QString("Recent%1").arg(i), _recentList.first());
+#endif
+ _recentList.pop_front();
+ i = i + 1;
+ }
+ /* Write config on disk */
+ _config->sync();
+ }
+
+ /* Create a temp file */
+ KTempFile temp("xsltimport-", "kwd");
+ temp.setAutoDelete(true);
+
+ QFile* tempFile = temp.file();
+ tempFile->open(IO_WriteOnly);
+
+ /* Generate the data in the temp file */
+ XSLTProc* xsltproc = new XSLTProc(_fileIn, temp.name(), stylesheet);
+ xsltproc->parse();
+
+ /* Save the temp file in the store */
+ tempFile->open(IO_ReadOnly);
+ _out->write(tempFile->readAll());
+
+ delete tempFile;
+ delete xsltproc;
+
+ _out->close();
+ temp.close();
+
+ kdDebug() << "XSLT FILTER --> END" << endl;
+ reject();
+}
+
diff --git a/filters/xsltfilter/import/xsltimportdia.h b/filters/xsltfilter/import/xsltimportdia.h
new file mode 100644
index 000000000..55b1eab9b
--- /dev/null
+++ b/filters/xsltfilter/import/xsltimportdia.h
@@ -0,0 +1,64 @@
+/* This file is part of the KDE project
+ Copyright (C) 2000 Robert JACOLIN <rjacolin@ifrance.com>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+
+#ifndef __XSLTIMPORTDIA_H__
+#define __XSLTIMPORTDIA_H__
+
+#include "kapplication.h"
+#include <kfiledialog.h>
+#include <KoStore.h>
+#include "xsltdialog.h"
+
+class XSLTImportDia : public XSLTDialog
+{
+ Q_OBJECT
+
+ QString _fileIn;
+ QString _fileOut;
+ QByteArray _arrayIn;
+ KoStore* _out;
+ /** xslt file current */
+ KURL _currentFile;
+ QCString _format;
+ KConfig* _config;
+ /** List of the most recent xslt file used. */
+ QStringList _recentList;
+
+ /** Lits use for common xslt files. */
+ QStringList _dirsList;
+ QStringList _filesList;
+ QStringList _namesList;
+
+public:
+ XSLTImportDia(KoStore*, const QCString &format, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+ ~XSLTImportDia();
+
+ void setInputFile(QString file) { _fileIn = file; }
+ void setOutputFile(QString file) { _fileOut = file; }
+
+public slots:
+ virtual void cancelSlot();
+ virtual void chooseSlot();
+ virtual void chooseRecentSlot();
+ virtual void chooseCommonSlot();
+ virtual void okSlot();
+
+};
+
+#endif /* __XSLTIMPORTDIA_H__ */
diff --git a/filters/xsltfilter/import/xsltproc.cc b/filters/xsltfilter/import/xsltproc.cc
new file mode 100644
index 000000000..592c849a2
--- /dev/null
+++ b/filters/xsltfilter/import/xsltproc.cc
@@ -0,0 +1,309 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Robert JACOLIN <rjacolin@ifrance.com>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ This file has been made from xsltproc.c from libxslt.
+*/
+
+/*
+ * xsltproc.c: user program for the XSL Transformation 1.0 engine
+ *
+ * See Copyright for the status of this software.
+ *
+ * daniel@veillard.com
+ */
+#include "xsltproc.h"
+
+#include <qfile.h>
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#include <libxml/debugXML.h>
+#include <libxml/xmlIO.h>
+#include <libxml/parserInternals.h>
+
+#include <libexslt/exsltconfig.h>
+
+#ifdef WIN32
+#ifdef _MSC_VER
+#include <winsock2.h>
+#pragma comment(lib, "ws2_32.lib")
+#define gettimeofday(p1,p2)
+#endif /* _MS_VER */
+#else /* WIN32 */
+#endif /* WIN32 */
+
+#ifndef HAVE_STAT
+# ifdef HAVE__STAT
+ /* MS C library seems to define stat and _stat. The definition
+ * is identical. Still, mapping them to each other causes a warning. */
+# ifndef _MSC_VER
+# define stat(x,y) _stat(x,y)
+# endif
+# define HAVE_STAT
+# endif
+#endif
+
+xmlParserInputPtr xmlNoNetExternalEntityLoader(const char *URL,
+ const char *ID,
+ xmlParserCtxtPtr ctxt);
+
+#if 0
+XSLTProc::XSLTProc(const char* fileIn, const char* fileOut, const char* xsltsheet)
+{
+ _fileIn = fileIn;
+ _fileOut = fileOut;
+ _stylesheet = xsltsheet;
+ nbparams = 0;
+ debug = 0;
+ repeat = 0;
+ novalid = 0;
+ output = NULL;
+}
+#endif
+
+XSLTProc::XSLTProc(QString fileIn, QString fileOut, QString xsltsheet)
+{
+ _fileIn = QFile::encodeName(fileIn);
+ _fileOut = QFile::encodeName(fileOut);
+ _stylesheet = QFile::encodeName(xsltsheet);
+ nbparams = 0;
+ debug = 0;
+ repeat = 0;
+ novalid = 0;
+ output = NULL;
+}
+
+/*static int debug = 0;
+static int repeat = 0;
+static int novalid = 0;*/
+
+/*const char *XSLTProc::params[16 + 1];
+int XSLTProc::nbparams = 0;
+static const char *output = NULL;*/
+
+void
+XSLTProc::xsltProcess(xmlDocPtr doc, xsltStylesheetPtr cur, const char *filename)
+{
+ xmlDocPtr res;
+
+ if (output == NULL)
+ {
+
+ if (repeat)
+ {
+ int j;
+
+ for (j = 1; j < repeat; j++)
+ {
+ res = xsltApplyStylesheet(cur, doc, params);
+ xmlFreeDoc(res);
+ xmlFreeDoc(doc);
+ doc = xmlParseFile(filename);
+ }
+ }
+ res = xsltApplyStylesheet(cur, doc, params);
+ xmlFreeDoc(doc);
+
+ if (res == NULL)
+ {
+ fprintf(stderr, "no result for %s\n", filename);
+ return;
+ }
+#ifdef LIBXML_DEBUG_ENABLED
+ if (debug)
+ xmlDebugDumpDocument(stdout, res);
+ else
+ {
+#endif
+ if (cur->methodURI == NULL)
+ {
+ xsltSaveResultToFile(stdout, res, cur);
+ }
+ else
+ {
+ if (xmlStrEqual
+ (cur->method, (const xmlChar *) "xhtml"))
+ {
+ fprintf(stderr, "non standard output xhtml\n");
+ xsltSaveResultToFile(stdout, res, cur);
+ }
+ else
+ {
+ fprintf(stderr,
+ "Unsupported non standard output %s\n",
+ cur->method);
+ }
+ }
+#ifdef LIBXML_DEBUG_ENABLED
+ }
+#endif
+ xmlFreeDoc(res);
+ }
+ else
+ {
+ xsltRunStylesheet(cur, doc, params, output, NULL, NULL);
+ xmlFreeDoc(doc);
+ }
+}
+
+/*static void usage(const char *name) {
+ printf("Usage: %s [options] stylesheet file [file ...]\n", name);
+ printf(" Options:\n");
+ printf(" --version or -V: show the version of libxml and libxslt used\n");
+ printf(" --verbose or -v: show logs of what's happening\n");
+ printf(" --output file or -o file: save to a given file\n");
+ printf(" --timing: display the time used\n");
+ printf(" --repeat: run the transformation 20 times\n");
+ printf(" --debug: dump the tree of the result instead\n");
+ printf(" --novalid: skip the Dtd loading phase\n");
+ printf(" --noout: do not dump the result\n");
+ printf(" --maxdepth val : increase the maximum depth\n");
+#ifdef LIBXML_HTML_ENABLED
+ printf(" --html: the input document is(are) an HTML file(s)\n");
+#endif
+#ifdef LIBXML_DOCB_ENABLED
+ printf(" --docbook: the input document is SGML docbook\n");
+#endif
+ printf(" --param name value : pass a (parameter,value) pair\n");
+ printf(" string values must be quoted like \"'string'\"\n");
+ printf(" --nonet refuse to fetch DTDs or entities over network\n");
+#ifdef LIBXML_CATALOG_ENABLED
+ printf(" --catalogs : use the catalogs from $SGML_CATALOG_FILES\n");
+#endif
+#ifdef LIBXML_XINCLUDE_ENABLED
+ printf(" --xinclude : do XInclude processing on document intput\n");
+#endif
+ printf(" --profile or --norman : dump profiling informations \n");
+}*/
+
+void XSLTProc::addParam(QString name, QString value)
+{
+ if(nbparams < NB_PARAMETER_MAX)
+ {
+ params[nbparams] = strdup(name.latin1());
+ params[nbparams + 1] = strdup(value.latin1());
+ fprintf(stderr, "%s => ", params[0]);
+ fprintf(stderr, "%s\n", params[1]);
+ nbparams = nbparams + 2;
+ }
+}
+
+int XSLTProc::parse()
+{
+ int i = 0;
+ xsltStylesheetPtr cur = NULL;
+ xmlDocPtr doc, style;
+
+ xmlInitMemory();
+
+ LIBXML_TEST_VERSION
+
+ //xmlLineNumbersDefault(1);
+
+ if (novalid == 0)
+ xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
+ else
+ xmlLoadExtDtdDefaultValue = 0;
+
+ /* Options */
+ debug = debug + 1;
+ novalid = novalid + 1;
+ output = _fileOut;
+ repeat = 20;
+ xsltMaxDepth = 5;
+ params[nbparams] = NULL;
+
+ /*
+ * Replace entities with their content.
+ */
+ xmlSubstituteEntitiesDefault(1);
+
+ /*
+ * Register the EXSLT extensions and the test module
+ */
+ //exsltRegisterAll();
+ xsltRegisterTestModule();
+
+
+ style = xmlParseFile((const char *) _stylesheet);
+ if (style == NULL)
+ {
+ fprintf(stderr, "cannot parse %s\n", _stylesheet.data());
+ cur = NULL;
+ }
+ else
+ {
+ cur = xsltLoadStylesheetPI(style);
+ if (cur != NULL)
+ {
+ /* it is an embedded stylesheet */
+ xsltProcess(style, cur, _stylesheet);
+ xsltFreeStylesheet(cur);
+ goto done;
+ }
+ cur = xsltParseStylesheetDoc(style);
+ if (cur != NULL)
+ {
+ if (cur->indent == 1)
+ xmlIndentTreeOutput = 1;
+ else
+ xmlIndentTreeOutput = 0;
+ i++;
+ }
+ else
+ {
+ xmlFreeDoc(style);
+ goto done;
+ }
+ }
+
+ /*
+ * disable CDATA from being built in the document tree
+ */
+ xmlDefaultSAXHandlerInit();
+ xmlDefaultSAXHandler.cdataBlock = NULL;
+
+ if ((cur != NULL) && (cur->errors == 0))
+ {
+ doc = NULL;
+ doc = xmlParseFile(_fileIn);
+ if (doc == NULL)
+ fprintf(stderr, "unable to parse %s\n", _fileIn.data());
+ else
+ xsltProcess(doc, cur, _fileIn);
+ }
+ if (cur != NULL)
+ xsltFreeStylesheet(cur);
+done:
+ xsltCleanupGlobals();
+ xmlCleanupParser();
+ xmlMemoryDump();
+ return (0);
+}
+
diff --git a/filters/xsltfilter/import/xsltproc.h b/filters/xsltfilter/import/xsltproc.h
new file mode 100644
index 000000000..9469b5023
--- /dev/null
+++ b/filters/xsltfilter/import/xsltproc.h
@@ -0,0 +1,75 @@
+/* This file is part of the KDE project
+ Copyright (C) 2000 Robert JACOLIN <rjacolin@ifrance.com>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+
+#ifndef __XSLTPROC_H__
+#define __XSLTPROC_H__
+
+#include <qstring.h>
+
+#include <libexslt/exslt.h>
+#include <libxslt/xsltconfig.h>
+#include <libxslt/xslt.h>
+#include <libxslt/xsltInternals.h>
+#include <libxslt/transform.h>
+#include <libxslt/xsltutils.h>
+#include <libxslt/extensions.h>
+
+#define NB_PARAMETER_MAX 16
+
+class XSLTProc
+{
+ QCString _fileIn;
+ QCString _fileOut;
+ QCString _stylesheet;
+
+ const char *params[NB_PARAMETER_MAX + 1];
+ int nbparams;
+ int debug;
+ int repeat;
+ int novalid;
+ const char *output;
+
+ public:
+ /**
+ * Create a new xslt processor
+ * @param fileIn file to parse.
+ * @param fileOut file to generate.
+ * @param stylesheet xsl file to convert fileIn in fileOut.
+ */
+ XSLTProc(const char* fileIn, const char* fileOut, const char *stylesheet);
+
+ XSLTProc(QString fileIn, QString fileOut, QString stylesheet);
+
+ /**
+ * Destroy the processor
+ */
+ virtual ~XSLTProc() {}
+
+ void addParam(QString name, QString value);
+
+ /** Process fileIn through the stylesheet.
+ * @return return 0 if no error occurred
+ */
+ int parse();
+
+ private:
+ void xsltProcess(xmlDocPtr doc, xsltStylesheetPtr cur,
+ const char *filename);
+};
+#endif /* __XSLTPROC_H__ */
diff --git a/filters/xsltfilter/kword2xslfo.xsl b/filters/xsltfilter/kword2xslfo.xsl
new file mode 100644
index 000000000..4268afbad
--- /dev/null
+++ b/filters/xsltfilter/kword2xslfo.xsl
@@ -0,0 +1,377 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ This file is part of the KDE project
+ Copyright (C) 2002 Robert JACOLIN <rjacolin@ifrance.com>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+ This stylesheet convert kword document in xsl:fo.
+
+ -->
+
+<xsl:stylesheet version = '1.0'
+ xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
+ xmlns:fo='http://www.w3.org/1999/XSL/Format'>
+
+<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
+<xsl:param name="nbTotalPara" select="30"/>
+
+<!-- DOC. (DEFINITIONS, ...) -->
+<xsl:template match="DOC">
+ <xsl:comment>
+ <xsl:value-of select="@editor"/>
+ </xsl:comment>
+ <fo:root>
+ <fo:layout-master-set>
+ <fo:simple-page-master
+ margin-right="0.5cm" margin-left="0.5cm" margin-bottom="0.5cm" margin-top="0.75cm"
+ page-width="21cm" page-height="29.7cm" master-name="first">
+ <fo:region-body></fo:region-body>
+ </fo:simple-page-master>
+ <fo:simple-page-master
+ margin-right="2.5cm" margin-left="2.5cm" margin-bottom="2cm" margin-top="1cm"
+ page-width="21cm" page-height="29.7cm" master-name="rest">
+ <fo:region-body></fo:region-body>
+ </fo:simple-page-master>
+
+ <fo:page-sequence-master master-name="page">
+ <fo:repeatable-page-master-alternatives>
+ <fo:conditional-page-master-reference master-name="first"
+ page-position="first" />
+ <fo:conditional-page-master-reference master-name="rest"
+ page-position="rest" />
+ <!-- recommended fallback procedure -->
+ <fo:conditional-page-master-reference master-name="rest" />
+ </fo:repeatable-page-master-alternatives>
+ </fo:page-sequence-master>
+ </fo:layout-master-set>
+ <xsl:apply-templates select="FRAMESETS"/>
+ </fo:root>
+</xsl:template>
+
+<!-- LE DOCUMENT LUI-MEME -->
+<xsl:template match="FRAMESETS">
+ <fo:page-sequence master-name="page">
+ <xsl:if test="/DOC/ATTRIBUTES/@hasHeader='1'">
+ <xsl:apply-templates select="FRAMESET[@frameInfo=1]"/>
+ <xsl:apply-templates select="FRAMESET[@frameInfo=2]"/>
+ <xsl:apply-templates select="FRAMESET[@frameInfo=3]"/>
+ </xsl:if>
+
+ <xsl:if test="/DOC/ATTRIBUTES/@hasFooter='1'">
+ <xsl:apply-templates select="FRAMESET[@frameInfo=4]"/>
+ <xsl:apply-templates select="FRAMESET[@frameInfo=5]"/>
+ <xsl:apply-templates select="FRAMESET[@frameInfo=6]"/>
+ </xsl:if>
+
+ <xsl:apply-templates select="FRAMESET[@frameInfo=0]"/>
+ </fo:page-sequence>
+
+</xsl:template>
+
+<!-- CADRES POUR CHAQUE PARTIE D'UNE PAGE -->
+<xsl:template match="FRAMESET">
+
+ <xsl:if test="@frameInfo=0">
+ <fo:flow flow-name="xsl-region-body">
+ <xsl:apply-templates select="FRAME"/>
+ <xsl:call-template name="PARAS" select="PARAGRAPH">
+ <xsl:with-param name="i">1</xsl:with-param>
+ <xsl:with-param name="debutListInitial">0</xsl:with-param>
+ <xsl:with-param name="nbItemInitial">0</xsl:with-param>
+ </xsl:call-template>
+ </fo:flow>
+ </xsl:if>
+
+ <xsl:if test="@frameInfo=1">
+ <fo:static-content flow-name="xsl-region-bottom">
+ <xsl:apply-templates select="FRAME"/>
+ <xsl:apply-templates name="PARAGS" select="PARAS"/>
+ </fo:static-content>
+ </xsl:if>
+
+</xsl:template>
+
+<!-- CADRE -->
+<xsl:template match="FRAME">
+
+</xsl:template>
+
+<!-- LISTE DE PARAG. -->
+<xsl:template name="PARAS">
+ <xsl:param name="i">param_i</xsl:param>
+ <xsl:param name="nbItemInitial">param_nbItem</xsl:param>
+ <xsl:param name="debutListeInitial" select="param_debutListeInitial"/>
+
+ <xsl:message>parag. <xsl:value-of select="$i"/></xsl:message>
+
+ <!-- test si le paragraphe est une liste -->
+ <xsl:choose>
+ <xsl:when test="PARAGRAPH[position()=$i]/LAYOUT/COUNTER/@numberingtype=0">
+ <!-- si le parag. est une liste on groupe -->
+ <xsl:message>Une liste</xsl:message>
+ <xsl:variable name="nbItem" select="$nbItemInitial + 1"/>
+ <!-- Rappelle le template -->
+ <xsl:if test="($i + 1) &lt;=$nbTotalPara">
+ <xsl:message>parag. suivant </xsl:message>
+ <xsl:call-template name="PARAS">
+ <xsl:with-param name="debutListeInitial" select="$debutListeInitial"/>
+ <xsl:with-param name="i"><xsl:value-of select="$i + 1"/></xsl:with-param>
+ <xsl:with-param name="nbItemInitial" select="$nbItem"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <!-- si le parag. est normal, on le genere. -->
+ <xsl:otherwise>
+ <xsl:if test="$nbItemInitial &gt; 0">
+ <fo:list-block>
+ <xsl:variable name="startInit">
+ <xsl:choose>
+ <xsl:when test="PARAGRAPH[position()=($i - 1)]/LAYOUT/COUNTER/@start">
+ <xsl:copy-of select="PARAGRAPH[position()=$i]/LAYOUT/COUNTER/@start"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="PARAGRAPH[position()=($i - 1)]/LAYOUT/COUNTER/@type=1">
+ <xsl:copy-of select="1"/>
+ </xsl:if>
+ <xsl:if test="PARAGRAPH[position()=$i]/LAYOUT/COUNTER/@type=2">
+ <xsl:copy-of select="a"/>
+ </xsl:if>
+ <xsl:if test="PARAGRAPH[position()=$i]/LAYOUT/COUNTER/@type=3">
+ <xsl:copy-of select="A"/>
+ </xsl:if>
+ <xsl:if test="PARAGRAPH[position()=$i]/LAYOUT/COUNTER/@type=4">
+ <xsl:copy-of select="i"/>
+ </xsl:if>
+ <xsl:if test="PARAGRAPH[position()=$i]/LAYOUT/COUNTER/@type=5">
+ <xsl:copy-of select="I"/>
+ </xsl:if>
+ <xsl:if test="PARAGRAPH[position()=$i]/LAYOUT/COUNTER/@type=6">
+ <xsl:copy-of select="PARAGRAPH[position()=$i]/LAYOUT/COUNTER/@bullet"/>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="genListe">
+ <xsl:with-param name="debutListe" select="$debutListeInitial"/>
+ <xsl:with-param name="nbItem" select="$nbItemInitial"/>
+ <xsl:with-param name="i" select="$debutListeInitial"/>
+ <xsl:with-param name="start" select="$startInit"/>
+ </xsl:call-template>
+ </fo:list-block>
+ </xsl:if>
+ <xsl:variable name="nbItem">0</xsl:variable>
+ <!--<xsl:variable name="nextItem"></xsl:variable>-->
+ <xsl:message>Un parag.</xsl:message>
+ <xsl:apply-templates select="PARAGRAPH[position()=$i]"/>
+ <!-- Rappelle le template -->
+ <xsl:if test="($i + 1) &lt;=$nbTotalPara">
+ <xsl:message>parag. suivant </xsl:message>
+ <xsl:call-template name="PARAS">
+ <xsl:with-param name="debutListeInitial" select="$i + 1"/>
+ <xsl:with-param name="i"><xsl:value-of select="$i + 1"/></xsl:with-param>
+ <xsl:with-param name="nbItemInitial" select="$nbItem"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+
+</xsl:template>
+
+<xsl:template name="genListe">
+ <xsl:param name="nbItem">param_nbItem</xsl:param>
+ <xsl:param name="debutListe" select="param_debutListe"/>
+ <xsl:param name="i">param_i</xsl:param>
+ <xsl:param name="start">param_start</xsl:param>
+ <xsl:message>Generation de la liste</xsl:message>
+ <xsl:message> debut : <xsl:value-of select="$debutListe"/></xsl:message>
+ <xsl:message> courant : <xsl:value-of select="$i"/></xsl:message>
+ <xsl:message> nb : <xsl:value-of select="$nbItem"/></xsl:message>
+ <xsl:message> start : <xsl:value-of select="$start"/></xsl:message>
+ <xsl:call-template name="createItem">
+ <xsl:with-param name="i" select="$i"/>
+ <xsl:with-param name="start" select="$start"/>
+ </xsl:call-template>
+
+ <xsl:if test="($i + 1) &lt; ($debutListe + $nbItem)">
+ <xsl:variable name="nextStart">
+ <xsl:choose>
+ <xsl:when test="PARAGRAPH[position()=$i]/LAYOUT/COUNTER/@type &gt; 5">
+ <xsl:copy-of select="$start"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:copy-of select="$start + 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="genListe">
+ <xsl:with-param name="debutListe" select="$debutListe"/>
+ <xsl:with-param name="nbItem" select="$nbItem"/>
+ <xsl:with-param name="i" select="$i + 1"/>
+ <xsl:with-param name="start" select="$nextStart"/>
+ </xsl:call-template>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template name="createItem">
+ <xsl:param name="i">param_i</xsl:param>
+ <xsl:param name="start">param_start</xsl:param>
+ <fo:list-item>
+ <fo:list-item-label>
+ <fo:block>
+ <xsl:value-of select="PARAGRAPH[position()=$i]/LAYOUT/COUNTER/@lefttext"/>
+ <xsl:value-of select="$start"/>
+ <xsl:value-of select="PARAGRAPH[position()=$i]/LAYOUT/COUNTER/@righttext"/>
+ </fo:block>
+ </fo:list-item-label>
+ <fo:list-item-body>
+ <xsl:apply-templates select="PARAGRAPH[position()=$i]"/>
+ </fo:list-item-body>
+ </fo:list-item>
+</xsl:template>
+
+<!-- PARAGRAPH -->
+<xsl:template match="PARAGRAPH" name="PARAGRAPH">
+ <xsl:text>
+ </xsl:text>
+ <fo:block>
+ <!-- Formats the paragraph -->
+ <xsl:apply-templates select="LAYOUT"/>
+
+ <xsl:variable name="text"><xsl:value-of select="TEXT"/></xsl:variable>
+ <!-- Formats each part of the paragraph -->
+ <xsl:choose>
+ <xsl:when test="FORMATS">
+ <xsl:for-each select="FORMATS">
+ <xsl:call-template name="FORMATS">
+ <xsl:with-param name="text"><xsl:value-of select="$text"/></xsl:with-param>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$text"/>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ </fo:block>
+ <xsl:text>
+ </xsl:text>
+</xsl:template>
+
+<!-- FORMATS -->
+<xsl:template name="FORMATS">
+ <xsl:param name="text"/>
+
+ <xsl:variable name="pos"><xsl:value-of select="FORMAT/@pos"/></xsl:variable>
+ <!-- Add the text before the first format. -->
+ <xsl:if test="$pos != 0">
+ <xsl:value-of select="substring($text, 0, $pos + 1)"/>
+ </xsl:if>
+
+ <xsl:for-each select="FORMAT">
+ <xsl:variable name="pos"><xsl:value-of select="@pos"/></xsl:variable>
+ <xsl:variable name="len"><xsl:value-of select="@len"/></xsl:variable>
+ <!-- Add the text in a format. -->
+ <fo:inline>
+ <xsl:apply-templates select="."/>
+ <xsl:value-of select="substring($text, $pos + 1, $len)"/>
+ </fo:inline>
+ <xsl:variable name="next_pos"><xsl:value-of select="following::FORMAT/@pos"/></xsl:variable>
+ <!-- Add the text when a following format exists. -->
+ <xsl:if test="$next_pos > ($pos + $len)">
+ <xsl:value-of select="substring($text, $pos + $len + 1, $next_pos - $pos - $len)"/>
+ </xsl:if>
+ <!-- Add the text when there are no more formats. -->
+ <xsl:if test="$next_pos=0">
+ <xsl:value-of select="substring($text, $pos + $len + 1)"/>
+ </xsl:if>
+ </xsl:for-each>
+</xsl:template>
+
+<!-- FORMAT -->
+<xsl:template match="FORMAT" name="FORMAT">
+ <xsl:choose>
+ <xsl:when test="@id=1">
+ <xsl:call-template name="TEXT-FORMAT"/>
+ </xsl:when>
+ </xsl:choose>
+</xsl:template>
+
+<!-- TEXT-FORMAT -->
+<xsl:template name="TEXT-FORMAT">
+ <xsl:choose>
+ <xsl:when test="VERTALIGN/@value=1">
+ <xsl:attribute name="vertical-align">sub</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="VERTALIGN/@value=2">
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="FONT">
+ <xsl:attribute name="font-family"><xsl:value-of select="FONT/@name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="UNDERLINE/@value=1">
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="STRIKEOUT/@value=1">
+ <xsl:attribute name="text-decoration">line-through</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="CHARSET">
+ <!--<xsl:attribute name="charset"><xsl:value-of select="CHARSET/@value"/></xsl:attribute>-->
+ </xsl:if>
+ <xsl:if test="ITALIC/@value=1">
+ <xsl:attribute name="font-style">italic</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="WEIGHT/@value=75">
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="SIZE">
+ <xsl:attribute name="font-size"><xsl:value-of select="SIZE/@value"/>pt</xsl:attribute>
+ </xsl:if>
+</xsl:template>
+
+<!-- OTHER-FORMAT -->
+
+<!-- LAYOUT -->
+<xsl:template match="LAYOUT">
+ <xsl:if test="NAME">
+ <!-- MUST USE THE STYLE WHICH THIS NAME -->
+ <!-- TODO -->
+ <xsl:variable name="name"><xsl:value-of select="@value"/></xsl:variable>
+ <xsl:call-template name="FORMAT" select="/DOC/STYLES//STYLE/NAME[@value=$name]"/>
+ </xsl:if>
+
+ <xsl:if test="FLOW">
+ <xsl:attribute name="text-align">
+ <xsl:value-of select="FLOW/@align"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="COUNTER">
+
+ </xsl:if>
+ <xsl:if test="INDENTS/@first">
+ <xsl:attribute name="text-indent">
+ <xsl:value-of select="/@first"/>
+ </xsl:attribute>
+ </xsl:if>
+
+ <xsl:if test="FORMAT">
+ <xsl:apply-templates select="FORMAT"/>
+ </xsl:if>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/filters/xsltfilter/status.html b/filters/xsltfilter/status.html
new file mode 100644
index 000000000..0f7ad37f1
--- /dev/null
+++ b/filters/xsltfilter/status.html
@@ -0,0 +1,213 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <title>KOffice filters status: XSLT FILTER</title>
+</head>
+<body text="#000000" bgcolor="#FFFFFF" link="#000099" vlink="#666666" alink="#666666">
+<A NAME="START">&nbsp;</A>
+
+<BR>
+<center>
+ <h1>
+ KOffice filters status: &nbsp;&nbsp;<i>XSLT FILTER</i>
+ </h1>
+
+<hr NOSHADE SIZE="2" width="70%">
+
+</center>
+<!--<font size="-1"><b>
+ <A HREF="#import">Import</A> |
+ <A HREF="#export">Export</A>
+</b></font>-->
+
+<BR><BR><BR>
+<center><a NAME="import"></a></center>
+
+<!--<A HREF="#START"><font size="-1"><b>Up</b></font></A>-->
+<center>
+<table border="0" cellspacing="0" bgcolor="#000000" width="100%">
+ <tr>
+ <td>
+ <table border="0" cellpadding="2" bgcolor="#FFFFFF" width="100%">
+
+ <tr bgcolor="#DDFFDD">
+ <td COLSPAN="2">
+ <center><b><i><font size="+1">
+ <BR>
+ Export / Import with XSLT for KOffice applications<BR>
+ <BR>
+ </font></i></b></center>
+ </td>
+ </tr>
+
+ <tr bgcolor="#EEEEFF">
+ <td valign="top" width="1%" NOWRAP><b><font size="+1">Last update</font></b></td>
+ <td>01 March 2002</td>
+ </tr>
+
+ <tr bgcolor="#CCCCFF">
+ <td valign="top"><b><font size="+1">Features</font></b></td>
+ <td>
+ <ul>
+ <li>Using a personnal xslt;</li>
+ <li>List of recent xslt used;</li>
+ <li>List of common xslt;</li>
+ <li>Write a xslt for tests.<li/>
+ </ul>
+ </td>
+ </tr>
+
+ <tr bgcolor="#EEEEFF">
+ <td valign="top"><b><font size="+1">Todo</font></b></td>
+ <td>
+ <ul>
+ <li>Options (timing, ...);<li/>
+ <li>Parameters support;</li>
+ <li>Picture support</li>
+ </ul>
+ </td>
+ </tr>
+
+ <tr bgcolor="#CCCCFF">
+ <td valign="top"><b><font size="+1">History</font></b></td>
+ <td>
+ <ul>
+ <li>01 March 2002
+ <ul>
+ <li>Support of xslt access (recent xslt used, common xslt, personal xslt).</li>
+ </ul>
+ </li>
+ <li>02 February 2002
+ <ul>
+ <li>Add configuration window</li>
+ </ul>
+ </li>
+
+ <li>27 January 2002
+ <ul>
+ <li>Creation</li>
+ </ul>
+ </li>
+ </ul>
+ </td>
+ </tr>
+
+ <tr bgcolor="#EEEEFF">
+ <td valign="top"><b><font size="+1">Authors&nbsp;</font></b></td>
+ <td><a href="mailto:rjacolin@ifrance.com">Robert Jacolin</a></td>
+ </tr>
+
+ <tr bgcolor="#CCCCFF">
+ <td valign="top"><b><font size="+1">Links</font></b></td>
+ <td><a href="http://elbobby.free.fr/xslt/index.html">Informations sur xsl</a><br>
+ <a href="http://elbobby.free.fr/xslt/index-en.html">Information about xsl</a></td>
+ </tr>
+
+ <tr bgcolor="#EEEEFF">
+ <td valign="top"><b><font size="+1">Progress report </font></b></td>
+ <td>---</td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+</center>
+<A HREF="#START"><font size="-1"><b>Up</b></font></A>
+
+<br><br><br>
+
+<!--
+<hr NOSHADE SIZE=1>
+<br><br><br>
+
+
+<center>
+ <a NAME="export"></a>
+</center>
+<A HREF="#START"><font size="-1"><b>Up</b></font></A>
+<center>
+<table border="0" CELLSPACING="0" bgcolor="#000000" width="100%">
+ <tr>
+ <td>
+ <table border="0" CELLPADDING="2" bgcolor="#FFFFFF" width="100%">
+ <tr bgcolor="#FFDDDD">
+ <td COLSPAN="2">
+ <center><b><i><font size="+1">
+ <BR>Export for KOffice applications with XSLT <BR><BR>
+ </font></i></b></center>
+ </td>
+ </tr>
+
+ <tr bgcolor="#EEEEFF">
+ <td valign="top" width="1%" NOWRAP><b><font size="+1">Last update</font></b></td>
+ <td>02 February 2002</td>
+ </tr>
+
+ <tr bgcolor="#CCCCFF">
+ <td valign="top"><b><font size="+1">Features</font></b></td>
+ <td>Can use a personnal xslt</td>
+ </tr>
+
+ <tr bgcolor="#EEEEFF">
+ <td valign="top"><b><font size="+1">Todo</font></b></td>
+ <td>
+ <ul>
+ <li>Options;<li/>
+ <li>Recent xslt</li>
+ <li>can use common xslt</li>
+ <li>Write a xslt for tests.<li/>
+ <li>Picture support</li>
+ </ul>
+ </td>
+ </tr>
+
+ <tr bgcolor="#CCCCFF">
+ <td valign="top"><b><font size="+1">History</font></b></td>
+
+ <td>
+ <ul>
+ <li>02 February 2002
+ <ul>
+ <li>Add configuration window</li>
+ </ul>
+ </li>
+ <li>28 January 2002
+ <ul>
+ <li>creation</li>
+ </ul>
+ </li>
+ </ul>
+ </td>
+ </tr>
+
+ <tr bgcolor="#EEEEFF">
+ <td valign="top"><b><font size="+1">Authors</font></b></td>
+ <td><a href="mailto:rjacolin@ifrance.com">Robert JACOLIN</a></td>
+ </tr>
+
+ <tr bgcolor="#CCCCFF">
+ <td valign="top"><b><font size="+1">Links</font></b></td>
+ <td><a href="http://elbobby.free.fr/index.html">Rien pour l'instant</a><br>
+ <a href="http://elbobby.free.fr/index-en.html">Nothing right now</a>
+ </td>
+ </tr>
+
+ <tr bgcolor="#EEEEFF">
+ <td valign="top"><b><font size="+1">Progress report </font></b></td>
+ <td>-</td>
+ </tr>
+
+
+
+ </table>
+ </td>
+ </tr>
+</table>
+</center>
+<A HREF="#START"><font size="-1"><b>Up</b></font></A>
+
+-->
+
+</body>
+</html>