Class ShapeFactory

class ooodev.draw.shapes.shape_factory.ShapeFactory(owner, lo_inst=None)[source]

Bases: ShapeFactoryPartial

Shape Factory class.

__init__(owner, lo_inst=None)

Constructor

Parameters:
  • owner (_T) – Owner object.

  • lo_inst (LoInst | None, optional) – Lo Instance. Defaults to None.

Return type:

None

is_know_shape(shape)

Checks if a shape is known by this factory.

Parameters:

shape (XShape) – UNO object of a shape.

Returns:

True if shape is known; Otherwise, False.

Return type:

bool

shape_factory(shape)

Gets a ShapeBase object from a XShape object.

Parameters:

shape (XShape) – UNO object of a shape.

Raises:

ValueError – If shape does not have ShapeType property.

Returns:

Object the inherits from ShapeBase such as RectangleShape or EllipseShape. If ShapeType of shape is not a match then DrawShape[_T] is returned.

Return type:

ShapeBase[_T]

property office_doc: OfficeDocumentT

Office Document.

Return type:

OfficeDocumentT