Skip to content

Shapes

Drawing classes ShapeBase, LineShape, PolylineShape, PolygonShape, RectangleShape, EllipseShape, ConnectorShape and DrawGroup.

Classes:

Name Description
AngleMix

Kind, start_angle and end_angle for circle and ellipse.

CircleShape

Represents an circular shape, “draw:circle”.

ConnectorShape

Represents a connector shape, “draw:connector”.

DrawCaption

Represents a description attached to a fixed point, “draw:caption”.

DrawControl

Represents a shape that is linked to a control inside an

DrawGroup

Representation of a group of drawing shapes, “draw:g”.

DrawMeasure

Represents a shape that is used to measure distances in drawings,

DrawPageThumbnail

Represents a rectangular area that displays the thumbnail of a

DrawPath

Represents a path, “draw:path”.

EllipseShape

Represents an ellipse shape, “draw:ellipse”.

LineShape

Represents a line shape, “draw:line”.

PolygonShape

Represents a polygon, “draw:polygon”.

PolylineShape

Represents a polyline shape, “draw:polyline”.

RectangleShape

Represents a rectangle shape, “draw:rect”.

RegularPolygonShape

Represents a regular polygon, “draw:regular-polygon”.

ShapeBase

Base class for all drawing shapes.

Attributes:

Name Type Description
registered_shapes

registered_shapes module-attribute

registered_shapes = [
    (_tag)
    for s in (
        CircleShape,
        ConnectorShape,
        DrawCaption,
        DrawControl,
        DrawMeasure,
        DrawPageThumbnail,
        DrawPath,
        EllipseShape,
        LineShape,
        PolygonShape,
        PolylineShape,
        RectangleShape,
        RegularPolygonShape,
    )
]

AngleMix

Bases: Element

Kind, start_angle and end_angle for circle and ellipse.

Kind value can be: ‘full’, ‘section’, ‘cut’ or ‘arc’. Default is ‘full’.

Attributes:

Name Type Description
KIND_VALUE_CHOICE
kind str

Get or set the kind, “draw:kind”.

Source code in odfdo/shapes.py
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
class AngleMix(Element):
    """Kind, start_angle and end_angle for circle and ellipse.

    Kind value can be: 'full', 'section', 'cut' or 'arc'. Default is 'full'.
    """

    _tag = "draw:anglemix-odfdo-notodf"
    _properties: tuple[PropDef | PropDefBool, ...] = (
        PropDef("start_angle", "draw:start-angle"),
        PropDef("end_angle", "draw:end-angle"),
    )

    KIND_VALUE_CHOICE = {  # noqa: RUF012
        "full",
        "section",
        "cut",
        "arc",
    }

    @property
    def kind(self) -> str:
        'Get or set the kind, "draw:kind".'
        return self._get_attribute_str_default("draw:kind", "full")

    @kind.setter
    def kind(self, kind: str) -> None:
        if kind not in self.KIND_VALUE_CHOICE:
            raise TypeError(f"'draw:kind' not valid: {kind!r}")
        self._set_attribute_str_default("draw:kind", kind, "full")

KIND_VALUE_CHOICE class-attribute instance-attribute

KIND_VALUE_CHOICE = {'full', 'section', 'cut', 'arc'}

_properties class-attribute instance-attribute

_properties: tuple[PropDef | PropDefBool, ...] = (
    PropDef("start_angle", "draw:start-angle"),
    PropDef("end_angle", "draw:end-angle"),
)

_tag class-attribute instance-attribute

_tag = 'draw:anglemix-odfdo-notodf'

kind property writable

kind: str

Get or set the kind, “draw:kind”.

CircleShape

Bases: AngleMix, PosMix, SizeMix, ShapeBase

Represents an circular shape, “draw:circle”.

This shape defines a circular area.

Methods:

Name Description
__init__

Create a circular shape “draw:circle”.

Attributes:

Name Type Description
center tuple[str | None, str | None]

Get or set the center (cx, cy) coordinates of the circle.

end_angle
kind
position
radius
size
start_angle
Source code in odfdo/shapes.py
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
class CircleShape(AngleMix, PosMix, SizeMix, ShapeBase):
    """Represents an circular shape, "draw:circle".

    This shape defines a circular area.
    """

    _tag = "draw:circle"
    _properties: tuple[PropDef | PropDefBool, ...] = (
        PropDef("radius", "svg:r"),
        PropDef("cx", "svg:cx"),
        PropDef("cy", "svg:cy"),
    )

    def __init__(
        self,
        name: str | None = None,
        style: str | None = None,
        text_style: str | None = None,
        draw_id: str | None = None,
        layer: str | None = None,
        position: tuple[str, str] | list[str] | None = None,
        size: tuple[str, str] | list[str] | None = None,
        radius: str | None = None,
        kind: str | None = None,
        start_angle: str | None = None,
        end_angle: str | None = None,
        center: tuple[str, str] | list[str] | None = None,
        presentation_class: str | None = None,
        presentation_style: str | None = None,
        caption_id: str | None = None,
        class_names: str | None = None,
        transform: str | None = None,
        z_index: int | None = None,
        end_cell_address: str | None = None,
        end_x: str | None = None,
        end_y: str | None = None,
        table_background: bool | None = None,
        anchor_type: str | None = None,
        anchor_page: int | None = None,
        xml_id: str | None = None,
        **kwargs: Any,
    ) -> None:
        """Create a circular shape "draw:circle".

        Args:
            name: Name of the graphical element.
            style: The style name for the circle.
            text_style: The text style name for the circle.
            draw_id: The unique ID for the drawing shape.
            layer: The drawing layer of the circle.
            position: The (x, y) coordinates for the circle's position.
            size: The (width, height) for the circle's size.
            radius: The radius of the circle.
            kind: The appearance of a circle or circle, "full", "section",
                "cut" or "arc". Default is "full".
            start_angle: The start angle of a section, cut, or arc where the
                draw:kind is "section", "cut" or "arc".
            end_angle: The end angle of a section, cut, or arc where the
                draw:kind is "section", "cut" or "arc".
            center: The x-axis coordinate of the center of a circular image map
                area.
            center: The (cx, cy) coordinates of the center of the circle.
            presentation_class: White-space-separated list of presentation
                class names.
            presentation_style: Style for a presentation shape.
            caption_id: Target ID assigned to the "draw:text-box" that
                contains the caption.
            class_names: White-space-separated list of styles with the
                family value of graphic.
            transform: White-space or comma separated list of transform
                definitions.
            z_index: Rendering order for shapes in a document instance.
            end_cell_address: End position of the shape if it is included
                in a spreadsheet document.
            end_x: The x-coordinate of the end position of a shape relative
                to the top-left edge of a cell.
            end_y: The y-coordinate of the end position of a shape relative
                to the top-left edge of a cell.
            table_background: Wether the shape is in the table background if
                the drawing shape is included in a spreadsheet.
            anchor_type: How a drawing shape is bound to a text document.
            anchor_page: Physical page number of an anchor if the drawing
                object is bound to a page within a text document.
            xml_id: The unique XML ID.
        """
        kwargs.update(
            {
                "name": name,
                "style": style,
                "text_style": text_style,
                "draw_id": draw_id,
                "layer": layer,
                "presentation_class": presentation_class,
                "presentation_style": presentation_style,
                "caption_id": caption_id,
                "class_names": class_names,
                "transform": transform,
                "z_index": z_index,
                "end_cell_address": end_cell_address,
                "end_x": end_x,
                "end_y": end_y,
                "table_background": table_background,
                "anchor_type": anchor_type,
                "anchor_page": anchor_page,
                "xml_id": xml_id,
            }
        )
        super().__init__(**kwargs)
        if self._do_init:
            if position:
                self.position = position
            if size:
                self.size = size
            if radius:
                self.radius = radius
            if kind:
                self.kind = kind
            if start_angle:
                self.start_angle = start_angle
            if end_angle:
                self.end_angle = end_angle
            if center:
                self.center = center

    @property
    def center(self) -> tuple[str | None, str | None]:
        "Get or set the center (cx, cy) coordinates of the circle."
        return (self.cx, self.cy)

    @center.setter
    def center(self, center: tuple[str, str] | list[str] | None) -> None:
        if center is None:
            self.cx = None
            self.cy = None
        else:
            self.cx = center[0]
            self.cy = center[1]

_properties class-attribute instance-attribute

_properties: tuple[PropDef | PropDefBool, ...] = (
    PropDef("radius", "svg:r"),
    PropDef("cx", "svg:cx"),
    PropDef("cy", "svg:cy"),
)

_tag class-attribute instance-attribute

_tag = 'draw:circle'

center property writable

center: tuple[str | None, str | None]

Get or set the center (cx, cy) coordinates of the circle.

end_angle instance-attribute

end_angle = end_angle

kind instance-attribute

kind = kind

position instance-attribute

position = position

radius instance-attribute

radius = radius

size instance-attribute

size = size

start_angle instance-attribute

start_angle = start_angle

__init__

__init__(
    name: str | None = None,
    style: str | None = None,
    text_style: str | None = None,
    draw_id: str | None = None,
    layer: str | None = None,
    position: tuple[str, str] | list[str] | None = None,
    size: tuple[str, str] | list[str] | None = None,
    radius: str | None = None,
    kind: str | None = None,
    start_angle: str | None = None,
    end_angle: str | None = None,
    center: tuple[str, str] | list[str] | None = None,
    presentation_class: str | None = None,
    presentation_style: str | None = None,
    caption_id: str | None = None,
    class_names: str | None = None,
    transform: str | None = None,
    z_index: int | None = None,
    end_cell_address: str | None = None,
    end_x: str | None = None,
    end_y: str | None = None,
    table_background: bool | None = None,
    anchor_type: str | None = None,
    anchor_page: int | None = None,
    xml_id: str | None = None,
    **kwargs: Any,
) -> None

Create a circular shape “draw:circle”.

Parameters:

Name Type Description Default
name str | None

Name of the graphical element.

None
style str | None

The style name for the circle.

None
text_style str | None

The text style name for the circle.

None
draw_id str | None

The unique ID for the drawing shape.

None
layer str | None

The drawing layer of the circle.

None
position tuple[str, str] | list[str] | None

The (x, y) coordinates for the circle’s position.

None
size tuple[str, str] | list[str] | None

The (width, height) for the circle’s size.

None
radius str | None

The radius of the circle.

None
kind str | None

The appearance of a circle or circle, “full”, “section”, “cut” or “arc”. Default is “full”.

None
start_angle str | None

The start angle of a section, cut, or arc where the draw:kind is “section”, “cut” or “arc”.

None
end_angle str | None

The end angle of a section, cut, or arc where the draw:kind is “section”, “cut” or “arc”.

None
center tuple[str, str] | list[str] | None

The x-axis coordinate of the center of a circular image map area.

None
center tuple[str, str] | list[str] | None

The (cx, cy) coordinates of the center of the circle.

None
presentation_class str | None

White-space-separated list of presentation class names.

None
presentation_style str | None

Style for a presentation shape.

None
caption_id str | None

Target ID assigned to the “draw:text-box” that contains the caption.

None
class_names str | None

White-space-separated list of styles with the family value of graphic.

None
transform str | None

White-space or comma separated list of transform definitions.

None
z_index int | None

Rendering order for shapes in a document instance.

None
end_cell_address str | None

End position of the shape if it is included in a spreadsheet document.

None
end_x str | None

The x-coordinate of the end position of a shape relative to the top-left edge of a cell.

None
end_y str | None

The y-coordinate of the end position of a shape relative to the top-left edge of a cell.

None
table_background bool | None

Wether the shape is in the table background if the drawing shape is included in a spreadsheet.

None
anchor_type str | None

How a drawing shape is bound to a text document.

None
anchor_page int | None

Physical page number of an anchor if the drawing object is bound to a page within a text document.

None
xml_id str | None

The unique XML ID.

None
Source code in odfdo/shapes.py
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
def __init__(
    self,
    name: str | None = None,
    style: str | None = None,
    text_style: str | None = None,
    draw_id: str | None = None,
    layer: str | None = None,
    position: tuple[str, str] | list[str] | None = None,
    size: tuple[str, str] | list[str] | None = None,
    radius: str | None = None,
    kind: str | None = None,
    start_angle: str | None = None,
    end_angle: str | None = None,
    center: tuple[str, str] | list[str] | None = None,
    presentation_class: str | None = None,
    presentation_style: str | None = None,
    caption_id: str | None = None,
    class_names: str | None = None,
    transform: str | None = None,
    z_index: int | None = None,
    end_cell_address: str | None = None,
    end_x: str | None = None,
    end_y: str | None = None,
    table_background: bool | None = None,
    anchor_type: str | None = None,
    anchor_page: int | None = None,
    xml_id: str | None = None,
    **kwargs: Any,
) -> None:
    """Create a circular shape "draw:circle".

    Args:
        name: Name of the graphical element.
        style: The style name for the circle.
        text_style: The text style name for the circle.
        draw_id: The unique ID for the drawing shape.
        layer: The drawing layer of the circle.
        position: The (x, y) coordinates for the circle's position.
        size: The (width, height) for the circle's size.
        radius: The radius of the circle.
        kind: The appearance of a circle or circle, "full", "section",
            "cut" or "arc". Default is "full".
        start_angle: The start angle of a section, cut, or arc where the
            draw:kind is "section", "cut" or "arc".
        end_angle: The end angle of a section, cut, or arc where the
            draw:kind is "section", "cut" or "arc".
        center: The x-axis coordinate of the center of a circular image map
            area.
        center: The (cx, cy) coordinates of the center of the circle.
        presentation_class: White-space-separated list of presentation
            class names.
        presentation_style: Style for a presentation shape.
        caption_id: Target ID assigned to the "draw:text-box" that
            contains the caption.
        class_names: White-space-separated list of styles with the
            family value of graphic.
        transform: White-space or comma separated list of transform
            definitions.
        z_index: Rendering order for shapes in a document instance.
        end_cell_address: End position of the shape if it is included
            in a spreadsheet document.
        end_x: The x-coordinate of the end position of a shape relative
            to the top-left edge of a cell.
        end_y: The y-coordinate of the end position of a shape relative
            to the top-left edge of a cell.
        table_background: Wether the shape is in the table background if
            the drawing shape is included in a spreadsheet.
        anchor_type: How a drawing shape is bound to a text document.
        anchor_page: Physical page number of an anchor if the drawing
            object is bound to a page within a text document.
        xml_id: The unique XML ID.
    """
    kwargs.update(
        {
            "name": name,
            "style": style,
            "text_style": text_style,
            "draw_id": draw_id,
            "layer": layer,
            "presentation_class": presentation_class,
            "presentation_style": presentation_style,
            "caption_id": caption_id,
            "class_names": class_names,
            "transform": transform,
            "z_index": z_index,
            "end_cell_address": end_cell_address,
            "end_x": end_x,
            "end_y": end_y,
            "table_background": table_background,
            "anchor_type": anchor_type,
            "anchor_page": anchor_page,
            "xml_id": xml_id,
        }
    )
    super().__init__(**kwargs)
    if self._do_init:
        if position:
            self.position = position
        if size:
            self.size = size
        if radius:
            self.radius = radius
        if kind:
            self.kind = kind
        if start_angle:
            self.start_angle = start_angle
        if end_angle:
            self.end_angle = end_angle
        if center:
            self.center = center

ConnectorShape

Bases: ShapeBase

Represents a connector shape, “draw:connector”.

A connector typically links two other shapes.

Methods:

Name Description
__init__

Create a connector shape “draw:connector”.

Attributes:

Name Type Description
DRAW_TYOE_CHOICE
connected_shapes tuple[str | None, str | None]

Get or set the connected shapes (“draw:start-shape”,

draw_type str

Get or set the draw type, “draw:type”.

glue_points tuple[str | None, str | None]

Get or set the the glue points for connection

line_skew
p1 tuple[str | None, str | None]

Get or set the (x1, y1) coordinates of the starting point.

p2 tuple[str | None, str | None]

Get or set the (x2, y2) coordinates of the ending point.

svg_d
view_box
Source code in odfdo/shapes.py
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
class ConnectorShape(ShapeBase):
    """Represents a connector shape, "draw:connector".

    A connector typically links two other shapes.
    """

    _tag = "draw:connector"
    _properties: tuple[PropDef | PropDefBool, ...] = (
        PropDef("start_shape", "draw:start-shape"),
        PropDef("end_shape", "draw:end-shape"),
        PropDef("start_glue_point", "draw:start-glue-point"),
        PropDef("end_glue_point", "draw:end-glue-point"),
        PropDef("x1", "svg:x1"),
        PropDef("y1", "svg:y1"),
        PropDef("x2", "svg:x2"),
        PropDef("y2", "svg:y2"),
        PropDef("line_skew", "draw:line-skew"),
        PropDef("svg_d", "svg:d"),
        PropDef("view_box", "svg:viewBox"),
    )

    DRAW_TYOE_CHOICE = {  # noqa: RUF012
        "standard",
        "lines",
        "line",
        "curve",
    }

    def __init__(
        self,
        name: str | None = None,
        style: str | None = None,
        text_style: str | None = None,
        draw_id: str | None = None,
        layer: str | None = None,
        connected_shapes: tuple[ShapeBase, ShapeBase] | list[ShapeBase] | None = None,
        glue_points: tuple[str | int, str | int] | list[str | int] | None = None,
        p1: tuple[str, str] | list[str] | None = None,
        p2: tuple[str, str] | list[str] | None = None,
        draw_type: str | None = None,
        line_skew: str | None = None,
        svg_d: str | None = None,
        view_box: str | None = None,
        presentation_class: str | None = None,
        presentation_style: str | None = None,
        caption_id: str | None = None,
        class_names: str | None = None,
        transform: str | None = None,
        z_index: int | None = None,
        end_cell_address: str | None = None,
        end_x: str | None = None,
        end_y: str | None = None,
        table_background: bool | None = None,
        anchor_type: str | None = None,
        anchor_page: int | None = None,
        xml_id: str | None = None,
        **kwargs: Any,
    ) -> None:
        """Create a connector shape "draw:connector".

        Args:
            name: Name of the graphical element.
            style: The style name for the connector.
            text_style: The text style name for the connector.
            draw_id: The unique ID for the drawing shape.
            layer: The drawing layer of the connector.
            connected_shapes: A tuple of (start_shape, end_shape)
                where each shape is a shape with a `draw_id`.
            glue_points: A tuple of (start_glue_point, end_glue_point)
                specifying the glue points for connection.
            p1: The (x1, y1) coordinates of the starting point.
            p2: The (x2, y2) coordinates of the ending point.
            draw_type: The line or series of lines that connect two glue
                points. Values are 'standard' (default), 'lines', 'line'
                or 'curve'.
            line_skew: A list of offsets for the placements of connector
                lines if the connector is of type standard.
            svg_d: A path data.
            view_box: The rectangle in a local coordinates system used by the
                points.
            presentation_class: White-space-separated list of presentation
                class names.
            presentation_style: Style for a presentation shape.
            caption_id: Target ID assigned to the "draw:text-box" that
                contains the caption.
            class_names: White-space-separated list of styles with the
                family value of graphic.
            transform: White-space or comma separated list of transform
                definitions.
            z_index: Rendering order for shapes in a document instance.
            end_cell_address: End position of the shape if it is included
                in a spreadsheet document.
            end_x: The x-coordinate of the end position of a shape relative
                to the top-left edge of a cell.
            end_y: The y-coordinate of the end position of a shape relative
                to the top-left edge of a cell.
            table_background: Wether the shape is in the table background if
                the drawing shape is included in a spreadsheet.
            anchor_type: How a drawing shape is bound to a text document.
            anchor_page: Physical page number of an anchor if the drawing
                object is bound to a page within a text document.
            xml_id: The unique XML ID.
        """
        kwargs.update(
            {
                "name": name,
                "style": style,
                "text_style": text_style,
                "draw_id": draw_id,
                "layer": layer,
                "presentation_class": presentation_class,
                "presentation_style": presentation_style,
                "caption_id": caption_id,
                "class_names": class_names,
                "transform": transform,
                "z_index": z_index,
                "end_cell_address": end_cell_address,
                "end_x": end_x,
                "end_y": end_y,
                "table_background": table_background,
                "anchor_type": anchor_type,
                "anchor_page": anchor_page,
                "xml_id": xml_id,
            }
        )
        super().__init__(**kwargs)
        if self._do_init:
            if connected_shapes:
                self.connected_shapes = connected_shapes
            if glue_points:
                self.glue_points = glue_points
            self.p1 = p1
            self.p2 = p2
            if draw_type:
                self.draw_type = draw_type
            if line_skew:
                self.line_skew = line_skew
            if svg_d:
                self.svg_d = svg_d
            if view_box:
                self.view_box = view_box

    @property
    def connected_shapes(self) -> tuple[str | None, str | None]:
        """Get or set the connected shapes ("draw:start-shape",
        "draw:end-shape")."""
        get_attr = self.get_attribute_string
        return get_attr("draw:start-shape"), get_attr("draw:end-shape")

    @connected_shapes.setter
    def connected_shapes(
        self, connected_shapes: tuple[ShapeBase, ShapeBase] | list[ShapeBase] | None
    ) -> None:
        if connected_shapes is None:
            self.start_shape = None
            self.end_shape = None
        else:
            self.start_shape = connected_shapes[0].draw_id
            self.end_shape = connected_shapes[1].draw_id

    @property
    def glue_points(self) -> tuple[str | None, str | None]:
        """Get or set the the glue points for connection
        ("draw:start-glue-point", "draw:end-glue-point")."""
        get_attr = self.get_attribute_string
        return get_attr("draw:start-glue-point"), get_attr("draw:end-glue-point")

    @glue_points.setter
    def glue_points(
        self, glue_points: tuple[str | int, str | int] | list[str | int] | None
    ) -> None:
        if glue_points is None:
            self.start_glue_point = None
            self.end_glue_point = None
        else:
            self.start_glue_point = glue_points[0]
            self.end_glue_point = glue_points[1]

    @property
    def p1(self) -> tuple[str | None, str | None]:
        "Get or set the (x1, y1) coordinates of the starting point."
        return (self.x1, self.y1)

    @p1.setter
    def p1(self, p1: tuple[str, str] | list[str] | None) -> None:
        if p1 is None:
            self.x1 = None
            self.y1 = None
        else:
            self.x1 = p1[0]
            self.y1 = p1[1]

    @property
    def p2(self) -> tuple[str | None, str | None]:
        "Get or set the (x2, y2) coordinates of the ending point."
        return (self.x2, self.y2)

    @p2.setter
    def p2(self, p2: tuple[str, str] | list[str] | None) -> None:
        if p2 is None:
            self.x2 = None
            self.y2 = None
        else:
            self.x2 = p2[0]
            self.y2 = p2[1]

    @property
    def draw_type(self) -> str:
        'Get or set the draw type, "draw:type".'
        return self._get_attribute_str_default("draw:type", "standard")

    @draw_type.setter
    def draw_type(self, draw_type: str) -> None:
        if draw_type not in self.DRAW_TYOE_CHOICE:
            raise TypeError(f"'draw:type' not valid: {draw_type!r}")
        self._set_attribute_str_default("draw:type", draw_type, "standard")

DRAW_TYOE_CHOICE class-attribute instance-attribute

DRAW_TYOE_CHOICE = {'standard', 'lines', 'line', 'curve'}

_properties class-attribute instance-attribute

_properties: tuple[PropDef | PropDefBool, ...] = (
    PropDef("start_shape", "draw:start-shape"),
    PropDef("end_shape", "draw:end-shape"),
    PropDef("start_glue_point", "draw:start-glue-point"),
    PropDef("end_glue_point", "draw:end-glue-point"),
    PropDef("x1", "svg:x1"),
    PropDef("y1", "svg:y1"),
    PropDef("x2", "svg:x2"),
    PropDef("y2", "svg:y2"),
    PropDef("line_skew", "draw:line-skew"),
    PropDef("svg_d", "svg:d"),
    PropDef("view_box", "svg:viewBox"),
)

_tag class-attribute instance-attribute

_tag = 'draw:connector'

connected_shapes property writable

connected_shapes: tuple[str | None, str | None]

Get or set the connected shapes (“draw:start-shape”, “draw:end-shape”).

draw_type property writable

draw_type: str

Get or set the draw type, “draw:type”.

glue_points property writable

glue_points: tuple[str | None, str | None]

Get or set the the glue points for connection (“draw:start-glue-point”, “draw:end-glue-point”).

line_skew instance-attribute

line_skew = line_skew

p1 property writable

p1: tuple[str | None, str | None]

Get or set the (x1, y1) coordinates of the starting point.

p2 property writable

p2: tuple[str | None, str | None]

Get or set the (x2, y2) coordinates of the ending point.

svg_d instance-attribute

svg_d = svg_d

view_box instance-attribute

view_box = view_box

__init__

__init__(
    name: str | None = None,
    style: str | None = None,
    text_style: str | None = None,
    draw_id: str | None = None,
    layer: str | None = None,
    connected_shapes: tuple[ShapeBase, ShapeBase]
    | list[ShapeBase]
    | None = None,
    glue_points: tuple[str | int, str | int]
    | list[str | int]
    | None = None,
    p1: tuple[str, str] | list[str] | None = None,
    p2: tuple[str, str] | list[str] | None = None,
    draw_type: str | None = None,
    line_skew: str | None = None,
    svg_d: str | None = None,
    view_box: str | None = None,
    presentation_class: str | None = None,
    presentation_style: str | None = None,
    caption_id: str | None = None,
    class_names: str | None = None,
    transform: str | None = None,
    z_index: int | None = None,
    end_cell_address: str | None = None,
    end_x: str | None = None,
    end_y: str | None = None,
    table_background: bool | None = None,
    anchor_type: str | None = None,
    anchor_page: int | None = None,
    xml_id: str | None = None,
    **kwargs: Any,
) -> None

Create a connector shape “draw:connector”.

Parameters:

Name Type Description Default
name str | None

Name of the graphical element.

None
style str | None

The style name for the connector.

None
text_style str | None

The text style name for the connector.

None
draw_id str | None

The unique ID for the drawing shape.

None
layer str | None

The drawing layer of the connector.

None
connected_shapes tuple[ShapeBase, ShapeBase] | list[ShapeBase] | None

A tuple of (start_shape, end_shape) where each shape is a shape with a draw_id.

None
glue_points tuple[str | int, str | int] | list[str | int] | None

A tuple of (start_glue_point, end_glue_point) specifying the glue points for connection.

None
p1 tuple[str, str] | list[str] | None

The (x1, y1) coordinates of the starting point.

None
p2 tuple[str, str] | list[str] | None

The (x2, y2) coordinates of the ending point.

None
draw_type str | None

The line or series of lines that connect two glue points. Values are ‘standard’ (default), ‘lines’, ‘line’ or ‘curve’.

None
line_skew str | None

A list of offsets for the placements of connector lines if the connector is of type standard.

None
svg_d str | None

A path data.

None
view_box str | None

The rectangle in a local coordinates system used by the points.

None
presentation_class str | None

White-space-separated list of presentation class names.

None
presentation_style str | None

Style for a presentation shape.

None
caption_id str | None

Target ID assigned to the “draw:text-box” that contains the caption.

None
class_names str | None

White-space-separated list of styles with the family value of graphic.

None
transform str | None

White-space or comma separated list of transform definitions.

None
z_index int | None

Rendering order for shapes in a document instance.

None
end_cell_address str | None

End position of the shape if it is included in a spreadsheet document.

None
end_x str | None

The x-coordinate of the end position of a shape relative to the top-left edge of a cell.

None
end_y str | None

The y-coordinate of the end position of a shape relative to the top-left edge of a cell.

None
table_background bool | None

Wether the shape is in the table background if the drawing shape is included in a spreadsheet.

None
anchor_type str | None

How a drawing shape is bound to a text document.

None
anchor_page int | None

Physical page number of an anchor if the drawing object is bound to a page within a text document.

None
xml_id str | None

The unique XML ID.

None
Source code in odfdo/shapes.py
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
def __init__(
    self,
    name: str | None = None,
    style: str | None = None,
    text_style: str | None = None,
    draw_id: str | None = None,
    layer: str | None = None,
    connected_shapes: tuple[ShapeBase, ShapeBase] | list[ShapeBase] | None = None,
    glue_points: tuple[str | int, str | int] | list[str | int] | None = None,
    p1: tuple[str, str] | list[str] | None = None,
    p2: tuple[str, str] | list[str] | None = None,
    draw_type: str | None = None,
    line_skew: str | None = None,
    svg_d: str | None = None,
    view_box: str | None = None,
    presentation_class: str | None = None,
    presentation_style: str | None = None,
    caption_id: str | None = None,
    class_names: str | None = None,
    transform: str | None = None,
    z_index: int | None = None,
    end_cell_address: str | None = None,
    end_x: str | None = None,
    end_y: str | None = None,
    table_background: bool | None = None,
    anchor_type: str | None = None,
    anchor_page: int | None = None,
    xml_id: str | None = None,
    **kwargs: Any,
) -> None:
    """Create a connector shape "draw:connector".

    Args:
        name: Name of the graphical element.
        style: The style name for the connector.
        text_style: The text style name for the connector.
        draw_id: The unique ID for the drawing shape.
        layer: The drawing layer of the connector.
        connected_shapes: A tuple of (start_shape, end_shape)
            where each shape is a shape with a `draw_id`.
        glue_points: A tuple of (start_glue_point, end_glue_point)
            specifying the glue points for connection.
        p1: The (x1, y1) coordinates of the starting point.
        p2: The (x2, y2) coordinates of the ending point.
        draw_type: The line or series of lines that connect two glue
            points. Values are 'standard' (default), 'lines', 'line'
            or 'curve'.
        line_skew: A list of offsets for the placements of connector
            lines if the connector is of type standard.
        svg_d: A path data.
        view_box: The rectangle in a local coordinates system used by the
            points.
        presentation_class: White-space-separated list of presentation
            class names.
        presentation_style: Style for a presentation shape.
        caption_id: Target ID assigned to the "draw:text-box" that
            contains the caption.
        class_names: White-space-separated list of styles with the
            family value of graphic.
        transform: White-space or comma separated list of transform
            definitions.
        z_index: Rendering order for shapes in a document instance.
        end_cell_address: End position of the shape if it is included
            in a spreadsheet document.
        end_x: The x-coordinate of the end position of a shape relative
            to the top-left edge of a cell.
        end_y: The y-coordinate of the end position of a shape relative
            to the top-left edge of a cell.
        table_background: Wether the shape is in the table background if
            the drawing shape is included in a spreadsheet.
        anchor_type: How a drawing shape is bound to a text document.
        anchor_page: Physical page number of an anchor if the drawing
            object is bound to a page within a text document.
        xml_id: The unique XML ID.
    """
    kwargs.update(
        {
            "name": name,
            "style": style,
            "text_style": text_style,
            "draw_id": draw_id,
            "layer": layer,
            "presentation_class": presentation_class,
            "presentation_style": presentation_style,
            "caption_id": caption_id,
            "class_names": class_names,
            "transform": transform,
            "z_index": z_index,
            "end_cell_address": end_cell_address,
            "end_x": end_x,
            "end_y": end_y,
            "table_background": table_background,
            "anchor_type": anchor_type,
            "anchor_page": anchor_page,
            "xml_id": xml_id,
        }
    )
    super().__init__(**kwargs)
    if self._do_init:
        if connected_shapes:
            self.connected_shapes = connected_shapes
        if glue_points:
            self.glue_points = glue_points
        self.p1 = p1
        self.p2 = p2
        if draw_type:
            self.draw_type = draw_type
        if line_skew:
            self.line_skew = line_skew
        if svg_d:
            self.svg_d = svg_d
        if view_box:
            self.view_box = view_box

DrawCaption

Bases: PosMix, SizeMix, ShapeBase

Represents a description attached to a fixed point, “draw:caption”.

It consists of rectangular drawing shape with an additional set of connected lines that connect the rectangle with the fixed point.

Methods:

Name Description
__init__

Create a draw caption “draw:caption”.

Attributes:

Name Type Description
caption_point tuple[str | None, str | None]

Get or set the (caption_point_x, caption_point_y) coordinates of the

corner_radius
position
size
Source code in odfdo/shapes.py
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
class DrawCaption(PosMix, SizeMix, ShapeBase):
    """Represents a description attached to a fixed point, "draw:caption".

    It consists of rectangular drawing shape with an additional set of
    connected lines that connect the rectangle with the fixed point.
    """

    _tag = "draw:caption"
    _properties: tuple[PropDef | PropDefBool, ...] = (
        PropDef("caption_point_x", "draw:caption-point-x"),
        PropDef("caption_point_y", "draw:caption-point-y"),
        PropDef("corner_radius", "draw:corner-radius"),
    )

    def __init__(
        self,
        name: str | None = None,
        style: str | None = None,
        text_style: str | None = None,
        draw_id: str | None = None,
        layer: str | None = None,
        caption_point: tuple[str, str] | list[str] | None = None,
        position: tuple[str, str] | list[str] | None = None,
        size: tuple[str, str] | list[str] | None = None,
        corner_radius: str | None = None,
        presentation_class: str | None = None,
        presentation_style: str | None = None,
        caption_id: str | None = None,
        class_names: str | None = None,
        transform: str | None = None,
        z_index: int | None = None,
        end_cell_address: str | None = None,
        end_x: str | None = None,
        end_y: str | None = None,
        table_background: bool | None = None,
        anchor_type: str | None = None,
        anchor_page: int | None = None,
        xml_id: str | None = None,
        **kwargs: Any,
    ) -> None:
        """Create a draw caption "draw:caption".

        Args:
            name: Name of the graphical element.
            style: The style name for the path.
            text_style: The text style name for the path.
            draw_id: The unique ID for the drawing shape.
            layer: The drawing layer of the path.
            caption_point: The position of a point that is captioned. A set
                of lines is rendered to that point from the caption area.
            position: The (x, y) coordinates for the path's position.
            size: The (width, height) values for the path's size.
            corner_radius: radius of the circle used to round off the corners.
            presentation_class: White-space-separated list of presentation
                class names.
            presentation_style: Style for a presentation shape.
            caption_id: Target ID assigned to the "draw:text-box" that
                contains the caption.
            class_names: White-space-separated list of styles with the
                family value of graphic.
            transform: White-space or comma separated list of transform
                definitions.
            z_index: Rendering order for shapes in a document instance.
            end_cell_address: End position of the shape if it is included
                in a spreadsheet document.
            end_x: The x-coordinate of the end position of a shape relative
                to the top-left edge of a cell.
            end_y: The y-coordinate of the end position of a shape relative
                to the top-left edge of a cell.
            table_background: Wether the shape is in the table background if
                the drawing shape is included in a spreadsheet.
            anchor_type: How a drawing shape is bound to a text document.
            anchor_page: Physical page number of an anchor if the drawing
                object is bound to a page within a text document.
            xml_id: The unique XML ID.
        """
        kwargs.update(
            {
                "name": name,
                "style": style,
                "text_style": text_style,
                "draw_id": draw_id,
                "layer": layer,
                "presentation_class": presentation_class,
                "presentation_style": presentation_style,
                "caption_id": caption_id,
                "class_names": class_names,
                "transform": transform,
                "z_index": z_index,
                "end_cell_address": end_cell_address,
                "end_x": end_x,
                "end_y": end_y,
                "table_background": table_background,
                "anchor_type": anchor_type,
                "anchor_page": anchor_page,
                "xml_id": xml_id,
            }
        )
        super().__init__(**kwargs)
        if self._do_init:
            if position:
                self.position = position
            if size:
                self.size = size
            if corner_radius:
                self.corner_radius = corner_radius
            if caption_point:
                self.caption_point = caption_point

    @property
    def caption_point(self) -> tuple[str | None, str | None]:
        """Get or set the (caption_point_x, caption_point_y) coordinates of the
        caption point."""
        return (self.caption_point_x, self.caption_point_y)

    @caption_point.setter
    def caption_point(self, caption_point: tuple[str, str] | list[str] | None) -> None:
        if caption_point is None:
            self.caption_point_x = None
            self.caption_point_y = None
        else:
            self.caption_point_x = caption_point[0]
            self.caption_point_y = caption_point[1]

_properties class-attribute instance-attribute

_properties: tuple[PropDef | PropDefBool, ...] = (
    PropDef("caption_point_x", "draw:caption-point-x"),
    PropDef("caption_point_y", "draw:caption-point-y"),
    PropDef("corner_radius", "draw:corner-radius"),
)

_tag class-attribute instance-attribute

_tag = 'draw:caption'

caption_point property writable

caption_point: tuple[str | None, str | None]

Get or set the (caption_point_x, caption_point_y) coordinates of the caption point.

corner_radius instance-attribute

corner_radius = corner_radius

position instance-attribute

position = position

size instance-attribute

size = size

__init__

__init__(
    name: str | None = None,
    style: str | None = None,
    text_style: str | None = None,
    draw_id: str | None = None,
    layer: str | None = None,
    caption_point: tuple[str, str]
    | list[str]
    | None = None,
    position: tuple[str, str] | list[str] | None = None,
    size: tuple[str, str] | list[str] | None = None,
    corner_radius: str | None = None,
    presentation_class: str | None = None,
    presentation_style: str | None = None,
    caption_id: str | None = None,
    class_names: str | None = None,
    transform: str | None = None,
    z_index: int | None = None,
    end_cell_address: str | None = None,
    end_x: str | None = None,
    end_y: str | None = None,
    table_background: bool | None = None,
    anchor_type: str | None = None,
    anchor_page: int | None = None,
    xml_id: str | None = None,
    **kwargs: Any,
) -> None

Create a draw caption “draw:caption”.

Parameters:

Name Type Description Default
name str | None

Name of the graphical element.

None
style str | None

The style name for the path.

None
text_style str | None

The text style name for the path.

None
draw_id str | None

The unique ID for the drawing shape.

None
layer str | None

The drawing layer of the path.

None
caption_point tuple[str, str] | list[str] | None

The position of a point that is captioned. A set of lines is rendered to that point from the caption area.

None
position tuple[str, str] | list[str] | None

The (x, y) coordinates for the path’s position.

None
size tuple[str, str] | list[str] | None

The (width, height) values for the path’s size.

None
corner_radius str | None

radius of the circle used to round off the corners.

None
presentation_class str | None

White-space-separated list of presentation class names.

None
presentation_style str | None

Style for a presentation shape.

None
caption_id str | None

Target ID assigned to the “draw:text-box” that contains the caption.

None
class_names str | None

White-space-separated list of styles with the family value of graphic.

None
transform str | None

White-space or comma separated list of transform definitions.

None
z_index int | None

Rendering order for shapes in a document instance.

None
end_cell_address str | None

End position of the shape if it is included in a spreadsheet document.

None
end_x str | None

The x-coordinate of the end position of a shape relative to the top-left edge of a cell.

None
end_y str | None

The y-coordinate of the end position of a shape relative to the top-left edge of a cell.

None
table_background bool | None

Wether the shape is in the table background if the drawing shape is included in a spreadsheet.

None
anchor_type str | None

How a drawing shape is bound to a text document.

None
anchor_page int | None

Physical page number of an anchor if the drawing object is bound to a page within a text document.

None
xml_id str | None

The unique XML ID.

None
Source code in odfdo/shapes.py
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
def __init__(
    self,
    name: str | None = None,
    style: str | None = None,
    text_style: str | None = None,
    draw_id: str | None = None,
    layer: str | None = None,
    caption_point: tuple[str, str] | list[str] | None = None,
    position: tuple[str, str] | list[str] | None = None,
    size: tuple[str, str] | list[str] | None = None,
    corner_radius: str | None = None,
    presentation_class: str | None = None,
    presentation_style: str | None = None,
    caption_id: str | None = None,
    class_names: str | None = None,
    transform: str | None = None,
    z_index: int | None = None,
    end_cell_address: str | None = None,
    end_x: str | None = None,
    end_y: str | None = None,
    table_background: bool | None = None,
    anchor_type: str | None = None,
    anchor_page: int | None = None,
    xml_id: str | None = None,
    **kwargs: Any,
) -> None:
    """Create a draw caption "draw:caption".

    Args:
        name: Name of the graphical element.
        style: The style name for the path.
        text_style: The text style name for the path.
        draw_id: The unique ID for the drawing shape.
        layer: The drawing layer of the path.
        caption_point: The position of a point that is captioned. A set
            of lines is rendered to that point from the caption area.
        position: The (x, y) coordinates for the path's position.
        size: The (width, height) values for the path's size.
        corner_radius: radius of the circle used to round off the corners.
        presentation_class: White-space-separated list of presentation
            class names.
        presentation_style: Style for a presentation shape.
        caption_id: Target ID assigned to the "draw:text-box" that
            contains the caption.
        class_names: White-space-separated list of styles with the
            family value of graphic.
        transform: White-space or comma separated list of transform
            definitions.
        z_index: Rendering order for shapes in a document instance.
        end_cell_address: End position of the shape if it is included
            in a spreadsheet document.
        end_x: The x-coordinate of the end position of a shape relative
            to the top-left edge of a cell.
        end_y: The y-coordinate of the end position of a shape relative
            to the top-left edge of a cell.
        table_background: Wether the shape is in the table background if
            the drawing shape is included in a spreadsheet.
        anchor_type: How a drawing shape is bound to a text document.
        anchor_page: Physical page number of an anchor if the drawing
            object is bound to a page within a text document.
        xml_id: The unique XML ID.
    """
    kwargs.update(
        {
            "name": name,
            "style": style,
            "text_style": text_style,
            "draw_id": draw_id,
            "layer": layer,
            "presentation_class": presentation_class,
            "presentation_style": presentation_style,
            "caption_id": caption_id,
            "class_names": class_names,
            "transform": transform,
            "z_index": z_index,
            "end_cell_address": end_cell_address,
            "end_x": end_x,
            "end_y": end_y,
            "table_background": table_background,
            "anchor_type": anchor_type,
            "anchor_page": anchor_page,
            "xml_id": xml_id,
        }
    )
    super().__init__(**kwargs)
    if self._do_init:
        if position:
            self.position = position
        if size:
            self.size = size
        if corner_radius:
            self.corner_radius = corner_radius
        if caption_point:
            self.caption_point = caption_point

DrawControl

Bases: PosMix, SizeMix, ShapeBase

Represents a shape that is linked to a control inside an “office:forms” element, “draw:control”.

Methods:

Name Description
__init__

Create a control shape “draw:control”.

Attributes:

Name Type Description
control
position
size
Source code in odfdo/shapes.py
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
class DrawControl(PosMix, SizeMix, ShapeBase):
    """Represents a shape that is linked to a control inside an
    "office:forms" element, "draw:control".
    """

    _tag = "draw:control"
    _properties: tuple[PropDef | PropDefBool, ...] = (
        PropDef("control", "draw:control"),
    )

    def __init__(
        self,
        name: str | None = None,
        style: str | None = None,
        text_style: str | None = None,
        draw_id: str | None = None,
        layer: str | None = None,
        control: str | None = None,
        position: tuple[str, str] | list[str] | None = None,
        size: tuple[str, str] | list[str] | None = None,
        presentation_class: str | None = None,
        presentation_style: str | None = None,
        caption_id: str | None = None,
        class_names: str | None = None,
        transform: str | None = None,
        z_index: int | None = None,
        end_cell_address: str | None = None,
        end_x: str | None = None,
        end_y: str | None = None,
        table_background: bool | None = None,
        anchor_type: str | None = None,
        anchor_page: int | None = None,
        xml_id: str | None = None,
        **kwargs: Any,
    ) -> None:
        """Create a control shape "draw:control".

        Args:
            name: Name of the graphical element.
            style: The style name for the control.
            text_style: The text style name for the control.
            draw_id: The unique ID for the drawing shape.
            layer: The drawing layer of the control.
            control: A control within a form that is linked to the control
                shape by its ID.
            position: The (x, y) coordinates for the control's position.
            size: The (width, height) values for the control's size.
            presentation_class: White-space-separated list of presentation
                class names.
            presentation_style: Style for a presentation shape.
            caption_id: Target ID assigned to the "draw:text-box" that
                contains the caption.
            class_names: White-space-separated list of styles with the
                family value of graphic.
            transform: White-space or comma separated list of transform
                definitions.
            z_index: Rendering order for shapes in a document instance.
            end_cell_address: End position of the shape if it is included
                in a spreadsheet document.
            end_x: The x-coordinate of the end position of a shape relative
                to the top-left edge of a cell.
            end_y: The y-coordinate of the end position of a shape relative
                to the top-left edge of a cell.
            table_background: Wether the shape is in the table background if
                the drawing shape is included in a spreadsheet.
            anchor_type: How a drawing shape is bound to a text document.
            anchor_page: Physical page number of an anchor if the drawing
                object is bound to a page within a text document.
            xml_id: The unique XML ID.
        """
        kwargs.update(
            {
                "name": name,
                "style": style,
                "text_style": text_style,
                "draw_id": draw_id,
                "layer": layer,
                "presentation_class": presentation_class,
                "presentation_style": presentation_style,
                "caption_id": caption_id,
                "class_names": class_names,
                "transform": transform,
                "z_index": z_index,
                "end_cell_address": end_cell_address,
                "end_x": end_x,
                "end_y": end_y,
                "table_background": table_background,
                "anchor_type": anchor_type,
                "anchor_page": anchor_page,
                "xml_id": xml_id,
            }
        )
        super().__init__(**kwargs)
        if self._do_init:
            if control:
                self.control = control
            if position:
                self.position = position
            if size:
                self.size = size

_properties class-attribute instance-attribute

_properties: tuple[PropDef | PropDefBool, ...] = (
    PropDef("control", "draw:control"),
)

_tag class-attribute instance-attribute

_tag = 'draw:control'

control instance-attribute

control = control

position instance-attribute

position = position

size instance-attribute

size = size

__init__

__init__(
    name: str | None = None,
    style: str | None = None,
    text_style: str | None = None,
    draw_id: str | None = None,
    layer: str | None = None,
    control: str | None = None,
    position: tuple[str, str] | list[str] | None = None,
    size: tuple[str, str] | list[str] | None = None,
    presentation_class: str | None = None,
    presentation_style: str | None = None,
    caption_id: str | None = None,
    class_names: str | None = None,
    transform: str | None = None,
    z_index: int | None = None,
    end_cell_address: str | None = None,
    end_x: str | None = None,
    end_y: str | None = None,
    table_background: bool | None = None,
    anchor_type: str | None = None,
    anchor_page: int | None = None,
    xml_id: str | None = None,
    **kwargs: Any,
) -> None

Create a control shape “draw:control”.

Parameters:

Name Type Description Default
name str | None

Name of the graphical element.

None
style str | None

The style name for the control.

None
text_style str | None

The text style name for the control.

None
draw_id str | None

The unique ID for the drawing shape.

None
layer str | None

The drawing layer of the control.

None
control str | None

A control within a form that is linked to the control shape by its ID.

None
position tuple[str, str] | list[str] | None

The (x, y) coordinates for the control’s position.

None
size tuple[str, str] | list[str] | None

The (width, height) values for the control’s size.

None
presentation_class str | None

White-space-separated list of presentation class names.

None
presentation_style str | None

Style for a presentation shape.

None
caption_id str | None

Target ID assigned to the “draw:text-box” that contains the caption.

None
class_names str | None

White-space-separated list of styles with the family value of graphic.

None
transform str | None

White-space or comma separated list of transform definitions.

None
z_index int | None

Rendering order for shapes in a document instance.

None
end_cell_address str | None

End position of the shape if it is included in a spreadsheet document.

None
end_x str | None

The x-coordinate of the end position of a shape relative to the top-left edge of a cell.

None
end_y str | None

The y-coordinate of the end position of a shape relative to the top-left edge of a cell.

None
table_background bool | None

Wether the shape is in the table background if the drawing shape is included in a spreadsheet.

None
anchor_type str | None

How a drawing shape is bound to a text document.

None
anchor_page int | None

Physical page number of an anchor if the drawing object is bound to a page within a text document.

None
xml_id str | None

The unique XML ID.

None
Source code in odfdo/shapes.py
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
def __init__(
    self,
    name: str | None = None,
    style: str | None = None,
    text_style: str | None = None,
    draw_id: str | None = None,
    layer: str | None = None,
    control: str | None = None,
    position: tuple[str, str] | list[str] | None = None,
    size: tuple[str, str] | list[str] | None = None,
    presentation_class: str | None = None,
    presentation_style: str | None = None,
    caption_id: str | None = None,
    class_names: str | None = None,
    transform: str | None = None,
    z_index: int | None = None,
    end_cell_address: str | None = None,
    end_x: str | None = None,
    end_y: str | None = None,
    table_background: bool | None = None,
    anchor_type: str | None = None,
    anchor_page: int | None = None,
    xml_id: str | None = None,
    **kwargs: Any,
) -> None:
    """Create a control shape "draw:control".

    Args:
        name: Name of the graphical element.
        style: The style name for the control.
        text_style: The text style name for the control.
        draw_id: The unique ID for the drawing shape.
        layer: The drawing layer of the control.
        control: A control within a form that is linked to the control
            shape by its ID.
        position: The (x, y) coordinates for the control's position.
        size: The (width, height) values for the control's size.
        presentation_class: White-space-separated list of presentation
            class names.
        presentation_style: Style for a presentation shape.
        caption_id: Target ID assigned to the "draw:text-box" that
            contains the caption.
        class_names: White-space-separated list of styles with the
            family value of graphic.
        transform: White-space or comma separated list of transform
            definitions.
        z_index: Rendering order for shapes in a document instance.
        end_cell_address: End position of the shape if it is included
            in a spreadsheet document.
        end_x: The x-coordinate of the end position of a shape relative
            to the top-left edge of a cell.
        end_y: The y-coordinate of the end position of a shape relative
            to the top-left edge of a cell.
        table_background: Wether the shape is in the table background if
            the drawing shape is included in a spreadsheet.
        anchor_type: How a drawing shape is bound to a text document.
        anchor_page: Physical page number of an anchor if the drawing
            object is bound to a page within a text document.
        xml_id: The unique XML ID.
    """
    kwargs.update(
        {
            "name": name,
            "style": style,
            "text_style": text_style,
            "draw_id": draw_id,
            "layer": layer,
            "presentation_class": presentation_class,
            "presentation_style": presentation_style,
            "caption_id": caption_id,
            "class_names": class_names,
            "transform": transform,
            "z_index": z_index,
            "end_cell_address": end_cell_address,
            "end_x": end_x,
            "end_y": end_y,
            "table_background": table_background,
            "anchor_type": anchor_type,
            "anchor_page": anchor_page,
            "xml_id": xml_id,
        }
    )
    super().__init__(**kwargs)
    if self._do_init:
        if control:
            self.control = control
        if position:
            self.position = position
        if size:
            self.size = size

DrawGroup

Bases: SvgMixin, AnchorMix, ZMix, Element

Representation of a group of drawing shapes, “draw:g”.

Warning: implementation is currently minimal.

Drawing shapes contained by a “draw:g” element that is itself contained by a “draw:a” element, act as hyperlinks using the xlink:href attribute of the containing “draw:a” element. If the included drawing shapes are themselves contained within “draw:a” elements, then the xlink:href attributes of those “draw:a” elements act as the hyperlink information for the shapes they contain.

Methods:

Name Description
__init__

Create a group of drawing shapes “draw:g”.

get_formatted_text

Return the formatted text content of the shape.

Attributes:

Name Type Description
anchor_page
anchor_type
caption_id
class_names
draw_id
end_cell_address
end_x
end_y
name
presentation_class
presentation_style
style
svg_y
table_background
xml_id
z_index
Source code in odfdo/shapes.py
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
class DrawGroup(SvgMixin, AnchorMix, ZMix, Element):
    """Representation of a group of drawing shapes, "draw:g".

    Warning: implementation is currently minimal.

    Drawing shapes contained by a "draw:g" element that is itself
    contained by a "draw:a" element, act as hyperlinks using the
    xlink:href attribute of the containing "draw:a" element. If the
    included drawing shapes are themselves contained within "draw:a"
    elements, then the xlink:href attributes of those "draw:a" elements
    act as the hyperlink information for the shapes they contain.
    """

    _tag = "draw:g"
    _properties: tuple[PropDef | PropDefBool, ...] = (
        PropDef("name", "draw:name"),
        PropDef("style", "draw:style-name"),
        PropDef("draw_id", "draw:id"),
        PropDef("svg_y", "svg:y"),
        PropDef("presentation_class", "presentation:class-names"),
        PropDef("presentation_style", "presentation:style-name"),
        PropDef("caption_id", "draw:caption-id"),
        PropDef("class_names", "draw:class-names"),
        PropDef("end_cell_address", "table:end-cell-address"),
        PropDef("end_x", "table:end-x"),
        PropDef("end_y", "table:end-y"),
        PropDefBool("table_background", "table:table-background", False),
        PropDef("xml_id", "xml:id"),
    )

    def __init__(
        self,
        name: str | None = None,
        style: str | None = None,
        draw_id: str | None = None,
        svg_y: str | None = None,
        presentation_class: str | None = None,
        presentation_style: str | None = None,
        caption_id: str | None = None,
        class_names: str | None = None,
        z_index: int | None = None,
        end_cell_address: str | None = None,
        end_x: str | None = None,
        end_y: str | None = None,
        table_background: bool | None = None,
        anchor_type: str | None = None,
        anchor_page: int | None = None,
        xml_id: str | None = None,
        **kwargs: Any,
    ) -> None:
        """Create a group of drawing shapes "draw:g".

        Args:
            name: Name of the group.
            style: The style name for the group.
            draw_id: The unique ID for the drawing group.
            svg_y: Position on the y-axis of the group.
            presentation_class: White-space-separated list of presentation
                class names.
            presentation_style: Style for a presentation shape.
            caption_id: Target ID assigned to the "draw:text-box" that
                contains the caption.
            class_names: White-space-separated list of styles with the
                family value of graphic.
            z_index: Rendering order for shapes in a document instance.
            end_cell_address: End position of the shape if it is included
                in a spreadsheet document.
            end_x: The x-coordinate of the end position of a shape relative
                to the top-left edge of a cell.
            end_y: The y-coordinate of the end position of a shape relative
                to the top-left edge of a cell.
            table_background: Wether the shape is in the table background if
                the drawing shape is included in a spreadsheet.
            anchor_type: How a drawing shape is bound to a text document.
            anchor_page: Physical page number of an anchor if the drawing
                object is bound to a page within a text document.
            xml_id: The unique XML ID.
        """
        super().__init__(**kwargs)
        if self._do_init:
            if name:
                self.name = name
            if style:
                self.style = style
            if draw_id:
                self.draw_id = draw_id
            if svg_y:
                self.svg_y = svg_y
            if presentation_class:
                self.presentation_class = presentation_class
            if presentation_style:
                self.presentation_style = presentation_style
            if caption_id:
                self.caption_id = caption_id
            if class_names:
                self.class_names = class_names
            if z_index is not None:
                self.z_index = z_index
            if end_cell_address:
                self.end_cell_address = end_cell_address
            if end_x:
                self.end_x = end_x
            if end_y:
                self.end_y = end_y
            if table_background is not None:
                self.table_background = table_background
            if anchor_type:
                self.anchor_type = anchor_type
            if anchor_page is not None:
                self.anchor_page = anchor_page
            if xml_id:
                self.xml_id = xml_id

    def get_formatted_text(self, context: dict | None = None) -> str:
        """Return the formatted text content of the shape.

        Args:
            context: A dictionary of context variables.

        Returns:
            str: The formatted text content.
        """
        result: list[str] = []
        for child in self.children:
            result.append(child.get_formatted_text(context))
        result.append("\n")
        return "".join(result)

_properties class-attribute instance-attribute

_properties: tuple[PropDef | PropDefBool, ...] = (
    PropDef("name", "draw:name"),
    PropDef("style", "draw:style-name"),
    PropDef("draw_id", "draw:id"),
    PropDef("svg_y", "svg:y"),
    PropDef(
        "presentation_class", "presentation:class-names"
    ),
    PropDef(
        "presentation_style", "presentation:style-name"
    ),
    PropDef("caption_id", "draw:caption-id"),
    PropDef("class_names", "draw:class-names"),
    PropDef("end_cell_address", "table:end-cell-address"),
    PropDef("end_x", "table:end-x"),
    PropDef("end_y", "table:end-y"),
    PropDefBool(
        "table_background", "table:table-background", False
    ),
    PropDef("xml_id", "xml:id"),
)

_tag class-attribute instance-attribute

_tag = 'draw:g'

anchor_page instance-attribute

anchor_page = anchor_page

anchor_type instance-attribute

anchor_type = anchor_type

caption_id instance-attribute

caption_id = caption_id

class_names instance-attribute

class_names = class_names

draw_id instance-attribute

draw_id = draw_id

end_cell_address instance-attribute

end_cell_address = end_cell_address

end_x instance-attribute

end_x = end_x

end_y instance-attribute

end_y = end_y

name instance-attribute

name = name

presentation_class instance-attribute

presentation_class = presentation_class

presentation_style instance-attribute

presentation_style = presentation_style

style instance-attribute

style = style

svg_y instance-attribute

svg_y = svg_y

table_background instance-attribute

table_background = table_background

xml_id instance-attribute

xml_id = xml_id

z_index instance-attribute

z_index = z_index

__init__

__init__(
    name: str | None = None,
    style: str | None = None,
    draw_id: str | None = None,
    svg_y: str | None = None,
    presentation_class: str | None = None,
    presentation_style: str | None = None,
    caption_id: str | None = None,
    class_names: str | None = None,
    z_index: int | None = None,
    end_cell_address: str | None = None,
    end_x: str | None = None,
    end_y: str | None = None,
    table_background: bool | None = None,
    anchor_type: str | None = None,
    anchor_page: int | None = None,
    xml_id: str | None = None,
    **kwargs: Any,
) -> None

Create a group of drawing shapes “draw:g”.

Parameters:

Name Type Description Default
name str | None

Name of the group.

None
style str | None

The style name for the group.

None
draw_id str | None

The unique ID for the drawing group.

None
svg_y str | None

Position on the y-axis of the group.

None
presentation_class str | None

White-space-separated list of presentation class names.

None
presentation_style str | None

Style for a presentation shape.

None
caption_id str | None

Target ID assigned to the “draw:text-box” that contains the caption.

None
class_names str | None

White-space-separated list of styles with the family value of graphic.

None
z_index int | None

Rendering order for shapes in a document instance.

None
end_cell_address str | None

End position of the shape if it is included in a spreadsheet document.

None
end_x str | None

The x-coordinate of the end position of a shape relative to the top-left edge of a cell.

None
end_y str | None

The y-coordinate of the end position of a shape relative to the top-left edge of a cell.

None
table_background bool | None

Wether the shape is in the table background if the drawing shape is included in a spreadsheet.

None
anchor_type str | None

How a drawing shape is bound to a text document.

None
anchor_page int | None

Physical page number of an anchor if the drawing object is bound to a page within a text document.

None
xml_id str | None

The unique XML ID.

None
Source code in odfdo/shapes.py
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
def __init__(
    self,
    name: str | None = None,
    style: str | None = None,
    draw_id: str | None = None,
    svg_y: str | None = None,
    presentation_class: str | None = None,
    presentation_style: str | None = None,
    caption_id: str | None = None,
    class_names: str | None = None,
    z_index: int | None = None,
    end_cell_address: str | None = None,
    end_x: str | None = None,
    end_y: str | None = None,
    table_background: bool | None = None,
    anchor_type: str | None = None,
    anchor_page: int | None = None,
    xml_id: str | None = None,
    **kwargs: Any,
) -> None:
    """Create a group of drawing shapes "draw:g".

    Args:
        name: Name of the group.
        style: The style name for the group.
        draw_id: The unique ID for the drawing group.
        svg_y: Position on the y-axis of the group.
        presentation_class: White-space-separated list of presentation
            class names.
        presentation_style: Style for a presentation shape.
        caption_id: Target ID assigned to the "draw:text-box" that
            contains the caption.
        class_names: White-space-separated list of styles with the
            family value of graphic.
        z_index: Rendering order for shapes in a document instance.
        end_cell_address: End position of the shape if it is included
            in a spreadsheet document.
        end_x: The x-coordinate of the end position of a shape relative
            to the top-left edge of a cell.
        end_y: The y-coordinate of the end position of a shape relative
            to the top-left edge of a cell.
        table_background: Wether the shape is in the table background if
            the drawing shape is included in a spreadsheet.
        anchor_type: How a drawing shape is bound to a text document.
        anchor_page: Physical page number of an anchor if the drawing
            object is bound to a page within a text document.
        xml_id: The unique XML ID.
    """
    super().__init__(**kwargs)
    if self._do_init:
        if name:
            self.name = name
        if style:
            self.style = style
        if draw_id:
            self.draw_id = draw_id
        if svg_y:
            self.svg_y = svg_y
        if presentation_class:
            self.presentation_class = presentation_class
        if presentation_style:
            self.presentation_style = presentation_style
        if caption_id:
            self.caption_id = caption_id
        if class_names:
            self.class_names = class_names
        if z_index is not None:
            self.z_index = z_index
        if end_cell_address:
            self.end_cell_address = end_cell_address
        if end_x:
            self.end_x = end_x
        if end_y:
            self.end_y = end_y
        if table_background is not None:
            self.table_background = table_background
        if anchor_type:
            self.anchor_type = anchor_type
        if anchor_page is not None:
            self.anchor_page = anchor_page
        if xml_id:
            self.xml_id = xml_id

get_formatted_text

get_formatted_text(context: dict | None = None) -> str

Return the formatted text content of the shape.

Parameters:

Name Type Description Default
context dict | None

A dictionary of context variables.

None

Returns:

Name Type Description
str str

The formatted text content.

Source code in odfdo/shapes.py
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
def get_formatted_text(self, context: dict | None = None) -> str:
    """Return the formatted text content of the shape.

    Args:
        context: A dictionary of context variables.

    Returns:
        str: The formatted text content.
    """
    result: list[str] = []
    for child in self.children:
        result.append(child.get_formatted_text(context))
    result.append("\n")
    return "".join(result)

DrawMeasure

Bases: LineShape

Represents a shape that is used to measure distances in drawings, “draw:measure”.

Methods:

Name Description
__init__

Create a line shape “draw:line”.

Source code in odfdo/shapes.py
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
class DrawMeasure(LineShape):
    """Represents a shape that is used to measure distances in drawings,
    "draw:measure".
    """

    _tag = "draw:measure"

    def __init__(
        self,
        name: str | None = None,
        style: str | None = None,
        text_style: str | None = None,
        draw_id: str | None = None,
        layer: str | None = None,
        p1: tuple[str, str] | list[str] | None = None,
        p2: tuple[str, str] | list[str] | None = None,
        presentation_class: str | None = None,
        presentation_style: str | None = None,
        caption_id: str | None = None,
        class_names: str | None = None,
        transform: str | None = None,
        z_index: int | None = None,
        end_cell_address: str | None = None,
        end_x: str | None = None,
        end_y: str | None = None,
        table_background: bool | None = None,
        anchor_type: str | None = None,
        anchor_page: int | None = None,
        xml_id: str | None = None,
        **kwargs: Any,
    ) -> None:
        """Create a line shape "draw:line".

        Args:
            name: Name of the graphical element.
            style: The style name for the measure.
            text_style: The text style name for the measure.
            draw_id: The unique ID for the drawing shape.
            layer: The drawing layer of the measure.
            p1: The (x1, y1) coordinates of the starting point.
            p2: The (x2, y2) coordinates of the ending point.
            presentation_class: White-space-separated list of presentation
                class names.
            presentation_style: Style for a presentation shape.
            caption_id: Target ID assigned to the "draw:text-box" that
                contains the caption.
            class_names: White-space-separated list of styles with the
                family value of graphic.
            transform: White-space or comma separated list of transform
                definitions.
            z_index: Rendering order for shapes in a document instance.
            end_cell_address: End position of the shape if it is included
                in a spreadsheet document.
            end_x: The x-coordinate of the end position of a shape relative
                to the top-left edge of a cell.
            end_y: The y-coordinate of the end position of a shape relative
                to the top-left edge of a cell.
            table_background: Wether the shape is in the table background if
                the drawing shape is included in a spreadsheet.
            anchor_type: How a drawing shape is bound to a text document.
            anchor_page: Physical page number of an anchor if the drawing
                object is bound to a page within a text document.
            xml_id: The unique XML ID.
        """
        kwargs.update(
            {
                "name": name,
                "style": style,
                "text_style": text_style,
                "draw_id": draw_id,
                "layer": layer,
                "p1": p1,
                "p2": p2,
                "presentation_class": presentation_class,
                "presentation_style": presentation_style,
                "caption_id": caption_id,
                "class_names": class_names,
                "transform": transform,
                "z_index": z_index,
                "end_cell_address": end_cell_address,
                "end_x": end_x,
                "end_y": end_y,
                "table_background": table_background,
                "anchor_type": anchor_type,
                "anchor_page": anchor_page,
                "xml_id": xml_id,
            }
        )
        super().__init__(**kwargs)

_tag class-attribute instance-attribute

_tag = 'draw:measure'

__init__

__init__(
    name: str | None = None,
    style: str | None = None,
    text_style: str | None = None,
    draw_id: str | None = None,
    layer: str | None = None,
    p1: tuple[str, str] | list[str] | None = None,
    p2: tuple[str, str] | list[str] | None = None,
    presentation_class: str | None = None,
    presentation_style: str | None = None,
    caption_id: str | None = None,
    class_names: str | None = None,
    transform: str | None = None,
    z_index: int | None = None,
    end_cell_address: str | None = None,
    end_x: str | None = None,
    end_y: str | None = None,
    table_background: bool | None = None,
    anchor_type: str | None = None,
    anchor_page: int | None = None,
    xml_id: str | None = None,
    **kwargs: Any,
) -> None

Create a line shape “draw:line”.

Parameters:

Name Type Description Default
name str | None

Name of the graphical element.

None
style str | None

The style name for the measure.

None
text_style str | None

The text style name for the measure.

None
draw_id str | None

The unique ID for the drawing shape.

None
layer str | None

The drawing layer of the measure.

None
p1 tuple[str, str] | list[str] | None

The (x1, y1) coordinates of the starting point.

None
p2 tuple[str, str] | list[str] | None

The (x2, y2) coordinates of the ending point.

None
presentation_class str | None

White-space-separated list of presentation class names.

None
presentation_style str | None

Style for a presentation shape.

None
caption_id str | None

Target ID assigned to the “draw:text-box” that contains the caption.

None
class_names str | None

White-space-separated list of styles with the family value of graphic.

None
transform str | None

White-space or comma separated list of transform definitions.

None
z_index int | None

Rendering order for shapes in a document instance.

None
end_cell_address str | None

End position of the shape if it is included in a spreadsheet document.

None
end_x str | None

The x-coordinate of the end position of a shape relative to the top-left edge of a cell.

None
end_y str | None

The y-coordinate of the end position of a shape relative to the top-left edge of a cell.

None
table_background bool | None

Wether the shape is in the table background if the drawing shape is included in a spreadsheet.

None
anchor_type str | None

How a drawing shape is bound to a text document.

None
anchor_page int | None

Physical page number of an anchor if the drawing object is bound to a page within a text document.

None
xml_id str | None

The unique XML ID.

None
Source code in odfdo/shapes.py
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
def __init__(
    self,
    name: str | None = None,
    style: str | None = None,
    text_style: str | None = None,
    draw_id: str | None = None,
    layer: str | None = None,
    p1: tuple[str, str] | list[str] | None = None,
    p2: tuple[str, str] | list[str] | None = None,
    presentation_class: str | None = None,
    presentation_style: str | None = None,
    caption_id: str | None = None,
    class_names: str | None = None,
    transform: str | None = None,
    z_index: int | None = None,
    end_cell_address: str | None = None,
    end_x: str | None = None,
    end_y: str | None = None,
    table_background: bool | None = None,
    anchor_type: str | None = None,
    anchor_page: int | None = None,
    xml_id: str | None = None,
    **kwargs: Any,
) -> None:
    """Create a line shape "draw:line".

    Args:
        name: Name of the graphical element.
        style: The style name for the measure.
        text_style: The text style name for the measure.
        draw_id: The unique ID for the drawing shape.
        layer: The drawing layer of the measure.
        p1: The (x1, y1) coordinates of the starting point.
        p2: The (x2, y2) coordinates of the ending point.
        presentation_class: White-space-separated list of presentation
            class names.
        presentation_style: Style for a presentation shape.
        caption_id: Target ID assigned to the "draw:text-box" that
            contains the caption.
        class_names: White-space-separated list of styles with the
            family value of graphic.
        transform: White-space or comma separated list of transform
            definitions.
        z_index: Rendering order for shapes in a document instance.
        end_cell_address: End position of the shape if it is included
            in a spreadsheet document.
        end_x: The x-coordinate of the end position of a shape relative
            to the top-left edge of a cell.
        end_y: The y-coordinate of the end position of a shape relative
            to the top-left edge of a cell.
        table_background: Wether the shape is in the table background if
            the drawing shape is included in a spreadsheet.
        anchor_type: How a drawing shape is bound to a text document.
        anchor_page: Physical page number of an anchor if the drawing
            object is bound to a page within a text document.
        xml_id: The unique XML ID.
    """
    kwargs.update(
        {
            "name": name,
            "style": style,
            "text_style": text_style,
            "draw_id": draw_id,
            "layer": layer,
            "p1": p1,
            "p2": p2,
            "presentation_class": presentation_class,
            "presentation_style": presentation_style,
            "caption_id": caption_id,
            "class_names": class_names,
            "transform": transform,
            "z_index": z_index,
            "end_cell_address": end_cell_address,
            "end_x": end_x,
            "end_y": end_y,
            "table_background": table_background,
            "anchor_type": anchor_type,
            "anchor_page": anchor_page,
            "xml_id": xml_id,
        }
    )
    super().__init__(**kwargs)

DrawPageThumbnail

Bases: PosMix, SizeMix, ShapeBase

Represents a rectangular area that displays the thumbnail of a drawing page, “draw:page-thumbnail”.

Methods:

Name Description
__init__

Create a control shape “draw:page-thumbnail”.

Attributes:

Name Type Description
page_number int | None

Get or set the number of a page that is displayed as a thumbnail.

placeholder
position
size
user_transformed
Source code in odfdo/shapes.py
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
class DrawPageThumbnail(PosMix, SizeMix, ShapeBase):
    """Represents a rectangular area that displays the thumbnail of a
    drawing page, "draw:page-thumbnail".
    """

    _tag = "draw:page-thumbnail"
    _properties: tuple[PropDef | PropDefBool, ...] = (
        PropDefBool("placeholder", "presentation:placeholder", False),
        PropDef("user_transformed", "presentation:user-transformed"),
    )

    def __init__(
        self,
        name: str | None = None,
        style: str | None = None,
        text_style: str | None = None,
        draw_id: str | None = None,
        layer: str | None = None,
        page_number: int | None = None,
        position: tuple[str, str] | list[str] | None = None,
        size: tuple[str, str] | list[str] | None = None,
        placeholder: bool | None = None,
        user_transformed: bool | None = None,
        presentation_class: str | None = None,
        presentation_style: str | None = None,
        caption_id: str | None = None,
        class_names: str | None = None,
        transform: str | None = None,
        z_index: int | None = None,
        end_cell_address: str | None = None,
        end_x: str | None = None,
        end_y: str | None = None,
        table_background: bool | None = None,
        anchor_type: str | None = None,
        anchor_page: int | None = None,
        xml_id: str | None = None,
        **kwargs: Any,
    ) -> None:
        """Create a control shape "draw:page-thumbnail".

        Args:
            name: Name of the graphical element.
            style: The style name for the control.
            text_style: The text style name for the control.
            draw_id: The unique ID for the drawing shape.
            layer: The drawing layer of the control.
            page_number: The number of a page that is displayed as a
                thumbnail.
            position: The (x, y) coordinates for the control's position.
            size: The (width, height) values for the control's size.
            placeholder: True if shape is a placeholder.
            user_transformed: Whether the size and position of the shape
                is set by the user or is set by the corresponding
                presentation shape on the master page.
            presentation_class: White-space-separated list of presentation
                class names.
            presentation_style: Style for a presentation shape.
            caption_id: Target ID assigned to the "draw:text-box" that
                contains the caption.
            class_names: White-space-separated list of styles with the
                family value of graphic.
            transform: White-space or comma separated list of transform
                definitions.
            z_index: Rendering order for shapes in a document instance.
            end_cell_address: End position of the shape if it is included
                in a spreadsheet document.
            end_x: The x-coordinate of the end position of a shape relative
                to the top-left edge of a cell.
            end_y: The y-coordinate of the end position of a shape relative
                to the top-left edge of a cell.
            table_background: Wether the shape is in the table background if
                the drawing shape is included in a spreadsheet.
            anchor_type: How a drawing shape is bound to a text document.
            anchor_page: Physical page number of an anchor if the drawing
                object is bound to a page within a text document.
            xml_id: The unique XML ID.
        """
        kwargs.update(
            {
                "name": name,
                "style": style,
                "text_style": text_style,
                "draw_id": draw_id,
                "layer": layer,
                "presentation_class": presentation_class,
                "presentation_style": presentation_style,
                "caption_id": caption_id,
                "class_names": class_names,
                "transform": transform,
                "z_index": z_index,
                "end_cell_address": end_cell_address,
                "end_x": end_x,
                "end_y": end_y,
                "table_background": table_background,
                "anchor_type": anchor_type,
                "anchor_page": anchor_page,
                "xml_id": xml_id,
            }
        )
        super().__init__(**kwargs)
        if self._do_init:
            if page_number:
                self.page_number = page_number
            if position:
                self.position = position
            if size:
                self.size = size
            if placeholder is not None:
                self.placeholder = placeholder
            if user_transformed is not None:
                self.user_transformed = user_transformed

    @property
    def page_number(self) -> int | None:
        """Get or set the number of a page that is displayed as a thumbnail.

        type : int or None
        """
        page_number = self.get_attribute("draw:page-number")
        if page_number is None:
            return None
        return int(page_number)

    @page_number.setter
    def page_number(self, page_number: int | None) -> None:
        self._set_attribute_int("draw:page-number", page_number)

_properties class-attribute instance-attribute

_properties: tuple[PropDef | PropDefBool, ...] = (
    PropDefBool(
        "placeholder", "presentation:placeholder", False
    ),
    PropDef(
        "user_transformed", "presentation:user-transformed"
    ),
)

_tag class-attribute instance-attribute

_tag = 'draw:page-thumbnail'

page_number property writable

page_number: int | None

Get or set the number of a page that is displayed as a thumbnail.

type : int or None

placeholder instance-attribute

placeholder = placeholder

position instance-attribute

position = position

size instance-attribute

size = size

user_transformed instance-attribute

user_transformed = user_transformed

__init__

__init__(
    name: str | None = None,
    style: str | None = None,
    text_style: str | None = None,
    draw_id: str | None = None,
    layer: str | None = None,
    page_number: int | None = None,
    position: tuple[str, str] | list[str] | None = None,
    size: tuple[str, str] | list[str] | None = None,
    placeholder: bool | None = None,
    user_transformed: bool | None = None,
    presentation_class: str | None = None,
    presentation_style: str | None = None,
    caption_id: str | None = None,
    class_names: str | None = None,
    transform: str | None = None,
    z_index: int | None = None,
    end_cell_address: str | None = None,
    end_x: str | None = None,
    end_y: str | None = None,
    table_background: bool | None = None,
    anchor_type: str | None = None,
    anchor_page: int | None = None,
    xml_id: str | None = None,
    **kwargs: Any,
) -> None

Create a control shape “draw:page-thumbnail”.

Parameters:

Name Type Description Default
name str | None

Name of the graphical element.

None
style str | None

The style name for the control.

None
text_style str | None

The text style name for the control.

None
draw_id str | None

The unique ID for the drawing shape.

None
layer str | None

The drawing layer of the control.

None
page_number int | None

The number of a page that is displayed as a thumbnail.

None
position tuple[str, str] | list[str] | None

The (x, y) coordinates for the control’s position.

None
size tuple[str, str] | list[str] | None

The (width, height) values for the control’s size.

None
placeholder bool | None

True if shape is a placeholder.

None
user_transformed bool | None

Whether the size and position of the shape is set by the user or is set by the corresponding presentation shape on the master page.

None
presentation_class str | None

White-space-separated list of presentation class names.

None
presentation_style str | None

Style for a presentation shape.

None
caption_id str | None

Target ID assigned to the “draw:text-box” that contains the caption.

None
class_names str | None

White-space-separated list of styles with the family value of graphic.

None
transform str | None

White-space or comma separated list of transform definitions.

None
z_index int | None

Rendering order for shapes in a document instance.

None
end_cell_address str | None

End position of the shape if it is included in a spreadsheet document.

None
end_x str | None

The x-coordinate of the end position of a shape relative to the top-left edge of a cell.

None
end_y str | None

The y-coordinate of the end position of a shape relative to the top-left edge of a cell.

None
table_background bool | None

Wether the shape is in the table background if the drawing shape is included in a spreadsheet.

None
anchor_type str | None

How a drawing shape is bound to a text document.

None
anchor_page int | None

Physical page number of an anchor if the drawing object is bound to a page within a text document.

None
xml_id str | None

The unique XML ID.

None
Source code in odfdo/shapes.py
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
def __init__(
    self,
    name: str | None = None,
    style: str | None = None,
    text_style: str | None = None,
    draw_id: str | None = None,
    layer: str | None = None,
    page_number: int | None = None,
    position: tuple[str, str] | list[str] | None = None,
    size: tuple[str, str] | list[str] | None = None,
    placeholder: bool | None = None,
    user_transformed: bool | None = None,
    presentation_class: str | None = None,
    presentation_style: str | None = None,
    caption_id: str | None = None,
    class_names: str | None = None,
    transform: str | None = None,
    z_index: int | None = None,
    end_cell_address: str | None = None,
    end_x: str | None = None,
    end_y: str | None = None,
    table_background: bool | None = None,
    anchor_type: str | None = None,
    anchor_page: int | None = None,
    xml_id: str | None = None,
    **kwargs: Any,
) -> None:
    """Create a control shape "draw:page-thumbnail".

    Args:
        name: Name of the graphical element.
        style: The style name for the control.
        text_style: The text style name for the control.
        draw_id: The unique ID for the drawing shape.
        layer: The drawing layer of the control.
        page_number: The number of a page that is displayed as a
            thumbnail.
        position: The (x, y) coordinates for the control's position.
        size: The (width, height) values for the control's size.
        placeholder: True if shape is a placeholder.
        user_transformed: Whether the size and position of the shape
            is set by the user or is set by the corresponding
            presentation shape on the master page.
        presentation_class: White-space-separated list of presentation
            class names.
        presentation_style: Style for a presentation shape.
        caption_id: Target ID assigned to the "draw:text-box" that
            contains the caption.
        class_names: White-space-separated list of styles with the
            family value of graphic.
        transform: White-space or comma separated list of transform
            definitions.
        z_index: Rendering order for shapes in a document instance.
        end_cell_address: End position of the shape if it is included
            in a spreadsheet document.
        end_x: The x-coordinate of the end position of a shape relative
            to the top-left edge of a cell.
        end_y: The y-coordinate of the end position of a shape relative
            to the top-left edge of a cell.
        table_background: Wether the shape is in the table background if
            the drawing shape is included in a spreadsheet.
        anchor_type: How a drawing shape is bound to a text document.
        anchor_page: Physical page number of an anchor if the drawing
            object is bound to a page within a text document.
        xml_id: The unique XML ID.
    """
    kwargs.update(
        {
            "name": name,
            "style": style,
            "text_style": text_style,
            "draw_id": draw_id,
            "layer": layer,
            "presentation_class": presentation_class,
            "presentation_style": presentation_style,
            "caption_id": caption_id,
            "class_names": class_names,
            "transform": transform,
            "z_index": z_index,
            "end_cell_address": end_cell_address,
            "end_x": end_x,
            "end_y": end_y,
            "table_background": table_background,
            "anchor_type": anchor_type,
            "anchor_page": anchor_page,
            "xml_id": xml_id,
        }
    )
    super().__init__(**kwargs)
    if self._do_init:
        if page_number:
            self.page_number = page_number
        if position:
            self.position = position
        if size:
            self.size = size
        if placeholder is not None:
            self.placeholder = placeholder
        if user_transformed is not None:
            self.user_transformed = user_transformed

DrawPath

Bases: PosMix, SizeMix, ShapeBase

Represents a path, “draw:path”.

A path is a shape with a user-defined outline. The outline is defined by the svg:d attribute.

Methods:

Name Description
__init__

Create a path shape “draw:path”.

Attributes:

Name Type Description
position
size
svg_d
view_box
Source code in odfdo/shapes.py
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
class DrawPath(PosMix, SizeMix, ShapeBase):
    """Represents a path, "draw:path".

    A path is a shape with a user-defined outline. The outline is defined by
    the svg:d attribute.
    """

    _tag = "draw:path"
    _properties: tuple[PropDef | PropDefBool, ...] = (
        PropDef("svg_d", "svg:d"),
        PropDef("view_box", "svg:viewBox"),
    )

    def __init__(
        self,
        name: str | None = None,
        style: str | None = None,
        text_style: str | None = None,
        draw_id: str | None = None,
        layer: str | None = None,
        svg_d: str | None = None,
        position: tuple[str, str] | list[str] | None = None,
        size: tuple[str, str] | list[str] | None = None,
        view_box: str | None = None,
        presentation_class: str | None = None,
        presentation_style: str | None = None,
        caption_id: str | None = None,
        class_names: str | None = None,
        transform: str | None = None,
        z_index: int | None = None,
        end_cell_address: str | None = None,
        end_x: str | None = None,
        end_y: str | None = None,
        table_background: bool | None = None,
        anchor_type: str | None = None,
        anchor_page: int | None = None,
        xml_id: str | None = None,
        **kwargs: Any,
    ) -> None:
        """Create a path shape "draw:path".

        Args:
            name: Name of the graphical element.
            style: The style name for the path.
            text_style: The text style name for the path.
            draw_id: The unique ID for the drawing shape.
            layer: The drawing layer of the path.
            svg_d: A path data.
            position: The (x, y) coordinates for the path's position.
            size: The (width, height) values for the path's size.
            view_box: The rectangle in a local coordinates system used by the
                points.
            presentation_class: White-space-separated list of presentation
                class names.
            presentation_style: Style for a presentation shape.
            caption_id: Target ID assigned to the "draw:text-box" that
                contains the caption.
            class_names: White-space-separated list of styles with the
                family value of graphic.
            transform: White-space or comma separated list of transform
                definitions.
            z_index: Rendering order for shapes in a document instance.
            end_cell_address: End position of the shape if it is included
                in a spreadsheet document.
            end_x: The x-coordinate of the end position of a shape relative
                to the top-left edge of a cell.
            end_y: The y-coordinate of the end position of a shape relative
                to the top-left edge of a cell.
            table_background: Wether the shape is in the table background if
                the drawing shape is included in a spreadsheet.
            anchor_type: How a drawing shape is bound to a text document.
            anchor_page: Physical page number of an anchor if the drawing
                object is bound to a page within a text document.
            xml_id: The unique XML ID.
        """
        kwargs.update(
            {
                "name": name,
                "style": style,
                "text_style": text_style,
                "draw_id": draw_id,
                "layer": layer,
                "presentation_class": presentation_class,
                "presentation_style": presentation_style,
                "caption_id": caption_id,
                "class_names": class_names,
                "transform": transform,
                "z_index": z_index,
                "end_cell_address": end_cell_address,
                "end_x": end_x,
                "end_y": end_y,
                "table_background": table_background,
                "anchor_type": anchor_type,
                "anchor_page": anchor_page,
                "xml_id": xml_id,
            }
        )
        super().__init__(**kwargs)
        if self._do_init:
            if svg_d:
                self.svg_d = svg_d
            if position:
                self.position = position
            if size:
                self.size = size
            if view_box:
                self.view_box = view_box

_properties class-attribute instance-attribute

_properties: tuple[PropDef | PropDefBool, ...] = (
    PropDef("svg_d", "svg:d"),
    PropDef("view_box", "svg:viewBox"),
)

_tag class-attribute instance-attribute

_tag = 'draw:path'

position instance-attribute

position = position

size instance-attribute

size = size

svg_d instance-attribute

svg_d = svg_d

view_box instance-attribute

view_box = view_box

__init__

__init__(
    name: str | None = None,
    style: str | None = None,
    text_style: str | None = None,
    draw_id: str | None = None,
    layer: str | None = None,
    svg_d: str | None = None,
    position: tuple[str, str] | list[str] | None = None,
    size: tuple[str, str] | list[str] | None = None,
    view_box: str | None = None,
    presentation_class: str | None = None,
    presentation_style: str | None = None,
    caption_id: str | None = None,
    class_names: str | None = None,
    transform: str | None = None,
    z_index: int | None = None,
    end_cell_address: str | None = None,
    end_x: str | None = None,
    end_y: str | None = None,
    table_background: bool | None = None,
    anchor_type: str | None = None,
    anchor_page: int | None = None,
    xml_id: str | None = None,
    **kwargs: Any,
) -> None

Create a path shape “draw:path”.

Parameters:

Name Type Description Default
name str | None

Name of the graphical element.

None
style str | None

The style name for the path.

None
text_style str | None

The text style name for the path.

None
draw_id str | None

The unique ID for the drawing shape.

None
layer str | None

The drawing layer of the path.

None
svg_d str | None

A path data.

None
position tuple[str, str] | list[str] | None

The (x, y) coordinates for the path’s position.

None
size tuple[str, str] | list[str] | None

The (width, height) values for the path’s size.

None
view_box str | None

The rectangle in a local coordinates system used by the points.

None
presentation_class str | None

White-space-separated list of presentation class names.

None
presentation_style str | None

Style for a presentation shape.

None
caption_id str | None

Target ID assigned to the “draw:text-box” that contains the caption.

None
class_names str | None

White-space-separated list of styles with the family value of graphic.

None
transform str | None

White-space or comma separated list of transform definitions.

None
z_index int | None

Rendering order for shapes in a document instance.

None
end_cell_address str | None

End position of the shape if it is included in a spreadsheet document.

None
end_x str | None

The x-coordinate of the end position of a shape relative to the top-left edge of a cell.

None
end_y str | None

The y-coordinate of the end position of a shape relative to the top-left edge of a cell.

None
table_background bool | None

Wether the shape is in the table background if the drawing shape is included in a spreadsheet.

None
anchor_type str | None

How a drawing shape is bound to a text document.

None
anchor_page int | None

Physical page number of an anchor if the drawing object is bound to a page within a text document.

None
xml_id str | None

The unique XML ID.

None
Source code in odfdo/shapes.py
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
def __init__(
    self,
    name: str | None = None,
    style: str | None = None,
    text_style: str | None = None,
    draw_id: str | None = None,
    layer: str | None = None,
    svg_d: str | None = None,
    position: tuple[str, str] | list[str] | None = None,
    size: tuple[str, str] | list[str] | None = None,
    view_box: str | None = None,
    presentation_class: str | None = None,
    presentation_style: str | None = None,
    caption_id: str | None = None,
    class_names: str | None = None,
    transform: str | None = None,
    z_index: int | None = None,
    end_cell_address: str | None = None,
    end_x: str | None = None,
    end_y: str | None = None,
    table_background: bool | None = None,
    anchor_type: str | None = None,
    anchor_page: int | None = None,
    xml_id: str | None = None,
    **kwargs: Any,
) -> None:
    """Create a path shape "draw:path".

    Args:
        name: Name of the graphical element.
        style: The style name for the path.
        text_style: The text style name for the path.
        draw_id: The unique ID for the drawing shape.
        layer: The drawing layer of the path.
        svg_d: A path data.
        position: The (x, y) coordinates for the path's position.
        size: The (width, height) values for the path's size.
        view_box: The rectangle in a local coordinates system used by the
            points.
        presentation_class: White-space-separated list of presentation
            class names.
        presentation_style: Style for a presentation shape.
        caption_id: Target ID assigned to the "draw:text-box" that
            contains the caption.
        class_names: White-space-separated list of styles with the
            family value of graphic.
        transform: White-space or comma separated list of transform
            definitions.
        z_index: Rendering order for shapes in a document instance.
        end_cell_address: End position of the shape if it is included
            in a spreadsheet document.
        end_x: The x-coordinate of the end position of a shape relative
            to the top-left edge of a cell.
        end_y: The y-coordinate of the end position of a shape relative
            to the top-left edge of a cell.
        table_background: Wether the shape is in the table background if
            the drawing shape is included in a spreadsheet.
        anchor_type: How a drawing shape is bound to a text document.
        anchor_page: Physical page number of an anchor if the drawing
            object is bound to a page within a text document.
        xml_id: The unique XML ID.
    """
    kwargs.update(
        {
            "name": name,
            "style": style,
            "text_style": text_style,
            "draw_id": draw_id,
            "layer": layer,
            "presentation_class": presentation_class,
            "presentation_style": presentation_style,
            "caption_id": caption_id,
            "class_names": class_names,
            "transform": transform,
            "z_index": z_index,
            "end_cell_address": end_cell_address,
            "end_x": end_x,
            "end_y": end_y,
            "table_background": table_background,
            "anchor_type": anchor_type,
            "anchor_page": anchor_page,
            "xml_id": xml_id,
        }
    )
    super().__init__(**kwargs)
    if self._do_init:
        if svg_d:
            self.svg_d = svg_d
        if position:
            self.position = position
        if size:
            self.size = size
        if view_box:
            self.view_box = view_box

EllipseShape

Bases: AngleMix, PosMix, SizeMix, ShapeBase

Represents an ellipse shape, “draw:ellipse”.

This shape defines an elliptical or circular area.

Methods:

Name Description
__init__

Create an ellipse shape “draw:ellipse”.

Attributes:

Name Type Description
cx
cy
end_angle
kind
position
rx
ry
size
start_angle
Source code in odfdo/shapes.py
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
class EllipseShape(AngleMix, PosMix, SizeMix, ShapeBase):
    """Represents an ellipse shape, "draw:ellipse".

    This shape defines an elliptical or circular area.
    """

    _tag = "draw:ellipse"
    _properties: tuple[PropDef | PropDefBool, ...] = (
        PropDef("cx", "svg:cx"),
        PropDef("cy", "svg:cy"),
        PropDef("rx", "svg:rx"),
        PropDef("ry", "svg:ry"),
    )

    def __init__(
        self,
        name: str | None = None,
        style: str | None = None,
        text_style: str | None = None,
        draw_id: str | None = None,
        layer: str | None = None,
        position: tuple[str, str] | list[str] | None = None,
        size: tuple[str, str] | list[str] | None = None,
        kind: str | None = None,
        start_angle: str | None = None,
        end_angle: str | None = None,
        cx: str | None = None,
        cy: str | None = None,
        rx: str | None = None,
        ry: str | None = None,
        presentation_class: str | None = None,
        presentation_style: str | None = None,
        caption_id: str | None = None,
        class_names: str | None = None,
        transform: str | None = None,
        z_index: int | None = None,
        end_cell_address: str | None = None,
        end_x: str | None = None,
        end_y: str | None = None,
        table_background: bool | None = None,
        anchor_type: str | None = None,
        anchor_page: int | None = None,
        xml_id: str | None = None,
        **kwargs: Any,
    ) -> None:
        """Create an ellipse shape "draw:ellipse".

        Args:
            name: Name of the graphical element.
            style: The style name for the ellipse.
            text_style: The text style name for the ellipse.
            draw_id: The unique ID for the drawing shape.
            layer: The drawing layer of the ellipse.
            position: The (x, y) coordinates for the ellipse's position.
            size: The (width, height) for the ellipse's size.
            kind: The appearance of a circle or ellipse, "full", "section",
                "cut" or "arc". Default is "full".
            start_angle: The start angle of a section, cut, or arc where the
                draw:kind is "section", "cut" or "arc".
            end_angle: The end angle of a section, cut, or arc where the
                draw:kind is "section", "cut" or "arc".
            cx: The x-axis coordinate of the center of a circular image map
                area.
            cy: The y-axis coordinate of the center of a circular image map
                area.
            rx: The x-axis radius of the ellipse.
            ry: The y-axis radius of the ellipse.
            presentation_class: White-space-separated list of presentation
                class names.
            presentation_style: Style for a presentation shape.
            caption_id: Target ID assigned to the "draw:text-box" that
                contains the caption.
            class_names: White-space-separated list of styles with the
                family value of graphic.
            transform: White-space or comma separated list of transform
                definitions.
            z_index: Rendering order for shapes in a document instance.
            end_cell_address: End position of the shape if it is included
                in a spreadsheet document.
            end_x: The x-coordinate of the end position of a shape relative
                to the top-left edge of a cell.
            end_y: The y-coordinate of the end position of a shape relative
                to the top-left edge of a cell.
            table_background: Wether the shape is in the table background if
                the drawing shape is included in a spreadsheet.
            anchor_type: How a drawing shape is bound to a text document.
            anchor_page: Physical page number of an anchor if the drawing
                object is bound to a page within a text document.
            xml_id: The unique XML ID.
        """
        kwargs.update(
            {
                "name": name,
                "style": style,
                "text_style": text_style,
                "draw_id": draw_id,
                "layer": layer,
                "presentation_class": presentation_class,
                "presentation_style": presentation_style,
                "caption_id": caption_id,
                "class_names": class_names,
                "transform": transform,
                "z_index": z_index,
                "end_cell_address": end_cell_address,
                "end_x": end_x,
                "end_y": end_y,
                "table_background": table_background,
                "anchor_type": anchor_type,
                "anchor_page": anchor_page,
                "xml_id": xml_id,
            }
        )
        super().__init__(**kwargs)
        if self._do_init:
            if position:
                self.position = position
            if size:
                self.size = size
            if kind:
                self.kind = kind
            if start_angle:
                self.start_angle = start_angle
            if end_angle:
                self.end_angle = end_angle
            if cx:
                self.cx = cx
            if cy:
                self.cy = cy
            if rx:
                self.rx = rx
            if ry:
                self.ry = ry

_properties class-attribute instance-attribute

_properties: tuple[PropDef | PropDefBool, ...] = (
    PropDef("cx", "svg:cx"),
    PropDef("cy", "svg:cy"),
    PropDef("rx", "svg:rx"),
    PropDef("ry", "svg:ry"),
)

_tag class-attribute instance-attribute

_tag = 'draw:ellipse'

cx instance-attribute

cx = cx

cy instance-attribute

cy = cy

end_angle instance-attribute

end_angle = end_angle

kind instance-attribute

kind = kind

position instance-attribute

position = position

rx instance-attribute

rx = rx

ry instance-attribute

ry = ry

size instance-attribute

size = size

start_angle instance-attribute

start_angle = start_angle

__init__

__init__(
    name: str | None = None,
    style: str | None = None,
    text_style: str | None = None,
    draw_id: str | None = None,
    layer: str | None = None,
    position: tuple[str, str] | list[str] | None = None,
    size: tuple[str, str] | list[str] | None = None,
    kind: str | None = None,
    start_angle: str | None = None,
    end_angle: str | None = None,
    cx: str | None = None,
    cy: str | None = None,
    rx: str | None = None,
    ry: str | None = None,
    presentation_class: str | None = None,
    presentation_style: str | None = None,
    caption_id: str | None = None,
    class_names: str | None = None,
    transform: str | None = None,
    z_index: int | None = None,
    end_cell_address: str | None = None,
    end_x: str | None = None,
    end_y: str | None = None,
    table_background: bool | None = None,
    anchor_type: str | None = None,
    anchor_page: int | None = None,
    xml_id: str | None = None,
    **kwargs: Any,
) -> None

Create an ellipse shape “draw:ellipse”.

Parameters:

Name Type Description Default
name str | None

Name of the graphical element.

None
style str | None

The style name for the ellipse.

None
text_style str | None

The text style name for the ellipse.

None
draw_id str | None

The unique ID for the drawing shape.

None
layer str | None

The drawing layer of the ellipse.

None
position tuple[str, str] | list[str] | None

The (x, y) coordinates for the ellipse’s position.

None
size tuple[str, str] | list[str] | None

The (width, height) for the ellipse’s size.

None
kind str | None

The appearance of a circle or ellipse, “full”, “section”, “cut” or “arc”. Default is “full”.

None
start_angle str | None

The start angle of a section, cut, or arc where the draw:kind is “section”, “cut” or “arc”.

None
end_angle str | None

The end angle of a section, cut, or arc where the draw:kind is “section”, “cut” or “arc”.

None
cx str | None

The x-axis coordinate of the center of a circular image map area.

None
cy str | None

The y-axis coordinate of the center of a circular image map area.

None
rx str | None

The x-axis radius of the ellipse.

None
ry str | None

The y-axis radius of the ellipse.

None
presentation_class str | None

White-space-separated list of presentation class names.

None
presentation_style str | None

Style for a presentation shape.

None
caption_id str | None

Target ID assigned to the “draw:text-box” that contains the caption.

None
class_names str | None

White-space-separated list of styles with the family value of graphic.

None
transform str | None

White-space or comma separated list of transform definitions.

None
z_index int | None

Rendering order for shapes in a document instance.

None
end_cell_address str | None

End position of the shape if it is included in a spreadsheet document.

None
end_x str | None

The x-coordinate of the end position of a shape relative to the top-left edge of a cell.

None
end_y str | None

The y-coordinate of the end position of a shape relative to the top-left edge of a cell.

None
table_background bool | None

Wether the shape is in the table background if the drawing shape is included in a spreadsheet.

None
anchor_type str | None

How a drawing shape is bound to a text document.

None
anchor_page int | None

Physical page number of an anchor if the drawing object is bound to a page within a text document.

None
xml_id str | None

The unique XML ID.

None
Source code in odfdo/shapes.py
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
def __init__(
    self,
    name: str | None = None,
    style: str | None = None,
    text_style: str | None = None,
    draw_id: str | None = None,
    layer: str | None = None,
    position: tuple[str, str] | list[str] | None = None,
    size: tuple[str, str] | list[str] | None = None,
    kind: str | None = None,
    start_angle: str | None = None,
    end_angle: str | None = None,
    cx: str | None = None,
    cy: str | None = None,
    rx: str | None = None,
    ry: str | None = None,
    presentation_class: str | None = None,
    presentation_style: str | None = None,
    caption_id: str | None = None,
    class_names: str | None = None,
    transform: str | None = None,
    z_index: int | None = None,
    end_cell_address: str | None = None,
    end_x: str | None = None,
    end_y: str | None = None,
    table_background: bool | None = None,
    anchor_type: str | None = None,
    anchor_page: int | None = None,
    xml_id: str | None = None,
    **kwargs: Any,
) -> None:
    """Create an ellipse shape "draw:ellipse".

    Args:
        name: Name of the graphical element.
        style: The style name for the ellipse.
        text_style: The text style name for the ellipse.
        draw_id: The unique ID for the drawing shape.
        layer: The drawing layer of the ellipse.
        position: The (x, y) coordinates for the ellipse's position.
        size: The (width, height) for the ellipse's size.
        kind: The appearance of a circle or ellipse, "full", "section",
            "cut" or "arc". Default is "full".
        start_angle: The start angle of a section, cut, or arc where the
            draw:kind is "section", "cut" or "arc".
        end_angle: The end angle of a section, cut, or arc where the
            draw:kind is "section", "cut" or "arc".
        cx: The x-axis coordinate of the center of a circular image map
            area.
        cy: The y-axis coordinate of the center of a circular image map
            area.
        rx: The x-axis radius of the ellipse.
        ry: The y-axis radius of the ellipse.
        presentation_class: White-space-separated list of presentation
            class names.
        presentation_style: Style for a presentation shape.
        caption_id: Target ID assigned to the "draw:text-box" that
            contains the caption.
        class_names: White-space-separated list of styles with the
            family value of graphic.
        transform: White-space or comma separated list of transform
            definitions.
        z_index: Rendering order for shapes in a document instance.
        end_cell_address: End position of the shape if it is included
            in a spreadsheet document.
        end_x: The x-coordinate of the end position of a shape relative
            to the top-left edge of a cell.
        end_y: The y-coordinate of the end position of a shape relative
            to the top-left edge of a cell.
        table_background: Wether the shape is in the table background if
            the drawing shape is included in a spreadsheet.
        anchor_type: How a drawing shape is bound to a text document.
        anchor_page: Physical page number of an anchor if the drawing
            object is bound to a page within a text document.
        xml_id: The unique XML ID.
    """
    kwargs.update(
        {
            "name": name,
            "style": style,
            "text_style": text_style,
            "draw_id": draw_id,
            "layer": layer,
            "presentation_class": presentation_class,
            "presentation_style": presentation_style,
            "caption_id": caption_id,
            "class_names": class_names,
            "transform": transform,
            "z_index": z_index,
            "end_cell_address": end_cell_address,
            "end_x": end_x,
            "end_y": end_y,
            "table_background": table_background,
            "anchor_type": anchor_type,
            "anchor_page": anchor_page,
            "xml_id": xml_id,
        }
    )
    super().__init__(**kwargs)
    if self._do_init:
        if position:
            self.position = position
        if size:
            self.size = size
        if kind:
            self.kind = kind
        if start_angle:
            self.start_angle = start_angle
        if end_angle:
            self.end_angle = end_angle
        if cx:
            self.cx = cx
        if cy:
            self.cy = cy
        if rx:
            self.rx = rx
        if ry:
            self.ry = ry

LineShape

Bases: ShapeBase

Represents a line shape, “draw:line”.

This shape defines a straight line between two points.

Methods:

Name Description
__init__

Create a line shape “draw:line”.

Attributes:

Name Type Description
p1 tuple[str | None, str | None]

Get or set the (x1, y1) coordinates of the starting point.

p2 tuple[str | None, str | None]

Get or set the (x2, y2) coordinates of the ending point.

Source code in odfdo/shapes.py
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
class LineShape(ShapeBase):
    """Represents a line shape, "draw:line".

    This shape defines a straight line between two points.
    """

    _tag = "draw:line"
    _properties: tuple[PropDef | PropDefBool, ...] = (
        PropDef("x1", "svg:x1"),
        PropDef("y1", "svg:y1"),
        PropDef("x2", "svg:x2"),
        PropDef("y2", "svg:y2"),
    )

    def __init__(
        self,
        name: str | None = None,
        style: str | None = None,
        text_style: str | None = None,
        draw_id: str | None = None,
        layer: str | None = None,
        p1: tuple[str, str] | list[str] | None = None,
        p2: tuple[str, str] | list[str] | None = None,
        presentation_class: str | None = None,
        presentation_style: str | None = None,
        caption_id: str | None = None,
        class_names: str | None = None,
        transform: str | None = None,
        z_index: int | None = None,
        end_cell_address: str | None = None,
        end_x: str | None = None,
        end_y: str | None = None,
        table_background: bool | None = None,
        anchor_type: str | None = None,
        anchor_page: int | None = None,
        xml_id: str | None = None,
        **kwargs: Any,
    ) -> None:
        """Create a line shape "draw:line".

        Args:
            name: Name of the graphical element.
            style: The style name for the line.
            text_style: The text style name for the line.
            draw_id: The unique ID for the drawing shape.
            layer: The drawing layer of the line.
            p1: The (x1, y1) coordinates of the starting point.
            p2: The (x2, y2) coordinates of the ending point.
            presentation_class: White-space-separated list of presentation
                class names.
            presentation_style: Style for a presentation shape.
            caption_id: Target ID assigned to the "draw:text-box" that
                contains the caption.
            class_names: White-space-separated list of styles with the
                family value of graphic.
            transform: White-space or comma separated list of transform
                definitions.
            z_index: Rendering order for shapes in a document instance.
            end_cell_address: End position of the shape if it is included
                in a spreadsheet document.
            end_x: The x-coordinate of the end position of a shape relative
                to the top-left edge of a cell.
            end_y: The y-coordinate of the end position of a shape relative
                to the top-left edge of a cell.
            table_background: Wether the shape is in the table background if
                the drawing shape is included in a spreadsheet.
            anchor_type: How a drawing shape is bound to a text document.
            anchor_page: Physical page number of an anchor if the drawing
                object is bound to a page within a text document.
            xml_id: The unique XML ID.
        """
        kwargs.update(
            {
                "name": name,
                "style": style,
                "text_style": text_style,
                "draw_id": draw_id,
                "layer": layer,
                "presentation_class": presentation_class,
                "presentation_style": presentation_style,
                "caption_id": caption_id,
                "class_names": class_names,
                "transform": transform,
                "z_index": z_index,
                "end_cell_address": end_cell_address,
                "end_x": end_x,
                "end_y": end_y,
                "table_background": table_background,
                "anchor_type": anchor_type,
                "anchor_page": anchor_page,
                "xml_id": xml_id,
            }
        )
        super().__init__(**kwargs)
        if self._do_init:
            self.p1 = p1
            self.p2 = p2

    @property
    def p1(self) -> tuple[str | None, str | None]:
        "Get or set the (x1, y1) coordinates of the starting point."
        return (self.x1, self.y1)

    @p1.setter
    def p1(self, p1: tuple[str, str] | list[str] | None) -> None:
        if p1 is None:
            self.x1 = None
            self.y1 = None
        else:
            self.x1 = p1[0]
            self.y1 = p1[1]

    @property
    def p2(self) -> tuple[str | None, str | None]:
        "Get or set the (x2, y2) coordinates of the ending point."
        return (self.x2, self.y2)

    @p2.setter
    def p2(self, p2: tuple[str, str] | list[str] | None) -> None:
        if p2 is None:
            self.x2 = None
            self.y2 = None
        else:
            self.x2 = p2[0]
            self.y2 = p2[1]

_properties class-attribute instance-attribute

_properties: tuple[PropDef | PropDefBool, ...] = (
    PropDef("x1", "svg:x1"),
    PropDef("y1", "svg:y1"),
    PropDef("x2", "svg:x2"),
    PropDef("y2", "svg:y2"),
)

_tag class-attribute instance-attribute

_tag = 'draw:line'

p1 property writable

p1: tuple[str | None, str | None]

Get or set the (x1, y1) coordinates of the starting point.

p2 property writable

p2: tuple[str | None, str | None]

Get or set the (x2, y2) coordinates of the ending point.

__init__

__init__(
    name: str | None = None,
    style: str | None = None,
    text_style: str | None = None,
    draw_id: str | None = None,
    layer: str | None = None,
    p1: tuple[str, str] | list[str] | None = None,
    p2: tuple[str, str] | list[str] | None = None,
    presentation_class: str | None = None,
    presentation_style: str | None = None,
    caption_id: str | None = None,
    class_names: str | None = None,
    transform: str | None = None,
    z_index: int | None = None,
    end_cell_address: str | None = None,
    end_x: str | None = None,
    end_y: str | None = None,
    table_background: bool | None = None,
    anchor_type: str | None = None,
    anchor_page: int | None = None,
    xml_id: str | None = None,
    **kwargs: Any,
) -> None

Create a line shape “draw:line”.

Parameters:

Name Type Description Default
name str | None

Name of the graphical element.

None
style str | None

The style name for the line.

None
text_style str | None

The text style name for the line.

None
draw_id str | None

The unique ID for the drawing shape.

None
layer str | None

The drawing layer of the line.

None
p1 tuple[str, str] | list[str] | None

The (x1, y1) coordinates of the starting point.

None
p2 tuple[str, str] | list[str] | None

The (x2, y2) coordinates of the ending point.

None
presentation_class str | None

White-space-separated list of presentation class names.

None
presentation_style str | None

Style for a presentation shape.

None
caption_id str | None

Target ID assigned to the “draw:text-box” that contains the caption.

None
class_names str | None

White-space-separated list of styles with the family value of graphic.

None
transform str | None

White-space or comma separated list of transform definitions.

None
z_index int | None

Rendering order for shapes in a document instance.

None
end_cell_address str | None

End position of the shape if it is included in a spreadsheet document.

None
end_x str | None

The x-coordinate of the end position of a shape relative to the top-left edge of a cell.

None
end_y str | None

The y-coordinate of the end position of a shape relative to the top-left edge of a cell.

None
table_background bool | None

Wether the shape is in the table background if the drawing shape is included in a spreadsheet.

None
anchor_type str | None

How a drawing shape is bound to a text document.

None
anchor_page int | None

Physical page number of an anchor if the drawing object is bound to a page within a text document.

None
xml_id str | None

The unique XML ID.

None
Source code in odfdo/shapes.py
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
def __init__(
    self,
    name: str | None = None,
    style: str | None = None,
    text_style: str | None = None,
    draw_id: str | None = None,
    layer: str | None = None,
    p1: tuple[str, str] | list[str] | None = None,
    p2: tuple[str, str] | list[str] | None = None,
    presentation_class: str | None = None,
    presentation_style: str | None = None,
    caption_id: str | None = None,
    class_names: str | None = None,
    transform: str | None = None,
    z_index: int | None = None,
    end_cell_address: str | None = None,
    end_x: str | None = None,
    end_y: str | None = None,
    table_background: bool | None = None,
    anchor_type: str | None = None,
    anchor_page: int | None = None,
    xml_id: str | None = None,
    **kwargs: Any,
) -> None:
    """Create a line shape "draw:line".

    Args:
        name: Name of the graphical element.
        style: The style name for the line.
        text_style: The text style name for the line.
        draw_id: The unique ID for the drawing shape.
        layer: The drawing layer of the line.
        p1: The (x1, y1) coordinates of the starting point.
        p2: The (x2, y2) coordinates of the ending point.
        presentation_class: White-space-separated list of presentation
            class names.
        presentation_style: Style for a presentation shape.
        caption_id: Target ID assigned to the "draw:text-box" that
            contains the caption.
        class_names: White-space-separated list of styles with the
            family value of graphic.
        transform: White-space or comma separated list of transform
            definitions.
        z_index: Rendering order for shapes in a document instance.
        end_cell_address: End position of the shape if it is included
            in a spreadsheet document.
        end_x: The x-coordinate of the end position of a shape relative
            to the top-left edge of a cell.
        end_y: The y-coordinate of the end position of a shape relative
            to the top-left edge of a cell.
        table_background: Wether the shape is in the table background if
            the drawing shape is included in a spreadsheet.
        anchor_type: How a drawing shape is bound to a text document.
        anchor_page: Physical page number of an anchor if the drawing
            object is bound to a page within a text document.
        xml_id: The unique XML ID.
    """
    kwargs.update(
        {
            "name": name,
            "style": style,
            "text_style": text_style,
            "draw_id": draw_id,
            "layer": layer,
            "presentation_class": presentation_class,
            "presentation_style": presentation_style,
            "caption_id": caption_id,
            "class_names": class_names,
            "transform": transform,
            "z_index": z_index,
            "end_cell_address": end_cell_address,
            "end_x": end_x,
            "end_y": end_y,
            "table_background": table_background,
            "anchor_type": anchor_type,
            "anchor_page": anchor_page,
            "xml_id": xml_id,
        }
    )
    super().__init__(**kwargs)
    if self._do_init:
        self.p1 = p1
        self.p2 = p2

PolygonShape

Bases: PolylineShape

Represents a polygon, “draw:polygon”.

A polygon is a closed set of straight lines.

Methods:

Name Description
__init__

Create a polygon shape “draw:polygon>”.

Source code in odfdo/shapes.py
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
class PolygonShape(PolylineShape):
    """Represents a polygon, "draw:polygon".

    A polygon is a closed set of straight lines."""

    _tag = "draw:polygon"

    def __init__(
        self,
        name: str | None = None,
        style: str | None = None,
        text_style: str | None = None,
        draw_id: str | None = None,
        layer: str | None = None,
        points: str | None = None,
        position: tuple[str, str] | list[str] | None = None,
        size: tuple[str, str] | list[str] | None = None,
        view_box: str | None = None,
        presentation_class: str | None = None,
        presentation_style: str | None = None,
        caption_id: str | None = None,
        class_names: str | None = None,
        transform: str | None = None,
        z_index: int | None = None,
        end_cell_address: str | None = None,
        end_x: str | None = None,
        end_y: str | None = None,
        table_background: bool | None = None,
        anchor_type: str | None = None,
        anchor_page: int | None = None,
        xml_id: str | None = None,
        **kwargs: Any,
    ) -> None:
        """Create a polygon shape "draw:polygon>".

        Args:
            name: Name of the graphical element.
            style: The style name for the polygon.
            text_style: The text style name for the polygon.
            draw_id: The unique ID for the drawing shape.
            layer: The drawing layer of the polygon.
            points: The coordinates of the polygon.
            position: The (x, y) coordinates for the polygon's position.
            size: The (width, height) values for the polygon's size.
            view_box: The rectangle in a local coordinates system used by the
                points.
            presentation_class: White-space-separated list of presentation
                class names.
            presentation_style: Style for a presentation shape.
            caption_id: Target ID assigned to the "draw:text-box" that
                contains the caption.
            class_names: White-space-separated list of styles with the
                family value of graphic.
            transform: White-space or comma separated list of transform
                definitions.
            z_index: Rendering order for shapes in a document instance.
            end_cell_address: End position of the shape if it is included
                in a spreadsheet document.
            end_x: The x-coordinate of the end position of a shape relative
                to the top-left edge of a cell.
            end_y: The y-coordinate of the end position of a shape relative
                to the top-left edge of a cell.
            table_background: Wether the shape is in the table background if
                the drawing shape is included in a spreadsheet.
            anchor_type: How a drawing shape is bound to a text document.
            anchor_page: Physical page number of an anchor if the drawing
                object is bound to a page within a text document.
            xml_id: The unique XML ID.
        """
        kwargs.update(
            {
                "name": name,
                "style": style,
                "text_style": text_style,
                "draw_id": draw_id,
                "layer": layer,
                "points": points,
                "position": position,
                "size": size,
                "view_box": view_box,
                "presentation_class": presentation_class,
                "presentation_style": presentation_style,
                "caption_id": caption_id,
                "class_names": class_names,
                "transform": transform,
                "z_index": z_index,
                "end_cell_address": end_cell_address,
                "end_x": end_x,
                "end_y": end_y,
                "table_background": table_background,
                "anchor_type": anchor_type,
                "anchor_page": anchor_page,
                "xml_id": xml_id,
            }
        )
        super().__init__(**kwargs)

_tag class-attribute instance-attribute

_tag = 'draw:polygon'

__init__

__init__(
    name: str | None = None,
    style: str | None = None,
    text_style: str | None = None,
    draw_id: str | None = None,
    layer: str | None = None,
    points: str | None = None,
    position: tuple[str, str] | list[str] | None = None,
    size: tuple[str, str] | list[str] | None = None,
    view_box: str | None = None,
    presentation_class: str | None = None,
    presentation_style: str | None = None,
    caption_id: str | None = None,
    class_names: str | None = None,
    transform: str | None = None,
    z_index: int | None = None,
    end_cell_address: str | None = None,
    end_x: str | None = None,
    end_y: str | None = None,
    table_background: bool | None = None,
    anchor_type: str | None = None,
    anchor_page: int | None = None,
    xml_id: str | None = None,
    **kwargs: Any,
) -> None

Create a polygon shape “draw:polygon>”.

Parameters:

Name Type Description Default
name str | None

Name of the graphical element.

None
style str | None

The style name for the polygon.

None
text_style str | None

The text style name for the polygon.

None
draw_id str | None

The unique ID for the drawing shape.

None
layer str | None

The drawing layer of the polygon.

None
points str | None

The coordinates of the polygon.

None
position tuple[str, str] | list[str] | None

The (x, y) coordinates for the polygon’s position.

None
size tuple[str, str] | list[str] | None

The (width, height) values for the polygon’s size.

None
view_box str | None

The rectangle in a local coordinates system used by the points.

None
presentation_class str | None

White-space-separated list of presentation class names.

None
presentation_style str | None

Style for a presentation shape.

None
caption_id str | None

Target ID assigned to the “draw:text-box” that contains the caption.

None
class_names str | None

White-space-separated list of styles with the family value of graphic.

None
transform str | None

White-space or comma separated list of transform definitions.

None
z_index int | None

Rendering order for shapes in a document instance.

None
end_cell_address str | None

End position of the shape if it is included in a spreadsheet document.

None
end_x str | None

The x-coordinate of the end position of a shape relative to the top-left edge of a cell.

None
end_y str | None

The y-coordinate of the end position of a shape relative to the top-left edge of a cell.

None
table_background bool | None

Wether the shape is in the table background if the drawing shape is included in a spreadsheet.

None
anchor_type str | None

How a drawing shape is bound to a text document.

None
anchor_page int | None

Physical page number of an anchor if the drawing object is bound to a page within a text document.

None
xml_id str | None

The unique XML ID.

None
Source code in odfdo/shapes.py
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
def __init__(
    self,
    name: str | None = None,
    style: str | None = None,
    text_style: str | None = None,
    draw_id: str | None = None,
    layer: str | None = None,
    points: str | None = None,
    position: tuple[str, str] | list[str] | None = None,
    size: tuple[str, str] | list[str] | None = None,
    view_box: str | None = None,
    presentation_class: str | None = None,
    presentation_style: str | None = None,
    caption_id: str | None = None,
    class_names: str | None = None,
    transform: str | None = None,
    z_index: int | None = None,
    end_cell_address: str | None = None,
    end_x: str | None = None,
    end_y: str | None = None,
    table_background: bool | None = None,
    anchor_type: str | None = None,
    anchor_page: int | None = None,
    xml_id: str | None = None,
    **kwargs: Any,
) -> None:
    """Create a polygon shape "draw:polygon>".

    Args:
        name: Name of the graphical element.
        style: The style name for the polygon.
        text_style: The text style name for the polygon.
        draw_id: The unique ID for the drawing shape.
        layer: The drawing layer of the polygon.
        points: The coordinates of the polygon.
        position: The (x, y) coordinates for the polygon's position.
        size: The (width, height) values for the polygon's size.
        view_box: The rectangle in a local coordinates system used by the
            points.
        presentation_class: White-space-separated list of presentation
            class names.
        presentation_style: Style for a presentation shape.
        caption_id: Target ID assigned to the "draw:text-box" that
            contains the caption.
        class_names: White-space-separated list of styles with the
            family value of graphic.
        transform: White-space or comma separated list of transform
            definitions.
        z_index: Rendering order for shapes in a document instance.
        end_cell_address: End position of the shape if it is included
            in a spreadsheet document.
        end_x: The x-coordinate of the end position of a shape relative
            to the top-left edge of a cell.
        end_y: The y-coordinate of the end position of a shape relative
            to the top-left edge of a cell.
        table_background: Wether the shape is in the table background if
            the drawing shape is included in a spreadsheet.
        anchor_type: How a drawing shape is bound to a text document.
        anchor_page: Physical page number of an anchor if the drawing
            object is bound to a page within a text document.
        xml_id: The unique XML ID.
    """
    kwargs.update(
        {
            "name": name,
            "style": style,
            "text_style": text_style,
            "draw_id": draw_id,
            "layer": layer,
            "points": points,
            "position": position,
            "size": size,
            "view_box": view_box,
            "presentation_class": presentation_class,
            "presentation_style": presentation_style,
            "caption_id": caption_id,
            "class_names": class_names,
            "transform": transform,
            "z_index": z_index,
            "end_cell_address": end_cell_address,
            "end_x": end_x,
            "end_y": end_y,
            "table_background": table_background,
            "anchor_type": anchor_type,
            "anchor_page": anchor_page,
            "xml_id": xml_id,
        }
    )
    super().__init__(**kwargs)

PolylineShape

Bases: PosMix, SizeMix, ShapeBase

Represents a polyline shape, “draw:polyline”.

Methods:

Name Description
__init__

Create a polyline shape “draw:polyline”.

Attributes:

Name Type Description
points
position
size
view_box
Source code in odfdo/shapes.py
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
class PolylineShape(PosMix, SizeMix, ShapeBase):
    """Represents a polyline shape, "draw:polyline"."""

    _tag = "draw:polyline"
    _properties: tuple[PropDef | PropDefBool, ...] = (
        PropDef("points", "draw:points"),
        PropDef("view_box", "svg:viewBox"),
    )

    def __init__(
        self,
        name: str | None = None,
        style: str | None = None,
        text_style: str | None = None,
        draw_id: str | None = None,
        layer: str | None = None,
        points: str | None = None,
        position: tuple[str, str] | list[str] | None = None,
        size: tuple[str, str] | list[str] | None = None,
        view_box: str | None = None,
        presentation_class: str | None = None,
        presentation_style: str | None = None,
        caption_id: str | None = None,
        class_names: str | None = None,
        transform: str | None = None,
        z_index: int | None = None,
        end_cell_address: str | None = None,
        end_x: str | None = None,
        end_y: str | None = None,
        table_background: bool | None = None,
        anchor_type: str | None = None,
        anchor_page: int | None = None,
        xml_id: str | None = None,
        **kwargs: Any,
    ) -> None:
        """Create a polyline shape "draw:polyline".

        Args:
            name: Name of the graphical element.
            style: The style name for the polyline.
            text_style: The text style name for the polyline.
            draw_id: The unique ID for the drawing shape.
            layer: The drawing layer of the polyline.
            points: The coordinates of the polyline.
            position: The (x, y) coordinates for the polyline's position.
            size: The (width, height) values for the polyline's size.
            view_box: The rectangle in a local coordinates system used by the
                points.
            presentation_class: White-space-separated list of presentation
                class names.
            presentation_style: Style for a presentation shape.
            caption_id: Target ID assigned to the "draw:text-box" that
                contains the caption.
            class_names: White-space-separated list of styles with the
                family value of graphic.
            transform: White-space or comma separated list of transform
                definitions.
            z_index: Rendering order for shapes in a document instance.
            end_cell_address: End position of the shape if it is included
                in a spreadsheet document.
            end_x: The x-coordinate of the end position of a shape relative
                to the top-left edge of a cell.
            end_y: The y-coordinate of the end position of a shape relative
                to the top-left edge of a cell.
            table_background: Wether the shape is in the table background if
                the drawing shape is included in a spreadsheet.
            anchor_type: How a drawing shape is bound to a text document.
            anchor_page: Physical page number of an anchor if the drawing
                object is bound to a page within a text document.
            xml_id: The unique XML ID.
        """
        kwargs.update(
            {
                "name": name,
                "style": style,
                "text_style": text_style,
                "draw_id": draw_id,
                "layer": layer,
                "presentation_class": presentation_class,
                "presentation_style": presentation_style,
                "caption_id": caption_id,
                "class_names": class_names,
                "transform": transform,
                "z_index": z_index,
                "end_cell_address": end_cell_address,
                "end_x": end_x,
                "end_y": end_y,
                "table_background": table_background,
                "anchor_type": anchor_type,
                "anchor_page": anchor_page,
                "xml_id": xml_id,
            }
        )
        super().__init__(**kwargs)
        if self._do_init:
            if points:
                self.points = points
            if position:
                self.position = position
            if size:
                self.size = size
            if view_box:
                self.view_box = view_box

_properties class-attribute instance-attribute

_properties: tuple[PropDef | PropDefBool, ...] = (
    PropDef("points", "draw:points"),
    PropDef("view_box", "svg:viewBox"),
)

_tag class-attribute instance-attribute

_tag = 'draw:polyline'

points instance-attribute

points = points

position instance-attribute

position = position

size instance-attribute

size = size

view_box instance-attribute

view_box = view_box

__init__

__init__(
    name: str | None = None,
    style: str | None = None,
    text_style: str | None = None,
    draw_id: str | None = None,
    layer: str | None = None,
    points: str | None = None,
    position: tuple[str, str] | list[str] | None = None,
    size: tuple[str, str] | list[str] | None = None,
    view_box: str | None = None,
    presentation_class: str | None = None,
    presentation_style: str | None = None,
    caption_id: str | None = None,
    class_names: str | None = None,
    transform: str | None = None,
    z_index: int | None = None,
    end_cell_address: str | None = None,
    end_x: str | None = None,
    end_y: str | None = None,
    table_background: bool | None = None,
    anchor_type: str | None = None,
    anchor_page: int | None = None,
    xml_id: str | None = None,
    **kwargs: Any,
) -> None

Create a polyline shape “draw:polyline”.

Parameters:

Name Type Description Default
name str | None

Name of the graphical element.

None
style str | None

The style name for the polyline.

None
text_style str | None

The text style name for the polyline.

None
draw_id str | None

The unique ID for the drawing shape.

None
layer str | None

The drawing layer of the polyline.

None
points str | None

The coordinates of the polyline.

None
position tuple[str, str] | list[str] | None

The (x, y) coordinates for the polyline’s position.

None
size tuple[str, str] | list[str] | None

The (width, height) values for the polyline’s size.

None
view_box str | None

The rectangle in a local coordinates system used by the points.

None
presentation_class str | None

White-space-separated list of presentation class names.

None
presentation_style str | None

Style for a presentation shape.

None
caption_id str | None

Target ID assigned to the “draw:text-box” that contains the caption.

None
class_names str | None

White-space-separated list of styles with the family value of graphic.

None
transform str | None

White-space or comma separated list of transform definitions.

None
z_index int | None

Rendering order for shapes in a document instance.

None
end_cell_address str | None

End position of the shape if it is included in a spreadsheet document.

None
end_x str | None

The x-coordinate of the end position of a shape relative to the top-left edge of a cell.

None
end_y str | None

The y-coordinate of the end position of a shape relative to the top-left edge of a cell.

None
table_background bool | None

Wether the shape is in the table background if the drawing shape is included in a spreadsheet.

None
anchor_type str | None

How a drawing shape is bound to a text document.

None
anchor_page int | None

Physical page number of an anchor if the drawing object is bound to a page within a text document.

None
xml_id str | None

The unique XML ID.

None
Source code in odfdo/shapes.py
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
def __init__(
    self,
    name: str | None = None,
    style: str | None = None,
    text_style: str | None = None,
    draw_id: str | None = None,
    layer: str | None = None,
    points: str | None = None,
    position: tuple[str, str] | list[str] | None = None,
    size: tuple[str, str] | list[str] | None = None,
    view_box: str | None = None,
    presentation_class: str | None = None,
    presentation_style: str | None = None,
    caption_id: str | None = None,
    class_names: str | None = None,
    transform: str | None = None,
    z_index: int | None = None,
    end_cell_address: str | None = None,
    end_x: str | None = None,
    end_y: str | None = None,
    table_background: bool | None = None,
    anchor_type: str | None = None,
    anchor_page: int | None = None,
    xml_id: str | None = None,
    **kwargs: Any,
) -> None:
    """Create a polyline shape "draw:polyline".

    Args:
        name: Name of the graphical element.
        style: The style name for the polyline.
        text_style: The text style name for the polyline.
        draw_id: The unique ID for the drawing shape.
        layer: The drawing layer of the polyline.
        points: The coordinates of the polyline.
        position: The (x, y) coordinates for the polyline's position.
        size: The (width, height) values for the polyline's size.
        view_box: The rectangle in a local coordinates system used by the
            points.
        presentation_class: White-space-separated list of presentation
            class names.
        presentation_style: Style for a presentation shape.
        caption_id: Target ID assigned to the "draw:text-box" that
            contains the caption.
        class_names: White-space-separated list of styles with the
            family value of graphic.
        transform: White-space or comma separated list of transform
            definitions.
        z_index: Rendering order for shapes in a document instance.
        end_cell_address: End position of the shape if it is included
            in a spreadsheet document.
        end_x: The x-coordinate of the end position of a shape relative
            to the top-left edge of a cell.
        end_y: The y-coordinate of the end position of a shape relative
            to the top-left edge of a cell.
        table_background: Wether the shape is in the table background if
            the drawing shape is included in a spreadsheet.
        anchor_type: How a drawing shape is bound to a text document.
        anchor_page: Physical page number of an anchor if the drawing
            object is bound to a page within a text document.
        xml_id: The unique XML ID.
    """
    kwargs.update(
        {
            "name": name,
            "style": style,
            "text_style": text_style,
            "draw_id": draw_id,
            "layer": layer,
            "presentation_class": presentation_class,
            "presentation_style": presentation_style,
            "caption_id": caption_id,
            "class_names": class_names,
            "transform": transform,
            "z_index": z_index,
            "end_cell_address": end_cell_address,
            "end_x": end_x,
            "end_y": end_y,
            "table_background": table_background,
            "anchor_type": anchor_type,
            "anchor_page": anchor_page,
            "xml_id": xml_id,
        }
    )
    super().__init__(**kwargs)
    if self._do_init:
        if points:
            self.points = points
        if position:
            self.position = position
        if size:
            self.size = size
        if view_box:
            self.view_box = view_box

RectangleShape

Bases: PosMix, SizeMix, ShapeBase

Represents a rectangle shape, “draw:rect”.

This shape defines a rectangular area.

Methods:

Name Description
__init__

Create a rectangle shape “draw:rect”.

Attributes:

Name Type Description
corner_radius
position
rx
ry
size
Source code in odfdo/shapes.py
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
class RectangleShape(PosMix, SizeMix, ShapeBase):
    """Represents a rectangle shape, "draw:rect".

    This shape defines a rectangular area.
    """

    _tag = "draw:rect"
    _properties: tuple[PropDef | PropDefBool, ...] = (
        PropDef("corner_radius", "draw:corner-radius"),
        PropDef("rx", "svg:rx"),
        PropDef("ry", "svg:ry"),
    )

    def __init__(
        self,
        name: str | None = None,
        style: str | None = None,
        text_style: str | None = None,
        draw_id: str | None = None,
        layer: str | None = None,
        position: tuple[str, str] | list[str] | None = None,
        size: tuple[str, str] | list[str] | None = None,
        corner_radius: str | None = None,
        rx: str | None = None,
        ry: str | None = None,
        presentation_class: str | None = None,
        presentation_style: str | None = None,
        caption_id: str | None = None,
        class_names: str | None = None,
        transform: str | None = None,
        z_index: int | None = None,
        end_cell_address: str | None = None,
        end_x: str | None = None,
        end_y: str | None = None,
        table_background: bool | None = None,
        anchor_type: str | None = None,
        anchor_page: int | None = None,
        xml_id: str | None = None,
        **kwargs: Any,
    ) -> None:
        """Create a rectangle shape "draw:rect".

        Args:
            name: Name of the graphical element.
            style: The style name for the rectangle.
            text_style: The text style name for the rectangle.
            draw_id: The unique ID for the drawing shape.
            layer: The drawing layer of the rectangle.
            position: The (x, y) coordinates for the rectangle's position.
            size: The (width, height) values for the rectangle's size.
            corner_radius: radius of the circle used to round off the corners.
            rx: x-axis radius of the ellipse used to round off the corners.
            ry: y-axis radius of the ellipse used to round off the corners.
            presentation_class: White-space-separated list of presentation
                class names.
            presentation_style: Style for a presentation shape.
            caption_id: Target ID assigned to the "draw:text-box" that
                contains the caption.
            class_names: White-space-separated list of styles with the
                family value of graphic.
            transform: White-space or comma separated list of transform
                definitions.
            z_index: Rendering order for shapes in a document instance.
            end_cell_address: End position of the shape if it is included
                in a spreadsheet document.
            end_x: The x-coordinate of the end position of a shape relative
                to the top-left edge of a cell.
            end_y: The y-coordinate of the end position of a shape relative
                to the top-left edge of a cell.
            table_background: Wether the shape is in the table background if
                the drawing shape is included in a spreadsheet.
            anchor_type: How a drawing shape is bound to a text document.
            anchor_page: Physical page number of an anchor if the drawing
                object is bound to a page within a text document.
            xml_id: The unique XML ID.
        """
        kwargs.update(
            {
                "name": name,
                "style": style,
                "text_style": text_style,
                "draw_id": draw_id,
                "layer": layer,
                "presentation_class": presentation_class,
                "presentation_style": presentation_style,
                "caption_id": caption_id,
                "class_names": class_names,
                "transform": transform,
                "z_index": z_index,
                "end_cell_address": end_cell_address,
                "end_x": end_x,
                "end_y": end_y,
                "table_background": table_background,
                "anchor_type": anchor_type,
                "anchor_page": anchor_page,
                "xml_id": xml_id,
            }
        )
        super().__init__(**kwargs)
        if self._do_init:
            if position:
                self.position = position
            if size:
                self.size = size
            if corner_radius:
                self.corner_radius = corner_radius
            if rx:
                self.rx = rx
            if ry:
                self.ry = ry

_properties class-attribute instance-attribute

_properties: tuple[PropDef | PropDefBool, ...] = (
    PropDef("corner_radius", "draw:corner-radius"),
    PropDef("rx", "svg:rx"),
    PropDef("ry", "svg:ry"),
)

_tag class-attribute instance-attribute

_tag = 'draw:rect'

corner_radius instance-attribute

corner_radius = corner_radius

position instance-attribute

position = position

rx instance-attribute

rx = rx

ry instance-attribute

ry = ry

size instance-attribute

size = size

__init__

__init__(
    name: str | None = None,
    style: str | None = None,
    text_style: str | None = None,
    draw_id: str | None = None,
    layer: str | None = None,
    position: tuple[str, str] | list[str] | None = None,
    size: tuple[str, str] | list[str] | None = None,
    corner_radius: str | None = None,
    rx: str | None = None,
    ry: str | None = None,
    presentation_class: str | None = None,
    presentation_style: str | None = None,
    caption_id: str | None = None,
    class_names: str | None = None,
    transform: str | None = None,
    z_index: int | None = None,
    end_cell_address: str | None = None,
    end_x: str | None = None,
    end_y: str | None = None,
    table_background: bool | None = None,
    anchor_type: str | None = None,
    anchor_page: int | None = None,
    xml_id: str | None = None,
    **kwargs: Any,
) -> None

Create a rectangle shape “draw:rect”.

Parameters:

Name Type Description Default
name str | None

Name of the graphical element.

None
style str | None

The style name for the rectangle.

None
text_style str | None

The text style name for the rectangle.

None
draw_id str | None

The unique ID for the drawing shape.

None
layer str | None

The drawing layer of the rectangle.

None
position tuple[str, str] | list[str] | None

The (x, y) coordinates for the rectangle’s position.

None
size tuple[str, str] | list[str] | None

The (width, height) values for the rectangle’s size.

None
corner_radius str | None

radius of the circle used to round off the corners.

None
rx str | None

x-axis radius of the ellipse used to round off the corners.

None
ry str | None

y-axis radius of the ellipse used to round off the corners.

None
presentation_class str | None

White-space-separated list of presentation class names.

None
presentation_style str | None

Style for a presentation shape.

None
caption_id str | None

Target ID assigned to the “draw:text-box” that contains the caption.

None
class_names str | None

White-space-separated list of styles with the family value of graphic.

None
transform str | None

White-space or comma separated list of transform definitions.

None
z_index int | None

Rendering order for shapes in a document instance.

None
end_cell_address str | None

End position of the shape if it is included in a spreadsheet document.

None
end_x str | None

The x-coordinate of the end position of a shape relative to the top-left edge of a cell.

None
end_y str | None

The y-coordinate of the end position of a shape relative to the top-left edge of a cell.

None
table_background bool | None

Wether the shape is in the table background if the drawing shape is included in a spreadsheet.

None
anchor_type str | None

How a drawing shape is bound to a text document.

None
anchor_page int | None

Physical page number of an anchor if the drawing object is bound to a page within a text document.

None
xml_id str | None

The unique XML ID.

None
Source code in odfdo/shapes.py
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
def __init__(
    self,
    name: str | None = None,
    style: str | None = None,
    text_style: str | None = None,
    draw_id: str | None = None,
    layer: str | None = None,
    position: tuple[str, str] | list[str] | None = None,
    size: tuple[str, str] | list[str] | None = None,
    corner_radius: str | None = None,
    rx: str | None = None,
    ry: str | None = None,
    presentation_class: str | None = None,
    presentation_style: str | None = None,
    caption_id: str | None = None,
    class_names: str | None = None,
    transform: str | None = None,
    z_index: int | None = None,
    end_cell_address: str | None = None,
    end_x: str | None = None,
    end_y: str | None = None,
    table_background: bool | None = None,
    anchor_type: str | None = None,
    anchor_page: int | None = None,
    xml_id: str | None = None,
    **kwargs: Any,
) -> None:
    """Create a rectangle shape "draw:rect".

    Args:
        name: Name of the graphical element.
        style: The style name for the rectangle.
        text_style: The text style name for the rectangle.
        draw_id: The unique ID for the drawing shape.
        layer: The drawing layer of the rectangle.
        position: The (x, y) coordinates for the rectangle's position.
        size: The (width, height) values for the rectangle's size.
        corner_radius: radius of the circle used to round off the corners.
        rx: x-axis radius of the ellipse used to round off the corners.
        ry: y-axis radius of the ellipse used to round off the corners.
        presentation_class: White-space-separated list of presentation
            class names.
        presentation_style: Style for a presentation shape.
        caption_id: Target ID assigned to the "draw:text-box" that
            contains the caption.
        class_names: White-space-separated list of styles with the
            family value of graphic.
        transform: White-space or comma separated list of transform
            definitions.
        z_index: Rendering order for shapes in a document instance.
        end_cell_address: End position of the shape if it is included
            in a spreadsheet document.
        end_x: The x-coordinate of the end position of a shape relative
            to the top-left edge of a cell.
        end_y: The y-coordinate of the end position of a shape relative
            to the top-left edge of a cell.
        table_background: Wether the shape is in the table background if
            the drawing shape is included in a spreadsheet.
        anchor_type: How a drawing shape is bound to a text document.
        anchor_page: Physical page number of an anchor if the drawing
            object is bound to a page within a text document.
        xml_id: The unique XML ID.
    """
    kwargs.update(
        {
            "name": name,
            "style": style,
            "text_style": text_style,
            "draw_id": draw_id,
            "layer": layer,
            "presentation_class": presentation_class,
            "presentation_style": presentation_style,
            "caption_id": caption_id,
            "class_names": class_names,
            "transform": transform,
            "z_index": z_index,
            "end_cell_address": end_cell_address,
            "end_x": end_x,
            "end_y": end_y,
            "table_background": table_background,
            "anchor_type": anchor_type,
            "anchor_page": anchor_page,
            "xml_id": xml_id,
        }
    )
    super().__init__(**kwargs)
    if self._do_init:
        if position:
            self.position = position
        if size:
            self.size = size
        if corner_radius:
            self.corner_radius = corner_radius
        if rx:
            self.rx = rx
        if ry:
            self.ry = ry

RegularPolygonShape

Bases: PosMix, SizeMix, ShapeBase

Represents a regular polygon, “draw:regular-polygon”.

A regular polygon is a polygon that is specified by its number of edges (that is equal to the number of its corners), rather than by arbitrary points.

Methods:

Name Description
__init__

Create a regular polygon shape “draw:regular-polygon”.

Attributes:

Name Type Description
concave
corners int | None

Get or set the number of polygon corners.

position
sharpness
size
Source code in odfdo/shapes.py
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
class RegularPolygonShape(PosMix, SizeMix, ShapeBase):
    """Represents a regular polygon, "draw:regular-polygon".

    A regular polygon is a polygon that is specified by its number of edges
    (that is equal to the number of its corners), rather than by arbitrary
    points."""

    _tag = "draw:regular-polygon"
    _properties: tuple[PropDef | PropDefBool, ...] = (
        PropDefBool("concave", "draw:concave", False),
        PropDef("sharpness", "draw:sharpness"),
    )

    def __init__(
        self,
        name: str | None = None,
        style: str | None = None,
        text_style: str | None = None,
        draw_id: str | None = None,
        layer: str | None = None,
        corners: int | None = None,
        concave: bool | None = None,
        sharpness: str | None = None,
        position: tuple[str, str] | list[str] | None = None,
        size: tuple[str, str] | list[str] | None = None,
        presentation_class: str | None = None,
        presentation_style: str | None = None,
        caption_id: str | None = None,
        class_names: str | None = None,
        transform: str | None = None,
        z_index: int | None = None,
        end_cell_address: str | None = None,
        end_x: str | None = None,
        end_y: str | None = None,
        table_background: bool | None = None,
        anchor_type: str | None = None,
        anchor_page: int | None = None,
        xml_id: str | None = None,
        **kwargs: Any,
    ) -> None:
        """Create a regular polygon shape "draw:regular-polygon".

        Args:
            name: Name of the graphical element.
            style: The style name for the polygon.
            text_style: The text style name for the polygon.
            draw_id: The unique ID for the drawing shape.
            layer: The drawing layer of the polygon.
            corners: The number of polygon corners.
            concave: Whether a regular polygon is convex or concave.
            sharpness: The radius of the ellipse on which inner polygon
                corners are located for concave polygon.
            position: The (x, y) coordinates for the polygon's position.
            size: The (width, height) values for the polygon's size.
            presentation_class: White-space-separated list of presentation
                class names.
            presentation_style: Style for a presentation shape.
            caption_id: Target ID assigned to the "draw:text-box" that
                contains the caption.
            class_names: White-space-separated list of styles with the
                family value of graphic.
            transform: White-space or comma separated list of transform
                definitions.
            z_index: Rendering order for shapes in a document instance.
            end_cell_address: End position of the shape if it is included
                in a spreadsheet document.
            end_x: The x-coordinate of the end position of a shape relative
                to the top-left edge of a cell.
            end_y: The y-coordinate of the end position of a shape relative
                to the top-left edge of a cell.
            table_background: Wether the shape is in the table background if
                the drawing shape is included in a spreadsheet.
            anchor_type: How a drawing shape is bound to a text document.
            anchor_page: Physical page number of an anchor if the drawing
                object is bound to a page within a text document.
            xml_id: The unique XML ID.
        """
        kwargs.update(
            {
                "name": name,
                "style": style,
                "text_style": text_style,
                "draw_id": draw_id,
                "layer": layer,
                "presentation_class": presentation_class,
                "presentation_style": presentation_style,
                "caption_id": caption_id,
                "class_names": class_names,
                "transform": transform,
                "z_index": z_index,
                "end_cell_address": end_cell_address,
                "end_x": end_x,
                "end_y": end_y,
                "table_background": table_background,
                "anchor_type": anchor_type,
                "anchor_page": anchor_page,
                "xml_id": xml_id,
            }
        )
        super().__init__(**kwargs)
        if self._do_init:
            if corners:
                self.corners = corners
            if concave is not None:
                self.concave = concave
            if sharpness:
                self.sharpness = sharpness
            if position:
                self.position = position
            if size:
                self.size = size

    @property
    def corners(self) -> int | None:
        """Get or set the number of polygon corners.

        type : int or None
        """
        corners = self.get_attribute("draw:corners")
        if corners is None:
            return None
        return int(corners)

    @corners.setter
    def corners(self, corners: int | None) -> None:
        self._set_attribute_int("draw:corners", corners)

_properties class-attribute instance-attribute

_properties: tuple[PropDef | PropDefBool, ...] = (
    PropDefBool("concave", "draw:concave", False),
    PropDef("sharpness", "draw:sharpness"),
)

_tag class-attribute instance-attribute

_tag = 'draw:regular-polygon'

concave instance-attribute

concave = concave

corners property writable

corners: int | None

Get or set the number of polygon corners.

type : int or None

position instance-attribute

position = position

sharpness instance-attribute

sharpness = sharpness

size instance-attribute

size = size

__init__

__init__(
    name: str | None = None,
    style: str | None = None,
    text_style: str | None = None,
    draw_id: str | None = None,
    layer: str | None = None,
    corners: int | None = None,
    concave: bool | None = None,
    sharpness: str | None = None,
    position: tuple[str, str] | list[str] | None = None,
    size: tuple[str, str] | list[str] | None = None,
    presentation_class: str | None = None,
    presentation_style: str | None = None,
    caption_id: str | None = None,
    class_names: str | None = None,
    transform: str | None = None,
    z_index: int | None = None,
    end_cell_address: str | None = None,
    end_x: str | None = None,
    end_y: str | None = None,
    table_background: bool | None = None,
    anchor_type: str | None = None,
    anchor_page: int | None = None,
    xml_id: str | None = None,
    **kwargs: Any,
) -> None

Create a regular polygon shape “draw:regular-polygon”.

Parameters:

Name Type Description Default
name str | None

Name of the graphical element.

None
style str | None

The style name for the polygon.

None
text_style str | None

The text style name for the polygon.

None
draw_id str | None

The unique ID for the drawing shape.

None
layer str | None

The drawing layer of the polygon.

None
corners int | None

The number of polygon corners.

None
concave bool | None

Whether a regular polygon is convex or concave.

None
sharpness str | None

The radius of the ellipse on which inner polygon corners are located for concave polygon.

None
position tuple[str, str] | list[str] | None

The (x, y) coordinates for the polygon’s position.

None
size tuple[str, str] | list[str] | None

The (width, height) values for the polygon’s size.

None
presentation_class str | None

White-space-separated list of presentation class names.

None
presentation_style str | None

Style for a presentation shape.

None
caption_id str | None

Target ID assigned to the “draw:text-box” that contains the caption.

None
class_names str | None

White-space-separated list of styles with the family value of graphic.

None
transform str | None

White-space or comma separated list of transform definitions.

None
z_index int | None

Rendering order for shapes in a document instance.

None
end_cell_address str | None

End position of the shape if it is included in a spreadsheet document.

None
end_x str | None

The x-coordinate of the end position of a shape relative to the top-left edge of a cell.

None
end_y str | None

The y-coordinate of the end position of a shape relative to the top-left edge of a cell.

None
table_background bool | None

Wether the shape is in the table background if the drawing shape is included in a spreadsheet.

None
anchor_type str | None

How a drawing shape is bound to a text document.

None
anchor_page int | None

Physical page number of an anchor if the drawing object is bound to a page within a text document.

None
xml_id str | None

The unique XML ID.

None
Source code in odfdo/shapes.py
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
def __init__(
    self,
    name: str | None = None,
    style: str | None = None,
    text_style: str | None = None,
    draw_id: str | None = None,
    layer: str | None = None,
    corners: int | None = None,
    concave: bool | None = None,
    sharpness: str | None = None,
    position: tuple[str, str] | list[str] | None = None,
    size: tuple[str, str] | list[str] | None = None,
    presentation_class: str | None = None,
    presentation_style: str | None = None,
    caption_id: str | None = None,
    class_names: str | None = None,
    transform: str | None = None,
    z_index: int | None = None,
    end_cell_address: str | None = None,
    end_x: str | None = None,
    end_y: str | None = None,
    table_background: bool | None = None,
    anchor_type: str | None = None,
    anchor_page: int | None = None,
    xml_id: str | None = None,
    **kwargs: Any,
) -> None:
    """Create a regular polygon shape "draw:regular-polygon".

    Args:
        name: Name of the graphical element.
        style: The style name for the polygon.
        text_style: The text style name for the polygon.
        draw_id: The unique ID for the drawing shape.
        layer: The drawing layer of the polygon.
        corners: The number of polygon corners.
        concave: Whether a regular polygon is convex or concave.
        sharpness: The radius of the ellipse on which inner polygon
            corners are located for concave polygon.
        position: The (x, y) coordinates for the polygon's position.
        size: The (width, height) values for the polygon's size.
        presentation_class: White-space-separated list of presentation
            class names.
        presentation_style: Style for a presentation shape.
        caption_id: Target ID assigned to the "draw:text-box" that
            contains the caption.
        class_names: White-space-separated list of styles with the
            family value of graphic.
        transform: White-space or comma separated list of transform
            definitions.
        z_index: Rendering order for shapes in a document instance.
        end_cell_address: End position of the shape if it is included
            in a spreadsheet document.
        end_x: The x-coordinate of the end position of a shape relative
            to the top-left edge of a cell.
        end_y: The y-coordinate of the end position of a shape relative
            to the top-left edge of a cell.
        table_background: Wether the shape is in the table background if
            the drawing shape is included in a spreadsheet.
        anchor_type: How a drawing shape is bound to a text document.
        anchor_page: Physical page number of an anchor if the drawing
            object is bound to a page within a text document.
        xml_id: The unique XML ID.
    """
    kwargs.update(
        {
            "name": name,
            "style": style,
            "text_style": text_style,
            "draw_id": draw_id,
            "layer": layer,
            "presentation_class": presentation_class,
            "presentation_style": presentation_style,
            "caption_id": caption_id,
            "class_names": class_names,
            "transform": transform,
            "z_index": z_index,
            "end_cell_address": end_cell_address,
            "end_x": end_x,
            "end_y": end_y,
            "table_background": table_background,
            "anchor_type": anchor_type,
            "anchor_page": anchor_page,
            "xml_id": xml_id,
        }
    )
    super().__init__(**kwargs)
    if self._do_init:
        if corners:
            self.corners = corners
        if concave is not None:
            self.concave = concave
        if sharpness:
            self.sharpness = sharpness
        if position:
            self.position = position
        if size:
            self.size = size

ShapeBase

Bases: ListMixin, AnchorMix, SvgMixin, ZMix, Element

Base class for all drawing shapes.

This class provides common properties and methods for various shapes like lines, rectangles, ellipses, and connectors. It integrates sizing functionalities through mixins.

Methods:

Name Description
__init__

Initialize a ShapeBase element.

get_formatted_text

Return the formatted text content of the shape.

Attributes:

Name Type Description
anchor_page
anchor_type
caption_id
class_names
draw_id
end_cell_address
end_x
end_y
layer
name
presentation_class
presentation_style
style
table_background
text_style
transform
xml_id
z_index
Source code in odfdo/shapes.py
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
class ShapeBase(ListMixin, AnchorMix, SvgMixin, ZMix, Element):
    """Base class for all drawing shapes.

    This class provides common properties and methods for various shapes
    like lines, rectangles, ellipses, and connectors. It integrates sizing
    functionalities through mixins.
    """

    _tag = "draw:shape-odfdo-notodf"
    _properties: tuple[PropDef | PropDefBool, ...] = (
        PropDef("name", "draw:name"),
        PropDef("draw_id", "draw:id"),
        PropDef("layer", "draw:layer"),
        PropDef("presentation_class", "presentation:class-names"),
        PropDef("presentation_style", "presentation:style-name"),
        PropDef("style", "draw:style-name"),
        PropDef("text_style", "draw:text-style-name"),
        PropDef("caption_id", "draw:caption-id"),
        PropDef("class_names", "draw:class-names"),
        PropDef("transform", "draw:transform"),
        PropDef("end_cell_address", "table:end-cell-address"),
        PropDef("end_x", "table:end-x"),
        PropDef("end_y", "table:end-y"),
        PropDefBool("table_background", "table:table-background", False),
        PropDef("xml_id", "xml:id"),
    )

    def __init__(
        self,
        name: str | None = None,
        style: str | None = None,
        text_style: str | None = None,
        draw_id: str | None = None,
        layer: str | None = None,
        presentation_class: str | None = None,
        presentation_style: str | None = None,
        caption_id: str | None = None,
        class_names: str | None = None,
        transform: str | None = None,
        z_index: int | None = None,
        end_cell_address: str | None = None,
        end_x: str | None = None,
        end_y: str | None = None,
        table_background: bool | None = None,
        anchor_type: str | None = None,
        anchor_page: int | None = None,
        xml_id: str | None = None,
        **kwargs: Any,
    ) -> None:
        """Initialize a ShapeBase element.

        Args:
            name: Name of the graphical element.
            style: The style name for the shape.
            text_style: The text style name for the shape.
            draw_id: The unique ID for the drawing shape.
            layer: The drawing layer of the shape.
            presentation_class: White-space-separated list of presentation
                class names.
            presentation_style: Style for a presentation shape.
            caption_id: Target ID assigned to the "draw:text-box" that
                contains the caption.
            class_names: White-space-separated list of styles with the
                family value of graphic.
            transform: White-space or comma separated list of transform
                definitions.
            z_index: Rendering order for shapes in a document instance.
            end_cell_address: End position of the shape if it is included
                in a spreadsheet document.
            end_x: The x-coordinate of the end position of a shape relative
                to the top-left edge of a cell.
            end_y: The y-coordinate of the end position of a shape relative
                to the top-left edge of a cell.
            table_background: Wether the shape is in the table background if
                the drawing shape is included in a spreadsheet.
            anchor_type: How a drawing shape is bound to a text document.
            anchor_page: Physical page number of an anchor if the drawing
                object is bound to a page within a text document.
            xml_id: The unique XML ID.
        """
        super().__init__(**kwargs)
        if self._do_init:
            if name:
                self.name = name
            if style:
                self.style = style
            if text_style:
                self.text_style = text_style
            if draw_id:
                self.draw_id = draw_id
            if layer:
                self.layer = layer
            if presentation_class:
                self.presentation_class = presentation_class
            if presentation_style:
                self.presentation_style = presentation_style
            if caption_id:
                self.caption_id = caption_id
            if class_names:
                self.class_names = class_names
            if transform:
                self.transform = transform
            if z_index is not None:
                self.z_index = z_index
            if end_cell_address:
                self.end_cell_address = end_cell_address
            if end_x:
                self.end_x = end_x
            if end_y:
                self.end_y = end_y
            if table_background is not None:
                self.table_background = table_background
            if anchor_type:
                self.anchor_type = anchor_type
            if anchor_page is not None:
                self.anchor_page = anchor_page
            if xml_id:
                self.xml_id = xml_id

    def get_formatted_text(self, context: dict | None = None) -> str:
        """Return the formatted text content of the shape.

        Args:
            context: A dictionary of context variables.

        Returns:
            str: The formatted text content.
        """
        result: list[str] = []
        for child in self.children:
            result.append(child.get_formatted_text(context))
        result.append("\n")
        return "".join(result)

_properties class-attribute instance-attribute

_properties: tuple[PropDef | PropDefBool, ...] = (
    PropDef("name", "draw:name"),
    PropDef("draw_id", "draw:id"),
    PropDef("layer", "draw:layer"),
    PropDef(
        "presentation_class", "presentation:class-names"
    ),
    PropDef(
        "presentation_style", "presentation:style-name"
    ),
    PropDef("style", "draw:style-name"),
    PropDef("text_style", "draw:text-style-name"),
    PropDef("caption_id", "draw:caption-id"),
    PropDef("class_names", "draw:class-names"),
    PropDef("transform", "draw:transform"),
    PropDef("end_cell_address", "table:end-cell-address"),
    PropDef("end_x", "table:end-x"),
    PropDef("end_y", "table:end-y"),
    PropDefBool(
        "table_background", "table:table-background", False
    ),
    PropDef("xml_id", "xml:id"),
)

_tag class-attribute instance-attribute

_tag = 'draw:shape-odfdo-notodf'

anchor_page instance-attribute

anchor_page = anchor_page

anchor_type instance-attribute

anchor_type = anchor_type

caption_id instance-attribute

caption_id = caption_id

class_names instance-attribute

class_names = class_names

draw_id instance-attribute

draw_id = draw_id

end_cell_address instance-attribute

end_cell_address = end_cell_address

end_x instance-attribute

end_x = end_x

end_y instance-attribute

end_y = end_y

layer instance-attribute

layer = layer

name instance-attribute

name = name

presentation_class instance-attribute

presentation_class = presentation_class

presentation_style instance-attribute

presentation_style = presentation_style

style instance-attribute

style = style

table_background instance-attribute

table_background = table_background

text_style instance-attribute

text_style = text_style

transform instance-attribute

transform = transform

xml_id instance-attribute

xml_id = xml_id

z_index instance-attribute

z_index = z_index

__init__

__init__(
    name: str | None = None,
    style: str | None = None,
    text_style: str | None = None,
    draw_id: str | None = None,
    layer: str | None = None,
    presentation_class: str | None = None,
    presentation_style: str | None = None,
    caption_id: str | None = None,
    class_names: str | None = None,
    transform: str | None = None,
    z_index: int | None = None,
    end_cell_address: str | None = None,
    end_x: str | None = None,
    end_y: str | None = None,
    table_background: bool | None = None,
    anchor_type: str | None = None,
    anchor_page: int | None = None,
    xml_id: str | None = None,
    **kwargs: Any,
) -> None

Initialize a ShapeBase element.

Parameters:

Name Type Description Default
name str | None

Name of the graphical element.

None
style str | None

The style name for the shape.

None
text_style str | None

The text style name for the shape.

None
draw_id str | None

The unique ID for the drawing shape.

None
layer str | None

The drawing layer of the shape.

None
presentation_class str | None

White-space-separated list of presentation class names.

None
presentation_style str | None

Style for a presentation shape.

None
caption_id str | None

Target ID assigned to the “draw:text-box” that contains the caption.

None
class_names str | None

White-space-separated list of styles with the family value of graphic.

None
transform str | None

White-space or comma separated list of transform definitions.

None
z_index int | None

Rendering order for shapes in a document instance.

None
end_cell_address str | None

End position of the shape if it is included in a spreadsheet document.

None
end_x str | None

The x-coordinate of the end position of a shape relative to the top-left edge of a cell.

None
end_y str | None

The y-coordinate of the end position of a shape relative to the top-left edge of a cell.

None
table_background bool | None

Wether the shape is in the table background if the drawing shape is included in a spreadsheet.

None
anchor_type str | None

How a drawing shape is bound to a text document.

None
anchor_page int | None

Physical page number of an anchor if the drawing object is bound to a page within a text document.

None
xml_id str | None

The unique XML ID.

None
Source code in odfdo/shapes.py
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
def __init__(
    self,
    name: str | None = None,
    style: str | None = None,
    text_style: str | None = None,
    draw_id: str | None = None,
    layer: str | None = None,
    presentation_class: str | None = None,
    presentation_style: str | None = None,
    caption_id: str | None = None,
    class_names: str | None = None,
    transform: str | None = None,
    z_index: int | None = None,
    end_cell_address: str | None = None,
    end_x: str | None = None,
    end_y: str | None = None,
    table_background: bool | None = None,
    anchor_type: str | None = None,
    anchor_page: int | None = None,
    xml_id: str | None = None,
    **kwargs: Any,
) -> None:
    """Initialize a ShapeBase element.

    Args:
        name: Name of the graphical element.
        style: The style name for the shape.
        text_style: The text style name for the shape.
        draw_id: The unique ID for the drawing shape.
        layer: The drawing layer of the shape.
        presentation_class: White-space-separated list of presentation
            class names.
        presentation_style: Style for a presentation shape.
        caption_id: Target ID assigned to the "draw:text-box" that
            contains the caption.
        class_names: White-space-separated list of styles with the
            family value of graphic.
        transform: White-space or comma separated list of transform
            definitions.
        z_index: Rendering order for shapes in a document instance.
        end_cell_address: End position of the shape if it is included
            in a spreadsheet document.
        end_x: The x-coordinate of the end position of a shape relative
            to the top-left edge of a cell.
        end_y: The y-coordinate of the end position of a shape relative
            to the top-left edge of a cell.
        table_background: Wether the shape is in the table background if
            the drawing shape is included in a spreadsheet.
        anchor_type: How a drawing shape is bound to a text document.
        anchor_page: Physical page number of an anchor if the drawing
            object is bound to a page within a text document.
        xml_id: The unique XML ID.
    """
    super().__init__(**kwargs)
    if self._do_init:
        if name:
            self.name = name
        if style:
            self.style = style
        if text_style:
            self.text_style = text_style
        if draw_id:
            self.draw_id = draw_id
        if layer:
            self.layer = layer
        if presentation_class:
            self.presentation_class = presentation_class
        if presentation_style:
            self.presentation_style = presentation_style
        if caption_id:
            self.caption_id = caption_id
        if class_names:
            self.class_names = class_names
        if transform:
            self.transform = transform
        if z_index is not None:
            self.z_index = z_index
        if end_cell_address:
            self.end_cell_address = end_cell_address
        if end_x:
            self.end_x = end_x
        if end_y:
            self.end_y = end_y
        if table_background is not None:
            self.table_background = table_background
        if anchor_type:
            self.anchor_type = anchor_type
        if anchor_page is not None:
            self.anchor_page = anchor_page
        if xml_id:
            self.xml_id = xml_id

get_formatted_text

get_formatted_text(context: dict | None = None) -> str

Return the formatted text content of the shape.

Parameters:

Name Type Description Default
context dict | None

A dictionary of context variables.

None

Returns:

Name Type Description
str str

The formatted text content.

Source code in odfdo/shapes.py
155
156
157
158
159
160
161
162
163
164
165
166
167
168
def get_formatted_text(self, context: dict | None = None) -> str:
    """Return the formatted text content of the shape.

    Args:
        context: A dictionary of context variables.

    Returns:
        str: The formatted text content.
    """
    result: list[str] = []
    for child in self.children:
        result.append(child.get_formatted_text(context))
    result.append("\n")
    return "".join(result)