Getting Started Guide

organization dialogs, inserting special characters, and similar types of dialogs. Other
possible problems using the macro recorder include things such as inserting a
formula, setting user data, setting filters in Calc, actions in database forms, and
exporting a document to an encrypted PDF file. You never know for certain what will
work unless you try it, however. The actions from the search dialog are properly
captured, for example.
Other options
When the macro recorder is not able to solve a specific problem, the usual solution is
to write code using the OpenOffice.org objects. Unfortunately, there is a steep
learning curve for the OOo objects. It is usually best to start with simple examples
and then branch out slowly as you learn more. Learning to read generated macros is
a good place to start.
If you record Calc macros, and the recorder can correctly generate a macro, there is
an add-in created by Paolo Mantovani, which converts Calc macros when they are
recorded. The final code manipulates OpenOffice.org objects rather than generating
dispatches. This can be very useful for learning the object model.
You can download the macro recorder from Paolo’s web site directly or from the OOo
Macros web site. You should check both places to see which contains the latest
version.
http://www.paolo-mantovani.org/downloads/ DispatchToApiRecorder/
http://www.ooomacros.org/user.php
Macro organization
In OpenOffice.org, macros are grouped in modules, modules are grouped in libraries,
and libraries are grouped in library containers. A library is usually used as a major
grouping for either an entire category of macros, or for an entire application.
Modules usually split functionality, such as user interaction and calculations.
Individual macros are subroutines and functions.
Figure 303: Macro Library hierarchy
Chapter 13 Getting Started with Macros 333