Anything that sits outside the run of the text, such as a picture, a text box, a chart
or a formula, is held in a draw:frame. The frame gives the position, size
and anchor; its child gives the content. A frame may hold several children that are
different renditions of the same content, in order of preference: a reader shows the
first one it supports. The usual case is an embedded object followed by an image of it.
This page covers section 10.4 of OpenDocument 1.3 part 3, the drawing shapes of
section 10.3 as they occur in text, and their attributes from chapter 19. How a frame
looks and how text wraps round it are set by its graphic style (see
graphic formatting).
The frame
A frame must contain at least one content element. Its children are: one or more of
draw:text-box, draw:image, draw:object,
draw:object-ole, draw:applet, draw:plugin,
draw:floating-frame and table:table; then optionally
draw:image-map, a contour (draw:contour-polygon or
draw:contour-path), draw:glue-point,
office:event-listeners, and svg:title and
svg:desc, which all renditions share.
| Attribute | Values | Meaning |
|---|---|---|
draw:name | text | The frame’s name, by which it is referred to. |
draw:style-name | style name | A style of family graphic, which holds the frame’s formatting. |
draw:class-names | list of style names | More graphic styles, applied in order after draw:style-name. |
draw:text-style-name | style name | A paragraph style for text in the shape. |
text:anchor-type | paragraph (default), char, as-char, page, frame | What the frame is bound to; see Anchoring. |
text:anchor-page-number | positive integer | For a page anchor: the physical page number (pages counted from 1). |
svg:x, svg:y | coordinate | Position of the top left corner. |
svg:width, svg:height | length or percent | Size. |
style:rel-width, style:rel-height | percent, scale, scale-min | Size as a percentage of the surrounding table cell, text box or else the page or window; scale works the size out from the other dimension, keeping the content’s proportions; scale-min does the same but as a minimum. Writers should also give svg:width/svg:height and the minimum sizes for readers that do not support this. |
draw:transform | list of transforms | Transforms applied in order, separated by white space or commas: matrix(a b c d e f) (a 3×2 matrix in column order, e, f the translation), rotate(angle) (degrees about the origin), scale(sx [sy]) (sy defaults to sx), skewX(angle), skewY(angle), translate(tx [ty]) (lengths; ty defaults to 0). |
draw:z-index | integer | Drawing order, increasing from back to front. Without it, shapes are drawn in document order. Not written for shapes inside a group or 3D scene. Shapes drawn in the foreground should not have a lower z-index than shapes drawn in the background. |
draw:copy-of | frame name | Show the content of another frame, with this frame’s own style and position (for example a logo on every page). |
draw:caption-id | IDREF | The draw:text-box holding this shape’s caption. |
draw:layer | layer name | The drawing layer the frame belongs to. |
xml:id, draw:id | ID | Identifier. draw:id is deprecated; if both are present it must equal xml:id and is ignored. |
table:end-cell-address, table:end-x, table:end-y, table:table-background | cell address, coordinates, boolean | For shapes in spreadsheets: the cell and offset where the shape ends (the size attributes are then ignored), and whether it is behind the table. |
presentation:class, presentation:class-names, presentation:style-name, presentation:placeholder, presentation:user-transformed | – | Used only in presentations (ODP). |
Anchoring
text:anchor-type may also be given in the graphic style; the attribute on
the element wins. If neither gives one, it is paragraph. Where the frame
element sits in content.xml depends on the anchor:
| Value | Anchored to | The frame element is written |
|---|---|---|
as-char | Nothing: the frame behaves like a character in the line. | Where that character appears in the text. |
char | The character after the frame element. | Just before that character. |
paragraph | The paragraph containing the frame. | At the start of the paragraph. |
frame | The text box the frame is inside. | Inside that text box’s element. |
page | The page whose physical number is text:anchor-page-number; without that attribute, the page on which the character after the frame appears. | With a page number: at the start of the body, outside any paragraph or frame. Without one: in any paragraph not in a header, footer, footnote or text box. |
<text:p text:style-name="Standard">
<draw:frame draw:style-name="fr1" draw:name="Image1" text:anchor-type="paragraph"
svg:x="0cm" svg:y="0cm" svg:width="6cm" svg:height="4cm" draw:z-index="0">
<draw:image xlink:href="Pictures/photo.png" xlink:type="simple" xlink:show="embed"
xlink:actuate="onLoad" draw:mime-type="image/png"/>
<svg:title>Photo</svg:title>
</draw:frame>Text after the picture.</text:p>
Frame contents
| Element | Meaning | Attributes and children |
|---|---|---|
draw:text-box | A text box: text outside the main flow. It holds the same block content as a table cell (paragraphs, lists, tables, sections, indexes, shapes, frames). | draw:chain-next-name (the next text box in a chain: text that does not fit flows on into it); fo:min-width, fo:min-height (override the frame’s size; the box grows with its text), fo:max-width, fo:max-height (where growing stops; same units as the minimum); percentages are of the surrounding table cell, text box, or else page or window; draw:corner-radius; xml:id, text:id (deprecated) |
draw:image | An image, linked or embedded. Any format is allowed; vector images should be SVG and bitmaps PNG. Text inside it is shown as well as the image. | xlink:href (the file, usually Pictures/… in the package), xlink:type="simple", xlink:show="embed", xlink:actuate="onLoad", draw:mime-type, draw:filter-name (implementation’s import filter); children office:binary-data, text:p, text:list |
office:binary-data | The image or object data in Base64 (RFC 2045), in place of a link. If present, the parent’s xlink:href is ignored. A reader must look at the data to find its format. | – |
draw:object | An object that has an OpenDocument form (chart, formula, drawing…): a sub-document folder in the same package, a separate document, or an office:document or MathML math:math child. An image of it should be given too. | xlink:href, xlink:type, xlink:show, xlink:actuate, draw:notify-on-update-of-ranges (a range list or table name; the object is told when those cells change) |
draw:object-ole | An object with no OpenDocument form, such as an OLE object: a file in the package, an outside file, or office:binary-data. | draw:class-id (the OLE class ID), xlink attributes |
draw:applet | A Java applet, as HTML 4 applet. Deprecated. Must have draw:code or draw:object; its size and name come from the frame. | draw:code, draw:object, draw:archive, draw:may-script (default false), xlink attributes (base IRI, default empty); children draw:param |
draw:plugin | An outside program that handles data of a media type. How readers deal with it is not defined. | draw:mime-type, xlink attributes; children draw:param |
draw:param | A start-up parameter for an applet or plugin. | draw:name, draw:value |
draw:floating-frame | An embedded frame showing another document. It cannot be transformed. | draw:frame-name (a target for hyperlinks), xlink attributes |
table:table | A table placed in the frame (see Tables). | – |
The xlink attributes always have xlink:type="simple". For images,
objects, OLE objects, applets, plugins and floating frames xlink:show is
embed and xlink:actuate is onLoad.
Contours
A contour is an outline round an image or object, used for example to wrap text
tightly round it when the style has style:wrap-contour="true". Readers
should accept pixel lengths for its size.
| Element | Attributes |
|---|---|
draw:contour-polygon | draw:points (points x,y separated by white space, in view-box units), svg:viewBox (four integers: left, top, width, height of the local coordinate system), svg:width, svg:height (the bounding box), draw:recreate-on-edit (true: rebuild the contour when the image is edited) |
draw:contour-path | svg:d (SVG path data), svg:viewBox, svg:width, svg:height, draw:recreate-on-edit |
Hyperlinks and image maps
draw:a wraps a frame or shape to make it a hyperlink. A client-side image
map (draw:image-map) holds areas, each a link, positioned in the image’s
original size; readers scale the map with the image.
| Element | Attributes |
|---|---|
draw:a | xlink:href (target), xlink:type, xlink:show (new or replace), xlink:actuate (onRequest), office:name (a name other links can target; need not be unique), office:title (short accessible description), office:target-frame-name, office:server-map (default false; true appends the click position to the link for a server-side map) |
draw:area-rectangle | svg:x, svg:y, svg:width, svg:height, plus the area attributes |
draw:area-circle | svg:cx, svg:cy (centre), svg:r (radius), plus the area attributes |
draw:area-polygon | svg:x, svg:y, svg:width, svg:height (bounding box), svg:viewBox, draw:points, plus the area attributes |
Area attributes: xlink:href, xlink:type,
xlink:show, office:name, office:target-frame-name,
and draw:nohref="nohref" to make the area inactive. Each area may hold
svg:title, svg:desc and office:event-listeners.
office:target-frame-name is _blank (new frame; then
xlink:show should be new), _parent,
_self, _top (the outermost frame), or a frame name (created
if it does not exist); for any value but _blank, xlink:show
should be replace.
Drawing shapes in text
Every document type may hold drawing shapes. In a text document they take the same
anchoring attributes as a frame (text:anchor-type,
text:anchor-page-number) and the same common attributes
(draw:name, draw:style-name, draw:class-names,
draw:text-style-name, draw:transform,
draw:z-index, draw:layer, draw:caption-id,
xml:id). Most may contain paragraphs and lists (text inside the shape),
glue points, event listeners, and a title and description.
| Element | Shape | Own attributes |
|---|---|---|
draw:rect | Rectangle. | svg:x, svg:y, svg:width, svg:height; svg:rx, svg:ry (corner rounding; one alone sets both) or draw:corner-radius (ignored if svg:rx/svg:ry are present) |
draw:line | Straight line. | svg:x1, svg:y1, svg:x2, svg:y2 |
draw:polyline | Open line through points. | draw:points, svg:viewBox, position and size (readers may take the size from the points) |
draw:polygon | Closed polygon. | as polyline |
draw:regular-polygon | Regular polygon or star. | draw:corners; draw:concave (false: convex polygon; true: star with twice as many corners, needs draw:sharpness, a percentage: 0% is a plain polygon, 100% brings the inner points to the centre; may be negative or above 100%); position and size |
draw:path | Any outline. | svg:d, svg:viewBox, position and size |
draw:circle, draw:ellipse | Circle or ellipse, or part of one. | svg:cx, svg:cy, svg:r (circle) or svg:rx, svg:ry (ellipse), or position and size (a circle uses the smaller of width and height); draw:kind = full (default), section, cut, arc; draw:start-angle, draw:end-angle |
draw:connector | Lines joining two shapes. | draw:type = standard (default: right-angled lines that avoid the shapes), lines, line, curve; draw:start-shape, draw:end-shape, draw:start-glue-point, draw:end-glue-point; svg:x1…svg:y2 (may be left out when connected); draw:line-skew (one to three lengths moving the middle lines); svg:d and svg:viewBox (the path; writers should give it) |
draw:caption | A box with lines to a point it describes. | position and size, draw:caption-point-x, draw:caption-point-y, draw:corner-radius |
draw:measure | A dimension line between two reference points. | svg:x1, svg:y1 (start), svg:x2, svg:y2 (end); the rest is in the style |
draw:control | A form control’s visible shape. | draw:control (the control’s ID in office:forms), position and size |
draw:page-thumbnail | A thumbnail of a drawing page. | draw:page-number, position and size |
draw:g | A group of shapes. Inside a draw:a every shape in the group links to its target unless it has its own link. | svg:y |
draw:custom-shape | A shape drawn from an enhanced-geometry description. | position and size; child draw:enhanced-geometry |
dr3d:scene | A 3D scene. | – |
Every shape has four standard glue points, numbered 0 to 3 clockwise from the top,
at the middle of each edge of its bounding box. draw:glue-point adds
more: draw:id, svg:x and svg:y (a percentage
from the centre, or a distance from the edge named by draw:align:
top-left, top, top-right, left,
center, right, bottom-left,
bottom-right), and draw:escape-direction (auto,
left, right, up, down,
horizontal, vertical).
Custom shapes and 3D scenes are used mostly in drawings and presentations; their geometry is described on the ODP pages.
Source
OpenDocument Version 1.3, OASIS Standard, 27 April 2021, part 3 (schema), sections 10.3 and 10.4 and the attributes they reference in chapter 19 (including Table 17, text anchor positions); read in full for this page.