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