From a user perspective OpenOffice.org extensions are really easy to handle: Download the extension as one single .oxt file, start any application of the suite, go to the extension manager, load the .oxt file, accept the license agreement if available and you are done.
For developers there are quite a few components to prepare before you can create the .oxt file. To see what is needed let me show you the contents of the Jitenize extension file.
Like .jar files the .oxt files are actually archives in ZIP file format and can be opened and generated with every archive tool that can handle ZIP files, so let’s have a look at the Jitenize extension using the jar command line tool:
> jar tf jitenize_0.8.3.en.oxt types.rdb META-INF/ META-INF/manifest.xml jitenize.jar sqljet-1.0.7.jar antlr-runtime-3.1.3.jar dict_en.sqlite description.xml GPL COPYRIGHTS Jitenize/ Jitenize/dialog.xlb Jitenize/Jitenize.xba Jitenize/JitenizeSelectionDialog.xdl Jitenize/script.xlb Jitenize/Jitenize_local.xba jitenize.xcu
The central information that tells an OpenOffice.org application how to load an extension is in the manifest.xml file:
<?xml version="1.0" encoding="UTF-8"?> <manifest:manifest> <manifest:file-entry manifest:full-path="types.rdb" manifest:media-type="application/vnd.sun.star.uno-typelibrary;type=RDB"/> <manifest:file-entry manifest:full-path="jitenize.jar" manifest:media-type="application/vnd.sun.star.uno-component;type=Java"/> <manifest:file-entry manifest:full-path="Jitenize/" manifest:media-type="application/vnd.sun.star.basic-library"/> <manifest:file-entry manifest:full-path="jitenize.xcu" manifest:media-type="application/vnd.sun.star.configuration-data" /> </manifest:manifest>
jiteninze.jar and types.rdb contain the main code of the extension written as an UNO service in Java. More on this in a later post.
The Jitenize subdirectory contains the user interface written in BASIC that call the UNO service. The files were generated by writing a macro library in OpenOffice.org Writer and exporting it as a BASIC library (and not as an extension!).
jitenize.xcu contains the information how to extend the menu structure of OpenOffice.org Writer and how to connect the menu items to the BASIC macros. The easiest way that I found to create this file is to use the macro contained in chapter 2.2 of this document. Btw. addon is an old name for what is nowadays called extension, the document is quite outdated, but the macro still works well.
In addition to these four central files a few other files are available:
dict_en.sqlite, sqljet-1.0.7.jar and antlr-runtime-3.1.3.jar contain the dictionary database and the free sqlite database engine written in Java from TMate Software. The engine is used by the UNO service to whom it is made available by adding the jar files to the classpath defined in the manifest of jitenize.jar.
Finally description.xml contains information about the extension that show up in the extension manager (display name, version, etc.), links to the license file COPYRIGHT and an identifier for the extension that must be worldwide unique (com. fuyosoft.jitenize). The Extension manager uses this identifier to decide whether a newly loaded extension is an update to an already existing extension or not.
<?xml version="1.0" encoding="UTF-8"?> <description xmlns="http://openoffice.org/extensions/description/2006" xmlns:d="http://openoffice.org/extensions/description/2006" xmlns:xlink="http://www.w3.org/1999/xlink"> <identifier value="com.fuyosoft.jitenize" /> <version value="0.8.3.en" /> <dependencies> <OpenOffice.org-minimal-version value="2.2" name="OpenOffice.org 2.2"/> </dependencies> <publisher> <name xlink:href="http://fuyosoft.com">fuyosoft.com</name> </publisher> <display-name> <name>Jitenize</name> </display-name> <registration> <simple-license accept-by="admin" suppress-on-update="true" > <license-text xlink:href="COPYRIGHTS"/> </simple-license> </registration> </description>