ooodev.format.inner.direct.draw.shape.position_size.size module

class ooodev.format.inner.direct.draw.shape.position_size.size.Size(width, height, base_point=ShapeBasePointKind.TOP_LEFT)[source]

Bases: Size

Positions a shape.

New in version 0.17.3.

__init__(width, height, base_point=ShapeBasePointKind.TOP_LEFT)[source]

Constructor

Parameters:
  • width (float | UnitT) – Specifies the width of the shape (in mm units) or Class UnitT.

  • height (float | UnitT) – Specifies the height of the shape (in mm units) or Class UnitT.

  • base_point (ShapeBasePointKind) – Specifies the base point of the shape used to calculate the X and Y coordinates. Default is TOP_LEFT.

Return type:

None

apply(obj, **kwargs)[source]

Applies properties to obj

Parameters:

obj (Any) – UNO object.

Return type:

None

copy(**kwargs)[source]

Copy the current instance.

Returns:

The copied instance.

Return type:

Size

classmethod from_obj(obj)[source]
classmethod from_obj(obj, **kwargs)
classmethod from_obj(obj, **kwargs)

Gets size from obj

Parameters:

obj (Any) – UNO Shape object.

Returns:

New instance.

Return type:

Size

property prop_base_point: ShapeBasePointKind

Gets/Sets the base point of the shape used to calculate the X and Y coordinates.

Returns:

Base point.

Return type:

ShapeBasePointKind

ooodev.format.inner.direct.draw.shape.position_size.size.calculate_x_and_y_from_point_kind(x, y, orig_size, new_size, point_kind)[source]

Calculates the x and y coordinates from the point kind for a shapes size.

Parameters:
  • x (int) – x in 1/100th mm.

  • y (int) – y in 1/100th mm.

  • orig_size (Size) – Shape original size in 1/100th mm.

  • new_size (Size) – Shape new size in 1/100th mm.

  • point_kind (ShapeBasePointKind) – Point Kind

Raises:
  • ValueError – If Shape size is <= 0.

  • ValueError – Unknown point_kind.

Returns:

Size in 1/100th mm.

Return type:

Size