5efc495
--- plugins/wordperfect/xp/ie_imp_WordPerfect.cpp	(revision 29401)
5efc495
+++ plugins/wordperfect/xp/ie_imp_WordPerfect.cpp	(revision 29403)
5efc495
@@ -60,7 +60,7 @@
5efc495
 
5efc495
 // Stream class
5efc495
 
5efc495
-#include <libwpd/WPXStream.h>
5efc495
+#include <libwpd-stream/libwpd-stream.h>
5efc495
 
5efc495
 #include <gsf/gsf-input.h>
5efc495
 #include <gsf/gsf-infile.h>
5efc495
@@ -70,12 +70,7 @@
5efc495
 #include <libwps/libwps.h>
5efc495
 #endif
5efc495
 
5efc495
-class AbiWordperfectInputStream :
5efc495
-#ifdef HAVE_LIBWPS
5efc495
-	public WPSInputStream
5efc495
-#else
5efc495
-    public WPXInputStream
5efc495
-#endif
5efc495
+class AbiWordperfectInputStream : public WPXInputStream
5efc495
 {
5efc495
 public:
5efc495
 	AbiWordperfectInputStream(GsfInput *input);
5efc495
@@ -86,7 +81,7 @@
5efc495
 
5efc495
 	virtual WPXInputStream * getDocumentOLEStream(const char * name);
5efc495
 
5efc495
-	virtual const uint8_t *read(size_t numBytes, size_t &numBytesRead);
5efc495
+	virtual const unsigned char *read(unsigned long numBytes, unsigned long &numBytesRead);
5efc495
 	virtual int seek(long offset, WPX_SEEK_TYPE seekType);
5efc495
 	virtual long tell();
5efc495
 	virtual bool atEOS();
5efc495
@@ -98,11 +93,7 @@
5efc495
 };
5efc495
 
5efc495
 AbiWordperfectInputStream::AbiWordperfectInputStream(GsfInput *input) :
5efc495
-#ifdef HAVE_LIBWPS
5efc495
-	WPSInputStream(),
5efc495
-#else
5efc495
-	WPXInputStream(true),
5efc495
-#endif
5efc495
+	WPXInputStream(),
5efc495
 	m_input(input),
5efc495
 	m_ole(NULL)
5efc495
 {
5efc495
@@ -117,9 +108,9 @@
5efc495
 	g_object_unref(G_OBJECT(m_input));
5efc495
 }
5efc495
 
5efc495
-const uint8_t * AbiWordperfectInputStream::read(size_t numBytes, size_t &numBytesRead)
5efc495
+const unsigned char * AbiWordperfectInputStream::read(unsigned long numBytes, unsigned long &numBytesRead)
5efc495
 {
5efc495
-	const uint8_t *buf = gsf_input_read(m_input, numBytes, NULL);
5efc495
+	const unsigned char *buf = gsf_input_read(m_input, numBytes, NULL);
5efc495
 
5efc495
 	if (buf == NULL)
5efc495
 		numBytesRead = 0;
5efc495
@@ -256,19 +247,12 @@
5efc495
 {
5efc495
 	AbiWordperfectInputStream gsfInput(input);
5efc495
 
5efc495
-	WPDConfidence confidence = WPDocument::isFileFormatSupported(&gsfInput, true);
5efc495
+	WPDConfidence confidence = WPDocument::isFileFormatSupported(&gsfInput);
5efc495
 
5efc495
 	switch (confidence)
5efc495
 	{
5efc495
 		case WPD_CONFIDENCE_NONE:
5efc495
-		// libwpd > 0.7.1 reports POOR if the text file is plain text (that _could_ be a WP4x document)
5efc495
-		// however, we'll let the text importer handle such cases
5efc495
-		case WPD_CONFIDENCE_POOR: 
5efc495
 			return UT_CONFIDENCE_ZILCH;
5efc495
-		case WPD_CONFIDENCE_LIKELY:
5efc495
-			return UT_CONFIDENCE_SOSO;
5efc495
-		case WPD_CONFIDENCE_GOOD:
5efc495
-			return UT_CONFIDENCE_GOOD;
5efc495
 		case WPD_CONFIDENCE_EXCELLENT:
5efc495
 			return UT_CONFIDENCE_PERFECT;
5efc495
 		default:
5efc495
@@ -328,7 +312,7 @@
5efc495
 UT_Error IE_Imp_WordPerfect::_loadFile(GsfInput * input)
5efc495
 {
5efc495
 	AbiWordperfectInputStream gsfInput(input);
5efc495
-	WPDResult error = WPDocument::parse(&gsfInput, static_cast<WPXHLListenerImpl *>(this));
5efc495
+	WPDResult error = WPDocument::parse(&gsfInput, static_cast<WPXDocumentInterface *>(this), NULL);
5efc495
 
5efc495
 	if (error != WPD_OK)
5efc495
 	{
5efc495
@@ -381,9 +365,9 @@
5efc495
 	float marginLeft = 1.0f, marginRight = 1.0f;
5efc495
 
5efc495
 	if (propList["fo:margin-left"])
5efc495
-		marginLeft = propList["fo:margin-left"]->getFloat();
5efc495
+		marginLeft = propList["fo:margin-left"]->getDouble();
5efc495
 	if (propList["fo:margin-right"])
5efc495
-		marginRight = propList["fo:margin-right"]->getFloat();
5efc495
+		marginRight = propList["fo:margin-right"]->getDouble();
5efc495
 
5efc495
 	if (marginLeft != m_leftPageMargin || marginRight != m_rightPageMargin /* || */
5efc495
 		/* marginTop != m_marginBottom || marginBottom != m_marginBottom */ )
5efc495
@@ -456,15 +440,15 @@
5efc495
 	float marginTop = 0.0f, marginBottom = 0.0f;
5efc495
 	float marginLeft = 0.0f, marginRight = 0.0f, textIndent = 0.0f;
5efc495
 	if (propList["fo:margin-top"])
5efc495
-	    marginTop = propList["fo:margin-top"]->getFloat();
5efc495
+	    marginTop = propList["fo:margin-top"]->getDouble();
5efc495
 	if (propList["fo:margin-bottom"])
5efc495
-	    marginBottom = propList["fo:margin-bottom"]->getFloat();
5efc495
+	    marginBottom = propList["fo:margin-bottom"]->getDouble();
5efc495
 	if (propList["fo:margin-left"])
5efc495
-	    marginLeft = propList["fo:margin-left"]->getFloat();
5efc495
+	    marginLeft = propList["fo:margin-left"]->getDouble();
5efc495
 	if (propList["fo:margin-right"])
5efc495
-	    marginRight = propList["fo:margin-right"]->getFloat();
5efc495
+	    marginRight = propList["fo:margin-right"]->getDouble();
5efc495
 	if (propList["fo:text-indent"])
5efc495
-	    textIndent = propList["fo:text-indent"]->getFloat();
5efc495
+	    textIndent = propList["fo:text-indent"]->getDouble();
5efc495
 
5efc495
 	m_topMargin = marginTop;
5efc495
 	m_bottomMargin = marginBottom;
5efc495
@@ -487,7 +471,7 @@
5efc495
 
5efc495
 	float lineSpacing = 1.0f;
5efc495
 	if (propList["fo:line-height"])
5efc495
-		lineSpacing = propList["fo:line-height"]->getFloat();
5efc495
+		lineSpacing = propList["fo:line-height"]->getDouble();
5efc495
 	
5efc495
 	UT_String tmpBuffer;
5efc495
 	UT_String_sprintf(tmpBuffer, "; margin-top:%.4fin; margin-bottom:%.4fin; margin-left:%.4fin; margin-right:%.4fin; text-indent:%.4fin; line-height:%.4f",
5efc495
@@ -504,7 +488,7 @@
5efc495
 			propBuffer += tmpBuffer;
5efc495
 			if (i()["style:position"])
5efc495
 			{
5efc495
-				UT_String_sprintf(tmpBuffer, "%.4fin", i()["style:position"]->getFloat());
5efc495
+				UT_String_sprintf(tmpBuffer, "%.4fin", i()["style:position"]->getDouble());
5efc495
 				propBuffer += tmpBuffer;
5efc495
 			}
5efc495
 
5efc495
@@ -520,10 +504,10 @@
5efc495
 			else // Left aligned is default
5efc495
 				propBuffer += "/L";
5efc495
 
5efc495
-			if (i()["style:leader-char"])
5efc495
-				if (i()["style:leader-char"]->getStr() == "-")
5efc495
+			if (i()["style:leader-text"])
5efc495
+				if (i()["style:leader-text"]->getStr() == "-")
5efc495
 					propBuffer += "2";
5efc495
-				else if (i()["style:leader-char"]->getStr() == "_")
5efc495
+				else if (i()["style:leader-text"]->getStr() == "_")
5efc495
 					propBuffer += "3";
5efc495
 				else // default to dot leader if the given leader is dot or is not supported by AbiWord
5efc495
 					propBuffer += "1";
5efc495
@@ -586,12 +570,12 @@
5efc495
 			propBuffer += "subscript";
5efc495
 	}
5efc495
 
5efc495
-	if (propList["style:text-underline"] || propList["style:text-crossing-out"])
5efc495
+	if (propList["style:text-underline-type"] || propList["style:text-line-through-type"])
5efc495
 	{
5efc495
 		propBuffer += "; text-decoration:";
5efc495
-		if (propList["style:text-underline"])
5efc495
+		if (propList["style:text-underline-type"])
5efc495
 			propBuffer += "underline ";
5efc495
-		if (propList["style:text-crossing-out"])
5efc495
+		if (propList["style:text-line-through-type"])
5efc495
 			propBuffer += "line-through";
5efc495
 
5efc495
 	}
5efc495
@@ -615,10 +599,10 @@
5efc495
 		propBuffer += propList["fo:color"]->getStr().cstr();
5efc495
 	}
5efc495
 
5efc495
-	if (propList["style:text-background-color"])
5efc495
+	if (propList["fo:background-color"])
5efc495
 	{
5efc495
 		propBuffer += "; bgcolor:";
5efc495
-		propBuffer += propList["style:text-background-color"]->getStr().cstr();
5efc495
+		propBuffer += propList["fo:background-color"]->getStr().cstr();
5efc495
 	}
5efc495
 
5efc495
 	UT_DEBUGMSG(("AbiWordPerfect: Appending span format: %s\n", propBuffer.c_str()));
5efc495
@@ -639,10 +623,10 @@
5efc495
 	int columnsCount = ((columns.count() == 0) ? 1 : columns.count());
5efc495
 
5efc495
 	// TODO: support spaceAfter
5efc495
-	if (propList["fo:margin-left"])
5efc495
-		marginLeft = propList["fo:margin-left"]->getFloat();
5efc495
-	if (propList["fo:margin-right"])
5efc495
-		marginRight = propList["fo:margin-right"]->getFloat();
5efc495
+	if (propList["fo:start-indent"])
5efc495
+		marginLeft = propList["fo:start-indent"]->getDouble();
5efc495
+	if (propList["fo:end-indent"])
5efc495
+		marginRight = propList["fo:end-indent"]->getDouble();
5efc495
 
5efc495
 	if (marginLeft != m_leftSectionMargin || marginRight != m_rightSectionMargin || m_sectionColumnsCount != columnsCount)
5efc495
 		m_bSectionChanged = true;
5efc495
@@ -709,9 +693,9 @@
5efc495
 	if (propList["style:num-format"])
5efc495
 		listType = propList["style:num-format"]->getStr().cstr()[0];
5efc495
 	if (propList["text:space-before"])
5efc495
-		listLeftOffset = propList["text:space-before"]->getFloat();
5efc495
+		listLeftOffset = propList["text:space-before"]->getDouble();
5efc495
 	if (propList["text:min-label-width"])
5efc495
-		listMinLabelWidth = propList["text:min-label-width"]->getFloat();
5efc495
+		listMinLabelWidth = propList["text:min-label-width"]->getDouble();
5efc495
 
5efc495
 	if (!m_pCurrentListDefinition || 
5efc495
 		m_pCurrentListDefinition->getOutlineHash() != listID ||
5efc495
@@ -749,9 +733,9 @@
5efc495
 	if (propList["libwpd:level"])
5efc495
 		level = propList["libwpd:level"]->getInt();
5efc495
 	if (propList["text:space-before"])
5efc495
-		listLeftOffset = propList["text:space-before"]->getFloat();
5efc495
+		listLeftOffset = propList["text:space-before"]->getDouble();
5efc495
 	if (propList["text:min-label-width"])
5efc495
-		listMinLabelWidth = propList["text:min-label-width"]->getFloat();
5efc495
+		listMinLabelWidth = propList["text:min-label-width"]->getDouble();
5efc495
 
5efc495
 	if (!m_pCurrentListDefinition || m_pCurrentListDefinition->getOutlineHash() != listID)
5efc495
 	{
5efc495
@@ -871,10 +855,10 @@
5efc495
 
5efc495
 	UT_String_sprintf(tempBuffer, "margin-left:%.4fin; ", m_pCurrentListDefinition->getListLeftOffset(m_iCurrentListLevel)
5efc495
 					+ m_pCurrentListDefinition->getListMinLabelWidth(m_iCurrentListLevel)
5efc495
-					- (propList["fo:text-indent"] ? propList["fo:text-indent"]->getFloat() : 0.0f));
5efc495
+					- (propList["fo:text-indent"] ? propList["fo:text-indent"]->getDouble() : 0.0f));
5efc495
 	propBuffer += tempBuffer;
5efc495
 	UT_String_sprintf(tempBuffer, "text-indent:%.4fin", - m_pCurrentListDefinition->getListMinLabelWidth(m_iCurrentListLevel)
5efc495
-					+ (propList["fo:text-indent"] ? propList["fo:text-indent"]->getFloat() : 0.0f));
5efc495
+					+ (propList["fo:text-indent"] ? propList["fo:text-indent"]->getDouble() : 0.0f));
5efc495
 	propBuffer += tempBuffer;
5efc495
 
5efc495
 	listAttribs[attribsCount++] = PT_PROPS_ATTRIBUTE_NAME;
5efc495
@@ -1263,7 +1247,7 @@
5efc495
     virtual UT_Error _loadFile(GsfInput * input)
5efc495
 	{
5efc495
 		AbiWordperfectInputStream gsfInput(input);
5efc495
-		WPSResult error = WPSDocument::parse(&gsfInput, static_cast<WPXHLListenerImpl *>(this));
5efc495
+		WPSResult error = WPSDocument::parse(&gsfInput, static_cast<WPXDocumentInterface *>(this));
5efc495
 
5efc495
 		if (error != WPS_OK)
5efc495
 			{
5efc495
@@ -1302,18 +1286,12 @@
5efc495
 {
5efc495
 	AbiWordperfectInputStream gsfInput(input);
5efc495
 
5efc495
-	WPSConfidence confidence = WPSDocument::isFileFormatSupported(&gsfInput, true);
5efc495
+	WPSConfidence confidence = WPSDocument::isFileFormatSupported(&gsfInput);
5efc495
 
5efc495
 	switch (confidence)
5efc495
 	{
5efc495
 		case WPS_CONFIDENCE_NONE:
5efc495
 			return UT_CONFIDENCE_ZILCH;
5efc495
-		case WPS_CONFIDENCE_POOR: 
5efc495
-			return UT_CONFIDENCE_POOR;
5efc495
-		case WPS_CONFIDENCE_LIKELY:
5efc495
-			return UT_CONFIDENCE_SOSO;
5efc495
-		case WPS_CONFIDENCE_GOOD:
5efc495
-			return UT_CONFIDENCE_GOOD;
5efc495
 		case WPS_CONFIDENCE_EXCELLENT:
5efc495
 			return UT_CONFIDENCE_PERFECT;
5efc495
 		default:
5efc495
--- plugins/wordperfect/xp/ie_imp_WordPerfect.h	(revision 29401)
5efc495
+++ plugins/wordperfect/xp/ie_imp_WordPerfect.h	(revision 29403)
5efc495
@@ -30,13 +30,7 @@
5efc495
 #define IE_IMP_WP_H
5efc495
 
5efc495
 #include <stdio.h>
5efc495
-#ifdef _WIN32
5efc495
-#define POINT WPX_POINT
5efc495
-#endif
5efc495
 #include <libwpd/libwpd.h>
5efc495
-#ifdef _WIN32
5efc495
-#undef POINT
5efc495
-#endif
5efc495
 #include "ie_imp.h"
5efc495
 #include "ut_string.h"
5efc495
 #include "ut_string_class.h"
5efc495
@@ -98,7 +92,7 @@
5efc495
 					IE_Imp ** ppie);
5efc495
 };
5efc495
 
5efc495
-class IE_Imp_WordPerfect : public IE_Imp, public WPXHLListenerImpl
5efc495
+class IE_Imp_WordPerfect : public IE_Imp, public WPXDocumentInterface
5efc495
 {
5efc495
 public:
5efc495
     IE_Imp_WordPerfect(PD_Document * pDocument);
5efc495
@@ -154,6 +148,21 @@
5efc495
     virtual void insertCoveredTableCell(const WPXPropertyList & /*propList*/) {}
5efc495
     virtual void closeTable();
5efc495
 
5efc495
+    virtual void definePageStyle(const WPXPropertyList&) {}
5efc495
+    virtual void defineParagraphStyle(const WPXPropertyList&, const WPXPropertyListVector&) {}
5efc495
+    virtual void defineCharacterStyle(const WPXPropertyList&) {}
5efc495
+    virtual void defineSectionStyle(const WPXPropertyList&, const WPXPropertyListVector&) {}
5efc495
+    virtual void insertSpace() {}
5efc495
+    virtual void insertField(const WPXString&, const WPXPropertyList&) {}
5efc495
+    virtual void openComment(const WPXPropertyList&) {}
5efc495
+    virtual void closeComment() {}
5efc495
+    virtual void openTextBox(const WPXPropertyList&) {}
5efc495
+    virtual void closeTextBox() {}
5efc495
+    virtual void openFrame(const WPXPropertyList&) {}
5efc495
+    virtual void closeFrame() {}
5efc495
+    virtual void insertBinaryObject(const WPXPropertyList&, const WPXBinaryData&) {}
5efc495
+    virtual void insertEquation(const WPXPropertyList&, const WPXString&) {}
5efc495
+
5efc495
     
5efc495
 protected:
5efc495
 	virtual UT_Error _loadFile(GsfInput * input);
5efc495
--- plugins/wordperfect/plugin.m4	(revision 29401)
5efc495
+++ plugins/wordperfect/plugin.m4	(revision 29403)
5efc495
@@ -1,6 +1,6 @@
5efc495
 
5efc495
-wordperfect_pkgs="libwpd-0.8 >= 0.8.0 $gsf_req"
5efc495
-wordperfect_wps_pkgs='libwps-0.1 >= 0.1.0'
5efc495
+wordperfect_pkgs="libwpg-0.2 >= 0.2.0 libwpd-0.9 >= 0.9.0 libwpd-stream-0.9 >= 0.9.0 $gsf_req"
5efc495
+wordperfect_wps_pkgs='libwps-0.2 >= 0.1.0'
5efc495
 wordperfect_deps="no"
5efc495
 
5efc495
 WORDPERFECT_CFLAGS=
5efc495
--- plugins/wpg/xp/ie_impGraphic_WPG.cpp	(revision 29401)
5efc495
+++ plugins/wpg/xp/ie_impGraphic_WPG.cpp	(revision 29403)
5efc495
@@ -31,11 +31,10 @@
5efc495
 #include <gsf/gsf-input-memory.h>
5efc495
 #include <gsf/gsf-input-stdio.h>
5efc495
 #include <gsf/gsf-infile-msole.h>
5efc495
-#include <libwpd/WPXStream.h>
5efc495
+#include <libwpd-stream/libwpd-stream.h>
5efc495
 #include "xap_Module.h"
5efc495
 
5efc495
 using libwpg::WPGraphics;
5efc495
-using libwpg::WPGString;
5efc495
 
5efc495
 ABI_PLUGIN_DECLARE("WPG")
5efc495
 
5efc495
@@ -48,7 +47,7 @@
5efc495
 	virtual bool isOLEStream();
5efc495
 	virtual WPXInputStream * getDocumentOLEStream();
5efc495
 	virtual WPXInputStream * getDocumentOLEStream(const char * name);
5efc495
-	virtual const uint8_t *read(size_t numBytes, size_t &numBytesRead);
5efc495
+	virtual const unsigned char *read(unsigned long numBytes, unsigned long &numBytesRead);
5efc495
 	virtual int seek(long offset, WPX_SEEK_TYPE seekType);
5efc495
 	virtual long tell();
5efc495
 	virtual bool atEOS();
5efc495
@@ -60,7 +59,7 @@
5efc495
 };
5efc495
 
5efc495
 AbiWordPerfectGraphicsInputStream::AbiWordPerfectGraphicsInputStream(GsfInput *input) :
5efc495
-	WPXInputStream(true),
5efc495
+	WPXInputStream(),
5efc495
 	m_input(input),
5efc495
 	m_ole(NULL)
5efc495
 {
5efc495
@@ -75,9 +74,9 @@
5efc495
 	g_object_unref(G_OBJECT(m_input));
5efc495
 }
5efc495
 
5efc495
-const uint8_t * AbiWordPerfectGraphicsInputStream::read(size_t numBytes, size_t &numBytesRead)
5efc495
+const unsigned char * AbiWordPerfectGraphicsInputStream::read(unsigned long numBytes, unsigned long &numBytesRead)
5efc495
 {
5efc495
-	const uint8_t *buf = gsf_input_read(m_input, numBytes, NULL);
5efc495
+	const unsigned char *buf = gsf_input_read(m_input, numBytes, NULL);
5efc495
 
5efc495
 	if (buf == NULL)
5efc495
 		numBytesRead = 0;
5efc495
@@ -245,10 +244,10 @@
5efc495
 UT_Error IE_Imp_WordPerfectGraphics::importGraphic(GsfInput *input, FG_Graphic **ppfg)
5efc495
 {
5efc495
 	AbiWordPerfectGraphicsInputStream gsfInput(input);
5efc495
-	WPGString svgOutput;
5efc495
+	WPXString svgOutput;
5efc495
 	if (WPGraphics::generateSVG(&gsfInput, svgOutput))
5efc495
 	{
5efc495
-		GsfInput * svgInput = gsf_input_memory_new((const guint8*)svgOutput.cstr(), svgOutput.length(), false);
5efc495
+		GsfInput * svgInput = gsf_input_memory_new((const guint8*)svgOutput.cstr(), svgOutput.len(), false);
5efc495
 		UT_Error result = IE_ImpGraphic::loadGraphic(svgInput, IE_ImpGraphic::fileTypeForSuffix(".svg"), ppfg);
5efc495
 		g_object_unref(svgInput);
5efc495
 		return result;
5efc495
--- plugins/wpg/plugin.m4	(revision 29401)
5efc495
+++ plugins/wpg/plugin.m4	(revision 29403)
5efc495
@@ -1,5 +1,5 @@
5efc495
 
5efc495
-wpg_pkgs="$gsf_req libwpg-0.1 >= 0.1.0 libwpd-0.8 >= 0.8.0"
5efc495
+wpg_pkgs="$gsf_req libwpg-0.2 >= 0.2.0 libwpd-0.9 >= 0.9.0 libwpd-stream-0.9 >= 0.9.0"
5efc495
 wpg_deps="no"
5efc495
 
5efc495
 if test "$enable_wpg" != ""; then
5efc495
5efc495