Extend OpenOffice.org

It's easier than you might think to create your own OpenOffice.org extensions.

Before you fire up the Add-on Tool, you need to do some preparatory work. First, create a separate folder for all your working files (for example, loremipsum). If you want to add icons to the menu items, make sure you have the necessary graphics files. According to the official documentation, you need a set of small (16x16) and big (26x26) icons in BMP format. However, you also can use 16x16 icons in PNG format (you can find some high-quality icons at www.famfamfam.com/lab/icons/silk). Next, copy the entire LoremipsumLib library into the loremipsum folder. To do this, navigate to .OpenOffice.org2/user/basic inside your home directory, and copy LoremipsumLib into the loremipsum folder. Finally, copy the icons into the LoremipsumLib folder. Now, open the Add-on Tool document, and make sure that macro execution is enabled. Scroll to the Create the configuration file chapter, and press the Create XML file button to launch the Addon Creator.

Figure 2. Using the Addon Creator to Create a Programmatic Extension

The process of creating an extension using the Addon Creator can be roughly divided into three stages. First, you define the general setting, including the top-level menu and its position. Then, you specify the menu items, and finally, you zip the created package.

In the Basic Information window, specify the path to the main script file. Press the Browse button, and select the script.xlb file inside the LoremipsumLib folder. You also must specify a name for your extension in the Unique name for your addon field. Simply replace the example part in the org.openoffice.Office.addon.example string with the name you want (for example, org.openoffice.Office.addon.Loremipsum). Press Next to choose where to add the top-level extension menu. You have two choices here: you either can add a menu item to the Main menu or under the Tools menu. As a rule of thumb, if you have a simple extension containing only a couple of commands, tuck it under the Tools menu. A more complex extension deserves its own entry in the Main menu. Because the Lorem ipsum generator contains only one command, it makes sense to install it under the Tools menu. Next, enter a menu title, and press the Add this text button. If you want to make your extension available only for a particular language or country, you may do so by specifying the appropriate settings in the Language restrictions section. Press Finished when you are satisfied with the settings.

The next step is to link the LoremipsumMacro to the created menu item. To do this, you have to specify the library, the module and the macro itself. In our case, these are LoremipsumLib, LoremipsumModule and LoremipsumMacro, respectively. Once you have linked the macro to the command, you can add an icon to it. Because we've chosen to use an icon in PNG format, press the Other image type button, select the 16x16 normal contrast item from the Icon definition drop-down list, select the icon using the Browse button, and press OK to add it. When adding icons, you have two options: you either can link to an icon that will be added to the extension as an image file, or you can integrate it into the configuration file (this works only with icons in BMP format). Which option you choose is more or less a matter of taste, but linking to icons rather than embedding them produces a cleaner and easier-to-read configuration file. This can come in handy if you need to edit the file manually later. Use the Finished button to finalize the extension, and press the Addon zipping button to pack it. Now you can install the created extension by choosing Tools→Package Manager. Restart OpenOffice.org, and you should see the Lorem ipsum command in the Tools→Add-Ons menu.

Figure 3. The Lorem Ipsum Generator Extension in Action

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

openoffice

tom pitts's picture

with some organizations resisting the MS Office 2007 file formats, maybe the openoffice file formats gain have some traction.

a lot of people complain they couldn't get by with just openoffice, but i used it throughout college and still do at home.

Its the extensions that will make it great

Charley Uchea's picture

Being able to extend the functionality of an office suit will, in its maturity, allow openoffice to become the ms office killer it should be

Hallo

Anonymous's picture

Hallo

Open Office

Klettergriffe's picture

Thnaks for these very interesting posting. I will try it out now.

Open Office

AdiX's picture

It thanks for article. Open Office is essential in work me!

Something wrong with the date?

Michael's picture

Either you live in the future or something is wrong with the post date. It is the same with the next post. The following posts are okay.