If you’ve read the excellent Enterprise Integration Patterns (EIP) book by Gregor Hohpe and Bobby Woolf, you may also know that free VISIO stencils are available for the EIP shapes, from the download page.
This is great for those who have a copy of VISIO (or whose employer pays for a copy), but for those of us who don’t want to pay however many hundreds of dollars Microsoft wants for VISIO these days, an alternative (especially a free one) is always welcome. OpenOffice (OOo) Draw, though hardly as functional or attractive as VISIO, is both free and good enough for many diagrams.
So I decided to see if I could create a set of OOo Draw shapes from the VISIO stencil, and see whether Draw could be practical for integration diagramming. In short, I succeeded in converting the stencil, and I think Draw is just about good enough. For those not interested in the background, I’ve made the material freely available from this page on my website, so just go ahead and download/install. Otherwise, read on.
Exporting the VISIO Shapes
One way to get shape data into Draw is via SVG. So I started with the VISIO shapes, freely downloadable from the EIP site, and as I use VISIO at work I was able to load up the stencil and export it as SVG.
You need to install an OpenOffice extension for importing SVG. I’m using OOo 3.0: the extension installed without incident and the import was straightforward. I was surprised at how good the resulting shapes looked in Draw. Each shape is composed of drawing primitives, so you need to select and group them to create a shape you can place and move easily. I’ve done this for all the shapes in the download.
So now we have the shapes, where can we put them to make them easily reusable? In Draw, there’s no stencil feature as such: the only option is the Gallery:
The gallery feature in Draw isn’t very appealing, initially. When you first install OOo, the gallery contains some spectacularly awful materials: nasty backgrounds and bullets which I cannot imagine ever wanting to use, and it even contains some pointless sound-clips that surely only a 5-year old might use (and only then if they were desperate). The shapes and graphics are reminiscent of shareware software from the Windows 95 era. And what is the point of the built-in media player? Why can’t OpenOffice grow up? It’s so very close to being excellent in many respects: things like this just make it look silly and dated.
Anyway, back to the gallery feature. The one saving grace of this feature is that you can create new gallery themes and add your own shapes to them. To do this, create a new theme, give it a name and then drag your shapes into it. Note that when you drag/drop your shape you must hold down the mouse button and pause a second or two before dragging: this pause changes the drag-mode from a simple shape move to the required move/copy.
I’ve done this for all the EIP shapes, creating an EIP gallery theme:
Sharing the EIP Theme
Unfortunately, Draw doesn’t implement a theme export facility so to share this new theme with others requires some irritating file copying. The contents of the Gallery are stored in your profile (or home) folder. On Windows this is likely to be:
C:\Documents and Settings\<user>\Application Data\OpenOffice.org\3\user\gallery
On Unix/Linux, check your home folder. There are several file types in here and (unusually for OOo) they are binary, not XML. This makes it difficult to reverse-engineer their purpose and relationship but fortunately it doesn’t seem to be necessary to understand fully what’s going on. The key thing to note is that the numbers in the file names bind together related files. When you create a new theme, a new set of files appears to be created.
For the EIP theme I have manually renamed the files to use numbers which I hope won’t clash with any existing gallery files you may have. Check the zip contents before you extract the files into your OOo folder and if you have existing files with the same name, simply rename the files in my zip to be unique in your environment.
I think the result is pretty good. As a test, I have (partially) reproduced the diagram from the end-cover of the EIP book in a Draw file (.odg) which is included in the download zip:
I hope this may be some use to other folk. Download from this page.