[Patch] import "Microsoft Visio Diagram (*.vsd)" files (internal, based on libvisio)

Bug #1015572 reported by su_v on 2012-06-20
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Wishlist
Fridrich
Inkscape Devlibs
Low
jazzynico

Bug Description

Forwarded from #inkscape (irc):

Fridrich Strba recently shared a patch on #inkscape (irc) to add internal support for opening/importing "Microsoft Visio Diagram (*.vsd)" files - based on libvisio [1] - to Inkscape.

Requires libvisio >= 0.0.15, libwpg-0.2.x and libwpd-0.9.x.

Patch was tested ok on OS X 10.7.4 with recent trunk (r11505), screenshot:
<http://dl.dropbox.com/u/65084033/irc/inkscape-r11505-visio-import-1.png>

Fridrich is asking for someone familiar with Inkscape's code and GTK+ to take over and redo the import options dialog (it could then be reused for libcdr [2] as well):

|19:17| < Fridrich> if it interests someone, visio import filter is http://pastebin.com/vNZC8Yjq
(…)
|01:16| < Fridrich> su_v: at this stage, it would be good if someone from inkscape devs took the patch, cleaned up the dialogue and removed the 2-3 empty functions
(…)
|13:29| < su_v> Fridrich: would it be easy to use libcdr in the same way to add internal support?
|13:30| < Fridrich> yes, that is what I wanted, (…)
|13:31| < Fridrich> su_v: but if someone who actually knows gtk checks how to redo that dialogue so that the widget of preview page actually refreshes without my ugly hack, one can extract the dialogue and use it for both

---
[1] <http://www.freedesktop.org/wiki/Software/libvisio>
[2] <http://www.freedesktop.org/wiki/Software/libcdr>

Related branches

su_v (suv-lp) on 2012-06-24
description: updated
su_v (suv-lp) on 2012-06-27
description: updated
su_v (suv-lp) wrote :
su_v (suv-lp) wrote :

Updated version with refactored import dialog.

su_v (suv-lp) wrote :

Patch builds and runs ok with GTK3.

(patch v3 tested on OS X 10.7.4 with r11515, configured with '--enable-gtk3-experimental':
 <https://blueprints.launchpad.net/inkscape/+spec/gtk3-migration>)

su_v (suv-lp) on 2012-07-20
description: updated
su_v (suv-lp) wrote :

JFTR: MacPorts now offers a stable port for libvisio:

$ port info libvisio
libvisio @0.0.19 (graphics)
Variants: universal

Description: Libvisio is a C++ library for reading and parsing drawings in VSD
                      (Visio) format. VSD is the format used by Visio.
Homepage: http://www.freedesktop.org/wiki/Software/libvisio

Extract Dependencies: xz
Build Dependencies: pkgconfig
Library Dependencies: libwpg, boost
Platforms: darwin
License: LGPL-2
Maintainers: <email address hidden>
$

jazzynico (jazzynico) wrote :

Tested on Ubuntu 11.04, Inskcape trunk 11683.
Builds without error. Unfortunately, libvisio is not available on that system, and I can't test more.
Will try later on Debian Wheezy.

jazzynico (jazzynico) wrote :

Also compiled on Windows XP. No error and no obvious regression so far.

su_v (suv-lp) wrote :

Download page for sample VSD files from Microsoft (for testing):
<http://www.microsoft.com/en-us/download/details.aspx?id=24023>

Changed in inkscape:
milestone: none → 0.49
status: Confirmed → In Progress
su_v (suv-lp) wrote :

Branch also tested on an older Mac OS X system (10.5.8 (i386)) without libvisio installed - configured & compiled without errors, and no obvious regressions noticed due to "missing" dependencies for new import file type.

@JazzyNico - do you approve the merge request?

su_v (suv-lp) wrote :

Merged in revision 11688.

@Fridrich - many thanks for the contribution!

Changed in inkscape:
status: In Progress → Fix Committed
Alvin Penner (apenner) wrote :

just writing to note that, on Windows, a precompiled version is available, suitable for use in a DOS window, at:

http://sourceforge.net/projects/vsd2svg/

I've used this to do a conversion of one of the sample files from comment 9 above, svg result attached here:

jazzynico (jazzynico) wrote :

The win32 devlibs still need some work:
* Upgrade libwpg from 0.1 to 0.2 and libwpd from 0.8 to 0.9 (done locally, tests in progress).
* Compile libvisio >=0.0.19 (difficulties to compile due to autogen.sh not working as expected with mingw, tests in progress with the opensuse cross-compiled libs).

Changed in inkscape-devlibs:
assignee: nobody → JazzyNico (jazzynico)
importance: Undecided → Low
status: New → In Progress
jazzynico (jazzynico) wrote :

Unfortunately, the Opensuse dll as well as the one from vsd2svg both leads to a crash when importing a VSD file.

The new wpg and wpd libs work as expected, and will be updated in the devlibs soon.

Changed in inkscape-devlibs:
assignee: JazzyNico (jazzynico) → nobody
status: In Progress → Triaged
Fridrich (fridrich-strba) wrote :

Hello, I don't understand what does it mean that autogen.sh does not work under mingw, but you can under mingw build using the normal ./configure && make.
Concerning the crash, I would love to have the document, but apart that, the current libvisio is 0.0.22 that handles ALL visio versions from Visio 1 to Visio 2013. I would first try with that one, although it requires libxml2, zlib, boost and gperf to build. There is a cross-compiled binary of libvisio 0.0.22 in the openSUSE repositories now.

jazzynico (jazzynico) wrote :

Hi Fridrich,

> you can under mingw build using the normal ./configure && make.

Libvisio 0.0.22 (from http://cgit.freedesktop.org/libreoffice/contrib/libvisio/tag/?id=libvisio-0.0.22) doesn't provide the configure script, but autogen.sh only. And unfortunately I've had some issues with automake in my mingw-msys install. I may have done something wrong, but I can't figure what.

> I would love to have the document

I've only tried with a couple of documents from the package downloaded on the MS website: <http://www.microsoft.com/en-us/download/details.aspx?id=24023>.

> There is a cross-compiled binary of libvisio 0.0.22 in the openSUSE repositories now.

That's what I've done (libvisio-devel-0.0.22-1.1 and libvisio-0.0.22-1.1). Everything compiles with no error, but Inkscape crashes when importing a visio file. Since gdb doesn't work very well on Windows XP and Seven with Inkscape, it's a bit difficult to get a useful trace.

I'll try on Debian testing if I can reproduce the crash or not.

~suv, did you manage to import visio files on OSX?

su_v (suv-lp) wrote :

> ~suv, did you manage to import visio files on OSX?

Works as expected here (and also on Ubuntu 12.10, in VitrualBox). With the latest version of libvisio, and some local changes to trunk to add additional file types, it also allows to open newer formats as described in <http://libregraphicsworld.org/blog/entry/libreoffice-gets-visio-2013-support>, using the tests files available in <http://cgit.freedesktop.org/~fridrich/libvisio-test/>.

su_v (suv-lp) wrote :

> Works as expected here (…)

Minor issues on Inkscape's side (based on my limited tests):
1) Current Inkscape trunk gives me this warning during building (compiler: llvm-gcc-4.2 from Xcode 4.3.2):
  CXX extension/internal/vsd-input.o
../../src/extension/internal/vsd-input.cpp: In member function ‘void Inkscape::Extension::Internal::VsdImportDialog::_onPageNumberChanged()’:
../../src/extension/internal/vsd-input.cpp:189: warning: comparison between signed and unsigned integer expressions
2) Inkscape seems to have trouble with some filter effects in imported newer file formats (the filtered objects don't render visible on-canvas in normal view mode). I haven't investigated this further beyond some comparisons with other SVG viewers (which indicated that it's likely an issue with Inkscape's SVG filter support).

Minor issues with libvisio's SVG output:
3) Stroke widths sometimes are so thin that expected lines are not visibly rendered on-canvas in Inkscape at reasonable zoom-levels.
4) AFAICT some of the features of Visio files aren't yet fully supported in libvisio's SVG output (e.g. multi-line text, markers).

Fridrich (fridrich-strba) wrote :

Ah, sorry, the crash is there because those binaries are built with GCC 4.7.x which changed Windows C++ ABI and the class member functions use __thiscall calling convention, whereas with the previous versions, it was __cdecl.
The autogenerated tarballs of libvisio are in:
http://dev-www.libreoffice.org/src/libvisio-0.0.22.tar.bz2
http://dev-www.libreoffice.org/src/libvisio-0.0.22.tar.gz
and
http://dev-www.libreoffice.org/src/libvisio-0.0.22.tar.xz
as mentioned in
http://www.freedesktop.org/wiki/Software/libvisio
Those should have configure script and you should be able to build them yourself.

jazzynico (jazzynico) wrote :

> The autogenerated tarballs of libvisio are in...

Thanks! It's far easier with a configure file. Libvisio now compiles as expected (I've just had to disable -Werror due to strict-antialiasing warnings in the boost headers...), and Inkscape imports visio files as expected (tested with some files from your libvisio-test tree, and some others from the MS website).

Some more tests and it should be ready to be committed.

Changed in inkscape-devlibs:
assignee: nobody → JazzyNico (jazzynico)
status: Triaged → In Progress
Fridrich (fridrich-strba) wrote :

I just released 0.0.23 that fixes a small colour regression: we realized that the "cached" colour hex is actually colour override, and visio uses it instead of the colour pointed to by colour index if they differ.

jazzynico (jazzynico) wrote :

Wordperfect libs updated (libwpd 0.8 -> 0.9.6, libwpg 0.1 -> 0.2.1) and visio lib added (libvisio-0.0.23) in devlibs revision 39.
Visio support activated in Inkscape trunk, revision 11925.

@Fridrich, many thanks for the lib and for your help!

Changed in inkscape-devlibs:
status: In Progress → Fix Released
jazzynico (jazzynico) on 2012-12-03
Changed in inkscape:
assignee: nobody → Fridrich (fridrich-strba)
su_v (suv-lp) wrote :

> the current libvisio is 0.0.22 that handles ALL visio versions from Visio 1 to Visio 2013

Follow-up report filed to track adding support for newer file formats (based on file extension):
Bug #1086504 “Add support for newer MS Visio file formats (VDX, VSDX)”
<https://bugs.launchpad.net/inkscape/+bug/1086504>

Bryce Harrington (bryce) on 2015-02-21
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Related questions

Bug attachments