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