wok view inkscape/stuff/patches/0006-Update_to_new_libwpg.patch @ rev 17707

Up marlin: edit last patch (again)
author Yuri Pourre <yuripourre@gmail.com>
date Mon Mar 02 11:31:13 2015 -0300 (2015-03-02)
parents
children
line source
1 From: David Tardon <dtardon@redhat.com>
2 Date: Tue, 27 May 2014 16:47:39 +0200
3 Subject: Update_to_new_libwpg
5 ---
6 configure.ac | 19 ++---------------
7 src/extension/internal/wpg-input.cpp | 41 ++++++++++++------------------------
8 2 files changed, 15 insertions(+), 45 deletions(-)
10 diff --git a/configure.ac b/configure.ac
11 index fcff879..4bce58c 100644
12 --- a/configure.ac
13 +++ b/configure.ac
14 @@ -676,23 +676,8 @@ dnl ******************************
16 with_libwpg=no
18 -PKG_CHECK_MODULES(LIBWPG01, libwpg-0.1 libwpg-stream-0.1, with_libwpg01=yes, with_libwpg01=no)
19 -if test "x$with_libwpg01" = "xyes"; then
20 - AC_DEFINE(WITH_LIBWPG01,1,[Build in libwpg 0.1.x])
21 - with_libwpg=yes
22 - AC_SUBST(LIBWPG_LIBS, $LIBWPG01_LIBS)
23 - AC_SUBST(LIBWPG_CFLAGS, $LIBWPG01_CFLAGS)
24 -fi
25 -AM_CONDITIONAL(WITH_LIBWPG01, test "x$with_libwpg01" = "xyes")
26 -
27 -PKG_CHECK_MODULES(LIBWPG02, libwpg-0.2 libwpd-0.9 libwpd-stream-0.9, with_libwpg02=yes, with_libwpg02=no)
28 -if test "x$with_libwpg02" = "xyes"; then
29 - AC_DEFINE(WITH_LIBWPG02,1,[Build in libwpg 0.2.x])
30 - with_libwpg=yes
31 - AC_SUBST(LIBWPG_LIBS, $LIBWPG02_LIBS)
32 - AC_SUBST(LIBWPG_CFLAGS, $LIBWPG02_CFLAGS)
33 -fi
34 -AM_CONDITIONAL(WITH_LIBWPG02, test "x$with_libwpg02" = "xyes")
35 +PKG_CHECK_MODULES(LIBWPG, libwpg-0.3 librevenge-0.0 librevenge-stream-0.0, with_libwpg=yes, with_libwpg=no)
36 +AM_CONDITIONAL(WITH_LIBWPG01, test "x$with_libwpg" = "xyes")
38 if test "x$with_libwpg" = "xyes"; then
39 AC_DEFINE(WITH_LIBWPG,1,[Build in libwpg])
40 diff --git a/src/extension/internal/wpg-input.cpp b/src/extension/internal/wpg-input.cpp
41 index 5c5cb65..71c7b44 100644
42 --- a/src/extension/internal/wpg-input.cpp
43 +++ b/src/extension/internal/wpg-input.cpp
44 @@ -48,17 +48,8 @@
45 #include "extension/input.h"
46 #include "document.h"
48 -// Take a guess and fallback to 0.1.x if no configure has run
49 -#if !defined(WITH_LIBWPG01) && !defined(WITH_LIBWPG02)
50 -#define WITH_LIBWPG01 1
51 -#endif
52 -
53 #include "libwpg/libwpg.h"
54 -#if WITH_LIBWPG01
55 -#include "libwpg/WPGStreamImplementation.h"
56 -#elif WITH_LIBWPG02
57 -#include "libwpd-stream/libwpd-stream.h"
58 -#endif
59 +#include "librevenge-stream/librevenge-stream.h"
61 using namespace libwpg;
63 @@ -69,17 +60,9 @@ namespace Internal {
65 SPDocument *
66 WpgInput::open(Inkscape::Extension::Input * mod, const gchar * uri) {
67 -#if WITH_LIBWPG01
68 - WPXInputStream* input = new libwpg::WPGFileStream(uri);
69 -#elif WITH_LIBWPG02
70 - WPXInputStream* input = new WPXFileStream(uri);
71 -#endif
72 - if (input->isOLEStream()) {
73 -#if WITH_LIBWPG01
74 - WPXInputStream* olestream = input->getDocumentOLEStream();
75 -#elif WITH_LIBWPG02
76 - WPXInputStream* olestream = input->getDocumentOLEStream("PerfectOffice_MAIN");
77 -#endif
78 + librevenge::RVNGInputStream* input = new librevenge::RVNGFileStream(uri);
79 + if (input->isStructured()) {
80 + librevenge::RVNGInputStream* olestream = input->getSubStreamByName("PerfectOffice_MAIN");
81 if (olestream) {
82 delete input;
83 input = olestream;
84 @@ -94,15 +77,17 @@ WpgInput::open(Inkscape::Extension::Input * mod, const gchar * uri) {
85 return NULL;
86 }
88 -#if WITH_LIBWPG01
89 - libwpg::WPGString output;
90 -#elif WITH_LIBWPG02
91 - WPXString output;
92 -#endif
93 - if (!libwpg::WPGraphics::generateSVG(input, output)) {
94 + librevenge::RVNGStringVector vec;
95 + librevenge::RVNGSVGDrawingGenerator generator(vec, "");
96 +
97 + if (!libwpg::WPGraphics::parse(input, &generator) || vec.empty() || vec[0].empty())
98 + {
99 delete input;
100 return NULL;
101 - }
102 + }
103 +
104 + librevenge::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");
105 + output.append(vec[0]);
107 //printf("I've got a doc: \n%s", painter.document.c_str());
109 --
110 1.9.3