Class ShapeClassFactory

class ooodev.draw.shapes.shape_class_factory.ShapeClassFactory(*, owner, component, class_name='', lo_inst=None, base_class=<class 'ooodev.draw.shapes.draw_shape.DrawShape'>)[source]

Bases: OfficeDocumentPropPartial

” Generates a class instance of a shape.

If a shape supports a service, a partial class is created for that service. The partial class is a subclass of the DrawShape class.

The Service to partial class mapping is as follows:

  • com.sun.star.drawing.LineProperties -> ooodev.adapter.drawing.line_properties_partial.LinePropertiesPartial

  • com.sun.star.drawing.FillProperties -> ooodev.adapter.drawing.fill_properties_partial.FillPropertiesPartial

  • com.sun.star.drawing.ShadowProperties -> ooodev.adapter.drawing.shadow_properties_partial.ShadowPropertiesPartial

  • com.sun.star.drawing.RotationDescriptor -> ooodev.adapter.drawing.rotation_descriptor_properties_partial.RotationDescriptorPropertiesPartial

  • com.sun.star.drawing.TextProperties -> ooodev.adapter.drawing.text_properties_partial.TextPropertiesPartial

  • com.sun.star.document.LinkTarget-> ooodev.adapter.document.link_target_properties_partial.LinkTargetPropertiesPartial

If the shape supports the com.sun.star.drawing.GroupShape service, the following partial classes are implemented:

  • ooodev.adapter.drawing.shape_group_partial.ShapeGroupPartial

  • ooodev.adapter.drawing.shapes_partial.ShapesPartial

  • ooodev.adapter.drawing.rotation_descriptor_properties_partial.RotationDescriptorPropertiesPartial

  • ooodev.adapter.document.link_target_properties_partial.LinkTargetPropertiesPartial

If the shape supports the XGluePointsSupplier interface, the following partial class is also implemented:

  • ooodev.adapter.drawing.glue_points_supplier_partial.GluePointsSupplierPartial

If the shape document is of type DocType.IMPRESS (Impress document) and the shape supports the com.sun.star.presentation.Shape service, the following partial class is also implemented:

  • ooodev.adapter.presentation.shape_properties_partial.ShapePropertiesPartial

Parameters:
  • owner (Any) –

  • component (Any) –

  • class_name (str) –

  • lo_inst (LoInst | None) –

  • base_class (Type[Any]) –

__init__(*, owner, component, class_name='', lo_inst=None, base_class=<class 'ooodev.draw.shapes.draw_shape.DrawShape'>)[source]

Constructor

Parameters:
  • owner (Any) – Owner of the shape

  • component (Any) – UNO component that represents the shape

  • class_name (str, optional) – Class Name. Default to the name of the base_class.

  • lo_inst (LoInst | None, optional) – Load Office instance. Defaults to None.

  • base_class (Type[Any], optional) – Base Class Parent that the shape inherits from. Defaults to DrawShape.

Raises:

ValueError – _description_

Return type:

None

get_class(**kwargs)[source]

Gets the class instance of the shape.

The returned class instance is a subclass of DrawShape and the other partial classes that are supported by the shape.

Returns:

Shape class instance

Return type:

Any

property office_doc: OfficeDocumentT

Office Document.

Return type:

OfficeDocumentT