Chapter 1—Getting Started

In OpenOffice.org, macros and dialogs are stored in documents and libraries. The included integrated development environment (IDE) is used to create and debug macros. This chapter introduces the basic concepts of starting the IDE and creating macros by showing the steps to produce a simple macro, which displays the text “Hello World” on the screen.

Chapter 2—Language Constructs

The OpenOffice.org macro language is similar to the one in Microsoft Office because they are both based on BASIC. Both macro languages access the underlying implementation structures, which differ significantly and are therefore incompatible. This chapter emphasizes the portions of the language that do not access the underlying implementation.

Chapter 3—Numerical Routines

This chapter introduces the subroutines and functions supported by OpenOffice.org Basic that are related to numbers—including mathematical functions, conversion routines, formatting numbers as a string, and random numbers. This chapter also discusses alternate number bases.

Chapter 4—Array Routines

This chapter introduces the subroutines and functions supported by OpenOffice.org Basic that are used to manipulate arrays. It covers methods for manipulating arrays, creating arrays with data, creating arrays with no data, and changing the dimension of arrays. This chapter also introduces techniques that compensate for current bugs and other unexpected behaviors; and finally, it develops a method to inspect array variables.

Chapter 5—Date Routines

This chapter introduces the subroutines and functions supported by OpenOffice.org Basic that are related to dates—including functions to retrieve the current date and time, manipulate dates and times, and perform timing functions. It also discusses some potentially unexpected behavior around October 4, 1582, and again around December 30, 1899.

Chapter 6—String Routines

This chapter introduces the subroutines and functions supported by OpenOffice.org Basic that are related to strings. This includes functions to manipulate strings, convert other data types to strings, and to perform special formatting.

Chapter 7—File Routines

This chapter introduces the subroutines and functions supported by OpenOffice.org Basic that are related to files and directories. After reading this chapter you’ll be able to create, delete, rename, and move files and directories. You’ll learn methods that inspect files, both open and closed, and directories. This chapter also explains the idiosyncrasies and bugs related to reading and writing files, along with differences between operating systems.

Chapter 8—Miscellaneous Routines

This chapter introduces the subroutines and functions supported by OpenOffice.org Basic that do not easily fit into another larger category—for example, routines related to flow control, user input, user output, error handling, inspecting variables, color, and display—as well as those routines that you should not use.

Chapter 9—Universal Network Objects

The internals of OpenOffice.org are based on Universal Network Objects (UNO). This chapter introduces the subroutines and functions supported by OpenOffice.org Basic that are related to UNO. This chapter covers methods that create and inspect objects that are vital to the internals of OpenOffice.org. Extra attention is given to the topic of UNO listeners.

Chapter 10—UNO and the Dispatcher

This chapter builds on previous coverage of the OpenOffice.org paradigm and then introduces the dispatcher. The dispatcher provides a simple mechanism for invoking internal functionality with limited knowledge of how the internals work, but it is considered the least-favored way of directing OpenOffice.org.

Chapter 11—StarDesktop

The desktop acts as the main application that controls OpenOffice.org. This chapter introduces some general techniques—such as accessing indexed objects, enumerating open documents, and loading new documents—while discussing and demonstrating the base functionality of the Desktop object. This chapter also covers the Desktop object and ThisComponent.

Chapter 12—Generic Document Methods

OpenOffice.org supports five primary document types: text, spreadsheet, drawing, math, and presentation. The different document types share a lot of common functionality and interfaces, such as accessing the document model, printing, and saving. This chapter shows you how to perform these common tasks across all of the document types.

Chapter 13—Writer Documents

Writer documents primarily deal with text content arranged in paragraphs. This chapter introduces appropriate methods to manipulate, traverse, search, format, and modify the content contained in an OpenOffice.org Writer document.

Chapter 14—Calc Documents

The primary purpose of a Calc document is to contain multiple spreadsheets, which in turn contain rows and columns of data—in other words, tables. This chapter introduces appropriate methods to manipulate, traverse, format, and modify the content contained in a Calc document.

Chapter 15—Draw and Impress Documents

This chapter introduces methods to manipulate and modify the content contained in Draw and Impress documents. The drawing functionality is the same in Draw and Impress, but Impress contains extra functionality to facilitate presentations.

Chapter 16—Library Management

This chapter discusses how and where macro libraries are stored, along with methods you can use to manipulate them. This chapter also covers the subtleties of the macro organizer as well as using the UNO API to manipulate libraries and modules.

Chapter 17—Dialogs and Controls

This chapter discusses how to create and use dialogs and the controls that they contain. It focuses on the Basic IDE as the primary method of creating dialogs. This chapter covers each of the different controls and provides examples for most of the control types. It also includes a method to build dialogs and controls at run time, rather than using the Basic IDE.

Chapter 18—Sources of Information

The internals of OpenOffice.org are very extensive, not completely documented, and in a state of change due to ongoing feature development and bug fixes. This chapter introduces sources of information that can assist you in finding your own solutions.