Merge lp:~inkscape.dev/inkscape/lp1015572 into lp:~inkscape.dev/inkscape/trunk
- lp1015572
- Merge into trunk
Proposed by
Ted Gould
Status: | Merged |
---|---|
Approved by: | jazzynico |
Approved revision: | 11535 |
Merged at revision: | 11688 |
Proposed branch: | lp:~inkscape.dev/inkscape/lp1015572 |
Merge into: | lp:~inkscape.dev/inkscape/trunk |
Diff against target: |
453 lines (+378/-0) 6 files modified
configure.ac (+22/-0) src/Makefile.am (+2/-0) src/extension/init.cpp (+6/-0) src/extension/internal/Makefile_insert (+5/-0) src/extension/internal/vsd-input.cpp (+289/-0) src/extension/internal/vsd-input.h (+54/-0) |
To merge this branch: | bzr merge lp:~inkscape.dev/inkscape/lp1015572 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
jazzynico (community) | Approve | ||
su_v (community) | Approve | ||
Review via email: mp+114040@code.launchpad.net |
Commit message
Description of the change
Imported the patch from the bug so that diffs can be autogenerated.
To post a comment you must log in.
Revision history for this message
Ted Gould (ted) wrote : | # |
On Mon, 2012-07-09 at 21:29 +0000, ~suv wrote:
> AFAICT the proposed branch misses the two files which are added by the patch:
> src/extension/
> src/extension/
Uhg, sorry. Fixed.
Revision history for this message
su_v (suv-lp) : | # |
review:
Approve
Revision history for this message
jazzynico (jazzynico) : | # |
review:
Approve
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 2012-07-05 21:39:08 +0000 | |||
3 | +++ configure.ac 2012-07-09 21:33:25 +0000 | |||
4 | @@ -666,6 +666,27 @@ | |||
5 | 666 | AM_CONDITIONAL(WITH_LIBWPG02, test "x$with_libwpg02" = "xyes") | 666 | AM_CONDITIONAL(WITH_LIBWPG02, test "x$with_libwpg02" = "xyes") |
6 | 667 | AM_CONDITIONAL(WITH_LIBWPG, test "x$with_libwpg" = "xyes") | 667 | AM_CONDITIONAL(WITH_LIBWPG, test "x$with_libwpg" = "xyes") |
7 | 668 | 668 | ||
8 | 669 | dnl ******************************** | ||
9 | 670 | dnl Check for libvisio for extension | ||
10 | 671 | dnl ******************************** | ||
11 | 672 | |||
12 | 673 | AC_ARG_ENABLE(wpg, | ||
13 | 674 | [ --disable-visio compile without support for Microsoft Visio Diagrams], | ||
14 | 675 | enable_visio=$enableval,enable_visio=yes) | ||
15 | 676 | |||
16 | 677 | with_libvisio=no | ||
17 | 678 | |||
18 | 679 | if test "x$enable_visio" = "xyes"; then | ||
19 | 680 | PKG_CHECK_MODULES(LIBVISIO, libvisio-0.0 >= 0.0.15 libwpd-0.9 libwpd-stream-0.9 libwpg-0.2, with_libvisio=yes, with_libvisio=no) | ||
20 | 681 | |||
21 | 682 | if test "x$with_libvisio" = "xyes"; then | ||
22 | 683 | AC_DEFINE(WITH_LIBVISIO,1,[Build in libvisio]) | ||
23 | 684 | fi | ||
24 | 685 | fi | ||
25 | 686 | AC_SUBST(LIBVISIO_LIBS) | ||
26 | 687 | AC_SUBST(LIBVISIO_CFLAGS) | ||
27 | 688 | AM_CONDITIONAL(WITH_LIBVISIO, test "x$with_libvisio" = "xyes") | ||
28 | 689 | |||
29 | 669 | dnl ****************************** | 690 | dnl ****************************** |
30 | 670 | dnl Support doing a local install | 691 | dnl Support doing a local install |
31 | 671 | dnl (mostly for distcheck) | 692 | dnl (mostly for distcheck) |
32 | @@ -1125,6 +1146,7 @@ | |||
33 | 1125 | Enable Poppler-Cairo: ${enable_poppler_cairo} | 1146 | Enable Poppler-Cairo: ${enable_poppler_cairo} |
34 | 1126 | ImageMagick Magick++: ${magick_ok} | 1147 | ImageMagick Magick++: ${magick_ok} |
35 | 1127 | Libwpg: ${with_libwpg} | 1148 | Libwpg: ${with_libwpg} |
36 | 1149 | Libvisio: ${with_libvisio} | ||
37 | 1128 | Doing Local Install: ${with_localinstall} | 1150 | Doing Local Install: ${with_localinstall} |
38 | 1129 | GTK+ backend target: ${gtk_backend_target} | 1151 | GTK+ backend target: ${gtk_backend_target} |
39 | 1130 | " | 1152 | " |
40 | 1131 | 1153 | ||
41 | === modified file 'src/Makefile.am' | |||
42 | --- src/Makefile.am 2012-04-14 13:50:00 +0000 | |||
43 | +++ src/Makefile.am 2012-07-09 21:33:25 +0000 | |||
44 | @@ -51,6 +51,7 @@ | |||
45 | 51 | $(PYTHON_LIBS) \ | 51 | $(PYTHON_LIBS) \ |
46 | 52 | $(INKBOARD_LIBS) \ | 52 | $(INKBOARD_LIBS) \ |
47 | 53 | $(LIBWPG_LIBS) \ | 53 | $(LIBWPG_LIBS) \ |
48 | 54 | $(LIBVISIO_LIBS) \ | ||
49 | 54 | $(DBUS_LIBS) \ | 55 | $(DBUS_LIBS) \ |
50 | 55 | $(GDL_LIBS) \ | 56 | $(GDL_LIBS) \ |
51 | 56 | $(IMAGEMAGICK_LIBS) | 57 | $(IMAGEMAGICK_LIBS) |
52 | @@ -74,6 +75,7 @@ | |||
53 | 74 | $(IMAGEMAGICK_CFLAGS) \ | 75 | $(IMAGEMAGICK_CFLAGS) \ |
54 | 75 | $(INKBOARD_CFLAGS) \ | 76 | $(INKBOARD_CFLAGS) \ |
55 | 76 | $(LIBWPG_CFLAGS) \ | 77 | $(LIBWPG_CFLAGS) \ |
56 | 78 | $(LIBVISIO_CFLAGS) \ | ||
57 | 77 | $(DBUS_CFLAGS) \ | 79 | $(DBUS_CFLAGS) \ |
58 | 78 | $(GDL_CFLAGS) \ | 80 | $(GDL_CFLAGS) \ |
59 | 79 | $(XFT_CFLAGS) \ | 81 | $(XFT_CFLAGS) \ |
60 | 80 | 82 | ||
61 | === modified file 'src/extension/init.cpp' | |||
62 | --- src/extension/init.cpp 2012-02-25 18:49:04 +0000 | |||
63 | +++ src/extension/init.cpp 2012-07-09 21:33:25 +0000 | |||
64 | @@ -53,6 +53,9 @@ | |||
65 | 53 | #ifdef WITH_LIBWPG | 53 | #ifdef WITH_LIBWPG |
66 | 54 | #include "internal/wpg-input.h" | 54 | #include "internal/wpg-input.h" |
67 | 55 | #endif | 55 | #endif |
68 | 56 | #ifdef WITH_LIBVISIO | ||
69 | 57 | #include "internal/vsd-input.h" | ||
70 | 58 | #endif | ||
71 | 56 | #include "preferences.h" | 59 | #include "preferences.h" |
72 | 57 | #include "io/sys.h" | 60 | #include "io/sys.h" |
73 | 58 | #ifdef WITH_DBUS | 61 | #ifdef WITH_DBUS |
74 | @@ -183,6 +186,9 @@ | |||
75 | 183 | #ifdef WITH_LIBWPG | 186 | #ifdef WITH_LIBWPG |
76 | 184 | Internal::WpgInput::init(); | 187 | Internal::WpgInput::init(); |
77 | 185 | #endif | 188 | #endif |
78 | 189 | #ifdef WITH_LIBVISIO | ||
79 | 190 | Internal::VsdInput::init(); | ||
80 | 191 | #endif | ||
81 | 186 | 192 | ||
82 | 187 | /* Effects */ | 193 | /* Effects */ |
83 | 188 | Internal::BlurEdge::init(); | 194 | Internal::BlurEdge::init(); |
84 | 189 | 195 | ||
85 | === modified file 'src/extension/internal/Makefile_insert' | |||
86 | --- src/extension/internal/Makefile_insert 2011-08-18 21:29:26 +0000 | |||
87 | +++ src/extension/internal/Makefile_insert 2012-07-09 21:33:25 +0000 | |||
88 | @@ -4,7 +4,12 @@ | |||
89 | 4 | ink_common_sources += \ | 4 | ink_common_sources += \ |
90 | 5 | extension/internal/wpg-input.cpp \ | 5 | extension/internal/wpg-input.cpp \ |
91 | 6 | extension/internal/wpg-input.h | 6 | extension/internal/wpg-input.h |
92 | 7 | endif | ||
93 | 7 | 8 | ||
94 | 9 | if WITH_LIBVISIO | ||
95 | 10 | ink_common_sources += \ | ||
96 | 11 | extension/internal/vsd-input.cpp \ | ||
97 | 12 | extension/internal/vsd-input.h | ||
98 | 8 | endif | 13 | endif |
99 | 9 | 14 | ||
100 | 10 | if USE_IMAGE_MAGICK | 15 | if USE_IMAGE_MAGICK |
101 | 11 | 16 | ||
102 | === added file 'src/extension/internal/vsd-input.cpp' | |||
103 | --- src/extension/internal/vsd-input.cpp 1970-01-01 00:00:00 +0000 | |||
104 | +++ src/extension/internal/vsd-input.cpp 2012-07-09 21:33:25 +0000 | |||
105 | @@ -0,0 +1,289 @@ | |||
106 | 1 | /* | ||
107 | 2 | * This file came from libwpg as a source, their utility wpg2svg | ||
108 | 3 | * specifically. It has been modified to work as an Inkscape extension. | ||
109 | 4 | * The Inkscape extension code is covered by this copyright, but the | ||
110 | 5 | * rest is covered by the one bellow. | ||
111 | 6 | * | ||
112 | 7 | * Authors: | ||
113 | 8 | * Fridrich Strba (fridrich.strba@bluewin.ch) | ||
114 | 9 | * | ||
115 | 10 | * Copyright (C) 2012 Authors | ||
116 | 11 | * | ||
117 | 12 | * Released under GNU GPL, read the file 'COPYING' for more information | ||
118 | 13 | * | ||
119 | 14 | */ | ||
120 | 15 | |||
121 | 16 | #include <stdio.h> | ||
122 | 17 | #include "config.h" | ||
123 | 18 | |||
124 | 19 | #include "vsd-input.h" | ||
125 | 20 | |||
126 | 21 | #ifdef WITH_LIBVISIO | ||
127 | 22 | |||
128 | 23 | #include <string> | ||
129 | 24 | #include <cstring> | ||
130 | 25 | |||
131 | 26 | #include <libvisio/libvisio.h> | ||
132 | 27 | #include <libwpd-stream/libwpd-stream.h> | ||
133 | 28 | |||
134 | 29 | #include <gtkmm/alignment.h> | ||
135 | 30 | #include <gtkmm/comboboxtext.h> | ||
136 | 31 | #include <gtkmm/drawingarea.h> | ||
137 | 32 | #include <gtkmm/frame.h> | ||
138 | 33 | #include <gtkmm/scale.h> | ||
139 | 34 | |||
140 | 35 | #include "extension/system.h" | ||
141 | 36 | #include "extension/input.h" | ||
142 | 37 | #include "document.h" | ||
143 | 38 | |||
144 | 39 | #include "document-private.h" | ||
145 | 40 | #include "document-undo.h" | ||
146 | 41 | #include "inkscape.h" | ||
147 | 42 | |||
148 | 43 | #include "dialogs/dialog-events.h" | ||
149 | 44 | #include <gtk/gtk.h> | ||
150 | 45 | #include "ui/widget/spinbutton.h" | ||
151 | 46 | #include "ui/widget/frame.h" | ||
152 | 47 | #include <glibmm/i18n.h> | ||
153 | 48 | |||
154 | 49 | #include <gdkmm/general.h> | ||
155 | 50 | |||
156 | 51 | #include "svg-view.h" | ||
157 | 52 | #include "svg-view-widget.h" | ||
158 | 53 | |||
159 | 54 | namespace Inkscape { | ||
160 | 55 | namespace Extension { | ||
161 | 56 | namespace Internal { | ||
162 | 57 | |||
163 | 58 | |||
164 | 59 | class VsdImportDialog : public Gtk::Dialog { | ||
165 | 60 | public: | ||
166 | 61 | VsdImportDialog(const std::vector<WPXString> &vec); | ||
167 | 62 | virtual ~VsdImportDialog(); | ||
168 | 63 | |||
169 | 64 | bool showDialog(); | ||
170 | 65 | unsigned getSelectedPage(); | ||
171 | 66 | void getImportSettings(Inkscape::XML::Node *prefs); | ||
172 | 67 | |||
173 | 68 | private: | ||
174 | 69 | void _setPreviewPage(unsigned page); | ||
175 | 70 | |||
176 | 71 | // Signal handlers | ||
177 | 72 | #if !WITH_GTKMM_3_0 | ||
178 | 73 | bool _onExposePreview(GdkEventExpose *event); | ||
179 | 74 | #endif | ||
180 | 75 | |||
181 | 76 | void _onPageNumberChanged(); | ||
182 | 77 | |||
183 | 78 | class Gtk::Button * cancelbutton; | ||
184 | 79 | class Gtk::Button * okbutton; | ||
185 | 80 | class Gtk::Label * _labelSelect; | ||
186 | 81 | class Inkscape::UI::Widget::SpinButton * _pageNumberSpin; | ||
187 | 82 | class Gtk::Label * _labelTotalPages; | ||
188 | 83 | class Gtk::VBox * vbox1; | ||
189 | 84 | class Gtk::VBox * vbox2; | ||
190 | 85 | class Gtk::Widget * _previewArea; | ||
191 | 86 | |||
192 | 87 | const std::vector<WPXString> &_vec; // Document to be imported | ||
193 | 88 | unsigned _current_page; // Current selected page | ||
194 | 89 | int _preview_width, _preview_height; // Size of the preview area | ||
195 | 90 | }; | ||
196 | 91 | |||
197 | 92 | VsdImportDialog::VsdImportDialog(const std::vector<WPXString> &vec) | ||
198 | 93 | : _vec(vec), _current_page(1) | ||
199 | 94 | { | ||
200 | 95 | int num_pages = _vec.size(); | ||
201 | 96 | if ( num_pages <= 1 ) | ||
202 | 97 | return; | ||
203 | 98 | cancelbutton = Gtk::manage(new class Gtk::Button(Gtk::StockID("gtk-cancel"))); | ||
204 | 99 | okbutton = Gtk::manage(new class Gtk::Button(Gtk::StockID("gtk-ok"))); | ||
205 | 100 | _labelSelect = Gtk::manage(new class Gtk::Label(_("Select page:"))); | ||
206 | 101 | |||
207 | 102 | // Page number | ||
208 | 103 | #if WITH_GTKMM_3_0 | ||
209 | 104 | Glib::RefPtr<Gtk::Adjustment> _pageNumberSpin_adj = Gtk::Adjustment::create(1, 1, _vec.size(), 1, 10, 0); | ||
210 | 105 | _pageNumberSpin = Gtk::manage(new Inkscape::UI::Widget::SpinButton(_pageNumberSpin_adj, 1, 1)); | ||
211 | 106 | #else | ||
212 | 107 | Gtk::Adjustment *_pageNumberSpin_adj = Gtk::manage( | ||
213 | 108 | new class Gtk::Adjustment(1, 1, _vec.size(), 1, 10, 0)); | ||
214 | 109 | _pageNumberSpin = Gtk::manage(new class Inkscape::UI::Widget::SpinButton(*_pageNumberSpin_adj, 1, 1)); | ||
215 | 110 | #endif | ||
216 | 111 | _labelTotalPages = Gtk::manage(new class Gtk::Label()); | ||
217 | 112 | gchar *label_text = g_strdup_printf(_("out of %i"), num_pages); | ||
218 | 113 | _labelTotalPages->set_label(label_text); | ||
219 | 114 | g_free(label_text); | ||
220 | 115 | |||
221 | 116 | vbox1 = Gtk::manage(new class Gtk::VBox(false, 4)); | ||
222 | 117 | SPDocument *doc = SPDocument::createNewDocFromMem(_vec[0].cstr(), strlen(_vec[0].cstr()), 0); | ||
223 | 118 | _previewArea = Glib::wrap(sp_svg_view_widget_new(doc)); | ||
224 | 119 | |||
225 | 120 | vbox2 = Gtk::manage(new class Gtk::VBox(false, 4)); | ||
226 | 121 | cancelbutton->set_can_focus(); | ||
227 | 122 | cancelbutton->set_can_default(); | ||
228 | 123 | cancelbutton->set_relief(Gtk::RELIEF_NORMAL); | ||
229 | 124 | okbutton->set_can_focus(); | ||
230 | 125 | okbutton->set_can_default(); | ||
231 | 126 | okbutton->set_relief(Gtk::RELIEF_NORMAL); | ||
232 | 127 | this->get_action_area()->property_layout_style().set_value(Gtk::BUTTONBOX_END); | ||
233 | 128 | _labelSelect->set_line_wrap(false); | ||
234 | 129 | _labelSelect->set_use_markup(false); | ||
235 | 130 | _labelSelect->set_selectable(false); | ||
236 | 131 | _pageNumberSpin->set_can_focus(); | ||
237 | 132 | _pageNumberSpin->set_update_policy(Gtk::UPDATE_ALWAYS); | ||
238 | 133 | _pageNumberSpin->set_numeric(true); | ||
239 | 134 | _pageNumberSpin->set_digits(0); | ||
240 | 135 | _pageNumberSpin->set_wrap(false); | ||
241 | 136 | _labelTotalPages->set_line_wrap(false); | ||
242 | 137 | _labelTotalPages->set_use_markup(false); | ||
243 | 138 | _labelTotalPages->set_selectable(false); | ||
244 | 139 | vbox2->pack_start(*_previewArea, Gtk::PACK_SHRINK, 0); | ||
245 | 140 | this->get_vbox()->set_homogeneous(false); | ||
246 | 141 | this->get_vbox()->set_spacing(0); | ||
247 | 142 | this->get_vbox()->pack_start(*vbox2); | ||
248 | 143 | this->set_title(_("Page Selector")); | ||
249 | 144 | this->set_modal(true); | ||
250 | 145 | sp_transientize((GtkWidget *)this->gobj()); //Make transient | ||
251 | 146 | this->property_window_position().set_value(Gtk::WIN_POS_NONE); | ||
252 | 147 | this->set_resizable(true); | ||
253 | 148 | this->property_destroy_with_parent().set_value(false); | ||
254 | 149 | this->get_action_area()->add(*_labelSelect); | ||
255 | 150 | this->add_action_widget(*_pageNumberSpin, -7); | ||
256 | 151 | this->get_action_area()->add(*_labelTotalPages); | ||
257 | 152 | this->add_action_widget(*cancelbutton, -6); | ||
258 | 153 | this->add_action_widget(*okbutton, -5); | ||
259 | 154 | cancelbutton->show(); | ||
260 | 155 | okbutton->show(); | ||
261 | 156 | _labelSelect->show(); | ||
262 | 157 | _pageNumberSpin->show(); | ||
263 | 158 | _labelTotalPages->show(); | ||
264 | 159 | vbox1->show(); | ||
265 | 160 | _previewArea->show(); | ||
266 | 161 | vbox2->show(); | ||
267 | 162 | |||
268 | 163 | // Connect signals | ||
269 | 164 | _pageNumberSpin_adj->signal_value_changed().connect(sigc::mem_fun(*this, &VsdImportDialog::_onPageNumberChanged)); | ||
270 | 165 | } | ||
271 | 166 | |||
272 | 167 | VsdImportDialog::~VsdImportDialog() {} | ||
273 | 168 | |||
274 | 169 | bool VsdImportDialog::showDialog() | ||
275 | 170 | { | ||
276 | 171 | show(); | ||
277 | 172 | gint b = run(); | ||
278 | 173 | hide(); | ||
279 | 174 | if ( b == Gtk::RESPONSE_OK ) { | ||
280 | 175 | return TRUE; | ||
281 | 176 | } else { | ||
282 | 177 | return FALSE; | ||
283 | 178 | } | ||
284 | 179 | } | ||
285 | 180 | |||
286 | 181 | unsigned VsdImportDialog::getSelectedPage() | ||
287 | 182 | { | ||
288 | 183 | return _current_page; | ||
289 | 184 | } | ||
290 | 185 | |||
291 | 186 | void VsdImportDialog::_onPageNumberChanged() | ||
292 | 187 | { | ||
293 | 188 | int page = _pageNumberSpin->get_value_as_int(); | ||
294 | 189 | _current_page = CLAMP(page, 1, _vec.size()); | ||
295 | 190 | _setPreviewPage(_current_page); | ||
296 | 191 | } | ||
297 | 192 | |||
298 | 193 | /** | ||
299 | 194 | * \brief Renders the given page's thumbnail | ||
300 | 195 | */ | ||
301 | 196 | void VsdImportDialog::_setPreviewPage(unsigned page) | ||
302 | 197 | { | ||
303 | 198 | SPDocument *doc = SPDocument::createNewDocFromMem(_vec[page-1].cstr(), strlen(_vec[page-1].cstr()), 0); | ||
304 | 199 | Gtk::Widget * tmpPreviewArea = Glib::wrap(sp_svg_view_widget_new(doc)); | ||
305 | 200 | std::swap(_previewArea, tmpPreviewArea); | ||
306 | 201 | if (tmpPreviewArea) { | ||
307 | 202 | _previewArea->set_size_request( tmpPreviewArea->get_width(), tmpPreviewArea->get_height() ); | ||
308 | 203 | delete tmpPreviewArea; | ||
309 | 204 | } | ||
310 | 205 | vbox2->pack_start(*_previewArea, Gtk::PACK_SHRINK, 0); | ||
311 | 206 | _previewArea->show_now(); | ||
312 | 207 | } | ||
313 | 208 | |||
314 | 209 | SPDocument *VsdInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * uri) | ||
315 | 210 | { | ||
316 | 211 | WPXFileStream input(uri); | ||
317 | 212 | |||
318 | 213 | if (!libvisio::VisioDocument::isSupported(&input)) { | ||
319 | 214 | return NULL; | ||
320 | 215 | } | ||
321 | 216 | |||
322 | 217 | libvisio::VSDStringVector output; | ||
323 | 218 | if (!libvisio::VisioDocument::generateSVG(&input, output)) { | ||
324 | 219 | return NULL; | ||
325 | 220 | } | ||
326 | 221 | |||
327 | 222 | if (output.empty()) { | ||
328 | 223 | return NULL; | ||
329 | 224 | } | ||
330 | 225 | |||
331 | 226 | std::vector<WPXString> tmpSVGOutput; | ||
332 | 227 | for (unsigned i=0; i<output.size(); ++i) { | ||
333 | 228 | 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"); | ||
334 | 229 | tmpString.append(output[i]); | ||
335 | 230 | tmpSVGOutput.push_back(tmpString); | ||
336 | 231 | } | ||
337 | 232 | |||
338 | 233 | unsigned page_num = 1; | ||
339 | 234 | |||
340 | 235 | // If only one page is present, import that one without bothering user | ||
341 | 236 | if (tmpSVGOutput.size() > 1) { | ||
342 | 237 | VsdImportDialog *dlg = 0; | ||
343 | 238 | if (inkscape_use_gui()) { | ||
344 | 239 | dlg = new VsdImportDialog(tmpSVGOutput); | ||
345 | 240 | if (!dlg->showDialog()) { | ||
346 | 241 | delete dlg; | ||
347 | 242 | return NULL; | ||
348 | 243 | } | ||
349 | 244 | } | ||
350 | 245 | |||
351 | 246 | // Get needed page | ||
352 | 247 | if (dlg) { | ||
353 | 248 | page_num = dlg->getSelectedPage(); | ||
354 | 249 | if (page_num < 1) | ||
355 | 250 | page_num = 1; | ||
356 | 251 | if (page_num > tmpSVGOutput.size()) | ||
357 | 252 | page_num = tmpSVGOutput.size(); | ||
358 | 253 | } | ||
359 | 254 | } | ||
360 | 255 | |||
361 | 256 | SPDocument * doc = SPDocument::createNewDocFromMem(tmpSVGOutput[page_num-1].cstr(), strlen(tmpSVGOutput[page_num-1].cstr()), TRUE); | ||
362 | 257 | return doc; | ||
363 | 258 | } | ||
364 | 259 | |||
365 | 260 | #include "clear-n_.h" | ||
366 | 261 | |||
367 | 262 | void VsdInput::init(void) | ||
368 | 263 | { | ||
369 | 264 | Inkscape::Extension::build_from_mem( | ||
370 | 265 | "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" | ||
371 | 266 | "<name>" N_("VSD Input") "</name>\n" | ||
372 | 267 | "<id>org.inkscape.input.vsd</id>\n" | ||
373 | 268 | "<input>\n" | ||
374 | 269 | "<extension>.vsd</extension>\n" | ||
375 | 270 | "<mimetype>application/vnd.visio</mimetype>\n" | ||
376 | 271 | "<filetypename>" N_("Microsoft Visio Diagram (*.vsd)") "</filetypename>\n" | ||
377 | 272 | "<filetypetooltip>" N_("File format used by Microsoft Visio 6 and later") "</filetypetooltip>\n" | ||
378 | 273 | "</input>\n" | ||
379 | 274 | "</inkscape-extension>", new VsdInput()); | ||
380 | 275 | } // init | ||
381 | 276 | |||
382 | 277 | } } } /* namespace Inkscape, Extension, Implementation */ | ||
383 | 278 | #endif /* WITH_LIBVISIO */ | ||
384 | 279 | |||
385 | 280 | /* | ||
386 | 281 | Local Variables: | ||
387 | 282 | mode:c++ | ||
388 | 283 | c-file-style:"stroustrup" | ||
389 | 284 | c-file-offsets:((innamespace . 0)(inline-open . 0)) | ||
390 | 285 | indent-tabs-mode:nil | ||
391 | 286 | fill-column:99 | ||
392 | 287 | End: | ||
393 | 288 | */ | ||
394 | 289 | // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : | ||
395 | 0 | 290 | ||
396 | === added file 'src/extension/internal/vsd-input.h' | |||
397 | --- src/extension/internal/vsd-input.h 1970-01-01 00:00:00 +0000 | |||
398 | +++ src/extension/internal/vsd-input.h 2012-07-09 21:33:25 +0000 | |||
399 | @@ -0,0 +1,54 @@ | |||
400 | 1 | /* | ||
401 | 2 | * This code abstracts the libwpg interfaces into the Inkscape | ||
402 | 3 | * input extension interface. | ||
403 | 4 | * | ||
404 | 5 | * Authors: | ||
405 | 6 | * Fridrich Strba (fridrich.strba@bluewin.ch) | ||
406 | 7 | * | ||
407 | 8 | * Copyright (C) 2012 Authors | ||
408 | 9 | * | ||
409 | 10 | * Released under GNU GPL, read the file 'COPYING' for more information | ||
410 | 11 | */ | ||
411 | 12 | |||
412 | 13 | #ifndef __EXTENSION_INTERNAL_VSDOUTPUT_H__ | ||
413 | 14 | #define __EXTENSION_INTERNAL_VSDOUTPUT_H__ | ||
414 | 15 | |||
415 | 16 | #ifdef HAVE_CONFIG_H | ||
416 | 17 | # include <config.h> | ||
417 | 18 | #endif | ||
418 | 19 | |||
419 | 20 | #ifdef WITH_LIBVISIO | ||
420 | 21 | |||
421 | 22 | #include <gtkmm/dialog.h> | ||
422 | 23 | |||
423 | 24 | #include "../implementation/implementation.h" | ||
424 | 25 | |||
425 | 26 | namespace Inkscape { | ||
426 | 27 | namespace Extension { | ||
427 | 28 | namespace Internal { | ||
428 | 29 | |||
429 | 30 | class VsdInput : public Inkscape::Extension::Implementation::Implementation { | ||
430 | 31 | VsdInput () { }; | ||
431 | 32 | public: | ||
432 | 33 | SPDocument *open( Inkscape::Extension::Input *mod, | ||
433 | 34 | const gchar *uri ); | ||
434 | 35 | static void init( void ); | ||
435 | 36 | |||
436 | 37 | }; | ||
437 | 38 | |||
438 | 39 | } } } /* namespace Inkscape, Extension, Implementation */ | ||
439 | 40 | |||
440 | 41 | #endif /* WITH_LIBVISIO */ | ||
441 | 42 | #endif /* __EXTENSION_INTERNAL_VSDOUTPUT_H__ */ | ||
442 | 43 | |||
443 | 44 | |||
444 | 45 | /* | ||
445 | 46 | Local Variables: | ||
446 | 47 | mode:c++ | ||
447 | 48 | c-file-style:"stroustrup" | ||
448 | 49 | c-file-offsets:((innamespace . 0)(inline-open . 0)) | ||
449 | 50 | indent-tabs-mode:nil | ||
450 | 51 | fill-column:99 | ||
451 | 52 | End: | ||
452 | 53 | */ | ||
453 | 54 | // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : |
AFAICT the proposed branch misses the two files which are added by the patch: /internal/ vsd-input. cpp /internal/ vsd-input. h
src/extension
src/extension