Chapter 6. Drawings

Let's take a break from pure text and numbers to investigate OpenDocument's graphic elements. Before we get to the actual objects that you can draw on a page, we have to discuss the general format of the file.

A Drawing's styles.xml File

An <office:master-styles> element follows the <office:automatic-styles> in the styles.xml file. It defines the layers of a drawing and the master page. Example 6.1, “Master Styles in a Draw Document” shows this element:

Example 6.1. Master Styles in a Draw Document

<draw:layer-set> <draw:layer draw:name="layout"/> <draw:layer draw:name="background"/> <draw:layer draw:name="backgroundobjects"/> <draw:layer draw:name="controls"/> <draw:layer draw:name="measurelines"/> </draw:layer-set> <style:master-page style:name="Default" style:page-master-name="PM1" draw:style-name="dp1"/>

These layers, unlike layers in most drawing programs, do not determine the stacking order of objects. They are just separate workspaces for holding various parts of the drawing. The layout layer contains most of your ordinary graphics. The controls layer contains buttons with actions attached to them (we won't examine those in this chapter). The measurelines layer contains lines which automatically calculate and display linear dimensions. The background and backgroundobjects layers are used in presentation documents, which we will cover in Chapter 7, Presentation.

A Drawing's content.xml File

OpenDocument drawing documents have an <office:drawing> element ...

Get OASIS OpenDocument Essentials: Using OASIS OpenDocument XML now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.