ooodev.format.inner.direct.draw.shape.position_size.position module
- class ooodev.format.inner.direct.draw.shape.position_size.position.Position(pos_x, pos_y, base_point=ShapeBasePointKind.TOP_LEFT)[source]
Bases:
Position
Positions a shape.
New in version 0.17.3.
- __init__(pos_x, pos_y, base_point=ShapeBasePointKind.TOP_LEFT)[source]
Constructor
- Parameters:
pos_x (float | UnitT) – Specifies the x-coordinate of the position of the shape (in
mm
units) or Class UnitT.pos_y (float | UnitT) – Specifies the y-coordinate of the position 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
Note
pos_x
andpos_y
are the coordinates of the shape inside the draw page borders. This is the same behavior as the dialog box. If the draw page has a border of 10mm and the shape is positioned at 0mm,0mm in the dialog box then the shape is actually at 10mm,10mm relative to the draw page document.
- apply(obj, **kwargs)[source]
Applies position properties to
obj
- Parameters:
obj (Any) – UNO object.
- Return type:
None
- classmethod from_obj(obj)[source]
- classmethod from_obj(obj, **kwargs)
- classmethod from_obj(obj, **kwargs)
Creates a new instance from
obj
.- Parameters:
obj (Any) – UNO Shape object.
- Returns:
New instance.
- Return type:
- 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:
- ooodev.format.inner.direct.draw.shape.position_size.position.calculate_point_from_point_kind(x, y, shape_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
.shape_size (Size) – Shape 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: