Branch: master

ebea843b 2014-08-24 20:14:52 Michele Calgaro
Added support for libwpd-0.10. This resolves FTBFS in Debian/Testing.
Thanks to Slavek for testing in all Debian/Ubuntu distros and fixing a
couple of problems with libwpd-0.8.
A filters/kword/wordperfect/import/shared_headers.h
M config.h.in
M filters/kword/wordperfect/configure.in.in
M filters/kword/wordperfect/import/DocumentElement.cxx
M filters/kword/wordperfect/import/DocumentElement.hxx
M filters/kword/wordperfect/import/DocumentHandler.hxx
M filters/kword/wordperfect/import/FontStyle.hxx
M filters/kword/wordperfect/import/ListStyle.cxx
M filters/kword/wordperfect/import/ListStyle.hxx
M filters/kword/wordperfect/import/PageSpan.cxx
M filters/kword/wordperfect/import/PageSpan.hxx
M filters/kword/wordperfect/import/SectionStyle.cxx
M filters/kword/wordperfect/import/SectionStyle.hxx
M filters/kword/wordperfect/import/Style.hxx
M filters/kword/wordperfect/import/TableStyle.cxx
M filters/kword/wordperfect/import/TableStyle.hxx
M filters/kword/wordperfect/import/TextRunStyle.cxx
M filters/kword/wordperfect/import/TextRunStyle.hxx
M filters/kword/wordperfect/import/WordPerfectCollector.cxx
M filters/kword/wordperfect/import/WordPerfectCollector.hxx
M filters/kword/wordperfect/import/wpimport.cc
diff --git a/config.h.in b/config.h.in
index 78d8bb0..e07c90c 100644
--- a/config.h.in
+++ b/config.h.in
@@ -92,6 +92,9 @@
 /* Defines if your system has libpwd greater than or equal to v0.9.0 */
 #undef HAVE_LIBWPD_090
 
+/* Defines if your system has libpwd greater than or equal to v0.10.0 */
+#undef HAVE_LIBWPD_0100
+
 /* Define if you have libz */
 #undef HAVE_LIBZ
 
diff --git a/filters/kword/wordperfect/configure.in.in b/filters/kword/wordperfect/configure.in.in
index d3b8353..de1902e 100644
--- a/filters/kword/wordperfect/configure.in.in
+++ b/filters/kword/wordperfect/configure.in.in
@@ -45,6 +45,31 @@
   fi
 fi
 
+if test -z "$LIBWPD_LIBS"; then
+  if test -n "$PKGCONFIG"; then
+    vers=`$PKGCONFIG libwpd-0.10 --modversion 2>/dev/null`
+    if test -n "$vers"
+    then
+       LIBWPD_LIBS="`$PKGCONFIG libwpd-0.10 --libs`"
+       LIBWPD_RPATH=
+       for args in $LIBWPD_LIBS; do
+            case $args in
+              -L*)
+                 LIBWPD_RPATH="$LIBWPD_RPATH $args"
+                 ;;
+            esac
+       done
+       LIBWPD_RPATH=`echo $LIBWPD_RPATH | $SED -e "s/-L/-R/g"`
+       LIBWPD_CFLAGS="`$PKGCONFIG libwpd-0.10 --cflags`"
+       LIBWPD_VERSION="0.10"
+
+       AC_DEFINE_UNQUOTED(HAVE_WPD, 1, [Defines if your system has the libwpd library])
+       AC_DEFINE_UNQUOTED(HAVE_LIBWPD_0100, 1, [Defines if your system has libwpd greater than or equal to v0.10.0])
+       AC_SUBST(LIBWPD_VERSION)
+    fi
+  fi
+fi
+
 AC_SUBST(LIBWPD_LIBS)
 AC_SUBST(LIBWPD_CFLAGS)
 AC_SUBST(LIBWPD_RPATH)
diff --git a/filters/kword/wordperfect/import/DocumentElement.cxx b/filters/kword/wordperfect/import/DocumentElement.cxx
index 4f0428a..a1a9289 100644
--- a/filters/kword/wordperfect/import/DocumentElement.cxx
+++ b/filters/kword/wordperfect/import/DocumentElement.cxx
@@ -48,7 +48,7 @@
 	TagElement::print(); 	
 }
 
-void TagOpenElement::addAttribute(const char *szAttributeName, const WPXString &sAttributeValue)
+void TagOpenElement::addAttribute(const char *szAttributeName, const _SH_String &sAttributeValue)
 {
         maAttrList.insert(szAttributeName, sAttributeValue);
 }
@@ -66,8 +66,12 @@
 	xHandler.characters(msData);
 }
 
-TextElement::TextElement(const WPXString & sTextBuf) :
+TextElement::TextElement(const _SH_String & sTextBuf) :
+#ifdef HAVE_LIBWPD_0100	
+	msTextBuf(sTextBuf)
+#else
 	msTextBuf(sTextBuf, false)
+#endif
 {
 }
 
@@ -75,12 +79,12 @@
 // elements
 void TextElement::write(DocumentHandler &xHandler) const
 {
-	WPXPropertyList xBlankAttrList;
+	_SH_PropertyList xBlankAttrList;
         
-	WPXString sTemp;
+	_SH_String sTemp;
 
 	int iNumConsecutiveSpaces = 0;
-        WPXString::Iter i(msTextBuf);
+        _SH_String::Iter i(msTextBuf);
 	for (i.rewind(); i.next();) 
         {
 		if (*(i()) == ASCII_SPACE)
diff --git a/filters/kword/wordperfect/import/DocumentElement.hxx b/filters/kword/wordperfect/import/DocumentElement.hxx
index 5bdb03c..764758e 100644
--- a/filters/kword/wordperfect/import/DocumentElement.hxx
+++ b/filters/kword/wordperfect/import/DocumentElement.hxx
@@ -28,13 +28,11 @@
 
 #ifndef _DOCUMENTELEMENT_H
 #define _DOCUMENTELEMENT_H
+
 #include <libwpd/libwpd.h>
-#include <libwpd/WPXProperty.h>
-#include <libwpd/WPXString.h>
 #include <vector>
-
+#include "shared_headers.h"
 #include "DocumentHandler.hxx"
-
 
 const float fDefaultSideMargin = 1.0f; // inches
 const float fDefaultPageWidth = 8.5f; // inches (OOo required default: we will handle this later)
@@ -52,10 +50,10 @@
 {
 public:
 	TagElement(const char *szTagName) : msTagName(szTagName) {}
-	const WPXString & getTagName() const { return msTagName; }
+	const _SH_String & getTagName() const { return msTagName; }
 	virtual void print() const;
 private:
-	WPXString msTagName;
+	_SH_String msTagName;
 };
 
 class TagOpenElement : public TagElement
@@ -63,11 +61,11 @@
 public:
 	TagOpenElement(const char *szTagName) : TagElement(szTagName) {}
 	~TagOpenElement() {}
-	void addAttribute(const char *szAttributeName, const WPXString &sAttributeValue);
+	void addAttribute(const char *szAttributeName, const _SH_String &sAttributeValue);
 	virtual void write(DocumentHandler &xHandler) const;
 	virtual void print () const;
 private:
-	WPXPropertyList maAttrList;
+	_SH_PropertyList maAttrList;
 };
 
 class TagCloseElement : public TagElement
@@ -83,17 +81,17 @@
 	CharDataElement(const char *sData) : DocumentElement(), msData(sData) {}
 	virtual void write(DocumentHandler &xHandler) const;
 private:
-	WPXString msData;
+	_SH_String msData;
 };
 
 class TextElement : public DocumentElement
 {
 public:
-	TextElement(const WPXString & sTextBuf);
+	TextElement(const _SH_String & sTextBuf);
 	virtual void write(DocumentHandler &xHandler) const;
 
 private:
-	WPXString msTextBuf;
+	_SH_String msTextBuf;
 };
 
 #endif
diff --git a/filters/kword/wordperfect/import/DocumentHandler.hxx b/filters/kword/wordperfect/import/DocumentHandler.hxx
index a2fe2fa..ff8e39f 100644
--- a/filters/kword/wordperfect/import/DocumentHandler.hxx
+++ b/filters/kword/wordperfect/import/DocumentHandler.hxx
@@ -27,17 +27,18 @@
  */
 #ifndef _DOCUMENTHANDLER_H
 #define _DOCUMENTHANDLER_H
+
 #include <libwpd/libwpd.h>
-#include <libwpd/WPXProperty.h>
-#include <libwpd/WPXString.h>
+#include "shared_headers.h"
 
 class DocumentHandler
 {
 public:
         virtual void startDocument() = 0;
         virtual void endDocument() = 0;
-        virtual void startElement(const char *psName, const WPXPropertyList &xPropList) = 0;
+        virtual void startElement(const char *psName, const _SH_PropertyList &xPropList) = 0;
         virtual void endElement(const char *psName) = 0;
-        virtual void characters(const WPXString &sCharacters) = 0;
+        virtual void characters(const _SH_String &sCharacters) = 0;
 };
+
 #endif
diff --git a/filters/kword/wordperfect/import/FontStyle.hxx b/filters/kword/wordperfect/import/FontStyle.hxx
index 04ecfd1..6d09de5 100644
--- a/filters/kword/wordperfect/import/FontStyle.hxx
+++ b/filters/kword/wordperfect/import/FontStyle.hxx
@@ -27,10 +27,11 @@
  */
 #ifndef _FONTSTYLE_H
 #define _FONTSTYLE_H
-#include <libwpd/libwpd.h>
 
+#include <libwpd/libwpd.h>
 #include "Style.hxx"
 #include "WriterProperties.hxx"
+#include "shared_headers.h"
 
 class FontStyle : public Style
 {
@@ -38,10 +39,10 @@
 	FontStyle(const char *psName, const char *psFontFamily);
 	~FontStyle();
 	virtual void write(DocumentHandler &xHandler) const;
-	const WPXString &getFontFamily() const { return msFontFamily; }
+	const _SH_String &getFontFamily() const { return msFontFamily; }
 
 private:
-	WPXString msFontFamily;
-	WPXString msFontPitch;
+	_SH_String msFontFamily;
+	_SH_String msFontPitch;
 };
 #endif
diff --git a/filters/kword/wordperfect/import/ListStyle.cxx b/filters/kword/wordperfect/import/ListStyle.cxx
index 17d150e..66373a1 100644
--- a/filters/kword/wordperfect/import/ListStyle.cxx
+++ b/filters/kword/wordperfect/import/ListStyle.cxx
@@ -29,12 +29,12 @@
 #include "ListStyle.hxx"
 #include "DocumentElement.hxx"
 
-OrderedListLevelStyle::OrderedListLevelStyle(const WPXPropertyList &xPropList) : 
+OrderedListLevelStyle::OrderedListLevelStyle(const _SH_PropertyList &xPropList) : 
         mPropList(xPropList)
 {
 }
 
-void OrderedListStyle::updateListLevel(const int iLevel, const WPXPropertyList &xPropList) 
+void OrderedListStyle::updateListLevel(const int iLevel, const _SH_PropertyList &xPropList) 
 { 
 	if (iLevel < 0)
 		return;
@@ -44,7 +44,7 @@
 
 void OrderedListLevelStyle::write(DocumentHandler &xHandler, int iLevel) const
 {
-	WPXString sLevel;
+	_SH_String sLevel;
 	sLevel.sprintf("%i", (iLevel+1));
 
 	TagOpenElement listLevelStyleOpen("text:list-level-style-number");
@@ -73,12 +73,12 @@
 	xHandler.endElement("text:list-level-style-number");
 }
 ** Diff limit reached (max: 250 lines) **