If WPS4.{c,h} were cleaned up and split up into separate files, would this code be acceptable? Am I on the right track?
Andrew

P.S.
I still need to take another look at the copyrights in WPS4.cpp because of a bit of copy and paste.
diff --exclude='*.in' -ur libwpd-0.8.6.original/src/lib/GSFStream.cpp libwpd-0.8.6/src/lib/GSFStream.cpp
--- libwpd-0.8.6.original/src/lib/GSFStream.cpp	2005-12-05 06:53:48.000000000 -0700
+++ libwpd-0.8.6/src/lib/GSFStream.cpp	2006-08-19 09:57:07.000000000 -0600
@@ -83,7 +83,7 @@
 	return false;
 }
 
-WPXInputStream * GSFInputStream::getDocumentOLEStream()
+WPXInputStream * GSFInputStream::getDocumentOLEStream(char * streamName)
 {
 	WPXInputStream *documentStream = NULL;
 
@@ -92,7 +92,7 @@
 
 	if (m_ole)
 	{
-		GsfInput *document = gsf_infile_child_by_name(m_ole, "PerfectOffice_MAIN");
+		GsfInput *document = gsf_infile_child_by_name(m_ole, streamName);
 		if (document) 
 		{
 			documentStream = new GSFInputStream(document);
diff --exclude='*.in' -ur libwpd-0.8.6.original/src/lib/GSFStream.h libwpd-0.8.6/src/lib/GSFStream.h
--- libwpd-0.8.6.original/src/lib/GSFStream.h	2005-12-05 06:53:48.000000000 -0700
+++ libwpd-0.8.6/src/lib/GSFStream.h	2006-08-19 09:57:11.000000000 -0600
@@ -35,7 +35,7 @@
 	virtual ~GSFInputStream();
 
 	virtual bool isOLEStream();
-	virtual WPXInputStream * getDocumentOLEStream();
+	virtual WPXInputStream * getDocumentOLEStream(char * streamName);
 
 	virtual const uint8_t *read(size_t numBytes, size_t &numBytesRead);
 	virtual int seek(long offset, WPX_SEEK_TYPE seekType);
diff --exclude='*.in' -ur libwpd-0.8.6.original/src/lib/Makefile.am libwpd-0.8.6/src/lib/Makefile.am
--- libwpd-0.8.6.original/src/lib/Makefile.am	2006-07-14 14:34:45.000000000 -0600
+++ libwpd-0.8.6/src/lib/Makefile.am	2006-08-19 10:37:10.000000000 -0600
@@ -148,6 +148,7 @@
 	WP6UnsupportedFixedLengthGroup.cpp \
 	WP6UnsupportedVariableLengthGroup.cpp \
 	WP6VariableLengthGroup.cpp \
+	WPS4.cpp \
 	WPDocument.cpp \
 	WPXContentListener.cpp \
 	WPXHeader.cpp \
diff --exclude='*.in' -ur libwpd-0.8.6.original/src/lib/WPDocument.cpp libwpd-0.8.6/src/lib/WPDocument.cpp
--- libwpd-0.8.6.original/src/lib/WPDocument.cpp	2006-07-14 14:34:52.000000000 -0600
+++ libwpd-0.8.6/src/lib/WPDocument.cpp	2006-08-19 13:57:54.000000000 -0600
@@ -33,6 +33,7 @@
 #include "WP42Heuristics.h"
 #include "WP5Parser.h"
 #include "WP6Parser.h"
+#include "WPS4.h"
 #include "WPXStream.h"
 #include "libwpd_internal.h"
 
@@ -52,21 +53,14 @@
 */
 
 /**
-Analyzes the content of an input stream to see if it can be parsed
-\param input The input stream
-\param partialContent A boolean which states if the content from the input stream
-represents the full contents of a WordPerfect file, or just the first X bytes
-\return A confidence value which represents the likelyhood that the content from
-the input stream can be parsed
+Check for WordPerfect support.
 */
-WPDConfidence WPDocument::isFileFormatSupported(WPXInputStream *input, bool partialContent)
+WPDConfidence WPDocument::isFileFormatSupportedWPD(WPXInputStream *input, bool partialContent)
 {
 	WPDConfidence confidence = WPD_CONFIDENCE_NONE;
 
 	WPXHeader *header = NULL;
 
-	WPD_DEBUG_MSG(("WPDocument::isFileFormatSupported()\n"));
-
 	// by-pass the OLE stream (if it exists) and returns the (sub) stream with the
 	// WordPerfect document.
 	WPXInputStream *document = NULL;
@@ -75,7 +69,7 @@
 	// BIG BIG NOTE: very unsafe on partial content!!!
 	if (input->isOLEStream())
 	{
-		document = input->getDocumentOLEStream();
+		document = input->getDocumentOLEStream("PerfectOffice_MAIN");
 		if (document)
 			isDocumentOLE = true;
 		else
@@ -163,17 +157,81 @@
 		return WPD_CONFIDENCE_NONE;
 	}
 
+
+}
+
+
+/**
+Check for Microsoft Works support.
+**/
+WPDConfidence WPDocument::isFileFormatSupportedWPS(WPXInputStream *input, bool partialContent)
+{
+	WPXInputStream * document_mn0 = input->getDocumentOLEStream("MN0");	
+	
+	//fixme: catch exceptions
+	if (document_mn0)
+	{
+		WPD_DEBUG_MSG(("Microsoft Works 4 format detected\n"));	
+		DELETEP(document_mn0);		
+		return WPD_CONFIDENCE_EXCELLENT;
+	}	
+	
+	WPXInputStream * document_contents = input->getDocumentOLEStream("CONTENTS");	
+	
+	if (document_contents)
+	{
+		/* check the Works 2000/7/8 format magic */
+		document_contents->seek(0, WPX_SEEK_SET);
+		
+		char fileMagic[8];
+		size_t numBytesRead;
+		for (int i=0; i<7 && !document_contents->atEOS(); i++)
+			fileMagic[i] = readU8(document_contents);		
+		fileMagic[7] = '\0';
+	
+		/* Works 7/8 */
+		if (0 == strcmp(fileMagic, "CHNKWKS"))
+		{
+			WPD_DEBUG_MSG(("Microsoft Works 8 (maybe 7) format detected\n"));
+		}
+		
+		/* Works 2000 */		
+		if (0 == strcmp(fileMagic, "CHNKINK"))
+		{
+			WPD_DEBUG_MSG(("Microsoft Works 2000 (v5) format detected\n"));
+		}	
+		DELETEP(document_contents);
+	}
+	
 	return WPD_CONFIDENCE_NONE;
 }
 
 /**
-Parses the input stream content. It will make callbacks to the functions provided by a
-WPXHLListenerImpl class implementation when needed. This is often commonly called the
-'main parsing routine'.
+Analyzes the content of an input stream to see if it can be parsed
 \param input The input stream
-\param listenerImpl A WPXListener implementation
+\param partialContent A boolean which states if the content from the input stream
+represents the full contents of a WordPerfect file, or just the first X bytes
+\return A confidence value which represents the likelyhood that the content from
+the input stream can be parsed
 */
-WPDResult WPDocument::parse(WPXInputStream *input, WPXHLListenerImpl *listenerImpl)
+WPDConfidence WPDocument::isFileFormatSupported(WPXInputStream *input, bool partialContent)
+{
+	WPDConfidence confidence = WPD_CONFIDENCE_NONE;
+
+	WPD_DEBUG_MSG(("WPDocument::isFileFormatSupported()\n"));
+	
+	confidence = isFileFormatSupportedWPD(input, partialContent);
+	
+	if (WPD_CONFIDENCE_NONE == confidence)
+	{
+		confidence = isFileFormatSupportedWPS(input, partialContent);
+	}
+
+	return confidence;
+}
+
+
+WPDResult WPDocument::parseWPD(WPXInputStream *input, WPXHLListenerImpl *listenerImpl)
 {
 	WPXParser *parser = NULL;
 
@@ -186,7 +244,7 @@
 	WPD_DEBUG_MSG(("WPDocument::parse()\n"));
 	if (input->isOLEStream())
 	{
-		document = input->getDocumentOLEStream();
+		document = input->getDocumentOLEStream("PerfectOffice_MAIN");
 		if (document)
 			isDocumentOLE = true;
 		else
@@ -249,7 +307,7 @@
 			DELETEP(parser); // deletes the header as well
 		}
 		else
-		{
+		{	
 			// WP file formats prior to version 5.x do not contain a generic
 			// header which can be used to determine which parser to instanciate.
 			// Use heuristics to determine with some certainty if we are dealing with
@@ -296,3 +354,42 @@
 
 	return error;
 }
+
+
+WPDResult WPDocument::parseWPS(WPXInputStream *input, WPXHLListenerImpl *listenerImpl)
+{
+	WPXInputStream * document_mn0 = input->getDocumentOLEStream("MN0");	
+	
+	WPDResult error = WPD_OK;
+	
+	//fixme: catch exceptions
+	if (document_mn0)
+	{
+		WPD_DEBUG_MSG(("Microsoft Works 4 format detected\n"));	
+		WPS4Parser *parser = new WPS4Parser(document_mn0, NULL);
+		parser->parse(listenerImpl);
+		DELETEP(parser);		
+		DELETEP(document_mn0);		
+	}	
+	else
+		error = WPD_UNKNOWN_ERROR; //fixme too generic
+		
+	return error;
+}
+
+/**
+Parses the input stream content. It will make callbacks to the functions provided by a
+WPXHLListenerImpl class implementation when needed. This is often commonly called the
+'main parsing routine'.
+\param input The input stream
+\param listenerImpl A WPXListener implementation
+*/
+WPDResult WPDocument::parse(WPXInputStream *input, WPXHLListenerImpl *listenerImpl)
+{
+	WPDResult error = parseWPD(input, listenerImpl);
+	
+	if (WPD_OK != error)
+	{
+		parseWPS(input, listenerImpl);
+	}
+}
diff --exclude='*.in' -ur libwpd-0.8.6.original/src/lib/WPDocument.h libwpd-0.8.6/src/lib/WPDocument.h
--- libwpd-0.8.6.original/src/lib/WPDocument.h	2005-12-21 02:57:39.000000000 -0700
+++ libwpd-0.8.6/src/lib/WPDocument.h	2006-08-19 10:44:25.000000000 -0600
@@ -45,6 +45,12 @@
 	static WPDResult parse(WPXInputStream *input, WPXHLListenerImpl *listenerImpl);
 	//static void parse(WPXInputStream *input, WPXHLListenerImpl *listenerImpl, WPXFileType fileType);
 	//WPXFileType getFileType(WPXInputStream *input)
+private:
+	static WPDConfidence isFileFormatSupportedWPD(WPXInputStream *input, bool partialContent);
+	static WPDConfidence isFileFormatSupportedWPS(WPXInputStream *input, bool partialContent);
+	static WPDResult parseWPD(WPXInputStream *input, WPXHLListenerImpl *listenerImpl);	
+	static WPDResult parseWPS(WPXInputStream *input, WPXHLListenerImpl *listenerImpl);	
+	
 };
 
 #endif /* WPDOCUMENT_H */
diff --exclude='*.in' -ur libwpd-0.8.6.original/src/lib/WPXMemoryStream.h libwpd-0.8.6/src/lib/WPXMemoryStream.h
--- libwpd-0.8.6.original/src/lib/WPXMemoryStream.h	2006-07-14 14:34:53.000000000 -0600
+++ libwpd-0.8.6/src/lib/WPXMemoryStream.h	2006-08-19 09:50:21.000000000 -0600
@@ -33,7 +33,7 @@
 	virtual ~WPXMemoryInputStream();
 
 	virtual bool isOLEStream() { return false; }
-	virtual WPXInputStream * getDocumentOLEStream() { return NULL; }
+	virtual WPXInputStream * getDocumentOLEStream(char * streamName) { return NULL; }
 	
 	const virtual uint8_t *read(size_t numBytes, size_t &numBytesRead);
 	virtual int seek(long offset, WPX_SEEK_TYPE seekType);
diff --exclude='*.in' -ur libwpd-0.8.6.original/src/lib/WPXStream.h libwpd-0.8.6/src/lib/WPXStream.h
--- libwpd-0.8.6.original/src/lib/WPXStream.h	2006-07-14 14:34:53.000000000 -0600
+++ libwpd-0.8.6/src/lib/WPXStream.h	2006-08-19 09:50:34.000000000 -0600
@@ -52,7 +52,7 @@
 	\return Should be a NULL pointer, if the \c PerfectOffice_MAIN stream does not exist inside the OLE2 storage
 	or if the input stream is not an OLE2 storage.
 	*/
-	virtual WPXInputStream * getDocumentOLEStream() = 0;
+	virtual WPXInputStream * getDocumentOLEStream(char * streamName) = 0;
 
 	/**
 	Tries to read a given number of bytes starting from the current position inside the input stream.
--- /dev/null	2006-08-13 00:54:12.846607000 -0600
+++ libwpd-0.8.6/src/lib/WPS4.cpp	2006-08-19 15:26:06.000000000 -0600
@@ -0,0 +1,228 @@
+/* libwps
+ * Copyright (C) 2006 Andrew Ziem
+ * Copyright (C) 2004 Marc Maurer ([EMAIL PROTECTED])
+ * Copyright (C) 2004-2006 Fridrich Strba ([EMAIL PROTECTED])
+ *
+ * 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; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+ *
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include "WPS4.h"
+#include "WPDocument.h"
+#include "WPXHeader.h"
+#include "WPXStream.h"
+#include "libwpd_internal.h"
+
+
+/*
+WPS4Parser public
+*/
+
+
+WPS4Parser::WPS4Parser(WPXInputStream *input, WPXHeader * header) :
+	WPXParser(input, header)
+{
+	//fixme: don't ask for a header that we don't use
+}
+
+WPS4Parser::~WPS4Parser ()
+{
+
+}
+
+void WPS4Parser::parse(WPXHLListenerImpl *listenerImpl)
+{
+	//fixme: pageList not used
+	std::list<WPXPageSpan> pageList;
+	//fixme: subDocuments not used
+	std::vector<WPS4SubDocument *> subDocuments;	
+	//fixme: tableList not used
+	WPXTableList tableList;	
+	
+	WPXPageSpan m_currentPage;
+	pageList.push_front(m_currentPage);
+		
+	WPD_DEBUG_MSG(("WPS4Parser::parse()\n"));		
+
+	WPXInputStream *input = getInput();
+	WPS4ContentListener listener(pageList, subDocuments, listenerImpl);
+	parse(input, &listener);	
+}
+
+
+/*
+WPS4Parser private
+*/
+
+void WPS4Parser::parse(WPXInputStream *input, WPS4Listener *listener)
+{
+	uint8_t readVal;
+	size_t text_length;
+	
+	WPD_DEBUG_MSG(("WPS4Parser::parse()\n"));	
+
+	listener->startDocument();
+	
+	input->seek(0x26, WPX_SEEK_SET);
+	if ((text_length = readU32(input)) < 260)
+	{
+		WPD_DEBUG_MSG(("Works: Text length too short\n"));	
+		throw FileException();
+	}
+	text_length -= 260;
+	WPD_DEBUG_MSG(("Works: text_length = %i\n", text_length));
+	
+	input->seek(0x102, WPX_SEEK_SET);
+	
+	for ( ; text_length>0; text_length--)
+	{
+		readVal = readU8( input );
+		if (0x0D == readVal)
+		{
+			listener->insertEOL();
+		}
+		else if (0x0A != readVal)
+			listener->insertCharacter( (uint16_t)readVal );
+	}
+	
+	listener->endDocument();		
+}
+
+
+/*
+WPS4Listener public
+*/
+
+WPS4Listener::WPS4Listener()
+{
+}
+
+
+/*
+WPS4ContentParsingState public
+*/
+
+_WPS4ContentParsingState::_WPS4ContentParsingState()
+{
+	m_textBuffer.clear();
+}
+
+_WPS4ContentParsingState::~_WPS4ContentParsingState()
+{
+	m_textBuffer.clear();
+}
+
+
+/*
+WPS4ContentListener public
+*/
+
+WPS4ContentListener::WPS4ContentListener(std::list<WPXPageSpan> &pageList, std::vector<WPS4SubDocument *> &subDocuments, WPXHLListenerImpl *listenerImpl) :
+	WPS4Listener(),
+	WPXContentListener(pageList, listenerImpl),
+	m_parseState(new WPS4ContentParsingState)
+{
+}
+
+WPS4ContentListener::~WPS4ContentListener()
+{
+	delete m_parseState;
+}
+
+void WPS4ContentListener::insertCharacter(const uint16_t character) 
+{
+//	WPD_DEBUG_MSG(("WPS4ContentListener::insertCharacter()\n"));		
+	if (!m_ps->m_isSpanOpened)
+		_openSpan();
+	m_parseState->m_textBuffer.append(character);
+}
+
+void WPS4ContentListener::insertTab(const uint8_t tabType, float tabPosition) 
+{
+	WPD_DEBUG_MSG(("STUB WPS4ContentListener::insertTab()\n"));		
+}
+
+void WPS4ContentListener::insertEOL() 
+{
+//	WPD_DEBUG_MSG(("WPS4ContentListener::insertEOL()\n"));		
+	if (!m_ps->m_isParagraphOpened && !m_ps->m_isListElementOpened)
+		_openSpan();
+	if (m_ps->m_isParagraphOpened)
+		_closeParagraph();
+	if (m_ps->m_isListElementOpened)
+		_closeListElement();
+}
+
+void WPS4ContentListener::attributeChange(const bool isOn, const uint8_t attribute) {}
+void WPS4ContentListener::marginChange(const uint8_t side, const uint16_t margin) {}
+void WPS4ContentListener::indentFirstLineChange(const int16_t offset) {}
+void WPS4ContentListener::columnChange(const WPXTextColumnType columnType, const uint8_t numColumns, const std::vector<float> &columnWidth,
+				const std::vector<bool> &isFixedWidth) {}
+
+void WPS4ContentListener::defineTable(const uint8_t position, const uint16_t leftOffset) {}
+void WPS4ContentListener::addTableColumnDefinition(const uint32_t width, const uint32_t leftGutter, const uint32_t rightGutter,
+				const uint32_t attributes, const uint8_t alignment) {}
+void WPS4ContentListener::startTable() {}
+void WPS4ContentListener::insertRow() {}
+void WPS4ContentListener::insertCell() {}
+void WPS4ContentListener::closeCell() {}
+void WPS4ContentListener::closeRow() {}
+void WPS4ContentListener::setTableCellSpan(const uint16_t colSpan, const uint16_t rowSpan) {}
+void WPS4ContentListener::setTableCellFillColor(const RGBSColor * cellFillColor) {}
+void WPS4ContentListener::endTable() {}
+void WPS4ContentListener::undoChange(const uint8_t undoType, const uint16_t undoLevel) {}
+void WPS4ContentListener::justificationChange(const uint8_t justification) {}
+void WPS4ContentListener::setTextColor(const RGBSColor * fontColor) {}
+
+void WPS4ContentListener::setTextFont(const WPXString fontName)
+{
+	WPD_DEBUG_MSG(("STUB WPS4ContentListener::setTextFont()\n"));		
+}
+
+void WPS4ContentListener::setFontSize(const uint16_t fontSize)
+{
+	WPD_DEBUG_MSG(("STUB WPS4ContentListener::setTextSize()\n"));		
+}
+
+void WPS4ContentListener::insertPageNumber(const WPXString &pageNumber) {}
+void WPS4ContentListener::insertNoteReference(const WPXString &noteReference) {}
+void WPS4ContentListener::insertNote(const WPXNoteType noteType) {}
+void WPS4ContentListener::suppressPage(const uint16_t suppressCode) {}
+
+
+/*
+WPS4ContentListener protected 
+*/
+
+void WPS4ContentListener::_handleSubDocument(const WPXSubDocument *subDocument, const bool isHeaderFooter, WPXTableList tableList, int nextTableIndice)
+{
+	WPD_DEBUG_MSG(("STUB WPS4ContentListener::_handleSubDocument()\n"));		
+}
+
+void WPS4ContentListener::_openParagraph()
+{
+	WPD_DEBUG_MSG(("STUB WPS4ContentListener::_openParagraph()\n"));		
+	WPXContentListener::_openParagraph();
+}
+
+void WPS4ContentListener::_flushText()
+{
+//	WPD_DEBUG_MSG(("WPS4ContentListener::_flushText()\n"));		
+	if (m_parseState->m_textBuffer.len())
+		m_listenerImpl->insertText(m_parseState->m_textBuffer);
+	m_parseState->m_textBuffer.clear();
+}
--- /dev/null	2006-08-13 00:54:12.846607000 -0600
+++ libwpd-0.8.6/src/lib/WPS4.h	2006-08-19 14:49:31.000000000 -0600
@@ -0,0 +1,176 @@
+/* libwpd
+ * Copyright (C) 2006 Andrew Ziem
+ * Copyright (C) 2003-2005 William Lachance ([EMAIL PROTECTED])
+ * Copyright (C) 2003 Marc Maurer ([EMAIL PROTECTED])
+ *  
+ * 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; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+ *
+ */
+
+#ifndef WPS4_H
+#define WPS4_H
+
+#include <vector>
+
+#include "libwpd_internal.h"
+#include "WPXContentListener.h"
+#include "WPXStream.h"
+#include "WPXString.h"
+#include "WPXSubDocument.h"
+#include "WPXParser.h"
+
+enum WPS4OutlineLocation { paragraphGroup, indexHeader };
+
+class WPS4Listener;
+
+class WPS4SubDocument : public WPXSubDocument
+{
+public:
+	WPS4SubDocument(uint8_t * streamData, const int dataSize);
+	void parse(WPS4Listener *listener) const;
+};
+
+class WPS4PrefixDataPacket
+{
+public:
+	WPS4PrefixDataPacket(WPXInputStream * input);	
+	virtual ~WPS4PrefixDataPacket() {}
+	virtual void parse(WPS4Listener *listener) const {}
+	virtual WPS4SubDocument * getSubDocument() const { return NULL; }
+
+//	static WPS4PrefixDataPacket * constructPrefixDataPacket(WPXInputStream * input, WPS4PrefixIndice *prefixIndice);
+
+protected:
+	virtual void _readContents(WPXInputStream *input) = 0;
+ 	void _read(WPXInputStream *input, uint32_t dataOffset, uint32_t dataSize);
+};
+
+
+class WPS4Listener
+{
+public:
+	WPS4Listener();
+	virtual ~WPS4Listener() {}
+
+	virtual void startDocument() = 0;
+	virtual void insertCharacter(const uint16_t character) = 0;
+	virtual void insertTab(const uint8_t tabType, float tabPosition) = 0;
+	virtual void insertBreak(const uint8_t breakType) = 0;
+	virtual void insertEOL() = 0;
+	virtual void lineSpacingChange(const float lineSpacing) = 0;
+	virtual void attributeChange(const bool isOn, const uint8_t attribute) = 0;
+	virtual void pageMarginChange(const uint8_t side, const uint16_t margin) = 0;
+	virtual void pageFormChange(const uint16_t length, const uint16_t width, const WPXFormOrientation orientation, const bool isPersistent) = 0;
+	virtual void marginChange(const uint8_t side, const uint16_t margin) = 0;
+	virtual void indentFirstLineChange(const int16_t offset) = 0;
+	virtual void columnChange(const WPXTextColumnType columnType, const uint8_t numColumns, const std::vector<float> &columnWidth,
+					const std::vector<bool> &isFixedWidth) = 0;
+	virtual void endDocument() = 0;
+
+	virtual void defineTable(const uint8_t position, const uint16_t leftOffset) = 0;
+	virtual void addTableColumnDefinition(const uint32_t width, const uint32_t leftGutter, const uint32_t rightGutter,
+					const uint32_t attributes, const uint8_t alignment) = 0;
+	virtual void startTable() = 0;
+ 	virtual void closeCell() = 0;
+	virtual void closeRow() = 0;
+	virtual void setTableCellSpan(const uint16_t colSpan, const uint16_t rowSpan) = 0;
+	virtual void setTableCellFillColor(const RGBSColor * cellFillColor) = 0;
+ 	virtual void endTable() = 0;
+	virtual void undoChange(const uint8_t undoType, const uint16_t undoLevel) = 0;
+	virtual void justificationChange(const uint8_t justification) = 0;
+	virtual void setTextColor(const RGBSColor * fontColor) = 0;
+	virtual void setTextFont(const WPXString fontName) = 0;
+	virtual void setFontSize(const uint16_t fontSize) = 0;
+	virtual void insertPageNumber(const WPXString &pageNumber) = 0;
+	virtual void insertNoteReference(const WPXString &noteReference) = 0;
+	virtual void suppressPage(const uint16_t suppressCode) = 0;
+};
+
+class WPS4Parser : public WPXParser
+{
+public:
+	WPS4Parser(WPXInputStream *input, WPXHeader * header);
+	~WPS4Parser();
+
+	void parse(WPXHLListenerImpl *listenerImpl);
+private:
+	void parse(WPXInputStream *stream, WPS4Listener *listener);
+};
+
+
+typedef struct _WPS4ContentParsingState WPS4ContentParsingState;
+struct _WPS4ContentParsingState
+{
+	_WPS4ContentParsingState();
+	~_WPS4ContentParsingState();
+	WPXString m_textBuffer;
+};
+
+
+class WPS4ContentListener : public WPS4Listener, protected WPXContentListener
+{
+public:
+	WPS4ContentListener(std::list<WPXPageSpan> &pageList, std::vector<WPS4SubDocument *> &subDocuments, WPXHLListenerImpl *listenerImpl);
+	~WPS4ContentListener();
+
+	void startDocument() { WPXContentListener::startDocument(); };
+	void insertCharacter(const uint16_t character);
+	void insertTab(const uint8_t tabType, float tabPosition);
+	void insertBreak(const uint8_t breakType) { WPXContentListener::insertBreak(breakType); };
+	void insertEOL();
+	void attributeChange(const bool isOn, const uint8_t attribute);
+	void lineSpacingChange(const float lineSpacing) { WPXContentListener::lineSpacingChange(lineSpacing); };
+	void pageMarginChange(const uint8_t side, const uint16_t margin) {};
+	void pageFormChange(const uint16_t length, const uint16_t width, const WPXFormOrientation orientation, const bool isPersistent) {};
+	void marginChange(const uint8_t side, const uint16_t margin);
+	void indentFirstLineChange(const int16_t offset);
+	void columnChange(const WPXTextColumnType columnType, const uint8_t numColumns, const std::vector<float> &columnWidth,
+					const std::vector<bool> &isFixedWidth);
+	void endDocument() { WPXContentListener::endDocument(); };
+
+	void defineTable(const uint8_t position, const uint16_t leftOffset);
+	void addTableColumnDefinition(const uint32_t width, const uint32_t leftGutter, const uint32_t rightGutter,
+					const uint32_t attributes, const uint8_t alignment);
+	void startTable();
+ 	void insertRow();
+ 	void insertCell();
+ 	void closeCell();
+	void closeRow();
+	void setTableCellSpan(const uint16_t colSpan, const uint16_t rowSpan);
+	void setTableCellFillColor(const RGBSColor * cellFillColor);
+ 	void endTable();
+	void undoChange(const uint8_t undoType, const uint16_t undoLevel);
+	void justificationChange(const uint8_t justification);
+	void setTextColor(const RGBSColor * fontColor);
+	void setTextFont(const WPXString fontName);
+	void setFontSize(const uint16_t fontSize);
+	void insertPageNumber(const WPXString &pageNumber);
+	void insertNoteReference(const WPXString &noteReference);
+	void insertNote(const WPXNoteType noteType);
+//	void headerFooterGroup(const uint8_t headerFooterType, const uint8_t occurenceBits, WP3SubDocument *subDocument);
+	void suppressPage(const uint16_t suppressCode);
+	
+protected:
+	void _handleSubDocument(const WPXSubDocument *subDocument, const bool isHeaderFooter, WPXTableList tableList, int nextTableIndice = 0);
+	void _openParagraph();
+
+	void _flushText();
+	void _changeList() {};
+	
+private:
+	WPS4ContentParsingState *m_parseState;	
+};
+
+#endif /* WPS6_H */
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Libwpd-devel mailing list
Libwpd-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libwpd-devel

Reply via email to