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.
8
* Ted Gould <ted@gould.cx>
10
* Copyright (C) 2006 Authors
12
* Released under GNU GPL, read the file 'COPYING' for more information
17
* Copyright (C) 2006 Ariya Hidayat (ariya@kde.org)
18
* Copyright (C) 2005 Fridrich Strba (fridrich.strba@bluewin.ch)
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.
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.
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
34
* For further information visit http://libwpg.sourceforge.net
37
/* "This product is not manufactured, approved, or supported by
38
* Corel Corporation or Corel Corporation Limited."
46
#include "wpg-input.h"
47
#include "extension/system.h"
48
#include "extension/input.h"
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
56
#include "libwpg/libwpg.h"
58
#include "libwpg/WPGStreamImplementation.h"
60
#include "libwpd-stream/libwpd-stream.h"
63
using namespace libwpg;
71
WpgInput::open(Inkscape::Extension::Input * mod, const gchar * uri) {
73
WPXInputStream* input = new libwpg::WPGFileStream(uri);
75
WPXInputStream* input = new WPXFileStream(uri);
77
if (input->isOLEStream()) {
79
WPXInputStream* olestream = input->getDocumentOLEStream();
81
WPXInputStream* olestream = input->getDocumentOLEStream("PerfectOffice_MAIN");
89
if (!WPGraphics::isSupported(input)) {
91
// fprintf(stderr, "ERROR: Unsupported file format (unsupported version) or file is encrypted!\n");
92
// printf("I'm giving up not supported\n");
98
libwpg::WPGString output;
102
if (!libwpg::WPGraphics::generateSVG(input, output)) {
107
//printf("I've got a doc: \n%s", painter.document.c_str());
109
SPDocument * doc = sp_document_new_from_mem(output.cstr(), strlen(output.cstr()), TRUE);
114
#include "clear-n_.h"
117
WpgInput::init(void) {
118
Inkscape::Extension::Extension * ext;
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"
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"
130
"</inkscape-extension>", new WpgInput());
133
} } } /* namespace Inkscape, Extension, Implementation */
134
#endif /* WITH_LIBWPG */
139
c-file-style:"stroustrup"
140
c-file-offsets:((innamespace . 0)(inline-open . 0))
145
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :