Merge lp:~inkscape.dev/inkscape/inkscape-librevenge into lp:~inkscape.dev/inkscape/trunk

Proposed by su_v
Status: Superseded
Proposed branch: lp:~inkscape.dev/inkscape/inkscape-librevenge
Merge into: lp:~inkscape.dev/inkscape/trunk
Diff against target: 438 lines (+179/-62)
5 files modified
configure.ac (+64/-21)
src/extension/internal/cdr-input.cpp (+28/-8)
src/extension/internal/vsd-input.cpp (+29/-8)
src/extension/internal/wpg-input.cpp (+36/-21)
src/ui/dialog/symbols.cpp (+22/-4)
To merge this branch: bzr merge lp:~inkscape.dev/inkscape/inkscape-librevenge
Reviewer Review Type Date Requested Status
su_v (community) Needs Resubmitting
Review via email: mp+221153@code.launchpad.net

This proposal has been superseded by a proposal from 2014-08-26.

Description of the change

Port inkscape to librevenge framework for WPG, CDR and VSD imports

See also:
http://www.documentliberation.org/
http://libregraphicsworld.org/blog/entry/librevenge-has-arrived

Branch compiled successfully on OS X 10.7.5 with latest git master of librevenge, libwpd, libwpg, libcdr, libvisio. A handful of test files (WPG, VSD, VSDX, CDR) opened correctly.

Currently introduces an indirect dependency on one of the boost libraries: librevenge-stream-0.0 requires the Filesystem library from the Boost C++ libraries. Possibly an issue for packaging (Windows, OS X)?

To post a comment you must log in.
Revision history for this message
su_v (suv-lp) wrote :

On 2014-05-28 06:24 +0100, ~suv wrote:
> Currently introduces an indirect dependency on one of the boost
> libraries: librevenge-stream-0.0 requires the Filesystem library from
> the Boost C++ libraries.

The dependency on the Filesystem library has been removed from upstream librevenge today:
<http://sourceforge.net/p/libwpd/librevenge/ci/fd8b4f3d933b631584e3338eae564f9336a20533/tree/>

13400. By su_v

update to trunk (r13407)

13401. By su_v

update to trunk (r13425)

13402. By su_v

update to trunk (r13454)

13403. By su_v

update to trunk (r13472)

13404. By su_v

update to trunk (r13488)

13405. By su_v

librevenge: update to latest patch from bug #1323592 (support old and new versions of libwpg, libcdr and libvisio
)

13406. By su_v

update to trunk (r13532)

Revision history for this message
su_v (suv-lp) wrote :

Branch updated in r13405 to latest patch from bug #1323592 for conditional build.

review: Needs Resubmitting
13407. By su_v

update to trunk (r13540)

13408. By su_v

update to trunk (r13560)

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'configure.ac'
2--- configure.ac 2014-08-15 05:27:49 +0000
3+++ configure.ac 2014-08-26 09:24:10 +0000
4@@ -530,27 +530,32 @@
5 with_libwpg=no
6
7 if test "x$enable_wpg" = "xyes"; then
8- PKG_CHECK_MODULES(LIBWPG01, libwpg-0.1 libwpg-stream-0.1, with_libwpg01=yes, with_libwpg01=no)
9- if test "x$with_libwpg01" = "xyes"; then
10- AC_DEFINE(WITH_LIBWPG01,1,[Build in libwpg 0.1.x])
11- with_libwpg=yes
12- AC_SUBST(LIBWPG_LIBS, $LIBWPG01_LIBS)
13- AC_SUBST(LIBWPG_CFLAGS, $LIBWPG01_CFLAGS)
14- fi
15-
16- PKG_CHECK_MODULES(LIBWPG02, libwpg-0.2 libwpd-0.9 libwpd-stream-0.9, with_libwpg02=yes, with_libwpg02=no)
17- if test "x$with_libwpg02" = "xyes"; then
18- AC_DEFINE(WITH_LIBWPG02,1,[Build in libwpg 0.2.x])
19- with_libwpg=yes
20- AC_SUBST(LIBWPG_LIBS, $LIBWPG02_LIBS)
21- AC_SUBST(LIBWPG_CFLAGS, $LIBWPG02_CFLAGS)
22+ dnl **************************************************************
23+ dnl Try using librevenge framework first. Fall back to old libs
24+ dnl if unavailable.
25+ dnl TODO: Drop subsequent tests once this is widespread in distros
26+ dnl **************************************************************
27+ PKG_CHECK_MODULES(LIBWPG03, libwpg-0.3 librevenge-0.0 librevenge-stream-0.0, with_libwpg03=yes, with_libwpg03=no)
28+ if test "x$with_libwpg03" = "xyes"; then
29+ AC_DEFINE(WITH_LIBWPG03,1,[Build using libwpg 0.3.x])
30+ with_libwpg=yes
31+ AC_SUBST(LIBWPG_LIBS, $LIBWPG03_LIBS)
32+ AC_SUBST(LIBWPG_CFLAGS, $LIBWPG03_CFLAGS)
33+ else
34+ PKG_CHECK_MODULES(LIBWPG02, libwpg-0.2 libwpd-0.9 libwpd-stream-0.9, with_libwpg02=yes, with_libwpg02=no)
35+ if test "x$with_libwpg02" = "xyes"; then
36+ AC_DEFINE(WITH_LIBWPG02,1,[Build using libwpg 0.2.x])
37+ with_libwpg=yes
38+ AC_SUBST(LIBWPG_LIBS, $LIBWPG02_LIBS)
39+ AC_SUBST(LIBWPG_CFLAGS, $LIBWPG02_CFLAGS)
40+ fi
41 fi
42
43 if test "x$with_libwpg" = "xyes"; then
44 AC_DEFINE(WITH_LIBWPG,1,[Build in libwpg])
45 fi
46 fi
47-AM_CONDITIONAL(WITH_LIBWPG01, test "x$with_libwpg01" = "xyes")
48+AM_CONDITIONAL(WITH_LIBWPG03, test "x$with_libwpg03" = "xyes")
49 AM_CONDITIONAL(WITH_LIBWPG02, test "x$with_libwpg02" = "xyes")
50 AM_CONDITIONAL(WITH_LIBWPG, test "x$with_libwpg" = "xyes")
51
52@@ -565,14 +570,33 @@
53 with_libvisio=no
54
55 if test "x$enable_visio" = "xyes"; then
56- PKG_CHECK_MODULES(LIBVISIO, libvisio-0.0 >= 0.0.20 libwpd-0.9 libwpd-stream-0.9 libwpg-0.2, with_libvisio=yes, with_libvisio=no)
57+ dnl **************************************************************
58+ dnl Try using librevenge framework first. Fall back to old libs
59+ dnl if unavailable.
60+ dnl TODO: Drop subsequent tests once this is widespread in distros
61+ dnl **************************************************************
62+ PKG_CHECK_MODULES(LIBVISIO01, libvisio-0.1 librevenge-0.0 librevenge-stream-0.0, with_libvisio01=yes, with_libvisio01=no)
63+ if test "x$with_libvisio01" = "xyes"; then
64+ AC_DEFINE(WITH_LIBVISIO01,1,[Build using libvisio 0.1.x])
65+ with_libvisio=yes
66+ AC_SUBST(LIBVISIO_LIBS, $LIBVISIO01_LIBS)
67+ AC_SUBST(LIBVISIO_CFLAGS, $LIBVISIO01_CFLAGS)
68+ else
69+ PKG_CHECK_MODULES(LIBVISIO00, libvisio-0.0 >= 0.0.20 libwpd-0.9 libwpd-stream-0.9 libwpg-0.2, with_libvisio00=yes, with_libvisio00=no)
70+ if test "x$with_libvisio00" = "xyes"; then
71+ AC_DEFINE(WITH_LIBVISIO00,1,[Build using libvisio 0.0.x])
72+ with_libvisio=yes
73+ AC_SUBST(LIBVISIO_LIBS, $LIBVISIO00_LIBS)
74+ AC_SUBST(LIBVISIO_CFLAGS, $LIBVISIO00_CFLAGS)
75+ fi
76+ fi
77
78 if test "x$with_libvisio" = "xyes"; then
79 AC_DEFINE(WITH_LIBVISIO,1,[Build in libvisio])
80 fi
81 fi
82-AC_SUBST(LIBVISIO_LIBS)
83-AC_SUBST(LIBVISIO_CFLAGS)
84+AM_CONDITIONAL(WITH_LIBVISIO01, test "x$with_libvisio01" = "xyes")
85+AM_CONDITIONAL(WITH_LIBVISIO00, test "x$with_libvisio00" = "xyes")
86 AM_CONDITIONAL(WITH_LIBVISIO, test "x$with_libvisio" = "xyes")
87
88 dnl ********************************
89@@ -586,14 +610,33 @@
90 with_libcdr=no
91
92 if test "x$enable_cdr" = "xyes"; then
93- PKG_CHECK_MODULES(LIBCDR, libcdr-0.0 >= 0.0.3 libwpd-0.9 libwpd-stream-0.9 libwpg-0.2, with_libcdr=yes, with_libcdr=no)
94+ dnl **************************************************************
95+ dnl Try using librevenge framework first. Fall back to old libs
96+ dnl if unavailable.
97+ dnl TODO: Drop subsequent tests once this is widespread in distros
98+ dnl **************************************************************
99+ PKG_CHECK_MODULES(LIBCDR01, libcdr-0.1 librevenge-0.0 librevenge-stream-0.0, with_libcdr01=yes, with_libcdr01=no)
100+ if test "x$with_libcdr01" = "xyes"; then
101+ AC_DEFINE(WITH_LIBCDR01,1,[Build using libcdr 0.1.x])
102+ with_libcdr=yes
103+ AC_SUBST(LIBCDR_LIBS, $LIBCDR01_LIBS)
104+ AC_SUBST(LIBCDR_CFLAGS, $LIBCDR01_CFLAGS)
105+ else
106+ PKG_CHECK_MODULES(LIBCDR00, libcdr-0.0 >= 0.0.3 libwpd-0.9 libwpd-stream-0.9 libwpg-0.2, with_libcdr00=yes, with_libcdr00=no)
107+ if test "x$with_libcdr00" = "xyes"; then
108+ AC_DEFINE(WITH_LIBCDR00,1,[Build using libcdr 0.0.x])
109+ with_libcdr=yes
110+ AC_SUBST(LIBCDR_LIBS, $LIBCDR00_LIBS)
111+ AC_SUBST(LIBCDR_CFLAGS, $LIBCDR00_CFLAGS)
112+ fi
113+ fi
114
115 if test "x$with_libcdr" = "xyes"; then
116 AC_DEFINE(WITH_LIBCDR,1,[Build in libcdr])
117 fi
118 fi
119-AC_SUBST(LIBCDR_LIBS)
120-AC_SUBST(LIBCDR_CFLAGS)
121+AM_CONDITIONAL(WITH_LIBCDR01, test "x$with_libcdr01" = "xyes")
122+AM_CONDITIONAL(WITH_LIBCDR00, test "x$with_libcdr00" = "xyes")
123 AM_CONDITIONAL(WITH_LIBCDR, test "x$with_libcdr" = "xyes")
124
125 dnl ******************************
126
127=== modified file 'src/extension/internal/cdr-input.cpp'
128--- src/extension/internal/cdr-input.cpp 2013-10-27 16:33:32 +0000
129+++ src/extension/internal/cdr-input.cpp 2014-08-26 09:24:10 +0000
130@@ -24,7 +24,21 @@
131 #include <cstring>
132
133 #include <libcdr/libcdr.h>
134-#include <libwpd-stream/libwpd-stream.h>
135+
136+// TODO: Drop this check when librevenge is widespread.
137+#if WITH_LIBCDR01
138+ #include <librevenge-stream/librevenge-stream.h>
139+
140+ using librevenge::RVNGString;
141+ using librevenge::RVNGFileStream;
142+ using librevenge::RVNGStringVector;
143+#else
144+ #include <libwpd-stream/libwpd-stream.h>
145+
146+ typedef WPXString RVNGString;
147+ typedef WPXFileStream RVNGFileStream;
148+ typedef libcdr::CDRStringVector RVNGStringVector;
149+#endif
150
151 #include <gtkmm/alignment.h>
152 #include <gtkmm/comboboxtext.h>
153@@ -60,7 +74,7 @@
154
155 class CdrImportDialog : public Gtk::Dialog {
156 public:
157- CdrImportDialog(const std::vector<WPXString> &vec);
158+ CdrImportDialog(const std::vector<RVNGString> &vec);
159 virtual ~CdrImportDialog();
160
161 bool showDialog();
162@@ -86,12 +100,12 @@
163 class Gtk::VBox * vbox2;
164 class Gtk::Widget * _previewArea;
165
166- const std::vector<WPXString> &_vec; // Document to be imported
167+ const std::vector<RVNGString> &_vec; // Document to be imported
168 unsigned _current_page; // Current selected page
169 int _preview_width, _preview_height; // Size of the preview area
170 };
171
172-CdrImportDialog::CdrImportDialog(const std::vector<WPXString> &vec)
173+CdrImportDialog::CdrImportDialog(const std::vector<RVNGString> &vec)
174 : _vec(vec), _current_page(1)
175 {
176 int num_pages = _vec.size();
177@@ -210,14 +224,20 @@
178
179 SPDocument *CdrInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * uri)
180 {
181- WPXFileStream input(uri);
182+ RVNGFileStream input(uri);
183
184 if (!libcdr::CDRDocument::isSupported(&input)) {
185 return NULL;
186 }
187
188- libcdr::CDRStringVector output;
189+ RVNGStringVector output;
190+#if WITH_LIBCDR01
191+ librevenge::RVNGSVGDrawingGenerator generator(output, "svg");
192+
193+ if (!libcdr::CDRDocument::parse(&input, &generator)) {
194+#else
195 if (!libcdr::CDRDocument::generateSVG(&input, output)) {
196+#endif
197 return NULL;
198 }
199
200@@ -225,9 +245,9 @@
201 return NULL;
202 }
203
204- std::vector<WPXString> tmpSVGOutput;
205+ std::vector<RVNGString> tmpSVGOutput;
206 for (unsigned i=0; i<output.size(); ++i) {
207- WPXString tmpString("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n");
208+ RVNGString tmpString("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n");
209 tmpString.append(output[i]);
210 tmpSVGOutput.push_back(tmpString);
211 }
212
213=== modified file 'src/extension/internal/vsd-input.cpp'
214--- src/extension/internal/vsd-input.cpp 2013-10-24 15:03:01 +0000
215+++ src/extension/internal/vsd-input.cpp 2014-08-26 09:24:10 +0000
216@@ -24,7 +24,22 @@
217 #include <cstring>
218
219 #include <libvisio/libvisio.h>
220-#include <libwpd-stream/libwpd-stream.h>
221+
222+// TODO: Drop this check when librevenge is widespread.
223+#if WITH_LIBVISIO01
224+ #include <librevenge-stream/librevenge-stream.h>
225+
226+ using librevenge::RVNGString;
227+ using librevenge::RVNGFileStream;
228+ using librevenge::RVNGStringVector;
229+#else
230+ #include <libwpd-stream/libwpd-stream.h>
231+
232+ typedef WPXString RVNGString;
233+ typedef WPXFileStream RVNGFileStream;
234+ typedef libvisio::VSDStringVector RVNGStringVector;
235+#endif
236+
237
238 #include <gtkmm/alignment.h>
239 #include <gtkmm/comboboxtext.h>
240@@ -59,7 +74,7 @@
241
242 class VsdImportDialog : public Gtk::Dialog {
243 public:
244- VsdImportDialog(const std::vector<WPXString> &vec);
245+ VsdImportDialog(const std::vector<RVNGString> &vec);
246 virtual ~VsdImportDialog();
247
248 bool showDialog();
249@@ -85,12 +100,12 @@
250 class Gtk::VBox * vbox2;
251 class Gtk::Widget * _previewArea;
252
253- const std::vector<WPXString> &_vec; // Document to be imported
254+ const std::vector<RVNGString> &_vec; // Document to be imported
255 unsigned _current_page; // Current selected page
256 int _preview_width, _preview_height; // Size of the preview area
257 };
258
259-VsdImportDialog::VsdImportDialog(const std::vector<WPXString> &vec)
260+VsdImportDialog::VsdImportDialog(const std::vector<RVNGString> &vec)
261 : _vec(vec), _current_page(1)
262 {
263 int num_pages = _vec.size();
264@@ -209,14 +224,20 @@
265
266 SPDocument *VsdInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * uri)
267 {
268- WPXFileStream input(uri);
269+ RVNGFileStream input(uri);
270
271 if (!libvisio::VisioDocument::isSupported(&input)) {
272 return NULL;
273 }
274
275- libvisio::VSDStringVector output;
276+ RVNGStringVector output;
277+#if WITH_LIBVISIO01
278+ librevenge::RVNGSVGDrawingGenerator generator(output, "svg");
279+
280+ if (!libvisio::VisioDocument::parse(&input, &generator)) {
281+#else
282 if (!libvisio::VisioDocument::generateSVG(&input, output)) {
283+#endif
284 return NULL;
285 }
286
287@@ -224,9 +245,9 @@
288 return NULL;
289 }
290
291- std::vector<WPXString> tmpSVGOutput;
292+ std::vector<RVNGString> tmpSVGOutput;
293 for (unsigned i=0; i<output.size(); ++i) {
294- WPXString tmpString("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n");
295+ RVNGString tmpString("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n");
296 tmpString.append(output[i]);
297 tmpSVGOutput.push_back(tmpString);
298 }
299
300=== modified file 'src/extension/internal/wpg-input.cpp'
301--- src/extension/internal/wpg-input.cpp 2014-03-27 01:33:44 +0000
302+++ src/extension/internal/wpg-input.cpp 2014-08-26 09:24:10 +0000
303@@ -52,16 +52,24 @@
304 #include "util/units.h"
305 #include <cstring>
306
307-// Take a guess and fallback to 0.1.x if no configure has run
308-#if !defined(WITH_LIBWPG01) && !defined(WITH_LIBWPG02)
309-#define WITH_LIBWPG01 1
310+// Take a guess and fallback to 0.2.x if no configure has run
311+#if !defined(WITH_LIBWPG03) && !defined(WITH_LIBWPG02)
312+#define WITH_LIBWPG02 1
313 #endif
314
315 #include "libwpg/libwpg.h"
316-#if WITH_LIBWPG01
317-#include "libwpg/WPGStreamImplementation.h"
318-#elif WITH_LIBWPG02
319-#include "libwpd-stream/libwpd-stream.h"
320+#if WITH_LIBWPG03
321+ #include <librevenge-stream/librevenge-stream.h>
322+
323+ using librevenge::RVNGString;
324+ using librevenge::RVNGFileStream;
325+ using librevenge::RVNGInputStream;
326+#else
327+ #include "libwpd-stream/libwpd-stream.h"
328+
329+ typedef WPXString RVNGString;
330+ typedef WPXFileStream RVNGFileStream;
331+ typedef WPXInputStream RVNGInputStream;
332 #endif
333
334 using namespace libwpg;
335@@ -73,17 +81,15 @@
336
337 SPDocument *WpgInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * uri)
338 {
339-#if WITH_LIBWPG01
340- WPXInputStream* input = new libwpg::WPGFileStream(uri);
341-#elif WITH_LIBWPG02
342- WPXInputStream* input = new WPXFileStream(uri);
343-#endif
344+ RVNGInputStream* input = new RVNGFileStream(uri);
345+#if WITH_LIBWPG03
346+ if (input->isStructured()) {
347+ RVNGInputStream* olestream = input->getSubStreamByName("PerfectOffice_MAIN");
348+#else
349 if (input->isOLEStream()) {
350-#if WITH_LIBWPG01
351- WPXInputStream* olestream = input->getDocumentOLEStream();
352-#elif WITH_LIBWPG02
353- WPXInputStream* olestream = input->getDocumentOLEStream("PerfectOffice_MAIN");
354+ RVNGInputStream* olestream = input->getDocumentOLEStream("PerfectOffice_MAIN");
355 #endif
356+
357 if (olestream) {
358 delete input;
359 input = olestream;
360@@ -98,15 +104,24 @@
361 return NULL;
362 }
363
364-#if WITH_LIBWPG01
365- libwpg::WPGString output;
366-#elif WITH_LIBWPG02
367- WPXString output;
368-#endif
369+#if WITH_LIBWPG03
370+ librevenge::RVNGStringVector vec;
371+ librevenge::RVNGSVGDrawingGenerator generator(vec, "");
372+
373+ if (!libwpg::WPGraphics::parse(input, &generator) || vec.empty() || vec[0].empty()) {
374+ delete input;
375+ return NULL;
376+ }
377+
378+ RVNGString output("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n");
379+ output.append(vec[0]);
380+#else
381+ RVNGString output;
382 if (!libwpg::WPGraphics::generateSVG(input, output)) {
383 delete input;
384 return NULL;
385 }
386+#endif
387
388 //printf("I've got a doc: \n%s", painter.document.c_str());
389
390
391=== modified file 'src/ui/dialog/symbols.cpp'
392--- src/ui/dialog/symbols.cpp 2014-06-13 16:06:01 +0000
393+++ src/ui/dialog/symbols.cpp 2014-08-26 09:24:10 +0000
394@@ -62,8 +62,20 @@
395 #include "widgets/icon.h"
396
397 #ifdef WITH_LIBVISIO
398-#include <libvisio/libvisio.h>
399-#include <libwpd-stream/libwpd-stream.h>
400+ #include <libvisio/libvisio.h>
401+
402+ // TODO: Drop this check when librevenge is widespread.
403+ #if WITH_LIBVISIO01
404+ #include <librevenge-stream/librevenge-stream.h>
405+
406+ using librevenge::RVNGFileStream;
407+ using librevenge::RVNGStringVector;
408+ #else
409+ #include <libwpd-stream/libwpd-stream.h>
410+
411+ typedef WPXFileStream RVNGFileStream;
412+ typedef libvisio::VSDStringVector RVNGStringVector;
413+ #endif
414 #endif
415
416 #include "verbs.h"
417@@ -495,14 +507,20 @@
418 // Read Visio stencil files
419 SPDocument* read_vss( gchar* fullname, gchar* filename ) {
420
421- WPXFileStream input(fullname);
422+ RVNGFileStream input(fullname);
423
424 if (!libvisio::VisioDocument::isSupported(&input)) {
425 return NULL;
426 }
427
428- libvisio::VSDStringVector output;
429+ RVNGStringVector output;
430+#if WITH_LIBVISIO01
431+ librevenge::RVNGSVGDrawingGenerator generator(output, "svg");
432+
433+ if (!libvisio::VisioDocument::parseStencils(&input, &generator)) {
434+#else
435 if (!libvisio::VisioDocument::generateSVGStencils(&input, output)) {
436+#endif
437 return NULL;
438 }
439