From f409dd088f95b2e00c59dc5642769b95245ba7fc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fridrich=20=C5=A0trba?= <fridrich.strba@bluewin.ch>
Date: Tue, 14 Sep 2010 11:07:30 +0200
Subject: [PATCH] wpsimport-writerperfect.diff: WPS Import filter - core
implementation.
---
writerperfect/prj/d.lst | 4 +-
writerperfect/source/filter/DocumentCollector.cxx | 2 +-
writerperfect/source/filter/DocumentCollector.hxx | 7 ++-
writerperfect/source/filter/DocumentHandler.cxx | 10 ++--
writerperfect/source/filter/SectionStyle.cxx | 2 +-
writerperfect/source/filter/makefile.mk | 12 +++--
writerperfect/source/stream/WPXSvStream.cxx | 2 +-
writerperfect/source/stream/WPXSvStream.h | 3 +-
writerperfect/source/stream/makefile.mk | 6 +++
.../source/wpdimp/WordPerfectCollector.cxx | 5 +-
.../source/wpdimp/WordPerfectCollector.hxx | 4 +-
writerperfect/source/wpdimp/makefile.mk | 12 +++--
writerperfect/util/makefile.mk | 47 +++++++++++++++++--
14 files changed, 88 insertions(+), 33 deletions(-)
diff --git a/writerperfect/prj/d.lst b/writerperfect/prj/d.lst
index 5b5852c..fb11fa9 100644
--- a/writerperfect/prj/d.lst
+++ b/writerperfect/prj/d.lst
@@ -1,4 +1,4 @@
-..\%__SRC%\lib\libwpft*.so %_DEST%\lib%_EXT%
-..\%__SRC%\bin\wpft*.dll %_DEST%\bin%_EXT%
+..\%__SRC%\lib\lib*.so %_DEST%\lib%_EXT%
+..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%
..\%__SRC%\bin\wpftgo.dll %_DEST%\bin%_EXT%\wpftgo.dll
..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib
diff --git a/writerperfect/source/filter/DocumentCollector.cxx b/writerperfect/source/filter/DocumentCollector.cxx
index 828e799..5baae93 100644
--- a/writerperfect/source/filter/DocumentCollector.cxx
+++ b/writerperfect/source/filter/DocumentCollector.cxx
@@ -58,7 +58,7 @@ _WriterDocumentState::_WriterDocumentState() :
{
}
-DocumentCollector::DocumentCollector(WPXInputStream *pInput, DocumentHandler *pHandler) :
+DocumentCollector::DocumentCollector(WPSInputStream *pInput, DocumentHandler *pHandler) :
mpInput(pInput),
mpHandler(pHandler),
mbUsed(false),
diff --git a/writerperfect/source/filter/DocumentCollector.hxx b/writerperfect/source/filter/DocumentCollector.hxx
index 18ebcdb..a1e7fbc 100644
--- a/writerperfect/source/filter/DocumentCollector.hxx
+++ b/writerperfect/source/filter/DocumentCollector.hxx
@@ -35,6 +35,7 @@
#if defined _MSC_VER
#pragma warning( push, 1 )
#endif
+#include <libwps/libwps.h>
#include <libwpd/libwpd.h>
#if defined _MSC_VER
#pragma warning( pop )
@@ -82,7 +83,7 @@ struct ltstr
class DocumentCollector : public WPXHLListenerImpl
{
public:
- DocumentCollector(WPXInputStream *pInput, DocumentHandler *pHandler);
+ DocumentCollector(WPSInputStream *pInput, DocumentHandler *pHandler);
virtual ~DocumentCollector();
bool filter();
@@ -133,7 +134,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();
@@ -147,7 +148,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!)
diff --git a/writerperfect/source/filter/DocumentHandler.cxx b/writerperfect/source/filter/DocumentHandler.cxx
index e0a11ab..2af504c 100644
--- a/writerperfect/source/filter/DocumentHandler.cxx
+++ b/writerperfect/source/filter/DocumentHandler.cxx
@@ -42,19 +42,19 @@ DocumentHandler::DocumentHandler(Reference < XDocumentHandler > &xHandler) :
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);
@@ -71,13 +71,13 @@ void DocumentHandler::startElement(const char *psName, const WPXPropertyList &xP
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);
}
diff --git a/writerperfect/source/filter/SectionStyle.cxx b/writerperfect/source/filter/SectionStyle.cxx
index 7dae06c..de94e9c 100644
--- a/writerperfect/source/filter/SectionStyle.cxx
+++ b/writerperfect/source/filter/SectionStyle.cxx
@@ -33,7 +33,7 @@
#ifdef _MSC_VER
double rint(double x);
-#endif /* _WIN32 */
+#endif /* _MSC_VER */
SectionStyle::SectionStyle(const WPXPropertyList &xPropList,
const WPXPropertyListVector &xColumns,
diff --git a/writerperfect/source/filter/makefile.mk b/writerperfect/source/filter/makefile.mk
index e535d2a..a092ce2 100644
--- a/writerperfect/source/filter/makefile.mk
+++ b/writerperfect/source/filter/makefile.mk
@@ -7,12 +7,16 @@ ENABLE_EXCEPTIONS=true
.INCLUDE : settings.mk
.IF "$(SYSTEM_LIBWPD)" == "YES"
-INCPRE+=$(LIBWPD_CFLAGS) -I..
-.ELSE
-# broken but ... necessary, internal include shafted ...
-INCPRE+=-I..
+INCPRE+=$(LIBWPD_CFLAGS)
+.ENDIF
+
+.IF "$(SYSTEM_LIBWPS)" == "YES"
+INCPRE+=$(LIBWPS_CFLAGS)
.ENDIF
+# broken but ... necessary, internal include shafted ...
+INCPRE+= -I..
+
SLOFILES= \
$(SLO)$/DocumentElement.obj \
$(SLO)$/FontStyle.obj \
diff --git a/writerperfect/source/stream/WPXSvStream.cxx b/writerperfect/source/stream/WPXSvStream.cxx
index 3737e93..f7cfe35 100644
--- a/writerperfect/source/stream/WPXSvStream.cxx
+++ b/writerperfect/source/stream/WPXSvStream.cxx
@@ -10,7 +10,7 @@
using namespace ::com::sun::star::io;
WPXSvInputStream::WPXSvInputStream( Reference< XInputStream > xStream ) :
- WPXInputStream(true),
+ WPSInputStream(),
mxChildStorage(),
mxChildStream(),
mxStream(xStream),
@@ -147,7 +147,7 @@
return 0;
}
- mxChildStorage = new SotStorage( pStream, true );
+ mxChildStorage = new SotStorage( pStream, TRUE );
mxChildStream = mxChildStorage->OpenSotStream(
rtl::OUString::createFromAscii( name ),
diff --git a/writerperfect/source/stream/WPXSvStream.h b/writerperfect/source/stream/WPXSvStream.h
index 099c5a7..f4f3b7e 100644
--- a/writerperfect/source/stream/WPXSvStream.h
+++ b/writerperfect/source/stream/WPXSvStream.h
@@ -12,12 +12,13 @@
#if defined _MSC_VER
#pragma warning( push, 1 )
#endif
+#include <libwps/WPSStream.h>
#include <libwpd/WPXStream.h>
#if defined _MSC_VER
#pragma warning( pop )
#endif
-class WPXSvInputStream : public WPXInputStream
+class WPXSvInputStream : public WPSInputStream
{
public:
WPXSvInputStream( ::com::sun::star::uno::Reference<
diff --git a/writerperfect/source/stream/makefile.mk b/writerperfect/source/stream/makefile.mk
index 7e684b7..97262e7 100644
--- a/writerperfect/source/stream/makefile.mk
+++ b/writerperfect/source/stream/makefile.mk
@@ -10,6 +10,12 @@ ENABLE_EXCEPTIONS=true
INCPRE+=$(LIBWPD_CFLAGS)
.ENDIF
+.IF "$(SYSTEM_LIBWPS)" == "YES"
+INCPRE+=$(LIBWPS_CFLAGS)
+.ELSE
+INCPRE+=$(SOLARVER)$/$(UPD)$/$(INPATH)$/inc$/libwps
+.ENDIF
+
# broken but ... necessary, internal include shafted ...
INCPRE+= -I..
diff --git a/writerperfect/source/wpdimp/WordPerfectCollector.cxx b/writerperfect/source/wpdimp/WordPerfectCollector.cxx
index 0bc10cc..9d32fde 100644
--- a/writerperfect/source/wpdimp/WordPerfectCollector.cxx
+++ b/writerperfect/source/wpdimp/WordPerfectCollector.cxx
@@ -30,11 +30,12 @@
#pragma warning( push, 1 )
#endif
#include "WordPerfectCollector.hxx"
+#include <libwpd/WPDocument.h>
#if defined _MSC_VER
#pragma warning( pop )
#endif
-WordPerfectCollector::WordPerfectCollector(WPXInputStream *pInput, DocumentHandler *pHandler) :
+WordPerfectCollector::WordPerfectCollector(WPSInputStream *pInput, DocumentHandler *pHandler) :
DocumentCollector(pInput, pHandler)
{
}
@@ -43,7 +44,7 @@ WordPerfectCollector::~WordPerfectCollector()
{
}
-bool WordPerfectCollector::parseSourceDocument(WPXInputStream &input)
+bool WordPerfectCollector::parseSourceDocument(WPSInputStream &input)
{
WPDResult result = WPDocument::parse(&input, static_cast<WPXHLListenerImpl *>(this));
if (result != WPD_OK)
diff --git a/writerperfect/source/wpdimp/WordPerfectCollector.hxx b/writerperfect/source/wpdimp/WordPerfectCollector.hxx
index 400a5ca..95ed7af 100644
--- a/writerperfect/source/wpdimp/WordPerfectCollector.hxx
+++ b/writerperfect/source/wpdimp/WordPerfectCollector.hxx
@@ -35,9 +35,9 @@
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
diff --git a/writerperfect/source/wpdimp/makefile.mk b/writerperfect/source/wpdimp/makefile.mk
index bc2a3cd..745887e 100644
--- a/writerperfect/source/wpdimp/makefile.mk
+++ b/writerperfect/source/wpdimp/makefile.mk
@@ -7,12 +7,16 @@ ENABLE_EXCEPTIONS=true
.INCLUDE : settings.mk
.IF "$(SYSTEM_LIBWPD)" == "YES"
-INCPRE+=$(LIBWPD_CFLAGS) -I..
-.ELSE
-# broken but ... necessary, internal include shafted ...
-INCPRE+=-I..
+INCPRE+=$(LIBWPD_CFLAGS)
+.ENDIF
+
+.IF "$(SYSTEM_LIBWPS)" == "YES"
+INCPRE+=$(LIBWPS_CFLAGS)
.ENDIF
+# broken but ... necessary, internal include shafted ...
+INCPRE+= -I..
+
SLOFILES= \
$(SLO)$/WordPerfectCollector.obj \
$(SLO)$/WordPerfectImportFilter.obj \