]> git.pld-linux.org Git - packages/abiword.git/blame - abiword-librevenge.patch
- release 7 (by relup.sh)
[packages/abiword.git] / abiword-librevenge.patch
CommitLineData
988d24be
JR
1Index: plugins/wpg/xp/ie_impGraphic_WPG.cpp
2===================================================================
3--- plugins/wpg/xp/ie_impGraphic_WPG.cpp (revision 34460)
4+++ plugins/wpg/xp/ie_impGraphic_WPG.cpp (working copy)
5@@ -31,7 +31,7 @@
6 #include <gsf/gsf-input-memory.h>
7 #include <gsf/gsf-input-stdio.h>
8 #include <gsf/gsf-infile-msole.h>
9-#include <libwpd-stream/libwpd-stream.h>
10+#include <librevenge-0.0/librevenge-stream/librevenge-stream.h>
11 #include "xap_Module.h"
12
13 using libwpg::WPGraphics;
14@@ -38,30 +38,35 @@
15
16 ABI_PLUGIN_DECLARE("WPG")
17
18-class AbiWordPerfectGraphicsInputStream : public WPXInputStream
19+class AbiWordPerfectGraphicsInputStream : public librevenge::RVNGInputStream
20 {
21 public:
22 AbiWordPerfectGraphicsInputStream(GsfInput *input);
23 ~AbiWordPerfectGraphicsInputStream();
24
25- virtual bool isOLEStream();
26- virtual WPXInputStream * getDocumentOLEStream();
27- virtual WPXInputStream * getDocumentOLEStream(const char * name);
28+ virtual bool isStructured();
29+ virtual unsigned subStreamCount();
30+ virtual const char* subStreamName(unsigned);
31+ bool existsSubStream(const char*);
32+ virtual librevenge::RVNGInputStream* getSubStreamByName(const char*);
33+ virtual librevenge::RVNGInputStream* getSubStreamById(unsigned);
34 virtual const unsigned char *read(unsigned long numBytes, unsigned long &numBytesRead);
35- virtual int seek(long offset, WPX_SEEK_TYPE seekType);
36+ virtual int seek(long offset, librevenge::RVNG_SEEK_TYPE seekType);
37 virtual long tell();
38- virtual bool atEOS();
39+ virtual bool isEnd();
40
41 private:
42
43 GsfInput *m_input;
44 GsfInfile *m_ole;
45+ std::map<unsigned, std::string> m_substreams;
46 };
47
48 AbiWordPerfectGraphicsInputStream::AbiWordPerfectGraphicsInputStream(GsfInput *input) :
49- WPXInputStream(),
50+ librevenge::RVNGInputStream(),
51 m_input(input),
52- m_ole(NULL)
53+ m_ole(NULL),
54+ m_substreams()
55 {
56 g_object_ref(G_OBJECT(input));
57 }
58@@ -86,50 +91,120 @@
59 return buf;
60 }
61
62-int AbiWordPerfectGraphicsInputStream::seek(long offset, WPX_SEEK_TYPE seekType)
63+int AbiWordPerfectGraphicsInputStream::seek(long offset, librevenge::RVNG_SEEK_TYPE seekType)
64 {
65 GSeekType gsfSeekType = G_SEEK_SET;
66 switch(seekType)
67 {
68- case WPX_SEEK_CUR:
69+ case librevenge::RVNG_SEEK_CUR:
70 gsfSeekType = G_SEEK_CUR;
71 break;
72- case WPX_SEEK_SET:
73+ case librevenge::RVNG_SEEK_SET:
74 gsfSeekType = G_SEEK_SET;
75 break;
76+ case librevenge::RVNG_SEEK_END:
77+ gsfSeekType = G_SEEK_END;
78+ break;
79 }
80
81 return gsf_input_seek(m_input, offset, gsfSeekType);
82 }
83
84-bool AbiWordPerfectGraphicsInputStream::isOLEStream()
85+bool AbiWordPerfectGraphicsInputStream::isStructured()
86 {
87 if (!m_ole)
88 m_ole = GSF_INFILE(gsf_infile_msole_new (m_input, NULL));
89
90- if (m_ole != NULL)
91+ if (!m_ole)
92+ m_ole = GSF_INFILE(gsf_infile_zip_new (m_input, NULL));
93+
94+ if (m_ole)
95 return true;
96
97 return false;
98 }
99
100-WPXInputStream * AbiWordPerfectGraphicsInputStream::getDocumentOLEStream()
101+unsigned AbiWordPerfectGraphicsInputStream::subStreamCount()
102 {
103- return getDocumentOLEStream("PerfectOffice_MAIN");
104+ if (!m_ole)
105+ m_ole = GSF_INFILE(gsf_infile_msole_new (m_input, NULL));
106+
107+ if (!m_ole)
108+ m_ole = GSF_INFILE(gsf_infile_zip_new (m_input, NULL));
109+
110+ if (m_ole)
111+ {
112+ int numChildren = gsf_infile_num_children(m_ole);
113+ if (numChildren > 0)
114+ return numChildren;
115+ return 0;
116+ }
117+
118+ return 0;
119 }
120
121-WPXInputStream * AbiWordPerfectGraphicsInputStream::getDocumentOLEStream(const char * name)
122+const char * AbiWordPerfectGraphicsInputStream::subStreamName(unsigned id)
123 {
124- WPXInputStream *documentStream = NULL;
125+ if (!m_ole)
126+ m_ole = GSF_INFILE(gsf_infile_msole_new (m_input, NULL));
127
128 if (!m_ole)
129+ m_ole = GSF_INFILE(gsf_infile_zip_new (m_input, NULL));
130+
131+ if (m_ole)
132+ {
133+ if ((int)id >= gsf_infile_num_children(m_ole))
134+ {
135+ return 0;
136+ }
137+ std::map<unsigned, std::string>::iterator i = m_substreams.lower_bound(id);
138+ if (i == m_substreams.end() || m_substreams.key_comp()(id, i->first))
139+ {
140+ std::string name = gsf_infile_name_by_index(m_ole, (int)id);
141+ i = m_substreams.insert(i, std::map<unsigned, std::string>::value_type(id, name));
142+ }
143+ return i->second.c_str();
144+ }
145+
146+ return 0;
147+}
148+
149+bool AbiWordPerfectGraphicsInputStream::existsSubStream(const char * name)
150+{
151+ if (!m_ole)
152 m_ole = GSF_INFILE(gsf_infile_msole_new (m_input, NULL));
153
154+ if (!m_ole)
155+ m_ole = GSF_INFILE(gsf_infile_zip_new (m_input, NULL));
156+
157 if (m_ole)
158 {
159 GsfInput *document = gsf_infile_child_by_name(m_ole, name);
160 if (document)
161 {
162+ g_object_unref(G_OBJECT (document));
163+ return true;
164+ }
165+ }
166+
167+ return false;
168+}
169+
170+librevenge::RVNGInputStream * AbiWordPerfectGraphicsInputStream::getSubStreamByName(const char * name)
171+{
172+ librevenge::RVNGInputStream *documentStream = NULL;
173+
174+ if (!m_ole)
175+ m_ole = GSF_INFILE(gsf_infile_msole_new (m_input, NULL));
176+
177+ if (!m_ole)
178+ m_ole = GSF_INFILE(gsf_infile_zip_new (m_input, NULL));
179+
180+ if (m_ole)
181+ {
182+ GsfInput *document = gsf_infile_child_by_name(m_ole, name);
183+ if (document)
184+ {
185 documentStream = new AbiWordPerfectGraphicsInputStream(document);
186 g_object_unref(G_OBJECT (document)); // the only reference should be encapsulated within the new stream
187 }
188@@ -138,12 +213,35 @@
189 return documentStream;
190 }
191
192+librevenge::RVNGInputStream * AbiWordPerfectGraphicsInputStream::getSubStreamById(unsigned id)
193+{
194+ librevenge::RVNGInputStream *documentStream = NULL;
195+
196+ if (!m_ole)
197+ m_ole = GSF_INFILE(gsf_infile_msole_new (m_input, NULL));
198+
199+ if (!m_ole)
200+ m_ole = GSF_INFILE(gsf_infile_zip_new (m_input, NULL));
201+
202+ if (m_ole)
203+ {
204+ GsfInput *document = gsf_infile_child_by_index(m_ole, (int)id);
205+ if (document)
206+ {
207+ documentStream = new AbiWordPerfectGraphicsInputStream(document);
208+ g_object_unref(G_OBJECT (document)); // the only reference should be encapsulated within the new stream
209+ }
210+ }
211+
212+ return documentStream;
213+}
214+
215 long AbiWordPerfectGraphicsInputStream::tell()
216 {
217 return gsf_input_tell(m_input);
218 }
219
220-bool AbiWordPerfectGraphicsInputStream::atEOS()
221+bool AbiWordPerfectGraphicsInputStream::isEnd()
222 {
223 return gsf_input_eof(m_input);
224 }
225@@ -244,14 +342,24 @@
226 UT_Error IE_Imp_WordPerfectGraphics::importGraphic(GsfInput *input, FG_Graphic **ppfg)
227 {
228 AbiWordPerfectGraphicsInputStream gsfInput(input);
229- WPXString svgOutput;
230- if (WPGraphics::generateSVG(&gsfInput, svgOutput))
231+ librevenge::RVNGString svgOutput;
232+ librevenge::RVNGStringVector vec;
233+ librevenge::RVNGSVGDrawingGenerator generator(vec, "");
234+
235+ if (!libwpg::WPGraphics::parse(&gsfInput, &generator) || vec.empty() || vec[0].empty())
236 {
237- GsfInput * svgInput = gsf_input_memory_new((const guint8*)svgOutput.cstr(), svgOutput.len(), false);
238- UT_Error result = IE_ImpGraphic::loadGraphic(svgInput, IE_ImpGraphic::fileTypeForSuffix(".svg"), ppfg);
239- g_object_unref(svgInput);
240- return result;
241+ return UT_ERROR;
242 }
243- return UT_ERROR;
244+
245+ svgOutput.append("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n");
246+ svgOutput.append("<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"");
247+ svgOutput.append(" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n");
248+ svgOutput.append(vec[0]);
249+ svgOutput.append("\n");
250+
251+ GsfInput * svgInput = gsf_input_memory_new((const guint8*)svgOutput.cstr(), svgOutput.len(), false);
252+ UT_Error result = IE_ImpGraphic::loadGraphic(svgInput, IE_ImpGraphic::fileTypeForSuffix(".svg"), ppfg);
253+ g_object_unref(svgInput);
254+ return result;
255 }
256
257Index: plugins/wpg/plugin.m4
258===================================================================
259--- plugins/wpg/plugin.m4 (revision 34460)
260+++ plugins/wpg/plugin.m4 (working copy)
261@@ -1,5 +1,5 @@
262
263-wpg_pkgs="$gsf_req libwpg-0.2 >= 0.2.0 libwpd-0.9 >= 0.9.0 libwpd-stream-0.9 >= 0.9.0"
264+wpg_pkgs="libwpg-0.3 $gsf_req"
265 wpg_deps="no"
266
267 if test "$enable_wpg" != ""; then
268Index: plugins/wordperfect/xp/ie_imp_WordPerfect.h
269===================================================================
270--- plugins/wordperfect/xp/ie_imp_WordPerfect.h (revision 34460)
271+++ plugins/wordperfect/xp/ie_imp_WordPerfect.h (working copy)
272@@ -30,7 +30,7 @@
273 #define IE_IMP_WP_H
274
275 #include <stdio.h>
276-#include <libwpd/libwpd.h>
277+#include <librevenge-0.0/librevenge/librevenge.h>
278 #include "ie_imp.h"
279 #include "ut_string.h"
280 #include "ut_string_class.h"
281@@ -92,7 +92,7 @@
282 IE_Imp ** ppie);
283 };
284
285-class IE_Imp_WordPerfect : public IE_Imp, public WPXDocumentInterface
286+class IE_Imp_WordPerfect : public IE_Imp, public librevenge::RVNGTextInterface
287 {
288 public:
289 IE_Imp_WordPerfect(PD_Document * pDocument);
290@@ -101,69 +101,83 @@
291 virtual void pasteFromBuffer(PD_DocumentRange * pDocRange,
292 UT_uint8 * pData, UT_uint32 lenData, const char * szEncoding = 0);
293
294- virtual void setDocumentMetaData(const WPXPropertyList &propList);
295+ virtual void setDocumentMetaData(const librevenge::RVNGPropertyList &propList);
296
297- virtual void startDocument();
298- virtual void endDocument();
299+ virtual void startDocument(const librevenge::RVNGPropertyList &propList);
300+ virtual void endDocument();
301
302- virtual void openPageSpan(const WPXPropertyList &propList);
303- virtual void closePageSpan() {}
304- virtual void openHeader(const WPXPropertyList &propList);
305- virtual void closeHeader();
306- virtual void openFooter(const WPXPropertyList &propList);
307- virtual void closeFooter();
308+ virtual void defineEmbeddedFont(const librevenge::RVNGPropertyList & /* propList */) {}
309
310- virtual void openParagraph(const WPXPropertyList &propList, const WPXPropertyListVector &tabStops);
311- virtual void closeParagraph() {}
312+ virtual void definePageStyle(const librevenge::RVNGPropertyList &) {}
313+ virtual void openPageSpan(const librevenge::RVNGPropertyList &propList);
314+ virtual void closePageSpan() {}
315+ virtual void openHeader(const librevenge::RVNGPropertyList &propList);
316+ virtual void closeHeader();
317+ virtual void openFooter(const librevenge::RVNGPropertyList &propList);
318+ virtual void closeFooter();
319
320- virtual void openSpan(const WPXPropertyList &propList);
321- virtual void closeSpan() {}
322+ virtual void defineSectionStyle(const librevenge::RVNGPropertyList &) {}
323+ virtual void openSection(const librevenge::RVNGPropertyList &propList);
324+ virtual void closeSection() {}
325
326- virtual void openSection(const WPXPropertyList &propList, const WPXPropertyListVector &columns);
327- virtual void closeSection() {}
328+ virtual void defineParagraphStyle(const librevenge::RVNGPropertyList &) {}
329+ virtual void openParagraph(const librevenge::RVNGPropertyList &propList);
330+ virtual void closeParagraph() {}
331
332- virtual void insertTab();
333- virtual void insertText(const WPXString &text);
334- virtual void insertLineBreak();
335+ virtual void defineCharacterStyle(const librevenge::RVNGPropertyList &) {}
336+ virtual void openSpan(const librevenge::RVNGPropertyList &propList);
337+ virtual void closeSpan() {}
338
339- virtual void defineOrderedListLevel(const WPXPropertyList &propList);
340- virtual void defineUnorderedListLevel(const WPXPropertyList &propList);
341- virtual void openOrderedListLevel(const WPXPropertyList &propList);
342- virtual void openUnorderedListLevel(const WPXPropertyList &propList);
343- virtual void closeOrderedListLevel();
344- virtual void closeUnorderedListLevel();
345- virtual void openListElement(const WPXPropertyList &propList, const WPXPropertyListVector &tabStops);
346- virtual void closeListElement() {}
347+ virtual void openLink(const librevenge::RVNGPropertyList & /* propList */) {}
348+ virtual void closeLink() {}
349
350- virtual void openFootnote(const WPXPropertyList &propList);
351- virtual void closeFootnote();
352- virtual void openEndnote(const WPXPropertyList &propList);
353- virtual void closeEndnote();
354+ virtual void insertTab();
355+ virtual void insertText(const librevenge::RVNGString &text);
356+ virtual void insertSpace();
357+ virtual void insertLineBreak();
358+ virtual void insertField(const librevenge::RVNGPropertyList & /* propList */) {}
359
360- virtual void openTable(const WPXPropertyList &propList, const WPXPropertyListVector &columns);
361- virtual void openTableRow(const WPXPropertyList &propList);
362- virtual void closeTableRow() {}
363- virtual void openTableCell(const WPXPropertyList &propList);
364- virtual void closeTableCell() {}
365- virtual void insertCoveredTableCell(const WPXPropertyList & /*propList*/) {}
366- virtual void closeTable();
367+ virtual void openOrderedListLevel(const librevenge::RVNGPropertyList &propList);
368+ virtual void openUnorderedListLevel(const librevenge::RVNGPropertyList &propList);
369+ virtual void closeOrderedListLevel();
370+ virtual void closeUnorderedListLevel();
371+ virtual void openListElement(const librevenge::RVNGPropertyList &propList);
372+ virtual void closeListElement() {}
373
374- virtual void definePageStyle(const WPXPropertyList&) {}
375- virtual void defineParagraphStyle(const WPXPropertyList&, const WPXPropertyListVector&) {}
376- virtual void defineCharacterStyle(const WPXPropertyList&) {}
377- virtual void defineSectionStyle(const WPXPropertyList&, const WPXPropertyListVector&) {}
378- virtual void insertSpace() {}
379- virtual void insertField(const WPXString&, const WPXPropertyList&) {}
380- virtual void openComment(const WPXPropertyList&) {}
381- virtual void closeComment() {}
382- virtual void openTextBox(const WPXPropertyList&) {}
383- virtual void closeTextBox() {}
384- virtual void openFrame(const WPXPropertyList&) {}
385- virtual void closeFrame() {}
386- virtual void insertBinaryObject(const WPXPropertyList&, const WPXBinaryData&) {}
387- virtual void insertEquation(const WPXPropertyList&, const WPXString&) {}
388+ virtual void openFootnote(const librevenge::RVNGPropertyList &propList);
389+ virtual void closeFootnote();
390+ virtual void openEndnote(const librevenge::RVNGPropertyList &propList);
391+ virtual void closeEndnote();
392+ virtual void openComment(const librevenge::RVNGPropertyList & /* propList */) {}
393+ virtual void closeComment() {}
394+ virtual void openTextBox(const librevenge::RVNGPropertyList & /* propList */) {}
395+ virtual void closeTextBox() {}
396
397+ virtual void openTable(const librevenge::RVNGPropertyList &propList);
398+ virtual void openTableRow(const librevenge::RVNGPropertyList &propList);
399+ virtual void closeTableRow() {}
400+ virtual void openTableCell(const librevenge::RVNGPropertyList &propList);
401+ virtual void closeTableCell() {}
402+ virtual void insertCoveredTableCell(const librevenge::RVNGPropertyList & /* propList */) {}
403+ virtual void closeTable();
404
405+ virtual void openFrame(const librevenge::RVNGPropertyList & /* propList */) {}
406+ virtual void closeFrame() {}
407+
408+ virtual void openGroup(const librevenge::RVNGPropertyList & /* propList */) {}
409+ virtual void closeGroup() {}
410+
411+ virtual void defineGraphicStyle(const librevenge::RVNGPropertyList & /* propList */) {}
412+ virtual void drawRectangle(const librevenge::RVNGPropertyList & /* propList */) {}
413+ virtual void drawEllipse(const librevenge::RVNGPropertyList & /* propList */) {}
414+ virtual void drawPolygon(const librevenge::RVNGPropertyList & /* propList */) {}
415+ virtual void drawPolyline(const librevenge::RVNGPropertyList & /* propList */) {}
416+ virtual void drawPath(const librevenge::RVNGPropertyList & /* propList */) {}
417+ virtual void drawConnector(const librevenge::RVNGPropertyList & /* propList */) {}
418+
419+ virtual void insertBinaryObject(const librevenge::RVNGPropertyList & /* propList */) {}
420+ virtual void insertEquation(const librevenge::RVNGPropertyList & /* propList */) {}
421+
422 protected:
423 virtual UT_Error _loadFile(GsfInput * input);
424 UT_Error _appendSection(int numColumns, const float, const float);
425Index: plugins/wordperfect/xp/ie_impexp_WordPerfect.cpp
426===================================================================
427--- plugins/wordperfect/xp/ie_impexp_WordPerfect.cpp (revision 34460)
428+++ plugins/wordperfect/xp/ie_impexp_WordPerfect.cpp (working copy)
429@@ -35,7 +35,6 @@
430 ABI_PLUGIN_DECLARE("WordPerfect")
431
432 static IE_Imp_WordPerfect_Sniffer * m_ImpSniffer = 0;
433-static IE_Exp_WordPerfect_Sniffer * m_ExpSniffer = 0;
434
435 #ifdef HAVE_LIBWPS
436 static IE_Imp_MSWorks_Sniffer * m_MSWorks_ImpSniffer = 0;
437@@ -49,13 +48,7 @@
438 m_ImpSniffer = new IE_Imp_WordPerfect_Sniffer ();
439 }
440
441- if (!m_ExpSniffer)
442- {
443- m_ExpSniffer = new IE_Exp_WordPerfect_Sniffer ();
444- }
445-
446 UT_ASSERT (m_ImpSniffer);
447- UT_ASSERT (m_ExpSniffer);
448
449 #ifdef HAVE_LIBWPS
450 if (!m_MSWorks_ImpSniffer)
451@@ -79,7 +72,7 @@
452 mi->usage = "No Usage";
453
454 IE_Imp::registerImporter (m_ImpSniffer);
455- //IE_Exp::registerExporter (m_ExpSniffer);
456+
457 return 1;
458 }
459
460@@ -93,18 +86,11 @@
461 mi->usage = 0;
462
463 UT_ASSERT (m_ImpSniffer);
464- UT_ASSERT (m_ExpSniffer);
465
466 IE_Imp::unregisterImporter (m_ImpSniffer);
467 delete m_ImpSniffer;
468 m_ImpSniffer = 0;
469
470- /*
471- IE_Exp::unregisterExporter (m_ExpSniffer);
472- delete m_ExpSniffer;
473- m_ExpSniffer = 0;
474- */
475-
476 #ifdef HAVE_LIBWPS
477 IE_Imp::unregisterImporter (m_MSWorks_ImpSniffer);
478 delete m_MSWorks_ImpSniffer;
479Index: plugins/wordperfect/xp/ie_imp_WordPerfect.cpp
480===================================================================
481--- plugins/wordperfect/xp/ie_imp_WordPerfect.cpp (revision 34460)
482+++ plugins/wordperfect/xp/ie_imp_WordPerfect.cpp (working copy)
483@@ -31,6 +31,8 @@
484 #include <stdlib.h>
485 #include <string.h>
486 #include <math.h>
487+#include <map>
488+#include <string>
489 #include <gsf/gsf-utils.h>
490 #include <gsf/gsf-input-memory.h>
491 #include <gsf/gsf-input-stdio.h>
492@@ -60,42 +62,47 @@
493
494 // Stream class
495
496-#include <libwpd-stream/libwpd-stream.h>
497+#include <librevenge-0.0/librevenge-stream/librevenge-stream.h>
498+#include <libwpd/libwpd.h>
499
500 #include <gsf/gsf-input.h>
501 #include <gsf/gsf-infile.h>
502 #include <gsf/gsf-infile-msole.h>
503+#include <gsf/gsf-infile-zip.h>
504
505 #ifdef HAVE_LIBWPS
506 #include <libwps/libwps.h>
507 #endif
508
509-class AbiWordperfectInputStream : public WPXInputStream
510+class AbiWordperfectInputStream : public librevenge::RVNGInputStream
511 {
512 public:
513 AbiWordperfectInputStream(GsfInput *input);
514 ~AbiWordperfectInputStream();
515
516- virtual bool isOLEStream();
517- virtual WPXInputStream * getDocumentOLEStream();
518-
519- virtual WPXInputStream * getDocumentOLEStream(const char * name);
520-
521+ virtual bool isStructured();
522+ virtual unsigned subStreamCount();
523+ virtual const char* subStreamName(unsigned);
524+ bool existsSubStream(const char*);
525+ virtual librevenge::RVNGInputStream* getSubStreamByName(const char*);
526+ virtual librevenge::RVNGInputStream* getSubStreamById(unsigned);
527 virtual const unsigned char *read(unsigned long numBytes, unsigned long &numBytesRead);
528- virtual int seek(long offset, WPX_SEEK_TYPE seekType);
529+ virtual int seek(long offset, librevenge::RVNG_SEEK_TYPE seekType);
530 virtual long tell();
531- virtual bool atEOS();
532+ virtual bool isEnd();
533
534 private:
535
536 GsfInput *m_input;
537 GsfInfile *m_ole;
538+ std::map<unsigned, std::string> m_substreams;
539 };
540
541 AbiWordperfectInputStream::AbiWordperfectInputStream(GsfInput *input) :
542- WPXInputStream(),
543+ librevenge::RVNGInputStream(),
544 m_input(input),
545- m_ole(NULL)
546+ m_ole(NULL),
547+ m_substreams()
548 {
549 g_object_ref(G_OBJECT(input));
550 }
551@@ -120,50 +127,120 @@
552 return buf;
553 }
554
555-int AbiWordperfectInputStream::seek(long offset, WPX_SEEK_TYPE seekType)
556+int AbiWordperfectInputStream::seek(long offset, librevenge::RVNG_SEEK_TYPE seekType)
557 {
558 GSeekType gsfSeekType = G_SEEK_SET;
559 switch(seekType)
560 {
561- case WPX_SEEK_CUR:
562+ case librevenge::RVNG_SEEK_CUR:
563 gsfSeekType = G_SEEK_CUR;
564 break;
565- case WPX_SEEK_SET:
566+ case librevenge::RVNG_SEEK_SET:
567 gsfSeekType = G_SEEK_SET;
568 break;
569+ case librevenge::RVNG_SEEK_END:
570+ gsfSeekType = G_SEEK_END;
571+ break;
572 }
573
574 return gsf_input_seek(m_input, offset, gsfSeekType);
575 }
576
577-bool AbiWordperfectInputStream::isOLEStream()
578+bool AbiWordperfectInputStream::isStructured()
579 {
580 if (!m_ole)
581 m_ole = GSF_INFILE(gsf_infile_msole_new (m_input, NULL));
582
583- if (m_ole != NULL)
584+ if (!m_ole)
585+ m_ole = GSF_INFILE(gsf_infile_zip_new (m_input, NULL));
586+
587+ if (m_ole)
588 return true;
589
590 return false;
591 }
592
593-WPXInputStream * AbiWordperfectInputStream::getDocumentOLEStream()
594+unsigned AbiWordperfectInputStream::subStreamCount()
595 {
596- return getDocumentOLEStream("PerfectOffice_MAIN");
597+ if (!m_ole)
598+ m_ole = GSF_INFILE(gsf_infile_msole_new (m_input, NULL));
599+
600+ if (!m_ole)
601+ m_ole = GSF_INFILE(gsf_infile_zip_new (m_input, NULL));
602+
603+ if (m_ole)
604+ {
605+ int numChildren = gsf_infile_num_children(m_ole);
606+ if (numChildren > 0)
607+ return numChildren;
608+ return 0;
609+ }
610+
611+ return 0;
612 }
613
614-WPXInputStream * AbiWordperfectInputStream::getDocumentOLEStream(const char * name)
615+const char * AbiWordperfectInputStream::subStreamName(unsigned id)
616 {
617- WPXInputStream *documentStream = NULL;
618+ if (!m_ole)
619+ m_ole = GSF_INFILE(gsf_infile_msole_new (m_input, NULL));
620
621 if (!m_ole)
622+ m_ole = GSF_INFILE(gsf_infile_zip_new (m_input, NULL));
623+
624+ if (m_ole)
625+ {
626+ if ((int)id >= gsf_infile_num_children(m_ole))
627+ {
628+ return 0;
629+ }
630+ std::map<unsigned, std::string>::iterator i = m_substreams.lower_bound(id);
631+ if (i == m_substreams.end() || m_substreams.key_comp()(id, i->first))
632+ {
633+ std::string name = gsf_infile_name_by_index(m_ole, (int)id);
634+ i = m_substreams.insert(i, std::map<unsigned, std::string>::value_type(id, name));
635+ }
636+ return i->second.c_str();
637+ }
638+
639+ return 0;
640+}
641+
642+bool AbiWordperfectInputStream::existsSubStream(const char * name)
643+{
644+ if (!m_ole)
645 m_ole = GSF_INFILE(gsf_infile_msole_new (m_input, NULL));
646
647+ if (!m_ole)
648+ m_ole = GSF_INFILE(gsf_infile_zip_new (m_input, NULL));
649+
650 if (m_ole)
651 {
652 GsfInput *document = gsf_infile_child_by_name(m_ole, name);
653 if (document)
654 {
655+ g_object_unref(G_OBJECT (document));
656+ return true;
657+ }
658+ }
659+
660+ return false;
661+}
662+
663+librevenge::RVNGInputStream * AbiWordperfectInputStream::getSubStreamByName(const char * name)
664+{
665+ librevenge::RVNGInputStream *documentStream = NULL;
666+
667+ if (!m_ole)
668+ m_ole = GSF_INFILE(gsf_infile_msole_new (m_input, NULL));
669+
670+ if (!m_ole)
671+ m_ole = GSF_INFILE(gsf_infile_zip_new (m_input, NULL));
672+
673+ if (m_ole)
674+ {
675+ GsfInput *document = gsf_infile_child_by_name(m_ole, name);
676+ if (document)
677+ {
678 documentStream = new AbiWordperfectInputStream(document);
679 g_object_unref(G_OBJECT (document)); // the only reference should be encapsulated within the new stream
680 }
681@@ -172,12 +249,35 @@
682 return documentStream;
683 }
684
685+librevenge::RVNGInputStream * AbiWordperfectInputStream::getSubStreamById(unsigned id)
686+{
687+ librevenge::RVNGInputStream *documentStream = NULL;
688+
689+ if (!m_ole)
690+ m_ole = GSF_INFILE(gsf_infile_msole_new (m_input, NULL));
691+
692+ if (!m_ole)
693+ m_ole = GSF_INFILE(gsf_infile_zip_new (m_input, NULL));
694+
695+ if (m_ole)
696+ {
697+ GsfInput *document = gsf_infile_child_by_index(m_ole, (int)id);
698+ if (document)
699+ {
700+ documentStream = new AbiWordperfectInputStream(document);
701+ g_object_unref(G_OBJECT (document)); // the only reference should be encapsulated within the new stream
702+ }
703+ }
704+
705+ return documentStream;
706+}
707+
708 long AbiWordperfectInputStream::tell()
709 {
710 return gsf_input_tell(m_input);
711 }
712
713-bool AbiWordperfectInputStream::atEOS()
714+bool AbiWordperfectInputStream::isEnd()
715 {
716 return gsf_input_eof(m_input);
717 }
718@@ -247,13 +347,13 @@
719 {
720 AbiWordperfectInputStream gsfInput(input);
721
722- WPDConfidence confidence = WPDocument::isFileFormatSupported(&gsfInput);
723-
724+ libwpd::WPDConfidence confidence = libwpd::WPDocument::isFileFormatSupported(&gsfInput);
725+
726 switch (confidence)
727 {
728- case WPD_CONFIDENCE_NONE:
729+ case libwpd::WPD_CONFIDENCE_NONE:
730 return UT_CONFIDENCE_ZILCH;
731- case WPD_CONFIDENCE_EXCELLENT:
732+ case libwpd::WPD_CONFIDENCE_EXCELLENT:
733 return UT_CONFIDENCE_PERFECT;
734 default:
735 return UT_CONFIDENCE_ZILCH;
736@@ -312,9 +412,9 @@
737 UT_Error IE_Imp_WordPerfect::_loadFile(GsfInput * input)
738 {
739 AbiWordperfectInputStream gsfInput(input);
740- WPDResult error = WPDocument::parse(&gsfInput, static_cast<WPXDocumentInterface *>(this), NULL);
741+ libwpd::WPDResult error = libwpd::WPDocument::parse(&gsfInput, static_cast<librevenge::RVNGTextInterface *>(this), NULL);
742
743- if (error != WPD_OK)
744+ if (error != libwpd::WPD_OK)
745 {
746 UT_DEBUGMSG(("AbiWordPerfect: ERROR: %i!\n", (int)error));
747 return UT_IE_IMPORTERROR;
748@@ -329,7 +429,7 @@
749 // nada
750 }
751
752-void IE_Imp_WordPerfect::setDocumentMetaData(const WPXPropertyList &propList)
753+void IE_Imp_WordPerfect::setDocumentMetaData(const librevenge::RVNGPropertyList &propList)
754 {
755 if (propList["dc:author"])
756 getDoc()->setMetaDataProp(PD_META_KEY_CREATOR, propList["dc:author"]->getStr().cstr());
757@@ -339,15 +439,15 @@
758 getDoc()->setMetaDataProp(PD_META_KEY_PUBLISHER, propList["dc:publisher"]->getStr().cstr());
759 if (propList["dc:type"])
760 getDoc()->setMetaDataProp(PD_META_KEY_TYPE, propList["dc:category"]->getStr().cstr());
761- if (propList["libwpd:keywords"])
762- getDoc()->setMetaDataProp(PD_META_KEY_KEYWORDS, propList["libwpd:keywords"]->getStr().cstr());
763+ if (propList["librevenge:keywords"])
764+ getDoc()->setMetaDataProp(PD_META_KEY_KEYWORDS, propList["librevenge:keywords"]->getStr().cstr());
765 if (propList["dc:language"])
766 getDoc()->setMetaDataProp(PD_META_KEY_LANGUAGE, propList["dc:language"]->getStr().cstr());
767- if (propList["libwpd:abstract"])
768- getDoc()->setMetaDataProp(PD_META_KEY_DESCRIPTION, propList["libwpd:abstract"]->getStr().cstr());
769+ if (propList["librevenge:abstract"])
770+ getDoc()->setMetaDataProp(PD_META_KEY_DESCRIPTION, propList["librevenge:abstract"]->getStr().cstr());
771 }
772
773-void IE_Imp_WordPerfect::startDocument()
774+void IE_Imp_WordPerfect::startDocument(const librevenge::RVNGPropertyList & /* propList */)
775 {
776 UT_DEBUGMSG(("AbiWordPerfect: startDocument\n"));
777 }
778@@ -357,7 +457,7 @@
779 UT_DEBUGMSG(("AbiWordPerfect: endDocument\n"));
780 }
781
782-void IE_Imp_WordPerfect::openPageSpan(const WPXPropertyList &propList)
783+void IE_Imp_WordPerfect::openPageSpan(const librevenge::RVNGPropertyList &propList)
784 {
785 if (m_bHdrFtrOpenCount) return; // HACK
786 UT_DEBUGMSG(("AbiWordPerfect: openPageSpan\n"));
787@@ -378,7 +478,7 @@
788
789 }
790
791-void IE_Imp_WordPerfect::openHeader(const WPXPropertyList & /*propList*/)
792+void IE_Imp_WordPerfect::openHeader(const librevenge::RVNGPropertyList & /*propList*/)
793 {
794 m_bHdrFtrOpenCount++;
795
796@@ -420,7 +520,7 @@
797 */
798 }
799
800-void IE_Imp_WordPerfect::openFooter(const WPXPropertyList & /*propList*/)
801+void IE_Imp_WordPerfect::openFooter(const librevenge::RVNGPropertyList & /*propList*/)
802 {
803 m_bHdrFtrOpenCount++;
804 // see above comments re: openHeader
805@@ -432,7 +532,7 @@
806 // see above comments re: closeHeader
807 }
808
809-void IE_Imp_WordPerfect::openParagraph(const WPXPropertyList &propList, const WPXPropertyListVector &tabStops)
810+void IE_Imp_WordPerfect::openParagraph(const librevenge::RVNGPropertyList &propList)
811 {
812 if (m_bHdrFtrOpenCount) return; // HACK
813 UT_DEBUGMSG(("AbiWordPerfect: openParagraph()\n"));
814@@ -478,13 +578,15 @@
815 (int)(m_topMargin*72), (int)(m_bottomMargin*72), m_leftMarginOffset, m_rightMarginOffset, m_textIndent, lineSpacing);
816 propBuffer += tmpBuffer;
817
818- if (tabStops.count() > 0) // Append the tabstop information
819+ const librevenge::RVNGPropertyListVector *tabStops = propList.child("style:tab-stops");
820+
821+ if (tabStops && tabStops->count()) // Append the tabstop information
822 {
823 propBuffer += "; tabstops:";
824 tmpBuffer = "";
825- WPXPropertyListVector::Iter i(tabStops);
826- for (i.rewind(); i.next();)
827- {
828+ librevenge::RVNGPropertyListVector::Iter i(*tabStops);
829+ for (i.rewind(); i.next();)
830+ {
831 propBuffer += tmpBuffer;
832 if (i()["style:position"])
833 {
834@@ -515,8 +617,8 @@
835 propBuffer += "0";
836
837 tmpBuffer = ",";
838- }
839- }
840+ }
841+ }
842
843
844
845@@ -543,7 +645,7 @@
846 }
847 }
848
849-void IE_Imp_WordPerfect::openSpan(const WPXPropertyList &propList)
850+void IE_Imp_WordPerfect::openSpan(const librevenge::RVNGPropertyList &propList)
851 {
852 if (m_bHdrFtrOpenCount) return; // HACK
853 UT_DEBUGMSG(("AbiWordPerfect: Appending current text properties\n"));
854@@ -614,13 +716,14 @@
855 X_CheckDocumentError(appendFmt(propsArray));
856 }
857
858-void IE_Imp_WordPerfect::openSection(const WPXPropertyList &propList, const WPXPropertyListVector &columns)
859+void IE_Imp_WordPerfect::openSection(const librevenge::RVNGPropertyList &propList)
860 {
861 if (m_bHdrFtrOpenCount) return; // HACK
862 UT_DEBUGMSG(("AbiWordPerfect: openSection\n"));
863
864 float marginLeft = 0.0f, marginRight = 0.0f;
865- int columnsCount = ((columns.count() == 0) ? 1 : columns.count());
866+ const librevenge::RVNGPropertyListVector *columns = propList.child("style:columns");
867+ int columnsCount = ((!columns || !columns->count()) ? 1 : columns->count());
868
869 // TODO: support spaceAfter
870 if (propList["fo:start-indent"])
871@@ -647,7 +750,7 @@
872 X_CheckDocumentError(appendSpan(&ucs,1));
873 }
874
875-void IE_Imp_WordPerfect::insertText(const WPXString &text)
876+void IE_Imp_WordPerfect::insertText(const librevenge::RVNGString &text)
877 {
878 if (m_bHdrFtrOpenCount) return; // HACK
879 if (text.len())
880@@ -658,6 +761,15 @@
881 }
882 }
883
884+void IE_Imp_WordPerfect::insertSpace()
885+{
886+ if (m_bHdrFtrOpenCount) return; // HACK
887+ UT_DEBUGMSG(("AbiWordPerfect: insertSpace\n"));
888+
889+ UT_UCS4Char ucs = UCS_SPACE;
890+ X_CheckDocumentError(appendSpan(&ucs,1));
891+}
892+
893 void IE_Imp_WordPerfect::insertLineBreak()
894 {
895 if (m_bHdrFtrOpenCount) return; // HACK
896@@ -668,12 +780,11 @@
897 }
898
899
900-
901-void IE_Imp_WordPerfect::defineOrderedListLevel(const WPXPropertyList &propList)
902+void IE_Imp_WordPerfect::openOrderedListLevel(const librevenge::RVNGPropertyList &propList)
903 {
904 if (m_bHdrFtrOpenCount) return; // HACK
905- UT_DEBUGMSG(("AbiWordPerfect: defineOrderedListLevel\n"));
906-
907+ UT_DEBUGMSG(("AbiWordPerfect: openOrderedListLevel\n"));
908+
909 int listID = 0, startingNumber = 0, level = 1;
910 char listType = '1';
911 UT_UTF8String textBeforeNumber, textAfterNumber;
912@@ -680,12 +791,12 @@
913 float listLeftOffset = 0.0f;
914 float listMinLabelWidth = 0.0f;
915
916- if (propList["libwpd:id"])
917- listID = propList["libwpd:id"]->getInt();
918+ if (propList["librevenge:id"])
919+ listID = propList["librevenge:id"]->getInt();
920 if (propList["text:start-value"])
921 startingNumber = propList["text:start-value"]->getInt();
922- if (propList["libwpd:level"])
923- level = propList["libwpd:level"]->getInt();
924+ if (propList["librevenge:level"])
925+ level = propList["librevenge:level"]->getInt();
926 if (propList["style:num-prefix"])
927 textBeforeNumber += propList["style:num-prefix"]->getStr().cstr();
928 if (propList["style:num-suffix"])
929@@ -716,22 +827,38 @@
930 m_pCurrentListDefinition->setListMinLabelWidth(level, listMinLabelWidth);
931 _updateDocumentOrderedListDefinition(m_pCurrentListDefinition, level, listType, textBeforeNumber, textAfterNumber, startingNumber);
932 }
933+
934+ m_iCurrentListLevel++;
935 }
936
937-void IE_Imp_WordPerfect::defineUnorderedListLevel(const WPXPropertyList &propList)
938+void IE_Imp_WordPerfect::closeOrderedListLevel()
939 {
940 if (m_bHdrFtrOpenCount) return; // HACK
941- UT_DEBUGMSG(("AbiWordPerfect: defineUnorderedListLevel\n"));
942+ UT_DEBUGMSG(("AbiWordPerfect: closeOrderedListLevel (level: %i)\n", m_iCurrentListLevel));
943+ UT_ASSERT(m_iCurrentListLevel > 0);
944+
945+ // every time we close a list level, the level above it is normally renumbered to start at "1"
946+ // again. this code takes care of that.
947+ if (m_iCurrentListLevel < (WP6_NUM_LIST_LEVELS-1))
948+ m_pCurrentListDefinition->setLevelNumber(m_iCurrentListLevel + 1, 0);
949+
950+ m_iCurrentListLevel--;
951+}
952
953+void IE_Imp_WordPerfect::openUnorderedListLevel(const librevenge::RVNGPropertyList &propList)
954+{
955+ if (m_bHdrFtrOpenCount) return; // HACK
956+ UT_DEBUGMSG(("AbiWordPerfect: openUNorderedListLevel\n"));
957+
958 int listID = 0, level = 1;
959- WPXString textBeforeNumber, textAfterNumber;
960+ librevenge::RVNGString textBeforeNumber, textAfterNumber;
961 float listLeftOffset = 0.0f;
962 float listMinLabelWidth = 0.0f;
963
964- if (propList["libwpd:id"])
965- listID = propList["libwpd:id"]->getInt();
966- if (propList["libwpd:level"])
967- level = propList["libwpd:level"]->getInt();
968+ if (propList["librevenge:id"])
969+ listID = propList["librevenge:id"]->getInt();
970+ if (propList["librevenge:level"])
971+ level = propList["librevenge:level"]->getInt();
972 if (propList["text:space-before"])
973 listLeftOffset = propList["text:space-before"]->getDouble();
974 if (propList["text:min-label-width"])
975@@ -752,39 +879,10 @@
976 m_pCurrentListDefinition->setListMinLabelWidth(level, listMinLabelWidth);
977 _updateDocumentUnorderedListDefinition(m_pCurrentListDefinition, level);
978 }
979-}
980
981-//void IE_Imp_WordPerfect::openOrderedListLevel(const int listID)
982-void IE_Imp_WordPerfect::openOrderedListLevel(const WPXPropertyList & /*propList*/)
983-{
984- if (m_bHdrFtrOpenCount) return; // HACK
985- UT_DEBUGMSG(("AbiWordPerfect: openOrderedListLevel\n"));
986-
987 m_iCurrentListLevel++;
988 }
989
990-void IE_Imp_WordPerfect::closeOrderedListLevel()
991-{
992- if (m_bHdrFtrOpenCount) return; // HACK
993- UT_DEBUGMSG(("AbiWordPerfect: closeOrderedListLevel (level: %i)\n", m_iCurrentListLevel));
994- UT_ASSERT(m_iCurrentListLevel > 0);
995-
996- // every time we close a list level, the level above it is normally renumbered to start at "1"
997- // again. this code takes care of that.
998- if (m_iCurrentListLevel < (WP6_NUM_LIST_LEVELS-1))
999- m_pCurrentListDefinition->setLevelNumber(m_iCurrentListLevel + 1, 0);
1000-
1001- m_iCurrentListLevel--;
1002-}
1003-
1004-void IE_Imp_WordPerfect::openUnorderedListLevel(const WPXPropertyList & /*propList*/)
1005-{
1006- if (m_bHdrFtrOpenCount) return; // HACK
1007- UT_DEBUGMSG(("AbiWordPerfect: openUNorderedListLevel\n"));
1008-
1009- m_iCurrentListLevel++;
1010-}
1011-
1012 void IE_Imp_WordPerfect::closeUnorderedListLevel()
1013 {
1014 if (m_bHdrFtrOpenCount) return; // HACK
1015@@ -796,7 +894,7 @@
1016
1017 // ASSUMPTION: We assume that unordered lists will always pass a number of "0". unpredictable behaviour
1018 // may result otherwise
1019-void IE_Imp_WordPerfect::openListElement(const WPXPropertyList &propList, const WPXPropertyListVector & /*tabStops*/)
1020+void IE_Imp_WordPerfect::openListElement(const librevenge::RVNGPropertyList &propList)
1021 {
1022 if (m_bHdrFtrOpenCount) return; // HACK
1023 UT_DEBUGMSG(("AbiWordPerfect: openListElement\n"));
1024@@ -885,7 +983,7 @@
1025 X_CheckDocumentError(appendSpan(&ucs,1));
1026 }
1027
1028-void IE_Imp_WordPerfect::openFootnote(const WPXPropertyList & /*propList*/)
1029+void IE_Imp_WordPerfect::openFootnote(const librevenge::RVNGPropertyList & /*propList*/)
1030 {
1031 if (m_bHdrFtrOpenCount) return; // HACK
1032
1033@@ -934,7 +1032,7 @@
1034 X_CheckDocumentError(appendStrux(PTX_EndFootnote,NULL));
1035 }
1036
1037-void IE_Imp_WordPerfect::openEndnote(const WPXPropertyList & /*propList*/)
1038+void IE_Imp_WordPerfect::openEndnote(const librevenge::RVNGPropertyList & /*propList*/)
1039 {
1040 if (m_bHdrFtrOpenCount) return; // HACK
1041 const gchar** propsArray = NULL;
1042@@ -975,7 +1073,7 @@
1043 X_CheckDocumentError(appendStrux(PTX_EndEndnote,NULL));
1044 }
1045
1046-void IE_Imp_WordPerfect::openTable(const WPXPropertyList &propList, const WPXPropertyListVector &columns)
1047+void IE_Imp_WordPerfect::openTable(const librevenge::RVNGPropertyList &propList)
1048 {
1049 if (m_bHdrFtrOpenCount) return; // HACK
1050 // TODO: handle 'marginLeftOffset' and 'marginRightOffset'
1051@@ -1000,14 +1098,18 @@
1052 }
1053 }
1054
1055- propBuffer += "table-column-props:";
1056- WPXPropertyListVector::Iter i(columns);
1057- for (i.rewind(); i.next();)
1058+ const librevenge::RVNGPropertyListVector *columns = propList.child("librevenge:table-columns");
1059+ if (columns)
1060 {
1061- UT_String tmpBuffer;
1062- if (i()["style:column-width"])
1063- UT_String_sprintf(tmpBuffer, "%s/", i()["style:column-width"]->getStr().cstr());
1064- propBuffer += tmpBuffer;
1065+ propBuffer += "table-column-props:";
1066+ librevenge::RVNGPropertyListVector::Iter i(*columns);
1067+ for (i.rewind(); i.next();)
1068+ {
1069+ UT_String tmpBuffer;
1070+ if (i()["style:column-width"])
1071+ UT_String_sprintf(tmpBuffer, "%s/", i()["style:column-width"]->getStr().cstr());
1072+ propBuffer += tmpBuffer;
1073+ }
1074 }
1075
1076 const gchar* propsArray[3];
1077@@ -1018,7 +1120,7 @@
1078 X_CheckDocumentError(appendStrux(PTX_SectionTable, propsArray));
1079 }
1080
1081-void IE_Imp_WordPerfect::openTableRow(const WPXPropertyList & /*propList*/)
1082+void IE_Imp_WordPerfect::openTableRow(const librevenge::RVNGPropertyList & /*propList*/)
1083 {
1084 if (m_bHdrFtrOpenCount) return; // HACK
1085 UT_DEBUGMSG(("AbiWordPerfect: openRow\n"));
1086@@ -1030,14 +1132,14 @@
1087 m_bInCell = false;
1088 }
1089
1090-void IE_Imp_WordPerfect::openTableCell(const WPXPropertyList &propList)
1091+void IE_Imp_WordPerfect::openTableCell(const librevenge::RVNGPropertyList &propList)
1092 {
1093 if (m_bHdrFtrOpenCount) return; // HACK
1094 int col =0, row = 0, colSpan = 0, rowSpan = 0;
1095- if (propList["libwpd:column"])
1096- col = propList["libwpd:column"]->getInt();
1097- if (propList["libwpd:row"])
1098- row = propList["libwpd:row"]->getInt();
1099+ if (propList["librevenge:column"])
1100+ col = propList["librevenge:column"]->getInt();
1101+ if (propList["librevenge:row"])
1102+ row = propList["librevenge:row"]->getInt();
1103 if (propList["table:number-columns-spanned"])
1104 colSpan = propList["table:number-columns-spanned"]->getInt();
1105 if (propList["table:number-rows-spanned"])
1106@@ -1247,9 +1349,9 @@
1107 virtual UT_Error _loadFile(GsfInput * input)
1108 {
1109 AbiWordperfectInputStream gsfInput(input);
1110- WPSResult error = WPSDocument::parse(&gsfInput, static_cast<WPXDocumentInterface *>(this));
1111+ libwps::WPSResult error = libwps::WPSDocument::parse(&gsfInput, static_cast<librevenge::RVNGTextInterface *>(this));
1112
1113- if (error != WPS_OK)
1114+ if (error != libwps::WPS_OK)
1115 {
1116 UT_DEBUGMSG(("AbiMSWorks: ERROR: %i!\n", (int)error));
1117 return UT_IE_IMPORTERROR;
1118@@ -1286,13 +1388,17 @@
1119 {
1120 AbiWordperfectInputStream gsfInput(input);
1121
1122- WPSConfidence confidence = WPSDocument::isFileFormatSupported(&gsfInput);
1123+ libwps::WPSKind kind;
1124+ libwps::WPSConfidence confidence = libwps::WPSDocument::isFileFormatSupported(&gsfInput, kind);
1125+
1126+ if (kind != libwps::WPS_TEXT)
1127+ confidence = libwps::WPS_CONFIDENCE_NONE;
1128
1129 switch (confidence)
1130 {
1131- case WPS_CONFIDENCE_NONE:
1132+ case libwps::WPS_CONFIDENCE_NONE:
1133 return UT_CONFIDENCE_ZILCH;
1134- case WPS_CONFIDENCE_EXCELLENT:
1135+ case libwps::WPS_CONFIDENCE_EXCELLENT:
1136 return UT_CONFIDENCE_PERFECT;
1137 default:
1138 return UT_CONFIDENCE_ZILCH;
1139Index: plugins/wordperfect/xp/Makefile.am
1140===================================================================
1141--- plugins/wordperfect/xp/Makefile.am (revision 34460)
1142+++ plugins/wordperfect/xp/Makefile.am (working copy)
1143@@ -6,8 +6,6 @@
1144 -DABI_BUILD_VERSION=\"$(VERSION)\"
1145
1146 libxp_la_SOURCES = \
1147- ie_exp_WordPerfect.cpp \
1148- ie_exp_WordPerfect.h \
1149 ie_impexp_WordPerfect.cpp \
1150 ie_impexp_WordPerfect.h \
1151 ie_imp_WordPerfect.cpp \
1152Index: plugins/wordperfect/xp/ie_impexp_WordPerfect.h
1153===================================================================
1154--- plugins/wordperfect/xp/ie_impexp_WordPerfect.h (revision 34460)
1155+++ plugins/wordperfect/xp/ie_impexp_WordPerfect.h (working copy)
1156@@ -24,7 +24,6 @@
1157 */
1158
1159 #include "ie_imp_WordPerfect.h"
1160-#include "ie_exp_WordPerfect.h"
1161 #include "xap_Module.h"
1162
1163 #define IE_MIMETYPE_WP_51 "application/wordperfect5.1"
1164Index: plugins/wordperfect/plugin.m4
1165===================================================================
1166--- plugins/wordperfect/plugin.m4 (revision 34460)
1167+++ plugins/wordperfect/plugin.m4 (working copy)
1168@@ -1,6 +1,6 @@
1169
1170-wordperfect_pkgs="libwpg-0.2 >= 0.2.0 libwpd-0.9 >= 0.9.0 libwpd-stream-0.9 >= 0.9.0 $gsf_req"
1171-wordperfect_wps_pkgs='libwps-0.2 >= 0.1.0'
1172+wordperfect_pkgs="libwpd-0.10 $gsf_req"
1173+wordperfect_wps_pkgs='libwps-0.3'
1174 wordperfect_deps="no"
1175
1176 WORDPERFECT_CFLAGS=
1177@@ -29,7 +29,7 @@
1178
1179 PKG_CHECK_EXISTS([ $wordperfect_wps_pkgs ],
1180 [
1181- wp_deps_pkgs="$wp_deps_pkgs $wordperfect_wps_pkgs"
1182+ wp_deps_pkgs="$wordperfect_wps_pkgs $wp_deps_pkgs"
1183 WPS_DEFINE=" -DHAVE_LIBWPS"
1184 ])
1185
This page took 0.249874 seconds and 4 git commands to generate.