--- filter/source/config/fragments/fcfg_writer.mk	13 Jul 2006 09:12:35 -0000	1.9
+++ filter/source/config/fragments/fcfg_writer.mk	18 Dec 2006 13:22:05 -0000	1.9.90.1
@@ -46,6 +46,7 @@ T4_WRITER = \
     writer_StarOffice_XML_Writer \
     $(T4_WRITER_BINFILTER) \
     writer_WordPerfect_Document \
+    writer_MS_Works_Document \
     writer_Text \
     writer_Text_encoded \
     writer_JustSystem_Ichitaro_10 \
@@ -79,6 +80,7 @@ F4_WRITER = \
 	StarOffice_XML__Writer_ \
 	$(F4_WRITER_BINFILTER) \
 	WordPerfect \
+	MS_Works \
 	Text \
 	Text__encoded_ \
 	writer_JustSystem_Ichitaro_10 \
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ filter/source/config/fragments/filters/MS_Works.xcu	30 Jan 2007 14:12:47 -0000	1.1.2.2
@@ -0,0 +1,13 @@
+	<node oor:name="MS_Works" oor:op="replace">
+		<prop oor:name="Flags"><value>IMPORT ALIEN USESOPTIONS 3RDPARTYFILTER</value></prop>
+		<prop oor:name="UIComponent"/>
+		<prop oor:name="FilterService"><value>com.sun.star.comp.Writer.MSWorksImportFilter</value></prop>
+		<prop oor:name="UserData"><value>WPS</value></prop>
+		<prop oor:name="UIName">
+			<value xml:lang="x-default">Microsoft Works Document</value>
+		</prop>
+		<prop oor:name="FileFormatVersion"><value>0</value></prop>
+		<prop oor:name="Type"><value>writer_MS_Works_Document</value></prop>
+		<prop oor:name="TemplateName"/>
+		<prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+	</node>
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ filter/source/config/fragments/types/writer_MS_Works_Document.xcu	18 Dec 2006 13:22:06 -0000	1.1.2.1
@@ -0,0 +1,12 @@
+	<node oor:name="writer_MS_Works_Document" oor:op="replace" >
+		<prop oor:name="DetectService"><value>com.sun.star.comp.Writer.MSWorksImportFilter</value></prop>
+		<prop oor:name="URLPattern"/>
+		<prop oor:name="Extensions"><value>wps</value></prop>
+		<prop oor:name="MediaType"/>
+		<prop oor:name="Preferred"><value>true</value></prop>
+		<prop oor:name="PreferredFilter"><value>MS_Works</value></prop>
+		<prop oor:name="UIName">
+			<value>Microsoft Works Document</value>
+		</prop>
+		<prop oor:name="ClipboardFormat"/>
+	</node>
--- config_office/configure.in	25 Apr 2007 15:53:53 -0000	1.201
+++ config_office/configure.in	7 May 2007 09:28:02 -0000	1.189.2.5
@@ -296,6 +296,9 @@ AC_ARG_WITH(system-freetype,
 AC_ARG_WITH(system-libwpd,
 [  --with-system-libwpd    Use libwpd already on system
 ],,)
+AC_ARG_WITH(system-libwps,
+[  --with-system-libwps    Use libwps already on system
+],,)
 AC_ARG_WITH(system-libxml,
 [  --with-system-libxml    Use libxml already on system
 ],,)
@@ -3000,6 +3003,24 @@ AC_SUBST(LIBWPD_CFLAGS)
 AC_SUBST(LIBWPD_LIBS)
 
 dnl ===================================================================
+dnl Check for system libwps
+dnl ===================================================================
+AC_MSG_CHECKING([which libwps to use])
+if test -n "$with_system_libwps" -o -n "$with_system_libs" && \
+        test "$with_system_libwps" != "no"; then
+    AC_MSG_RESULT([external])
+    SYSTEM_LIBWPS=YES
+    PKG_CHECK_MODULES( LIBWPS, libwps-0.1 )
+else
+    AC_MSG_RESULT([internal])
+    SYSTEM_LIBWPS=NO
+    BUILD_TYPE="$BUILD_TYPE LIBWPS"
+fi
+AC_SUBST(SYSTEM_LIBWPS)
+AC_SUBST(LIBWPS_CFLAGS)
+AC_SUBST(LIBWPS_LIBS)
+
+dnl ===================================================================
 dnl Check whether freetype2 supports emboldening
 dnl ===================================================================
 if test "$SYSTEM_FREETYPE" = "YES" ; then
--- config_office/set_soenv.in	25 Apr 2007 15:54:09 -0000	1.141
+++ config_office/set_soenv.in	7 May 2007 09:28:12 -0000	1.127.2.5
@@ -1817,6 +1817,9 @@ ToFile( "CAIRO_LIBS",        "@CAIRO_LIB
 ToFile( "SYSTEM_LIBWPD",     "@SYSTEM_LIBWPD@",    "e" );
 ToFile( "LIBWPD_CFLAGS",     "@LIBWPD_CFLAGS@",    "e" );
 ToFile( "LIBWPD_LIBS",       "@LIBWPD_LIBS@",      "e" );
+ToFile( "SYSTEM_LIBWPS",     "@SYSTEM_LIBWPS@",    "e" );
+ToFile( "LIBWPS_CFLAGS",     "@LIBWPS_CFLAGS@",    "e" );
+ToFile( "LIBWPS_LIBS",       "@LIBWPS_LIBS@",      "e" );
 ToFile( "SYSTEM_LIBXML",     "@SYSTEM_LIBXML@",    "e" );
 ToFile( "USE_FT_EMBOLDEN",   "@USE_FT_EMBOLDEN@",  "e" );
 ToFile( "LIBXML_CFLAGS",     "@LIBXML_CFLAGS@",    "e" );
cvs diff: Diffing config_office/guw
cvs diff: Diffing writerperfect
cvs diff: Diffing writerperfect/prj
--- writerperfect/prj/build.lst	23 Jan 2007 12:11:31 -0000	1.9
+++ writerperfect/prj/build.lst	18 Dec 2006 13:12:18 -0000	1.8.12.2
@@ -1,6 +1,7 @@
-wp      writerperfect : LIBWPD:libwpd sot comphelper xmloff so3 NULL
+wp      writerperfect : LIBWPS:libwps LIBWPD:libwpd sot comphelper xmloff so3 NULL
 wp	writerperfect			usr1	-	all	wp_mkout NULL
 wp	writerperfect\source\stream	nmake	-	all	wp_stream NULL
 wp	writerperfect\source\filter	nmake	-	all	wp_filter NULL
 wp	writerperfect\source\wpdimp	nmake	-	all	wp_wpdimp NULL
-wp	writerperfect\util		nmake	-	all	wp_util wp_wpdimp wp_filter wp_stream NULL
+wp	writerperfect\source\wpsimp	nmake	-	all	wp_wpsimp NULL
+wp	writerperfect\util		nmake	-	all	wp_util wp_wpsimp wp_wpdimp wp_filter wp_stream NULL
--- writerperfect/prj/d.lst	12 Dec 2006 16:20:26 -0000	1.4
+++ writerperfect/prj/d.lst	4 Jan 2007 08:31:00 -0000	1.4.2.1
@@ -1,3 +1,3 @@
-..\%__SRC%\lib\libwpft*.so %_DEST%\lib%_EXT%
-..\%__SRC%\bin\wpft*.dll %_DEST%\lib%_EXT%
+..\%__SRC%\lib\lib*.so %_DEST%\lib%_EXT%
+..\%__SRC%\bin\*.dll %_DEST%\lib%_EXT%
 ..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib
--- writerperfect/source/filter/DocumentCollector.cxx	23 Jan 2007 12:11:39 -0000	1.2
+++ writerperfect/source/filter/DocumentCollector.cxx	19 Dec 2006 10:21:54 -0000	1.1.4.3
@@ -52,7 +52,7 @@ _WriterDocumentState::_WriterDocumentSta
 {
 }
 
-DocumentCollector::DocumentCollector(WPXInputStream *pInput, DocumentHandler *pHandler) :
+DocumentCollector::DocumentCollector(WPSInputStream *pInput, DocumentHandler *pHandler) :
         mpInput(pInput),
         mpHandler(pHandler),
 	mbUsed(false),
--- writerperfect/source/filter/DocumentCollector.hxx	23 Jan 2007 12:11:48 -0000	1.2
+++ writerperfect/source/filter/DocumentCollector.hxx	19 Dec 2006 10:21:54 -0000	1.1.4.3
@@ -32,6 +32,7 @@
 #define _DOCUMENTCOLLECTOR_HXX
 #include "SectionStyle.hxx"
 
+#include <libwps/libwps.h>
 #include <libwpd/libwpd.h>
 #include <vector>
 #include <map>
@@ -75,7 +76,7 @@ struct ltstr
 class DocumentCollector : public WPXHLListenerImpl
 {
 public:
-	DocumentCollector(WPXInputStream *pInput, DocumentHandler *pHandler);
+	DocumentCollector(WPSInputStream *pInput, DocumentHandler *pHandler);
 	virtual ~DocumentCollector();
 	bool filter();
 
@@ -126,7 +127,7 @@ public:
 	virtual void closeTableCell();
 	virtual void insertCoveredTableCell(const WPXPropertyList &propList);
  	virtual void closeTable();
-	virtual bool parseSourceDocument(WPXInputStream &input) = 0;
+	virtual bool parseSourceDocument(WPSInputStream &input) = 0;
 
 protected:
 	void _resetDocumentState();
@@ -141,7 +142,7 @@ private:
 	void _openListLevel(TagOpenElement *pListLevelOpenElement);
 	void _closeListLevel(const char *szListType);
 
-        WPXInputStream *mpInput;
+        WPSInputStream *mpInput;
         DocumentHandler *mpHandler;
 	bool mbUsed; // whether or not it has been before (you can only use me once!)
 
--- writerperfect/source/filter/DocumentHandler.cxx	23 Jan 2007 12:12:19 -0000	1.2
+++ writerperfect/source/filter/DocumentHandler.cxx	3 Jan 2007 16:57:28 -0000	1.1.4.5
@@ -48,19 +48,19 @@ DocumentHandler::DocumentHandler(Referen
 
 void DocumentHandler::startDocument() 
 {
-	WRITER_DEBUG_MSG(("DocumentHandler::startDocument"));
+	WRITER_DEBUG_MSG(("DocumentHandler::startDocument\n"));
 	mxHandler->startDocument();
 }
 
 void DocumentHandler::endDocument()
 {
-	WRITER_DEBUG_MSG(("DocumentHandler::endDocument"));
+	WRITER_DEBUG_MSG(("DocumentHandler::endDocument\n"));
 	mxHandler->endDocument();
 }
 
 void DocumentHandler::startElement(const char *psName, const WPXPropertyList &xPropList)
 {
-	WRITER_DEBUG_MSG(("DocumentHandler::startElement"));
+	WRITER_DEBUG_MSG(("DocumentHandler::startElement\n"));
         SvXMLAttributeList *pAttrList = new SvXMLAttributeList();
 	Reference < XAttributeList > xAttrList(pAttrList);
 	WPXPropertyList::Iter i(xPropList);
@@ -77,13 +77,13 @@ void DocumentHandler::startElement(const
 
 void DocumentHandler::endElement(const char *psName)
 {
-	WRITER_DEBUG_MSG(("DocumentHandler::endElement"));
+	WRITER_DEBUG_MSG(("DocumentHandler::endElement\n"));
         mxHandler->endElement(OUString::createFromAscii(psName));
 }
 
 void DocumentHandler::characters(const WPXString &sCharacters)
 {
-	WRITER_DEBUG_MSG(("DocumentHandler::characters"));
+	WRITER_DEBUG_MSG(("DocumentHandler::characters\n"));
         OUString sCharU16(sCharacters.cstr(), strlen(sCharacters.cstr()), RTL_TEXTENCODING_UTF8);
         mxHandler->characters(sCharU16);
 }
--- writerperfect/source/filter/SectionStyle.cxx	23 Jan 2007 12:15:14 -0000	1.3
+++ writerperfect/source/filter/SectionStyle.cxx	4 Jan 2007 11:08:33 -0000	1.2.40.3
@@ -33,7 +33,7 @@
 
 #ifdef _MSC_VER
 double rint(double x);
-#endif /* _WIN32 */
+#endif /* _MSC_VER */
 
 SectionStyle::SectionStyle(const WPXPropertyList &xPropList, 
                            const WPXPropertyListVector &xColumns, 
--- writerperfect/source/filter/makefile.mk	23 Jan 2007 12:18:02 -0000	1.4
+++ writerperfect/source/filter/makefile.mk	18 Dec 2006 13:12:18 -0000	1.3.6.2
@@ -7,12 +7,20 @@ ENABLE_EXCEPTIONS=true
 .INCLUDE :  settings.mk
 
 .IF "$(SYSTEM_LIBWPD)" == "YES"
-INCPRE+=$(LIBWPD_CFLAGS) -I..
+INCPRE+=$(LIBWPD_CFLAGS)
 .ELSE
-# broken but ... necessary, internal include shafted ...
-INCPRE+=$(SOLARVER)$/$(UPD)$/$(INPATH)$/inc$/libwpd -I..
+INCPRE+=$(SOLARVER)$/$(UPD)$/$(INPATH)$/inc$/libwpd
+.ENDIF
+
+.IF "$(SYSTEM_LIBWPS)" == "YES"
+INCPRE+=$(LIBWPS_CFLAGS)
+.ELSE
+INCPRE+=$(SOLARVER)$/$(UPD)$/$(INPATH)$/inc$/libwps
 .ENDIF
 
+# broken but ... necessary, internal include shafted ...
+INCPRE+= -I..
+
 SLOFILES= \
 	$(SLO)$/DocumentElement.obj		\
 	$(SLO)$/FontStyle.obj			\
--- writerperfect/source/stream/WPXSvStream.cxx	17 Apr 2007 14:50:35 -0000	1.7
+++ writerperfect/source/stream/WPXSvStream.cxx	6 Feb 2007 12:51:24 -0000	1.5.38.13
@@ -9,7 +9,7 @@ using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::io;
 
 WPXSvInputStream::WPXSvInputStream( Reference< XInputStream > xStream ) :
-		WPXInputStream(true),
+		WPSInputStream(),
 		mxChildStorage(),
 		mxChildStream(),
 		mxStream(xStream),
--- writerperfect/source/stream/WPXSvStream.h	23 Jan 2007 12:18:25 -0000	1.4
+++ writerperfect/source/stream/WPXSvStream.h	3 Jan 2007 16:30:17 -0000	1.3.40.4
@@ -7,11 +7,11 @@
 #ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_H_
 #include <com/sun/star/io/XSeekable.hpp>
 #endif
- 
 
+#include <libwps/WPSStream.h>
 #include <libwpd/WPXStream.h>
 
-class WPXSvInputStream : public WPXInputStream
+class WPXSvInputStream : public WPSInputStream
 {
 public:
 	WPXSvInputStream( ::com::sun::star::uno::Reference<
--- writerperfect/source/stream/makefile.mk	23 Jan 2007 12:18:39 -0000	1.4
+++ writerperfect/source/stream/makefile.mk	22 Dec 2006 16:08:14 -0000	1.3.12.2
@@ -12,6 +12,12 @@ INCPRE+=$(LIBWPD_CFLAGS)
 INCPRE+=$(SOLARVER)$/$(UPD)$/$(INPATH)$/inc$/libwpd
 .ENDIF
 
+.IF "$(SYSTEM_LIBWPS)" == "YES"
+INCPRE+=$(LIBWPS_CFLAGS)
+.ELSE
+INCPRE+=$(SOLARVER)$/$(UPD)$/$(INPATH)$/inc$/libwps
+.ENDIF
+
 # broken but ... necessary, internal include shafted ...
 INCPRE+= -I..
 
--- writerperfect/source/wpdimp/WordPerfectCollector.cxx	23 Jan 2007 12:18:49 -0000	1.2
+++ writerperfect/source/wpdimp/WordPerfectCollector.cxx	18 Dec 2006 13:12:19 -0000	1.1.4.1
@@ -27,8 +27,9 @@
  */
 
 #include "WordPerfectCollector.hxx"
+#include <libwpd/WPDocument.h>
 
-WordPerfectCollector::WordPerfectCollector(WPXInputStream *pInput, DocumentHandler *pHandler) :
+WordPerfectCollector::WordPerfectCollector(WPSInputStream *pInput, DocumentHandler *pHandler) :
 	DocumentCollector(pInput, pHandler)
 {
 }
@@ -37,7 +38,7 @@ WordPerfectCollector::~WordPerfectCollec
 {
 }
 
-bool WordPerfectCollector::parseSourceDocument(WPXInputStream &input)
+bool WordPerfectCollector::parseSourceDocument(WPSInputStream &input)
 {
         WPDResult result = WPDocument::parse(&input, static_cast<WPXHLListenerImpl *>(this));
         if (result != WPD_OK)
--- writerperfect/source/wpdimp/WordPerfectCollector.hxx	23 Jan 2007 12:19:00 -0000	1.2
+++ writerperfect/source/wpdimp/WordPerfectCollector.hxx	18 Dec 2006 13:12:19 -0000	1.1.4.1
@@ -34,8 +34,8 @@
 class WordPerfectCollector : public DocumentCollector
 {
 public:
-	WordPerfectCollector(WPXInputStream *pInput, DocumentHandler *pHandler);
+	WordPerfectCollector(WPSInputStream *pInput, DocumentHandler *pHandler);
 	virtual ~WordPerfectCollector();
-	bool parseSourceDocument(WPXInputStream &pInput);
+	bool parseSourceDocument(WPSInputStream &pInput);
 };
 #endif
--- writerperfect/source/wpdimp/makefile.mk	23 Jan 2007 12:19:31 -0000	1.2
+++ writerperfect/source/wpdimp/makefile.mk	18 Dec 2006 13:12:20 -0000	1.1.4.1
@@ -7,12 +7,20 @@ ENABLE_EXCEPTIONS=true
 .INCLUDE :  settings.mk
 
 .IF "$(SYSTEM_LIBWPD)" == "YES"
-INCPRE+=$(LIBWPD_CFLAGS) -I..
+INCPRE+=$(LIBWPD_CFLAGS)
 .ELSE
-# broken but ... necessary, internal include shafted ...
-INCPRE+=$(SOLARVER)$/$(UPD)$/$(INPATH)$/inc$/libwpd -I..
+INCPRE+=$(SOLARVER)$/$(UPD)$/$(INPATH)$/inc$/libwpd
+.ENDIF
+
+.IF "$(SYSTEM_LIBWPS)" == "YES"
+INCPRE+=$(LIBWPS_CFLAGS)
+.ELSE
+INCPRE+=$(SOLARVER)$/$(UPD)$/$(INPATH)$/inc$/libwps
 .ENDIF
 
+# broken but ... necessary, internal include shafted ...
+INCPRE+= -I..
+
 SLOFILES= \
 	$(SLO)$/WordPerfectCollector.obj  \
 	$(SLO)$/WordPerfectImportFilter.obj  \
cvs diff: Diffing writerperfect/source/wpsimp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ writerperfect/source/wpsimp/MSWorksCollector.cxx	18 Dec 2006 13:12:21 -0000	1.1.2.1
@@ -0,0 +1,48 @@
+/* MSWorksCollector: Collects sections and runs of text from a
+ * wordperfect file (and styles to go along with them) and writes them
+ * to a Writer target document
+ *
+ * Copyright (C) 2006 Fridrich Strba (fridrich.strba@bluewin.ch)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program 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; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ *
+ * For further information visit http://libwpd.sourceforge.net
+ *
+ */
+
+/* "This product is not manufactured, approved, or supported by
+ * Corel Corporation or Corel Corporation Limited."
+ */
+
+#include "MSWorksCollector.hxx"
+#include <libwps/WPSDocument.h>
+
+MSWorksCollector::MSWorksCollector(WPSInputStream *pInput, DocumentHandler *pHandler) :
+	DocumentCollector(pInput, pHandler)
+{
+}
+
+MSWorksCollector::~MSWorksCollector()
+{
+}
+
+bool MSWorksCollector::parseSourceDocument(WPSInputStream &input)
+{
+        WPSResult result = WPSDocument::parse(&input, static_cast<WPXHLListenerImpl *>(this));
+        if (result != WPS_OK)
+                return false;
+
+	return true;
+}
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ writerperfect/source/wpsimp/MSWorksCollector.hxx	18 Dec 2006 13:12:21 -0000	1.1.2.1
@@ -0,0 +1,41 @@
+/* MSWorksCollector: Collects sections and runs of text from a
+ * wordperfect file (and styles to go along with them) and writes them
+ * to a Writer target document
+ *
+ * Copyright (C) 2006 Fridrich Strba (fridrich.strba@bluewin.ch)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program 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; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ *
+ * For further information visit http://libwpd.sourceforge.net
+ *
+ */
+
+/* "This product is not manufactured, approved, or supported by
+ * Corel Corporation or Corel Corporation Limited."
+ */
+
+#ifndef _MSWORKSCOLLECTOR_HXX
+#define _MSWORKSCOLLECTOR_HXX
+
+#include "filter/DocumentCollector.hxx"
+
+class MSWorksCollector : public DocumentCollector
+{
+public:
+	MSWorksCollector(WPSInputStream *pInput, DocumentHandler *pHandler);
+	virtual ~MSWorksCollector();
+	bool parseSourceDocument(WPSInputStream &input);
+};
+#endif
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ writerperfect/source/wpsimp/MSWorksImportFilter.cxx	30 Dec 2006 14:23:13 -0000	1.1.2.4
@@ -0,0 +1,303 @@
+/* MSWorksImportFilter: Sets up the filter, and calls DocumentCollector
+ * to do the actual filtering
+ *
+ * Copyright (C) 2000 by Sun Microsystems, Inc.
+ * Copyright (C) 2002-2004 William Lachance (wlach@interlog.com)
+ * Copyright (C) 2004 Net Integration Technologies (http://www.net-itech.com)
+ * Copyright (C) 2004 Fridrich Strba <fridrich.strba@bluewin.ch>
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program 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 General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  
+ * 02111-1307, USA.
+ *
+ *  Contributor(s): Martin Gallwey (gallwey@sun.com)
+ *
+ */
+/* "This product is not manufactured, approved, or supported by 
+ * Corel Corporation or Corel Corporation Limited."
+ */
+
+#ifndef _OSL_DIAGNOSE_H_
+#include <osl/diagnose.h>
+#endif
+#ifndef _RTL_TENCINFO_H_
+#include <rtl/tencinfo.h>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_
+#include <com/sun/star/io/XInputStream.hpp>
+#endif
+#ifndef _COM_SUN_STAR_XML_SAX_XATTRIBUTELIST_HPP_
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#endif
+#ifndef _COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#endif
+#ifndef _COM_SUN_STAR_XML_SAX_INPUTSOURCE_HPP_
+#include <com/sun/star/xml/sax/InputSource.hpp>
+#endif
+#ifndef _COM_SUN_STAR_XML_SAX_XPARSER_HPP_
+#include <com/sun/star/xml/sax/XParser.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_UCB_XCOMMANDENVIRONMENT_HPP
+#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+#endif
+
+#ifndef _ATTRLIST_HPP_
+#include <xmloff/attrlist.hxx>
+#endif
+#ifndef _XMLKYWD_HPP
+#include <xmloff/xmlkywd.hxx>
+#endif
+
+#ifndef _UCBHELPER_CONTENT_HXX
+#include <ucbhelper/content.hxx>
+#endif
+
+#include "filter/FilterInternal.hxx"
+#include "filter/DocumentHandler.hxx"
+#include "filter/DocumentCollector.hxx"
+#include "stream/WPXSvStream.h"
+
+#include <libwps/WPSDocument.h>
+#include "MSWorksImportFilter.hxx"
+#include "MSWorksCollector.hxx"
+
+// using namespace ::rtl;
+using rtl::OString;
+using rtl::OUString;
+using com::sun::star::uno::Sequence;
+using com::sun::star::uno::Reference;
+using com::sun::star::uno::Any;
+using com::sun::star::uno::UNO_QUERY;
+using com::sun::star::uno::XInterface;
+using com::sun::star::uno::Exception;
+using com::sun::star::uno::RuntimeException;
+using com::sun::star::lang::XMultiServiceFactory;
+using com::sun::star::beans::PropertyValue;
+using com::sun::star::document::XFilter;
+using com::sun::star::document::XExtendedFilterDetection;
+using com::sun::star::ucb::XCommandEnvironment;
+
+using com::sun::star::io::XInputStream;
+using com::sun::star::document::XImporter;
+using com::sun::star::xml::sax::InputSource;
+using com::sun::star::xml::sax::XAttributeList;
+using com::sun::star::xml::sax::XDocumentHandler;
+using com::sun::star::xml::sax::XParser;
+
+void callHandler(Reference < XDocumentHandler > xDocHandler);
+
+sal_Bool SAL_CALL MSWorksImportFilter::importImpl( const Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
+	throw (RuntimeException)
+{
+	WRITER_DEBUG_MSG(("MSWorksImportFilter::importImpl: Got here!\n"));
+	
+	sal_Int32 nLength = aDescriptor.getLength();
+	const PropertyValue * pValue = aDescriptor.getConstArray();
+	OUString sURL;
+	Reference < XInputStream > xInputStream;
+	for ( sal_Int32 i = 0 ; i < nLength; i++)
+	{
+	    if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "InputStream" ) ) )
+		pValue[i].Value >>= xInputStream;
+	    else if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "URL" ) ) )
+		pValue[i].Value >>= sURL;
+	}
+	if ( !xInputStream.is() )
+	{
+	    OSL_ASSERT( 0 );
+	    return sal_False;
+	}
+	OString sFileName;
+	sFileName = OUStringToOString(sURL, RTL_TEXTENCODING_INFO_ASCII);
+	
+	// An XML import service: what we push sax messages to..
+	OUString sXMLImportService ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.XMLImporter" ) );
+	Reference < XDocumentHandler > xInternalHandler( mxMSF->createInstance( sXMLImportService ), UNO_QUERY );
+
+	// The XImporter sets up an empty target document for XDocumentHandler to write to.. 
+	Reference < XImporter > xImporter(xInternalHandler, UNO_QUERY);
+	xImporter->setTargetDocument(mxDoc);
+
+        // OO Document Handler: abstract class to handle document SAX messages, concrete implementation here
+        // writes to in-memory target doc
+        DocumentHandler xHandler(xInternalHandler);
+
+	WPXSvInputStream input( xInputStream );
+
+	MSWorksCollector collector(&input, &xHandler);
+	collector.filter();
+
+	return true; 
+}
+
+sal_Bool SAL_CALL MSWorksImportFilter::filter( const Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor ) 
+	throw (RuntimeException)
+{
+	WRITER_DEBUG_MSG(("MSWorksImportFilter::filter: Got here!\n"));
+	return importImpl ( aDescriptor );
+}
+void SAL_CALL MSWorksImportFilter::cancel(  ) 
+	throw (RuntimeException)
+{
+	WRITER_DEBUG_MSG(("MSWorksImportFilter::cancel: Got here!\n"));
+}
+
+// XImporter
+void SAL_CALL MSWorksImportFilter::setTargetDocument( const Reference< ::com::sun::star::lang::XComponent >& xDoc )
+	throw (::com::sun::star::lang::IllegalArgumentException, RuntimeException)
+{
+	WRITER_DEBUG_MSG(("MSWorksImportFilter::getTargetDocument: Got here!\n"));
+	meType = FILTER_IMPORT;
+	mxDoc = xDoc;
+}
+
+// XExtendedFilterDetection
+OUString SAL_CALL MSWorksImportFilter::detect( com::sun::star::uno::Sequence< PropertyValue >& Descriptor )
+	throw( com::sun::star::uno::RuntimeException )
+{
+	WRITER_DEBUG_MSG(("MSWorksImportFilter::detect: Got here!\n"));
+	
+	WPSConfidence confidence = WPS_CONFIDENCE_NONE;
+	OUString sTypeName = OUString( RTL_CONSTASCII_USTRINGPARAM ( "" ) );
+	sal_Int32 nLength = Descriptor.getLength();
+	sal_Int32 location = nLength;
+	OUString sURL;
+	const PropertyValue * pValue = Descriptor.getConstArray();
+	Reference < XInputStream > xInputStream;
+	for ( sal_Int32 i = 0 ; i < nLength; i++)
+	{
+		if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "TypeName" ) ) )
+			location=i;
+		else if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "InputStream" ) ) )
+			pValue[i].Value >>= xInputStream;
+		else if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "URL" ) ) )
+			pValue[i].Value >>= sURL;
+	}
+
+        Reference< com::sun::star::ucb::XCommandEnvironment > xEnv;
+        if (!xInputStream.is())
+        {
+		try
+		{
+			::ucbhelper::Content aContent(sURL, xEnv);
+	                xInputStream = aContent.openStream();
+		}
+		catch ( ... )
+		{
+			return ::rtl::OUString();
+		}
+		
+                if (!xInputStream.is())
+                    return ::rtl::OUString();
+        }
+		
+	WPXSvInputStream input( xInputStream );
+	
+	if (input.atEOS())
+        return ::rtl::OUString();
+
+	confidence = WPSDocument::isFileFormatSupported(&input, false);
+
+	if ((confidence == WPS_CONFIDENCE_EXCELLENT) || (confidence == WPS_CONFIDENCE_GOOD))
+		sTypeName = OUString( RTL_CONSTASCII_USTRINGPARAM ( "writer_MS_Works_Document" ) );
+
+	if (sTypeName.getLength())
+	{
+		if ( location == Descriptor.getLength() )
+		{
+			Descriptor.realloc(nLength+1);
+			Descriptor[location].Name = ::rtl::OUString::createFromAscii( "TypeName" );
+		}
+
+		Descriptor[location].Value <<=sTypeName;
+	}
+
+	return sTypeName;	
+}
+
+
+// XInitialization
+void SAL_CALL MSWorksImportFilter::initialize( const Sequence< Any >& aArguments ) 
+	throw (Exception, RuntimeException)
+{
+	WRITER_DEBUG_MSG(("MSWorksImportFilter::initialize: Got here!\n"));
+	Sequence < PropertyValue > aAnySeq;
+	sal_Int32 nLength = aArguments.getLength();
+	if ( nLength && ( aArguments[0] >>= aAnySeq ) )
+	{
+		const PropertyValue * pValue = aAnySeq.getConstArray();
+		nLength = aAnySeq.getLength();
+		for ( sal_Int32 i = 0 ; i < nLength; i++)
+		{
+			if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "Type" ) ) )
+			{
+				pValue[i].Value >>= msFilterName;
+				break;
+			}
+		}
+	}
+}
+OUString MSWorksImportFilter_getImplementationName ()
+	throw (RuntimeException)
+{
+	return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.MSWorksImportFilter" ) );
+}
+
+#define SERVICE_NAME1 "com.sun.star.document.ImportFilter"
+#define SERVICE_NAME2 "com.sun.star.document.ExtendedTypeDetection"
+sal_Bool SAL_CALL MSWorksImportFilter_supportsService( const OUString& ServiceName ) 
+	throw (RuntimeException)
+{
+	return (ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME1 ) ) ||
+		ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME2 ) ) );
+}
+Sequence< OUString > SAL_CALL MSWorksImportFilter_getSupportedServiceNames(  ) 
+	throw (RuntimeException)
+{
+	Sequence < OUString > aRet(2);
+        OUString* pArray = aRet.getArray();
+        pArray[0] =  OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME1 ) );
+	pArray[1] =  OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME2 ) ); 
+        return aRet;
+}
+#undef SERVICE_NAME2
+#undef SERVICE_NAME1
+
+Reference< XInterface > SAL_CALL MSWorksImportFilter_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
+	throw( Exception )
+{
+	return (cppu::OWeakObject*) new MSWorksImportFilter( rSMgr );
+}
+
+// XServiceInfo
+OUString SAL_CALL MSWorksImportFilter::getImplementationName(  ) 
+	throw (RuntimeException)
+{
+	return MSWorksImportFilter_getImplementationName();
+}
+sal_Bool SAL_CALL MSWorksImportFilter::supportsService( const OUString& rServiceName ) 
+	throw (RuntimeException)
+{
+    return MSWorksImportFilter_supportsService( rServiceName );
+}
+Sequence< OUString > SAL_CALL MSWorksImportFilter::getSupportedServiceNames(  ) 
+	throw (RuntimeException)
+{
+    return MSWorksImportFilter_getSupportedServiceNames();
+}
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ writerperfect/source/wpsimp/MSWorksImportFilter.hxx	18 Dec 2006 13:12:21 -0000	1.1.2.1
@@ -0,0 +1,129 @@
+/* 
+ * Copyright (C) 2000 by Sun Microsystems, Inc.
+ * Copyright (C) 2002-2004 William Lachance (wlach@interlog.com)
+ * Copyright (C) 2004 Net Integration Technologies (http://www.net-itech.com)
+ * Copyright (C) 2004 Fridrich Strba <fridrich.strba@bluewin.ch>
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program 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 General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  
+ * 02111-1307, USA.
+ *
+ *  Contributor(s): Martin Gallwey (gallwey@sun.com)
+ *
+ */
+
+/* "This product is not manufactured, approved, or supported by 
+ * Corel Corporation or Corel Corporation Limited."
+ */
+#ifndef _WORDPERFECTIMPORTFILTER_HXX
+#define _WORDPERFECTIMPORTFILTER_HXX
+
+#ifndef _COM_SUN_STAR_DOCUMENT_XFILTER_HPP_
+#include <com/sun/star/document/XFilter.hpp>
+#endif
+#ifndef _COM_SUN_STAR_DOCUMENT_XIMPORTER_HPP_
+#include <com/sun/star/document/XImporter.hpp>
+#endif
+#ifndef _COM_SUN_STAR_DOCUMENT_XEXTENDEDFILTERDETECTION_HPP_
+#include <com/sun/star/document/XExtendedFilterDetection.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XINITIALIZATION_HPP_
+#include <com/sun/star/lang/XInitialization.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#endif
+#ifndef _CPPUHELPER_IMPLBASE5_HXX_
+#include <cppuhelper/implbase5.hxx>
+#endif
+
+enum FilterType 
+{
+	FILTER_IMPORT,
+	FILTER_EXPORT
+};
+/* This component will be instantiated for both import or export. Whether it calls
+ * setSourceDocument or setTargetDocument determines which Impl function the filter
+ * member calls */
+class MSWorksImportFilter : public cppu::WeakImplHelper5 
+< 
+	com::sun::star::document::XFilter,
+	com::sun::star::document::XImporter,
+	com::sun::star::document::XExtendedFilterDetection,
+	com::sun::star::lang::XInitialization,
+	com::sun::star::lang::XServiceInfo
+>
+{
+protected:
+	// oo.org declares
+	::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
+	::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mxDoc;
+	::rtl::OUString msFilterName;
+	::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > mxHandler;
+
+	FilterType meType;
+
+	sal_Bool SAL_CALL importImpl( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor ) 
+		throw (::com::sun::star::uno::RuntimeException);
+
+public:
+	MSWorksImportFilter( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF)
+        : mxMSF( rxMSF ) {}
+	virtual ~MSWorksImportFilter() {}
+
+	// XFilter
+        virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor ) 
+		throw (::com::sun::star::uno::RuntimeException);
+        virtual void SAL_CALL cancel(  ) 
+		throw (::com::sun::star::uno::RuntimeException);
+
+	// XImporter
+        virtual void SAL_CALL setTargetDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc ) 
+		throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ 	//XExtendedFilterDetection
+	virtual ::rtl::OUString SAL_CALL detect( com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& Descriptor ) 
+		throw( com::sun::star::uno::RuntimeException );
+
+	// XInitialization
+        virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) 
+		throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+	// XServiceInfo
+        virtual ::rtl::OUString SAL_CALL getImplementationName(  ) 
+		throw (::com::sun::star::uno::RuntimeException);
+        virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) 
+		throw (::com::sun::star::uno::RuntimeException);
+        virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) 
+		throw (::com::sun::star::uno::RuntimeException);
+
+};
+
+::rtl::OUString MSWorksImportFilter_getImplementationName()
+	throw ( ::com::sun::star::uno::RuntimeException );
+
+sal_Bool SAL_CALL MSWorksImportFilter_supportsService( const ::rtl::OUString& ServiceName ) 
+	throw ( ::com::sun::star::uno::RuntimeException );
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL MSWorksImportFilter_getSupportedServiceNames(  ) 
+	throw ( ::com::sun::star::uno::RuntimeException );
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+SAL_CALL MSWorksImportFilter_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr)
+	throw ( ::com::sun::star::uno::Exception );
+
+#endif
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ writerperfect/source/wpsimp/makefile.mk	18 Dec 2006 13:12:22 -0000	1.1.2.1
@@ -0,0 +1,29 @@
+PRJ=..$/..
+
+PRJNAME=writerperfect
+TARGET=wpsimp
+ENABLE_EXCEPTIONS=true
+
+.INCLUDE :  settings.mk
+
+.IF "$(SYSTEM_LIBWPD)" == "YES"
+INCPRE+=$(LIBWPD_CFLAGS)
+.ELSE
+INCPRE+=$(SOLARVER)$/$(UPD)$/$(INPATH)$/inc$/libwpd
+.ENDIF
+
+.IF "$(SYSTEM_LIBWPS)" == "YES"
+INCPRE+=$(LIBWPS_CFLAGS)
+.ELSE
+INCPRE+=$(SOLARVER)$/$(UPD)$/$(INPATH)$/inc$/libwps
+.ENDIF
+
+# broken but ... necessary, internal include shafted ...
+INCPRE+= -I..
+
+SLOFILES= \
+	$(SLO)$/MSWorksCollector.obj  \
+	$(SLO)$/MSWorksImportFilter.obj  \
+	$(SLO)$/msworks_genericfilter.obj		
+
+.INCLUDE :  target.mk
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ writerperfect/source/wpsimp/msworks_genericfilter.cxx	19 Dec 2006 10:21:57 -0000	1.1.2.2
@@ -0,0 +1,101 @@
+/* genericfilter: mostly generic code for registering the filter
+ *
+ * Portions of this code Copyright 2000 by Sun Microsystems, Inc.
+ * Rest is Copyright (C) 2002 William Lachance (wlach@interlog.com)
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program 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 General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  
+ * 02111-1307, USA.
+ */
+
+/* "This product is not manufactured, approved, or supported by 
+ * Corel Corporation or Corel Corporation Limited."
+ */
+#include <stdio.h>
+
+#include <osl/mutex.hxx>
+#include <osl/thread.h>
+#include <cppuhelper/factory.hxx>
+
+#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#endif
+
+#include "MSWorksImportFilter.hxx"
+
+using namespace ::rtl;
+using namespace ::cppu;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::registry;
+
+extern "C"
+{
+//==================================================================================================
+void SAL_CALL component_getImplementationEnvironment(
+	const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ )
+{
+	*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+//==================================================================================================
+sal_Bool SAL_CALL component_writeInfo(
+	void * /* pServiceManager */, void * pRegistryKey )
+{
+	if (pRegistryKey)
+	{
+		try
+		{
+            sal_Int32 nPos = 0;
+            Reference< XRegistryKey > xNewKey(
+				reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( MSWorksImportFilter_getImplementationName() ) ); 
+            xNewKey = xNewKey->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) );
+			
+			const Sequence< OUString > & rSNL = MSWorksImportFilter_getSupportedServiceNames();
+			const OUString * pArray = rSNL.getConstArray();
+			for ( nPos = rSNL.getLength(); nPos--; )
+				xNewKey->createKey( pArray[nPos] );
+
+			return sal_True;
+		}
+		catch (InvalidRegistryException &)
+		{
+			OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
+		}
+	}
+	return sal_False;
+}
+//==================================================================================================
+void * SAL_CALL component_getFactory(
+	const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ )
+{
+	void * pRet = 0;
+
+    OUString implName = OUString::createFromAscii( pImplName );
+	if ( pServiceManager && implName.equals(MSWorksImportFilter_getImplementationName()) )
+	{
+		Reference< XSingleServiceFactory > xFactory( createSingleFactory(
+			reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
+			OUString::createFromAscii( pImplName ),
+			MSWorksImportFilter_createInstance, MSWorksImportFilter_getSupportedServiceNames() ) );
+		
+		if (xFactory.is())
+		{
+			xFactory->acquire();
+			pRet = xFactory.get();
+		}
+	}
+	
+	return pRet;
+}
+}
--- writerperfect/util/makefile.mk	26 Mar 2007 13:26:59 -0000	1.8
+++ writerperfect/util/makefile.mk	7 May 2007 09:28:20 -0000	1.6.6.4
@@ -5,18 +5,26 @@ VERSION=$(UPD)
 
 .INCLUDE :  settings.mk
 
-.IF "$(GUI)"=="UNX"
+
+.IF "$(GUI)"=="UNX" || "$(GUI)$(COM)"=="WNTGCC"
+
 .IF "$(SYSTEM_LIBWPD)" == "YES"
 LIBWPD=$(LIBWPD_LIBS)
 .ELSE
 LIBWPD=-lwpdlib
 .ENDIF
+
+.IF "$(SYSTEM_LIBWPS)" == "YES"
+LIBWPS=$(LIBWPS_LIBS)
 .ELSE
-.IF "$(GUI)$(COM)"=="WNTGCC"
-LIBWPD=-lwpdlib
-.ELSE
- LIBWPD=$(LIBPRE) wpdlib.lib
+LIBWPS=-lwpslib
 .ENDIF
+
+.ELSE
+
+LIBWPD=$(LIBPRE) wpdlib.lib
+LIBWPS=$(LIBPRE) wpslib.lib
+
 .ENDIF
 
 LIB1TARGET= $(SLB)$/wpft.lib
@@ -46,4 +54,33 @@ SHL1LIBS = $(LIB1TARGET)
 SHL1VERSIONMAP=wpft.map
 DEF1NAME=$(SHL1TARGET)
 
+
+LIB2TARGET= $(SLB)$/msworks.lib
+LIB2FILES= \
+	$(SLB)$/stream.lib  \
+	$(SLB)$/filter.lib  \
+	$(SLB)$/wpsimp.lib
+SHL2LIBS=$(LIB2TARGET)
+SHL2STDLIBS+= \
+	$(SVLLIB)	\
+	$(SOTLIB) \
+	$(SO2LIB) \
+	$(SVTOOLLIB) \
+	$(UNOTOOLSLIB) \
+	$(TOOLSLIB) \
+	$(COMPHELPERLIB) \
+	$(UCBHELPERLIB) \
+	$(CPPUHELPERLIB) \
+	$(CPPULIB) \
+	$(SALLIB) \
+	$(XMLOFFLIB) \
+	$(LIBWPS) \
+	$(LIBWPD)
+
+SHL2TARGET = msworks$(UPD)$(DLLPOSTFIX)
+SHL2IMPLIB = i$(SHL2TARGET)
+SHL2LIBS = $(LIB2TARGET)
+SHL2VERSIONMAP=msworks.map
+DEF2NAME=$(SHL2TARGET)
+
 .INCLUDE :  target.mk
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ writerperfect/util/msworks.map	18 Dec 2006 13:12:22 -0000	1.1.2.1
@@ -0,0 +1,8 @@
+WPFT_1_0 {
+	global:
+		component_getImplementationEnvironment;
+		component_writeInfo;
+		component_getFactory;
+	local:
+		*;
+};
--- scp2/source/ooo/file_library_ooo.scp	25 Apr 2007 16:18:25 -0000	1.230
+++ scp2/source/ooo/file_library_ooo.scp	7 May 2007 09:32:38 -0000	1.216.6.4
@@ -1432,6 +1432,8 @@ End
 
 STD_UNO_LIB_FILE_PATCH(gid_File_Lib_Wpft,wpft)
 
+STD_UNO_LIB_FILE_PATCH(gid_File_Lib_Msworks,msworks)
+
 #if !defined(MACOSX) && ( !defined(SYSTEM_MOZILLA) && !defined(WITHOUT_MOZILLA) )
 
 File gid_File_Lib_Mozabdrv
--- scp2/source/writer/module_writer.scp	2 Jan 2007 15:31:51 -0000	1.17
+++ scp2/source/writer/module_writer.scp	29 Jan 2007 10:54:40 -0000	1.16.158.2
@@ -53,6 +53,7 @@ Module gid_Module_Prg_Wrt_Bin
     gid_File_Lib_Swd,
     gid_File_Lib_Swui,
     gid_File_Lib_Wpft,
+    gid_File_Lib_Msworks,
     gid_File_Share_Config_Sofficecfg_Writer_Menubar_Xml,
     gid_File_Share_Config_Sofficecfg_Writerweb_Menubar_Xml,
     gid_File_Share_Config_Sofficecfg_Writerglobal_Menubar_Xml,
--- /dev/null	2007-01-22 11:02:07.811249416 +0100
+++ libwps/makefile.mk	2006-12-18 17:48:06.000000000 +0100
@@ -0,0 +1,69 @@
+#*************************************************************************
+#
+#   OpenOffice.org - a multi-platform office productivity suite
+#
+#   $RCSfile: makefile.mk,v $
+#
+#   $Revision: 1.1 $
+#
+#   last change: $Author: fridrich_strba $ $Date: 2006/12/18 16:48:06 $
+#
+#   The Contents of this file are made available subject to
+#   the terms of GNU Lesser General Public License Version 2.1.
+#
+#
+#     GNU Lesser General Public License Version 2.1
+#     =============================================
+#     Copyright 2005 by Sun Microsystems, Inc.
+#     901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+#     This library is free software; you can redistribute it and/or
+#     modify it under the terms of the GNU Lesser General Public
+#     License version 2.1, as published by the Free Software Foundation.
+#
+#     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
+#     Lesser General Public License for more details.
+#
+#     You should have received a copy of the GNU Lesser General Public
+#     License along with this library; if not, write to the Free Software
+#     Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+#     MA  02111-1307  USA
+#
+#*************************************************************************
+
+PRJ=.
+
+PRJNAME=wps
+TARGET=wps
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE :	settings.mk
+
+# --- Files --------------------------------------------------------
+
+.IF "$(SYSTEM_LIBWPS)" == "YES"
+@all:
+	@echo "Using system libwps..."
+.ENDIF
+
+# libwps depends on the libwpd framework
+.IF "$(SYSTEM_LIBWPD)" == "YES"
+INCPRE+=$(LIBWPD_CFLAGS)
+.ELSE
+INCPRE+=$(SOLARVER)$/$(UPD)$/$(INPATH)$/inc$/libwpd
+.ENDIF
+
+TARFILE_NAME=libwps-0.1.0
+PATCH_FILE_NAME=$(TARFILE_NAME).diff
+BUILD_ACTION=dmake $(MFLAGS) $(CALLMACROS)
+BUILD_DIR=src/lib
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : set_ext.mk
+.INCLUDE :	target.mk
+.INCLUDE :	tg_ext.mk
+
--- /dev/null	Sun Feb 18 20:52:18 2007
+++ libwps/libwps-0.1.0.diff	Wed Jun 20 13:52:09 2007
@@ -0,0 +1,45 @@
+*** misc/libwps-0.1.0/src/lib/WPS8.cpp	Sun Feb 18 20:52:18 2007
+--- misc/build/libwps-0.1.0/src/lib/WPS8.cpp	Wed Jun 20 13:51:46 2007
+***************
+*** 461,467 ****
+  	WPS_DEBUG_MSG(("Works8: debug: header index entry %s with offset=0x%04X, length=0x%04X\n", 
+  		name.c_str(), hie.offset, hie.length));
+  
+! 	headerIndexTable.insert(std::pair<std::string, HeaderIndexEntries>(name, hie));
+  
+  	input->seek(input->tell() + 0x18 - cch, WPX_SEEK_SET);
+  }
+--- 461,467 ----
+  	WPS_DEBUG_MSG(("Works8: debug: header index entry %s with offset=0x%04X, length=0x%04X\n", 
+  		name.c_str(), hie.offset, hie.length));
+  
+! 	headerIndexTable.insert(std::multimap<std::string, HeaderIndexEntries>::value_type(name, hie));
+  
+  	input->seek(input->tell() + 0x18 - cch, WPX_SEEK_SET);
+  }
+*** misc/libwps-0.1.0/src/lib/makefile.mk	Sun Feb 18 20:52:18 2007
+--- misc/build/libwps-0.1.0/src/lib/makefile.mk	Wed Jun 20 01:51:52 2007
+***************
+*** 5,13 ****
+  ENABLE_EXCEPTIONS=TRUE
+  LIBTARGET=NO
+  
+- .INCLUDE :  svpre.mk
+  .INCLUDE :  settings.mk
+- .INCLUDE :  sv.mk
+  
+  .IF "$(GUI)"=="WNT"
+  CFLAGS+=-GR
+--- 5,11 ----
+*** misc/libwps-0.1.0/src/lib/WPSHeader.cpp.old	2007-02-18 20:52:18.000000000 +0100
+--- misc/build/libwps-0.1.0/src/lib/WPSHeader.cpp	2007-11-16 16:15:12.000000000 +0100
+***************
+*** 27,32 ****
+--- 27,33 ----
+  #include "WPSHeader.h"
+  #include "WPSFileStructure.h"
+  #include "libwps_internal.h"
++ #include <string.h>
+  	
+  WPSHeader::WPSHeader(WPSInputStream *input, uint8_t majorVersion) :
+  	m_input(input),
--- /dev/null	2007-01-22 11:02:07.811249416 +0100
+++ libwps/prj/d.lst	2006-12-18 17:48:07.000000000 +0100
@@ -0,0 +1,6 @@
+mkdir: %_DEST%\inc%_EXT%\libwps
+..\%__SRC%\misc\build\libwps*\src\lib\libwps.h %_DEST%\inc%_EXT%\libwps\
+..\%__SRC%\misc\build\libwps*\src\lib\WPSStream.h %_DEST%\inc%_EXT%\libwps\
+..\%__SRC%\misc\build\libwps*\src\lib\WPSDocument.h %_DEST%\inc%_EXT%\libwps\
+..\%__SRC%\lib\*.a %_DEST%\lib%_EXT%\*.a
+..\%__SRC%\slb\*.lib %_DEST%\lib%_EXT%\*.lib
--- /dev/null	2007-01-22 11:02:07.811249416 +0100
+++ libwps/prj/build.lst	2006-12-18 17:48:07.000000000 +0100
@@ -0,0 +1,3 @@
+lwps	libwps	: LIBWPD:libwpd soltools NULL
+lwps	libwps	usr1	-	all	lwps_mkout NULL
+lwps	libwps	nmake	-	all	lwps_libwps NULL
