~ubuntu-branches/ubuntu/utopic/inkscape/utopic-proposed

« back to all changes in this revision

Viewing changes to .pc/librevenge.patch/src/extension/internal/wpg-input.cpp

  • Committer: Package Import Robot
  • Author(s): Alex Valavanis
  • Date: 2014-08-19 19:10:32 UTC
  • mfrom: (1.6.5) (2.5.14 sid)
  • Revision ID: package-import@ubuntu.com-20140819191032-2eca1qihaszjk9i6
Tags: 0.48.5-2ubuntu1
* Merge with Debian Unstable (LP: #1358863). Fixes several Ubuntu bugs:
  - Illustrator CS SVG won't load: namespace URIs in entities (LP: #166371)
  - inkscape crashed with SIGSEGV in
    sp_dtw_color_profile_event() (LP: #966441)
  - inkscape crashed with SIGSEGV (LP: #1051017)
  - inkscape crashed with SIGSEGV in Inkscape::Preferences::_getNode()
    (LP: #1163241)
  - save a copy reverts to save as (LP: #529843)
  - Extension to braille not working on Xubuntu 12.10 (LP: #1090865)
* Remaining changes:
  - debian/control:
    + Set Ubuntu Developer as maintainer,
    + build-depend on dh-translation to handle Ubuntu translation,
    + demote pstoedit from Recommends to Suggests (because it's in universe),
  - debian/patches/0006_add_unity_quicklist_support.patch: add.
  - debian/patches/series: update.
  - debian/rules:
    + add dh_translation to handle Ubuntu translation
* Drop debian/patches/librevenge.patch (superseded by
    debian/patches/0006-Update_to_new_libwpg.patch)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* 
2
 
 *  This file came from libwpg as a source, their utility wpg2svg
3
 
 *  specifically.  It has been modified to work as an Inkscape extension.
4
 
 *  The Inkscape extension code is covered by this copyright, but the
5
 
 *  rest is covered by the one bellow.
6
 
 *
7
 
 * Authors:
8
 
 *   Ted Gould <ted@gould.cx>
9
 
 *
10
 
 * Copyright (C) 2006 Authors
11
 
 *
12
 
 * Released under GNU GPL, read the file 'COPYING' for more information
13
 
 *
14
 
 */
15
 
 
16
 
/* libwpg
17
 
 * Copyright (C) 2006 Ariya Hidayat (ariya@kde.org)
18
 
 * Copyright (C) 2005 Fridrich Strba (fridrich.strba@bluewin.ch)
19
 
 *
20
 
 * This library is free software; you can redistribute it and/or
21
 
 * modify it under the terms of the GNU Library General Public
22
 
 * License as published by the Free Software Foundation; either
23
 
 * version 2 of the License, or (at your option) any later version.
24
 
 *
25
 
 * This library is distributed in the hope that it will be useful,
26
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
28
 
 * Library General Public License for more details.
29
 
 *
30
 
 * You should have received a copy of the GNU Library General Public
31
 
 * License along with this library; if not, write to the Free Software
32
 
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
33
 
 *
34
 
 * For further information visit http://libwpg.sourceforge.net
35
 
 */
36
 
 
37
 
/* "This product is not manufactured, approved, or supported by
38
 
 * Corel Corporation or Corel Corporation Limited."
39
 
 */
40
 
 
41
 
#include <stdio.h>
42
 
#include "config.h"
43
 
 
44
 
#ifdef WITH_LIBWPG
45
 
 
46
 
#include "wpg-input.h"
47
 
#include "extension/system.h"
48
 
#include "extension/input.h"
49
 
#include "document.h"
50
 
 
51
 
// Take a guess and fallback to 0.1.x if no configure has run
52
 
#if !defined(WITH_LIBWPG01) && !defined(WITH_LIBWPG02)
53
 
#define WITH_LIBWPG01 1
54
 
#endif
55
 
 
56
 
#include "libwpg/libwpg.h"
57
 
#if WITH_LIBWPG01
58
 
#include "libwpg/WPGStreamImplementation.h"
59
 
#elif WITH_LIBWPG02
60
 
#include "libwpd-stream/libwpd-stream.h"
61
 
#endif
62
 
 
63
 
using namespace libwpg;
64
 
 
65
 
namespace Inkscape {
66
 
namespace Extension {
67
 
namespace Internal {
68
 
 
69
 
 
70
 
SPDocument *
71
 
WpgInput::open(Inkscape::Extension::Input * mod, const gchar * uri) {
72
 
#if WITH_LIBWPG01
73
 
    WPXInputStream* input = new libwpg::WPGFileStream(uri);
74
 
#elif WITH_LIBWPG02
75
 
    WPXInputStream* input = new WPXFileStream(uri);
76
 
#endif
77
 
    if (input->isOLEStream()) {
78
 
#if WITH_LIBWPG01
79
 
        WPXInputStream* olestream = input->getDocumentOLEStream();
80
 
#elif WITH_LIBWPG02
81
 
        WPXInputStream* olestream = input->getDocumentOLEStream("PerfectOffice_MAIN");
82
 
#endif
83
 
        if (olestream) {
84
 
            delete input;
85
 
            input = olestream;
86
 
        }
87
 
    }
88
 
 
89
 
    if (!WPGraphics::isSupported(input)) {
90
 
        //! \todo Dialog here
91
 
        // fprintf(stderr, "ERROR: Unsupported file format (unsupported version) or file is encrypted!\n");
92
 
        // printf("I'm giving up not supported\n");
93
 
        delete input;
94
 
        return NULL;
95
 
    }
96
 
 
97
 
#if WITH_LIBWPG01
98
 
    libwpg::WPGString output;
99
 
#elif WITH_LIBWPG02
100
 
    WPXString output;
101
 
#endif
102
 
    if (!libwpg::WPGraphics::generateSVG(input, output)) {
103
 
        delete input;
104
 
        return NULL;
105
 
    }
106
 
 
107
 
    //printf("I've got a doc: \n%s", painter.document.c_str());
108
 
 
109
 
    SPDocument * doc = sp_document_new_from_mem(output.cstr(), strlen(output.cstr()), TRUE);
110
 
    delete input;
111
 
    return doc;
112
 
}
113
 
 
114
 
#include "clear-n_.h"
115
 
 
116
 
void
117
 
WpgInput::init(void) {
118
 
    Inkscape::Extension::Extension * ext;
119
 
 
120
 
    ext = Inkscape::Extension::build_from_mem(
121
 
        "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n"
122
 
            "<name>" N_("WPG Input") "</name>\n"
123
 
            "<id>org.inkscape.input.wpg</id>\n"
124
 
            "<input>\n"
125
 
                "<extension>.wpg</extension>\n"
126
 
                "<mimetype>image/x-wpg</mimetype>\n"
127
 
                "<filetypename>" N_("WordPerfect Graphics (*.wpg)") "</filetypename>\n"
128
 
                "<filetypetooltip>" N_("Vector graphics format used by Corel WordPerfect") "</filetypetooltip>\n"
129
 
            "</input>\n"
130
 
        "</inkscape-extension>", new WpgInput());
131
 
} // init
132
 
 
133
 
} } }  /* namespace Inkscape, Extension, Implementation */
134
 
#endif /* WITH_LIBWPG */
135
 
 
136
 
/*
137
 
  Local Variables:
138
 
  mode:c++
139
 
  c-file-style:"stroustrup"
140
 
  c-file-offsets:((innamespace . 0)(inline-open . 0))
141
 
  indent-tabs-mode:nil
142
 
  fill-column:99
143
 
  End:
144
 
*/
145
 
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :