Re: [Libreoffice] [PATCH] De-Java-ise flat XML export

2011-01-10 Thread Peter Jentsch
Hi Jan, Hi Gioele, 

I'm sending two more patches which aim to replace the xslt based flat
xml filter implementation by a different one directly interfacing with
the xml filter framework. It's actually simply copied from the ODK
example and only slightly modified. It currently still lacks support for
advanced pretty printing (like with split-long-lines.xsl), I will try to
add that next. 

Git still makes me feel awkward %]

I hope I got the formatting better than last time, but you're kindly
invited to nitpick where necessary.

Thanks for reviewing this. 

Peter
From dfae32c3c39896a21f266f37e261b6528687f93d Mon Sep 17 00:00:00 2001
From: Peter Jentsch pj...@guineapics.de
Date: Mon, 10 Jan 2011 21:34:09 +0100
Subject: [PATCH 2/2] Add alternative implementation of flat xml filter w/o xslt.

This filter implementation is directly based on
XmlFilterAdaptor and simply dumps the SAX events
provided by the XmlFilterAdaptor to an outputstream.
It currently still lacks the advanced pretty printing
available through split-long-lines.xsl in the xslt based
flat xml filter.
---
 scp2/source/ooo/file_library_ooo.scp  |1 +
 scp2/source/ooo/module_hidden_ooo.scp |1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/scp2/source/ooo/file_library_ooo.scp b/scp2/source/ooo/file_library_ooo.scp
index bf47c61..e30422e 100644
--- a/scp2/source/ooo/file_library_ooo.scp
+++ b/scp2/source/ooo/file_library_ooo.scp
@@ -1578,6 +1578,7 @@ STD_UNO_LIB_FILE( gid_File_Lib_Xsltdlg, xsltdlg )
 STD_UNO_LIB_FILE( gid_File_Lib_Xsltfilter, xsltfilter )
 STD_UNO_LIB_FILE( gid_File_Lib_Xmlfa, xmlfa )
 STD_UNO_LIB_FILE( gid_File_Lib_Xmlfd, xmlfd )
+STD_UNO_LIB_FILE( gid_File_Lib_Odfflatxml, odfflatxml )
 
 #ifdef SOLAR_JAVA
 UNO_JAR_FILE( gid_File_Jar_Xsltfilter, XSLTFilter )
diff --git a/scp2/source/ooo/module_hidden_ooo.scp b/scp2/source/ooo/module_hidden_ooo.scp
index d5214eb..b73a5b5 100644
--- a/scp2/source/ooo/module_hidden_ooo.scp
+++ b/scp2/source/ooo/module_hidden_ooo.scp
@@ -277,6 +277,7 @@ Module gid_Module_Root_Files_4
 	gid_File_Lib_Xof,
 	gid_File_Lib_Xsltdlg,
 	gid_File_Lib_Xsltfilter,
+	gid_File_Lib_Odfflatxml,
 	gid_File_Lib_Zip,
 	gid_File_Lib_Vclplug_Gen,
 	gid_File_Lib_Vclplug_Gtk,
-- 
1.7.1

From 9e6107712690957fa6366742c4b465fbcedba2a9 Mon Sep 17 00:00:00 2001
From: Peter Jentsch pj...@guineapics.de
Date: Mon, 10 Jan 2011 21:30:04 +0100
Subject: [PATCH 5/5] Add alternative implementation of flat xml filter w/o xslt.

This filter implementation is directly based on
XmlFilterAdaptor and simply dumps the SAX events
provided by the XmlFilterAdaptor to an outputstream.
It currently still lacks the advanced pretty printing
available through split-long-lines.xsl in the xslt based
flat xml filter.
---
 filter/prj/build.lst   |1 +
 .../config/fragments/filters/ODG_FlatXML.xcu   |2 +-
 .../config/fragments/filters/ODP_FlatXML.xcu   |2 +-
 .../config/fragments/filters/ODS_FlatXML.xcu   |2 +-
 .../config/fragments/filters/ODT_FlatXML.xcu   |2 +-
 filter/source/odfflatxml/FlatXml.cxx   |  365 
 filter/source/odfflatxml/FlatXml.hxx   |  144 
 filter/source/odfflatxml/makefile.mk   |   56 +++
 8 files changed, 570 insertions(+), 4 deletions(-)
 create mode 100644 filter/source/odfflatxml/FlatXml.cxx
 create mode 100644 filter/source/odfflatxml/FlatXml.hxx
 create mode 100644 filter/source/odfflatxml/makefile.mk

diff --git a/filter/prj/build.lst b/filter/prj/build.lst
index bed99e4..502ecff 100644
--- a/filter/prj/build.lst
+++ b/filter/prj/build.lst
@@ -11,6 +11,7 @@ fl	filter\source\svg		nmake	-	all	fl_svgfl_inc NULL
 fl	filter\source\placeware	nmake	-	all	fl_placeware		fl_inc NULL
 fl	filter\source\flash		nmake	-	all	fl_flash fl_pdf			fl_inc NULL
 fl	filter\source\filtertracernmake	-	all fl_filtertracer		fl_inc NULL
+fl  filter\source\odfflatxmlnmake   -   all fl_odfflatxml   fl_inc NULL
 fl	filter\source\xsltfilternmake	-	all fl_xsltfilter		fl_inc NULL
 fl	filter\source\xsltvalidatenmake	-	all fl_xsltvalidate fl_xsltfilter	fl_inc NULL
 fl	filter\source\xsltdialognmake	-	all fl_xsltdialog fl_flash		fl_inc NULL
diff --git a/filter/source/config/fragments/filters/ODG_FlatXML.xcu b/filter/source/config/fragments/filters/ODG_FlatXML.xcu
index 2a5a4a0..f528248 100644
--- a/filter/source/config/fragments/filters/ODG_FlatXML.xcu
+++ b/filter/source/config/fragments/filters/ODG_FlatXML.xcu
@@ -3,7 +3,7 @@
 prop oor:name=Typevaluedraw_ODG_FlatXML/value/prop
 prop oor:name=DocumentServicevaluecom.sun.star.drawing.DrawingDocument/value/prop
 prop oor:name=UIComponent/
-prop oor:name=UserDatavalue 

Re: [Libreoffice] [PATCH] De-Java-ise flat XML export

2011-01-08 Thread Peter Jentsch
Hi Jan, Hi Gioele, 

here's another patch: split-long-lines.xsl seems to be missing from the
list of files in file_xsltfilter.scp. The attached patch should fix
that. 

Bye, 
Peter

From 7657c25214ea4f0f73713b9cc007690c626480fa Mon Sep 17 00:00:00 2001
From: Peter Jentsch pj...@guineapics.de
Date: Fri, 7 Jan 2011 22:00:15 +0100
Subject: [PATCH] Added missing split-long-lines.xsl to installation list for xsltfilter.scp

---
 scp2/source/xsltfilter/file_xsltfilter.scp |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/scp2/source/xsltfilter/file_xsltfilter.scp b/scp2/source/xsltfilter/file_xsltfilter.scp
index d40a515..9cabd88 100644
--- a/scp2/source/xsltfilter/file_xsltfilter.scp
+++ b/scp2/source/xsltfilter/file_xsltfilter.scp
@@ -91,9 +91,17 @@ File gid_File_Xsl_Export_Odfflatxml
 Name = /xslt/odfflatxml/odfflatxmlexport.xsl;
 End
 
+File gid_File_Xsl_Export_Odfflatxml_Split_Long_Lines
+TXT_FILE_BODY;
+Styles = (PACKED, PATCH);
+Dir = gid_Dir_Share_Xslt_Odfflatxml;
+Name = /xslt/odfflatxml/split-long-lines.xsl;
+End
+
 File gid_File_Xsl_Import_Odfflatxml
 TXT_FILE_BODY;
 Styles = (PACKED, PATCH);
 Dir = gid_Dir_Share_Xslt_Odfflatxml;
 Name = /xslt/odfflatxml/odfflatxmlimport.xsl;
 End
+
-- 
1.7.1

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] [PATCH] De-Java-ise flat XML export

2011-01-08 Thread Peter Jentsch
Hi Jan, Hi Gioele, 

here's another patch: split-long-lines.xsl seems to be missing from the
list of files in file_xsltfilter.scp. The attached patch should fix
that. 

Bye, 
Peter
From 7657c25214ea4f0f73713b9cc007690c626480fa Mon Sep 17 00:00:00 2001
From: Peter Jentsch pj...@guineapics.de
Date: Fri, 7 Jan 2011 22:00:15 +0100
Subject: [PATCH] Added missing split-long-lines.xsl to installation list for xsltfilter.scp

---
 scp2/source/xsltfilter/file_xsltfilter.scp |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/scp2/source/xsltfilter/file_xsltfilter.scp b/scp2/source/xsltfilter/file_xsltfilter.scp
index d40a515..9cabd88 100644
--- a/scp2/source/xsltfilter/file_xsltfilter.scp
+++ b/scp2/source/xsltfilter/file_xsltfilter.scp
@@ -91,9 +91,17 @@ File gid_File_Xsl_Export_Odfflatxml
 Name = /xslt/odfflatxml/odfflatxmlexport.xsl;
 End
 
+File gid_File_Xsl_Export_Odfflatxml_Split_Long_Lines
+TXT_FILE_BODY;
+Styles = (PACKED, PATCH);
+Dir = gid_Dir_Share_Xslt_Odfflatxml;
+Name = /xslt/odfflatxml/split-long-lines.xsl;
+End
+
 File gid_File_Xsl_Import_Odfflatxml
 TXT_FILE_BODY;
 Styles = (PACKED, PATCH);
 Dir = gid_Dir_Share_Xslt_Odfflatxml;
 Name = /xslt/odfflatxml/odfflatxmlimport.xsl;
 End
+
-- 
1.7.1

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] [PATCH] De-Java-ise flat XML export

2011-01-05 Thread Jan Holesovsky
Hi Peter,

Jan Holesovsky píše v Út 04. 01. 2011 v 11:13 +0100:

  I'm attaching a patch I somehow managed to patiently pull out of git :-)
  
  As I'm new to C++, libxslt, git and a few other things involved in
  creating the patch I feel it must be full of warts and cause random
  crashes, but it seems to work and might be useful anyway.
 
 Thanks a lot - looks great on the first sight :-)  Let me look a bit
 better (unless somebody else volunteers to do a deeper review?) now.
 
 Before pushing it to the master branch, I'd like to ask you for 2
 things:
 
 License: Please, do you agree to license under the MPL / LGPL / GPL
 combo, as recommended in
 http://cgit.freedesktop.org/libreoffice/build/tree/COPYING.NEWFILES
 
 Purpose documentation: Can you please add a brief description of the new
 classes in the header?  Just something like:

I looked mainly at the parts that are about defaulting to your
implementation, or the Java xslt filter, and it looks good to me, so I'd
push it as soon as you let us know regarding the license :-)

One more nitpick that I spotted is that you use { and } differently to
the rest of the code base (we use opening { on a new line, and skip
{ and } if an if/for/while has only one command), would be great if you
can change it too; but of course that is not a blocker for pushing your
changes ;-)

Also, is there a special reason for ListenerList l = m_listeners; on few
occasions?  Didn't you want to use a reference?

Thank you a lot,
Kendy

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] [PATCH] De-Java-ise flat XML export

2011-01-03 Thread Peter Jentsch
Hi Jan, 

I'm attaching a patch I somehow managed to patiently pull out of git :-)

As I'm new to C++, libxslt, git and a few other things involved in
creating the patch I feel it must be full of warts and cause random
crashes, but it seems to work and might be useful anyway.

Basically, the patch provides an alternative service implementation
to be used by XSLTFilter.cxx. Use of the libxslt implementation can be
triggered by adding libxslt as second parameter to the UserData
configuration of an xslt filter. This second parameter is currently
unused for xslt filters. 

To completely remove the java dependency for xslt filters, the
xsltvalidation service would also need to be replaced by an
implementation based on libxslt. 

Also, the Office 2003 XML export filters use a saxon extension
implemented in Java, which needs to be replaced by a libxslt extension
if Office 2003 XML export should be supported without Java, too. 

The flat xml export could be implemented as a pure C++ xml Filter
indendendently of the xslt filter, as proposed in the SDK examples, I
suppose, and I'd like to do that next. 

I personally like the idea to make the implementation to use
configurable, instead of completely removing the Java based xslt filter
implementation. 

Cheers, 

Peter



 
Am Donnerstag, den 30.12.2010, 02:07 +0100 schrieb Jan Holesovsky:
 Hi Peter,
 
 On 2010-12-29 at 14:29 +0100, Peter Jentsch wrote:
 
  I've gotten so far as to have a working implementation of XSLTFilter
  which uses libxml2/libxslt to do the XSL transformation. It's still
  missing some details like passing parameters to the xslt script, but it
  works for the flat xml export and for xhtml export as well. Using this
  implementation would remove the java dependency from xslt filter
  processing,
 
 Wow, cool! :-)  Can you please post the patch here, so that we can have
 a look?  This sounds great.
 
 Regards,
 Kendy
 
 ___
 LibreOffice mailing list
 LibreOffice@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/libreoffice
 


From f3e5ff4c1ec9ecc01f92263f6fbe9a3f35dcfb16 Mon Sep 17 00:00:00 2001
From: Peter Jentsch pj...@guineapics.de
Date: Sun, 2 Jan 2011 14:02:18 +0100
Subject: [PATCH 1/2] Added support for libxslt in xsltfilter

libxslt will be used to perform xsl transformations if either Java is
not available/configured at compile time or the 2nd, currently unused
UserData parameter of the xslt filter is libxslt (w/o the quotes)
---
 filter/source/xsltfilter/LibXSLTTransformer.cxx |  282 +++
 filter/source/xsltfilter/LibXSLTTransformer.hxx |  145 
 filter/source/xsltfilter/XSLTFilter.cxx |  129 +++
 filter/source/xsltfilter/makefile.mk|   16 ++-
 4 files changed, 526 insertions(+), 46 deletions(-)
 create mode 100644 filter/source/xsltfilter/LibXSLTTransformer.cxx
 create mode 100644 filter/source/xsltfilter/LibXSLTTransformer.hxx

diff --git a/filter/source/xsltfilter/LibXSLTTransformer.cxx b/filter/source/xsltfilter/LibXSLTTransformer.cxx
new file mode 100644
index 000..da51908
--- /dev/null
+++ b/filter/source/xsltfilter/LibXSLTTransformer.cxx
@@ -0,0 +1,282 @@
+ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+ // MARKER(update_precomp.py): autogen include statement, do not remove
+ #include precompiled_filter.hxx
+
+ #include stdio.h
+ #include list
+ #include map
+ #include iostream
+ #include libxml/parser.h
+ #include libxml/tree.h
+ #include libxml/xmlIO.h
+ #include libxslt/transform.h
+ #include libxslt/xsltutils.h
+ #include libxslt/variables.h
+
+ #include cppuhelper/factory.hxx
+ #include cppuhelper/servicefactory.hxx
+ #include cppuhelper/implbase4.hxx
+ #include cppuhelper/implbase.hxx
+ #include osl/module.h
+ #include osl/file.hxx
+ #include osl/process.h
+ #include com/sun/star/lang/XComponent.hpp
+ #include com/sun/star/lang/XInitialization.hpp
+ #include com/sun/star/uno/Any.hxx
+ #include com/sun/star/beans/NamedValue.hpp
+ #include com/sun/star/io/XInputStream.hpp
+ #include com/sun/star/io/XOutputStream.hpp
+ #include com/sun/star/io/XActiveDataSource.hpp
+ #include com/sun/star/io/XActiveDataSink.hpp
+ #include com/sun/star/io/XActiveDataControl.hpp
+ #include com/sun/star/io/XStreamListener.hpp
+
+ #include LibXSLTTransformer.hxx
+
+ using namespace ::rtl;
+ using namespace ::cppu;
+ using namespace ::osl;
+ using namespace ::com::sun::star::beans;
+ using namespace ::com::sun::star::io;
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::registry;
+ using ::std::list;
+ using ::std::map;
+ using ::std::pair;
+
+ namespace XSLT {
+ const char* const LibXSLTTransformer::PARAM_SOURCE_URL = sourceURL;
+ const char* const LibXSLTTransformer::PARAM_SOURCE_BASE_URL = sourceBaseURL;
+ const char* const LibXSLTTransformer::PARAM_TARGET_URL = targetURL;
+ const char* const