ddn.odf.draw
ODF drawing document body model.
Provides typed access to office:drawing content for creating and reading OpenDocument Drawing files (.odg).
Drawing constructs
Fully typed:
- Drawing pages (
draw:page) with name, style, and master-page - Layers (
draw:layer) with name and visibility - Basic shapes: rectangle, ellipse, line, polygon, polyline, path
- Connectors between shapes
- Frames with text boxes, images, and custom shapes
- Groups of shapes
- Builder helpers for all shape types (
rectangle(),ellipse(),line(),polygon(),polyline(),pathShape(),circle(),arc(),textBox(),captionShape(),measureShape(),imageShape(),customShape())
Preservation-first (raw XML retained):
- Custom shapes with complex geometry
- 3-D scene elements
- Extension drawing objects from third-party office suites
- Enhanced geometry and glue-point definitions
enum DrawShapeKind
fn arc caption circle connector customShape drawLayer drawPage drawShapeKindFromLocal ellipse emptyDrawingBody frame getDrawAttr groupShape imageShape isShapeLocal line measure parseDrawingBody parseDrawPage parseDrawShape path polygon polyline rectangle serializeDrawingBody serializeDrawLayer serializeDrawPage serializeDrawShape shapeTag textBox
Types 5
enumDrawShapeKind
Discriminant for the kind of drawing shape.
RECTANGLE
ELLIPSE
LINE
POLYGON
POLYLINE
PATH
CONNECTOR
GROUP
FRAME
IMAGE
TEXT_BOX
MEASURE
CAPTION
CIRCLE
ARC
CUSTOM
CONTROL
OLE_OBJECT
PLUGIN
FLOATING_FRAME
THREED_SCENE
UNKNOWN
structDrawShape
A single drawing shape (discriminated union).
Covers the core ODF draw:* shape elements. Fields that only apply to some DrawShapeKind values are left empty for other kinds.
Fields
DrawShapeKind kindstring styleNamestring textStyleNamestring drawIdstring layerstring namestring svgXstring svgYstring svgWidthstring svgHeightstring svgViewBoxstring svgDstring svgRxstring svgRystring cornerRadiusstring minWidthstring minHeightstring maxWidthstring maxHeightstring x1string y1string x2string y2string dKindstring pointsstring pathDatastring connectorTypestring startShapestring startGluePointstring endShapestring endGluePointstring imagePathstring hrefstring mimeTypestring frameNamestring anchorTypestring textContentDrawShape[] childrenXmlElement[] unknownChildrenstring[string] extraAttributesMethods
structDrawLayer
A single drawing layer (draw:layer).
Fields
string namestring displaystring protected_structDrawPage
A single drawing page (draw:page).
A page is the primary container for shapes in an ODG document.
Fields
string namestring styleNamestring masterPageNamestring idDrawShape[] shapesDrawLayer[] layersXmlElement[] unknownElementsMethods
structOdfDrawingBody
Top-level model for office:drawing body content.
Functions 30
fn
OdfDrawingBody parseDrawingBody(XmlElement drawingElement)Parses an `office:drawing` XML element into an `OdfDrawingBody`.fn
string serializeDrawingBody(const ref OdfDrawingBody body)Serialises an `OdfDrawingBody` to an XML fragment string (without the surrounding `<office:drawing>` tags).fn
DrawPage drawPage(string name, DrawShape[] shapes...)Constructs a `DrawPage` with the given name and shapes.fn
DrawShape rectangle(string x, string y, string width, string height,
string styleName = "")Constructs a rectangle shape.fn
DrawShape ellipse(string x, string y, string width, string height,
string styleName = "")Constructs an ellipse shape.fn
DrawShape line(string x1, string y1, string x2, string y2,
string styleName = "")Constructs a line shape.fn
DrawShape frame(string x, string y, string width, string height,
string styleName = "")Constructs a frame shape for images or text boxes.fn
DrawShape connector(string connectorType, string startShape,
string endShape, string styleName = "")Constructs a connector shape.fn
DrawShape polygon(string points, string viewBox, string styleName = "")Constructs a polygon shape.fn
DrawShape polyline(string points, string viewBox, string styleName = "")Constructs a polyline shape.fn
DrawShape path(string pathData, string viewBox, string styleName = "")Constructs a path shape using SVG path data.fn
DrawShape arc(string x, string y, string width, string height,
string dKind = "arc", string styleName = "")Constructs an arc shape.fn
DrawShape textBox(string x, string y, string width, string height,
string textContent = "", string styleName = "")Constructs a text box shape.fn
DrawShape caption(string x, string y, string width, string height,
string styleName = "")Constructs a caption shape.fn
DrawShape measure(string x1, string y1, string x2, string y2,
string styleName = "")Constructs a measure shape (dimension line).fn
DrawShape imageShape(string imagePath, string x, string y,
string width, string height, string mimeType = "",
string styleName = "")Constructs an image shape embedding a referenced image.fn
DrawShape customShape(string x, string y, string width, string height,
string styleName = "")Constructs a custom shape.fn
DrawLayer drawLayer(string name, string display = "true",
string protected_ = "false") @safe pure nothrowConstructs a draw layer.fn
void serializeDrawPage(XmlElement parent, ref const DrawPage dp)fn
void serializeDrawLayer(XmlElement parent, ref const DrawLayer dl)fn
void serializeDrawShape(XmlElement parent, ref const DrawShape s)