]> git.pld-linux.org Git - packages/abiword.git/blob - abiword-libwpd.patch
- release 2
[packages/abiword.git] / abiword-libwpd.patch
1 diff -urN abiword-2.8.2/plugin-configure.m4 abiword-2.8.2.new//plugin-configure.m4
2 --- abiword-2.8.2/plugin-configure.m4   2010-02-12 15:12:07.000000000 +0100
3 +++ abiword-2.8.2.new//plugin-configure.m4      2010-12-18 12:07:08.550263907 +0100
4 @@ -1032,7 +1032,7 @@
5  AC_SUBST([LOADBINDINGS_LIBS])
6  
7  
8 -wpg_pkgs="$gsf_req libwpg-0.1 >= 0.1.0 libwpd-0.8 >= 0.8.0"
9 +wpg_pkgs="$gsf_req libwpg-0.2 >= 0.2.0 libwpd-0.9 >= 0.9.0 libwpd-stream-0.9 >= 0.9.0"
10  wpg_deps="no"
11  
12  if test "$enable_wpg" != ""; then
13 @@ -1272,8 +1272,8 @@
14  AC_SUBST([EML_LIBS])
15  
16  
17 -wordperfect_pkgs="libwpd-0.8 >= 0.8.0 $gsf_req"
18 -wordperfect_wps_pkgs='libwps-0.1 >= 0.1.0'
19 +wordperfect_pkgs="libwpg-0.2 >= 0.2.0 libwpd-0.9 >= 0.9.0 libwpd-stream-0.9 >= 0.9.0 $gsf_req"
20 +wordperfect_wps_pkgs='libwps-0.2 >= 0.1.0'
21  wordperfect_deps="no"
22  
23  WORDPERFECT_CFLAGS=
24 diff -urN abiword-2.8.2/plugins/wordperfect/plugin.m4 abiword-2.8.2.new//plugins/wordperfect/plugin.m4
25 --- abiword-2.8.2/plugins/wordperfect/plugin.m4 2009-06-22 06:33:05.000000000 +0200
26 +++ abiword-2.8.2.new//plugins/wordperfect/plugin.m4    2010-12-18 12:02:29.184921950 +0100
27 @@ -1,6 +1,6 @@
28  
29 -wordperfect_pkgs="libwpd-0.8 >= 0.8.0 $gsf_req"
30 -wordperfect_wps_pkgs='libwps-0.1 >= 0.1.0'
31 +wordperfect_pkgs="libwpg-0.2 >= 0.2.0 libwpd-0.9 >= 0.9.0 libwpd-stream-0.9 >= 0.9.0 $gsf_req"
32 +wordperfect_wps_pkgs='libwps-0.2 >= 0.1.0'
33  wordperfect_deps="no"
34  
35  WORDPERFECT_CFLAGS=
36 diff -urN abiword-2.8.2/plugins/wordperfect/xp/ie_imp_WordPerfect.cpp abiword-2.8.2.new//plugins/wordperfect/xp/ie_imp_WordPerfect.cpp
37 --- abiword-2.8.2/plugins/wordperfect/xp/ie_imp_WordPerfect.cpp 2010-02-06 22:06:11.000000000 +0100
38 +++ abiword-2.8.2.new//plugins/wordperfect/xp/ie_imp_WordPerfect.cpp    2010-12-18 12:02:29.181588156 +0100
39 @@ -60,7 +60,7 @@
40  
41  // Stream class
42  
43 -#include <libwpd/WPXStream.h>
44 +#include <libwpd-stream/libwpd-stream.h>
45  
46  #include <gsf/gsf-input.h>
47  #include <gsf/gsf-infile.h>
48 @@ -70,12 +70,7 @@
49  #include <libwps/libwps.h>
50  #endif
51  
52 -class AbiWordperfectInputStream :
53 -#ifdef HAVE_LIBWPS
54 -       public WPSInputStream
55 -#else
56 -    public WPXInputStream
57 -#endif
58 +class AbiWordperfectInputStream : public WPXInputStream
59  {
60  public:
61         AbiWordperfectInputStream(GsfInput *input);
62 @@ -86,7 +81,7 @@
63  
64         virtual WPXInputStream * getDocumentOLEStream(const char * name);
65  
66 -       virtual const uint8_t *read(size_t numBytes, size_t &numBytesRead);
67 +       virtual const unsigned char *read(unsigned long numBytes, unsigned long &numBytesRead);
68         virtual int seek(long offset, WPX_SEEK_TYPE seekType);
69         virtual long tell();
70         virtual bool atEOS();
71 @@ -98,11 +93,7 @@
72  };
73  
74  AbiWordperfectInputStream::AbiWordperfectInputStream(GsfInput *input) :
75 -#ifdef HAVE_LIBWPS
76 -       WPSInputStream(),
77 -#else
78 -       WPXInputStream(true),
79 -#endif
80 +       WPXInputStream(),
81         m_input(input),
82         m_ole(NULL)
83  {
84 @@ -117,9 +108,9 @@
85         g_object_unref(G_OBJECT(m_input));
86  }
87  
88 -const uint8_t * AbiWordperfectInputStream::read(size_t numBytes, size_t &numBytesRead)
89 +const unsigned char * AbiWordperfectInputStream::read(unsigned long numBytes, unsigned long &numBytesRead)
90  {
91 -       const uint8_t *buf = gsf_input_read(m_input, numBytes, NULL);
92 +       const unsigned char *buf = gsf_input_read(m_input, numBytes, NULL);
93  
94         if (buf == NULL)
95                 numBytesRead = 0;
96 @@ -256,19 +247,12 @@
97  {
98         AbiWordperfectInputStream gsfInput(input);
99  
100 -       WPDConfidence confidence = WPDocument::isFileFormatSupported(&gsfInput, true);
101 +       WPDConfidence confidence = WPDocument::isFileFormatSupported(&gsfInput);
102  
103         switch (confidence)
104         {
105                 case WPD_CONFIDENCE_NONE:
106 -               // libwpd > 0.7.1 reports POOR if the text file is plain text (that _could_ be a WP4x document)
107 -               // however, we'll let the text importer handle such cases
108 -               case WPD_CONFIDENCE_POOR: 
109                         return UT_CONFIDENCE_ZILCH;
110 -               case WPD_CONFIDENCE_LIKELY:
111 -                       return UT_CONFIDENCE_SOSO;
112 -               case WPD_CONFIDENCE_GOOD:
113 -                       return UT_CONFIDENCE_GOOD;
114                 case WPD_CONFIDENCE_EXCELLENT:
115                         return UT_CONFIDENCE_PERFECT;
116                 default:
117 @@ -328,7 +312,7 @@
118  UT_Error IE_Imp_WordPerfect::_loadFile(GsfInput * input)
119  {
120         AbiWordperfectInputStream gsfInput(input);
121 -       WPDResult error = WPDocument::parse(&gsfInput, static_cast<WPXHLListenerImpl *>(this));
122 +       WPDResult error = WPDocument::parse(&gsfInput, static_cast<WPXDocumentInterface *>(this), NULL);
123  
124         if (error != WPD_OK)
125         {
126 @@ -381,9 +365,9 @@
127         float marginLeft = 1.0f, marginRight = 1.0f;
128  
129         if (propList["fo:margin-left"])
130 -               marginLeft = propList["fo:margin-left"]->getFloat();
131 +               marginLeft = propList["fo:margin-left"]->getDouble();
132         if (propList["fo:margin-right"])
133 -               marginRight = propList["fo:margin-right"]->getFloat();
134 +               marginRight = propList["fo:margin-right"]->getDouble();
135  
136         if (marginLeft != m_leftPageMargin || marginRight != m_rightPageMargin /* || */
137                 /* marginTop != m_marginBottom || marginBottom != m_marginBottom */ )
138 @@ -456,15 +440,15 @@
139         float marginTop = 0.0f, marginBottom = 0.0f;
140         float marginLeft = 0.0f, marginRight = 0.0f, textIndent = 0.0f;
141         if (propList["fo:margin-top"])
142 -           marginTop = propList["fo:margin-top"]->getFloat();
143 +           marginTop = propList["fo:margin-top"]->getDouble();
144         if (propList["fo:margin-bottom"])
145 -           marginBottom = propList["fo:margin-bottom"]->getFloat();
146 +           marginBottom = propList["fo:margin-bottom"]->getDouble();
147         if (propList["fo:margin-left"])
148 -           marginLeft = propList["fo:margin-left"]->getFloat();
149 +           marginLeft = propList["fo:margin-left"]->getDouble();
150         if (propList["fo:margin-right"])
151 -           marginRight = propList["fo:margin-right"]->getFloat();
152 +           marginRight = propList["fo:margin-right"]->getDouble();
153         if (propList["fo:text-indent"])
154 -           textIndent = propList["fo:text-indent"]->getFloat();
155 +           textIndent = propList["fo:text-indent"]->getDouble();
156  
157         m_topMargin = marginTop;
158         m_bottomMargin = marginBottom;
159 @@ -487,7 +471,7 @@
160  
161         float lineSpacing = 1.0f;
162         if (propList["fo:line-height"])
163 -               lineSpacing = propList["fo:line-height"]->getFloat();
164 +               lineSpacing = propList["fo:line-height"]->getDouble();
165         
166         UT_String tmpBuffer;
167         UT_String_sprintf(tmpBuffer, "; margin-top:%.4fin; margin-bottom:%.4fin; margin-left:%.4fin; margin-right:%.4fin; text-indent:%.4fin; line-height:%.4f",
168 @@ -504,7 +488,7 @@
169                         propBuffer += tmpBuffer;
170                         if (i()["style:position"])
171                         {
172 -                               UT_String_sprintf(tmpBuffer, "%.4fin", i()["style:position"]->getFloat());
173 +                               UT_String_sprintf(tmpBuffer, "%.4fin", i()["style:position"]->getDouble());
174                                 propBuffer += tmpBuffer;
175                         }
176  
177 @@ -520,10 +504,10 @@
178                         else // Left aligned is default
179                                 propBuffer += "/L";
180  
181 -                       if (i()["style:leader-char"])
182 -                               if (i()["style:leader-char"]->getStr() == "-")
183 +                       if (i()["style:leader-text"])
184 +                               if (i()["style:leader-text"]->getStr() == "-")
185                                         propBuffer += "2";
186 -                               else if (i()["style:leader-char"]->getStr() == "_")
187 +                               else if (i()["style:leader-text"]->getStr() == "_")
188                                         propBuffer += "3";
189                                 else // default to dot leader if the given leader is dot or is not supported by AbiWord
190                                         propBuffer += "1";
191 @@ -586,12 +570,12 @@
192                         propBuffer += "subscript";
193         }
194  
195 -       if (propList["style:text-underline"] || propList["style:text-crossing-out"])
196 +       if (propList["style:text-underline-type"] || propList["style:text-line-through-type"])
197         {
198                 propBuffer += "; text-decoration:";
199 -               if (propList["style:text-underline"])
200 +               if (propList["style:text-underline-type"])
201                         propBuffer += "underline ";
202 -               if (propList["style:text-crossing-out"])
203 +               if (propList["style:text-line-through-type"])
204                         propBuffer += "line-through";
205  
206         }
207 @@ -615,10 +599,10 @@
208                 propBuffer += propList["fo:color"]->getStr().cstr();
209         }
210  
211 -       if (propList["style:text-background-color"])
212 +       if (propList["fo:background-color"])
213         {
214                 propBuffer += "; bgcolor:";
215 -               propBuffer += propList["style:text-background-color"]->getStr().cstr();
216 +               propBuffer += propList["fo:background-color"]->getStr().cstr();
217         }
218  
219         UT_DEBUGMSG(("AbiWordPerfect: Appending span format: %s\n", propBuffer.c_str()));
220 @@ -639,10 +623,10 @@
221         int columnsCount = ((columns.count() == 0) ? 1 : columns.count());
222  
223         // TODO: support spaceAfter
224 -       if (propList["fo:margin-left"])
225 -               marginLeft = propList["fo:margin-left"]->getFloat();
226 -       if (propList["fo:margin-right"])
227 -               marginRight = propList["fo:margin-right"]->getFloat();
228 +       if (propList["fo:start-indent"])
229 +               marginLeft = propList["fo:start-indent"]->getDouble();
230 +       if (propList["fo:end-indent"])
231 +               marginRight = propList["fo:end-indent"]->getDouble();
232  
233         if (marginLeft != m_leftSectionMargin || marginRight != m_rightSectionMargin || m_sectionColumnsCount != columnsCount)
234                 m_bSectionChanged = true;
235 @@ -709,9 +693,9 @@
236         if (propList["style:num-format"])
237                 listType = propList["style:num-format"]->getStr().cstr()[0];
238         if (propList["text:space-before"])
239 -               listLeftOffset = propList["text:space-before"]->getFloat();
240 +               listLeftOffset = propList["text:space-before"]->getDouble();
241         if (propList["text:min-label-width"])
242 -               listMinLabelWidth = propList["text:min-label-width"]->getFloat();
243 +               listMinLabelWidth = propList["text:min-label-width"]->getDouble();
244  
245         if (!m_pCurrentListDefinition || 
246                 m_pCurrentListDefinition->getOutlineHash() != listID ||
247 @@ -749,9 +733,9 @@
248         if (propList["libwpd:level"])
249                 level = propList["libwpd:level"]->getInt();
250         if (propList["text:space-before"])
251 -               listLeftOffset = propList["text:space-before"]->getFloat();
252 +               listLeftOffset = propList["text:space-before"]->getDouble();
253         if (propList["text:min-label-width"])
254 -               listMinLabelWidth = propList["text:min-label-width"]->getFloat();
255 +               listMinLabelWidth = propList["text:min-label-width"]->getDouble();
256  
257         if (!m_pCurrentListDefinition || m_pCurrentListDefinition->getOutlineHash() != listID)
258         {
259 @@ -871,10 +855,10 @@
260  
261         UT_String_sprintf(tempBuffer, "margin-left:%.4fin; ", m_pCurrentListDefinition->getListLeftOffset(m_iCurrentListLevel)
262                                         + m_pCurrentListDefinition->getListMinLabelWidth(m_iCurrentListLevel)
263 -                                       - (propList["fo:text-indent"] ? propList["fo:text-indent"]->getFloat() : 0.0f));
264 +                                       - (propList["fo:text-indent"] ? propList["fo:text-indent"]->getDouble() : 0.0f));
265         propBuffer += tempBuffer;
266         UT_String_sprintf(tempBuffer, "text-indent:%.4fin", - m_pCurrentListDefinition->getListMinLabelWidth(m_iCurrentListLevel)
267 -                                       + (propList["fo:text-indent"] ? propList["fo:text-indent"]->getFloat() : 0.0f));
268 +                                       + (propList["fo:text-indent"] ? propList["fo:text-indent"]->getDouble() : 0.0f));
269         propBuffer += tempBuffer;
270  
271         listAttribs[attribsCount++] = PT_PROPS_ATTRIBUTE_NAME;
272 @@ -1263,7 +1247,7 @@
273      virtual UT_Error _loadFile(GsfInput * input)
274         {
275                 AbiWordperfectInputStream gsfInput(input);
276 -               WPSResult error = WPSDocument::parse(&gsfInput, static_cast<WPXHLListenerImpl *>(this));
277 +               WPSResult error = WPSDocument::parse(&gsfInput, static_cast<WPXDocumentInterface *>(this));
278  
279                 if (error != WPS_OK)
280                         {
281 @@ -1302,18 +1286,12 @@
282  {
283         AbiWordperfectInputStream gsfInput(input);
284  
285 -       WPSConfidence confidence = WPSDocument::isFileFormatSupported(&gsfInput, true);
286 +       WPSConfidence confidence = WPSDocument::isFileFormatSupported(&gsfInput);
287  
288         switch (confidence)
289         {
290                 case WPS_CONFIDENCE_NONE:
291                         return UT_CONFIDENCE_ZILCH;
292 -               case WPS_CONFIDENCE_POOR: 
293 -                       return UT_CONFIDENCE_POOR;
294 -               case WPS_CONFIDENCE_LIKELY:
295 -                       return UT_CONFIDENCE_SOSO;
296 -               case WPS_CONFIDENCE_GOOD:
297 -                       return UT_CONFIDENCE_GOOD;
298                 case WPS_CONFIDENCE_EXCELLENT:
299                         return UT_CONFIDENCE_PERFECT;
300                 default:
301 diff -urN abiword-2.8.2/plugins/wordperfect/xp/ie_imp_WordPerfect.h abiword-2.8.2.new//plugins/wordperfect/xp/ie_imp_WordPerfect.h
302 --- abiword-2.8.2/plugins/wordperfect/xp/ie_imp_WordPerfect.h   2009-06-19 10:55:49.000000000 +0200
303 +++ abiword-2.8.2.new//plugins/wordperfect/xp/ie_imp_WordPerfect.h      2010-12-18 12:02:29.184921950 +0100
304 @@ -30,13 +30,7 @@
305  #define IE_IMP_WP_H
306  
307  #include <stdio.h>
308 -#ifdef _WIN32
309 -#define POINT WPX_POINT
310 -#endif
311  #include <libwpd/libwpd.h>
312 -#ifdef _WIN32
313 -#undef POINT
314 -#endif
315  #include "ie_imp.h"
316  #include "ut_string.h"
317  #include "ut_string_class.h"
318 @@ -98,7 +92,7 @@
319                                         IE_Imp ** ppie);
320  };
321  
322 -class IE_Imp_WordPerfect : public IE_Imp, public WPXHLListenerImpl
323 +class IE_Imp_WordPerfect : public IE_Imp, public WPXDocumentInterface
324  {
325  public:
326      IE_Imp_WordPerfect(PD_Document * pDocument);
327 @@ -154,6 +148,21 @@
328      virtual void insertCoveredTableCell(const WPXPropertyList & /*propList*/) {}
329      virtual void closeTable();
330  
331 +    virtual void definePageStyle(const WPXPropertyList&) {}
332 +    virtual void defineParagraphStyle(const WPXPropertyList&, const WPXPropertyListVector&) {}
333 +    virtual void defineCharacterStyle(const WPXPropertyList&) {}
334 +    virtual void defineSectionStyle(const WPXPropertyList&, const WPXPropertyListVector&) {}
335 +    virtual void insertSpace() {}
336 +    virtual void insertField(const WPXString&, const WPXPropertyList&) {}
337 +    virtual void openComment(const WPXPropertyList&) {}
338 +    virtual void closeComment() {}
339 +    virtual void openTextBox(const WPXPropertyList&) {}
340 +    virtual void closeTextBox() {}
341 +    virtual void openFrame(const WPXPropertyList&) {}
342 +    virtual void closeFrame() {}
343 +    virtual void insertBinaryObject(const WPXPropertyList&, const WPXBinaryData&) {}
344 +    virtual void insertEquation(const WPXPropertyList&, const WPXString&) {}
345 +
346      
347  protected:
348         virtual UT_Error _loadFile(GsfInput * input);
349 diff -urN abiword-2.8.2/plugins/wpg/plugin.m4 abiword-2.8.2.new//plugins/wpg/plugin.m4
350 --- abiword-2.8.2/plugins/wpg/plugin.m4 2008-05-19 16:06:19.000000000 +0200
351 +++ abiword-2.8.2.new//plugins/wpg/plugin.m4    2010-12-18 12:02:29.188255745 +0100
352 @@ -1,5 +1,5 @@
353  
354 -wpg_pkgs="$gsf_req libwpg-0.1 >= 0.1.0 libwpd-0.8 >= 0.8.0"
355 +wpg_pkgs="$gsf_req libwpg-0.2 >= 0.2.0 libwpd-0.9 >= 0.9.0 libwpd-stream-0.9 >= 0.9.0"
356  wpg_deps="no"
357  
358  if test "$enable_wpg" != ""; then
359 diff -urN abiword-2.8.2/plugins/wpg/xp/ie_impGraphic_WPG.cpp abiword-2.8.2.new//plugins/wpg/xp/ie_impGraphic_WPG.cpp
360 --- abiword-2.8.2/plugins/wpg/xp/ie_impGraphic_WPG.cpp  2008-08-15 23:52:32.000000000 +0200
361 +++ abiword-2.8.2.new//plugins/wpg/xp/ie_impGraphic_WPG.cpp     2010-12-18 12:02:29.188255745 +0100
362 @@ -31,11 +31,10 @@
363  #include <gsf/gsf-input-memory.h>
364  #include <gsf/gsf-input-stdio.h>
365  #include <gsf/gsf-infile-msole.h>
366 -#include <libwpd/WPXStream.h>
367 +#include <libwpd-stream/libwpd-stream.h>
368  #include "xap_Module.h"
369  
370  using libwpg::WPGraphics;
371 -using libwpg::WPGString;
372  
373  ABI_PLUGIN_DECLARE("WPG")
374  
375 @@ -48,7 +47,7 @@
376         virtual bool isOLEStream();
377         virtual WPXInputStream * getDocumentOLEStream();
378         virtual WPXInputStream * getDocumentOLEStream(const char * name);
379 -       virtual const uint8_t *read(size_t numBytes, size_t &numBytesRead);
380 +       virtual const unsigned char *read(unsigned long numBytes, unsigned long &numBytesRead);
381         virtual int seek(long offset, WPX_SEEK_TYPE seekType);
382         virtual long tell();
383         virtual bool atEOS();
384 @@ -60,7 +59,7 @@
385  };
386  
387  AbiWordPerfectGraphicsInputStream::AbiWordPerfectGraphicsInputStream(GsfInput *input) :
388 -       WPXInputStream(true),
389 +       WPXInputStream(),
390         m_input(input),
391         m_ole(NULL)
392  {
393 @@ -75,9 +74,9 @@
394         g_object_unref(G_OBJECT(m_input));
395  }
396  
397 -const uint8_t * AbiWordPerfectGraphicsInputStream::read(size_t numBytes, size_t &numBytesRead)
398 +const unsigned char * AbiWordPerfectGraphicsInputStream::read(unsigned long numBytes, unsigned long &numBytesRead)
399  {
400 -       const uint8_t *buf = gsf_input_read(m_input, numBytes, NULL);
401 +       const unsigned char *buf = gsf_input_read(m_input, numBytes, NULL);
402  
403         if (buf == NULL)
404                 numBytesRead = 0;
405 @@ -245,10 +244,10 @@
406  UT_Error IE_Imp_WordPerfectGraphics::importGraphic(GsfInput *input, FG_Graphic **ppfg)
407  {
408         AbiWordPerfectGraphicsInputStream gsfInput(input);
409 -       WPGString svgOutput;
410 +       WPXString svgOutput;
411         if (WPGraphics::generateSVG(&gsfInput, svgOutput))
412         {
413 -               GsfInput * svgInput = gsf_input_memory_new((const guint8*)svgOutput.cstr(), svgOutput.length(), false);
414 +               GsfInput * svgInput = gsf_input_memory_new((const guint8*)svgOutput.cstr(), svgOutput.len(), false);
415                 UT_Error result = IE_ImpGraphic::loadGraphic(svgInput, IE_ImpGraphic::fileTypeForSuffix(".svg"), ppfg);
416                 g_object_unref(svgInput);
417                 return result;
This page took 0.417013 seconds and 3 git commands to generate.