ooodev.format.writer.direct.para.alignment package

Module contents

class ooodev.format.writer.direct.para.alignment.Alignment(*, align=None, align_vert=None, txt_direction=None, align_last=None, expand_single_word=None, snap_to_grid=None)[source]

Bases: StyleMulti

Paragraph Alignment

Any properties starting with prop_ set or get current instance values.

All methods starting with fmt_ can be used to chain together properties.

New in version 0.9.0.

__init__(*, align=None, align_vert=None, txt_direction=None, align_last=None, expand_single_word=None, snap_to_grid=None)[source]

Constructor

Parameters:
  • align (ParagraphAdjust, optional) – Determines horizontal alignment of a paragraph.

  • align_vert (ParagraphVertAlignEnum, optional) – Determines vertical alignment of a paragraph.

  • text_direction (WritingMode, optional) – Determines the text direction.

  • align_last (LastLineKind, optional) – Determines the adjustment of the last line.

  • expand_single_word (bool, optional) – Determines if single words are stretched. It is only valid if align and align_last are also valid.

  • snap_to_grid (bool, optional) – Determines snap to text grid (if active).

  • txt_direction (WritingMode | None) –

Return type:

None

Hint

  • ParagraphAdjust can be imported from ooo.dyn.style.paragraph_adjust

  • ParagraphVertAlignEnum can be imported from ooo.dyn.text.paragraph_vert_align

  • LastLineKind can be imported from ooodev.format.writer.direct.para.alignment

  • WritingMode can be imported from ooodev.format.inner.direct.write.para.align

  • WritingMode2Enum can be imported from oo.dyn.text.writing_mode2.

apply(obj: Any)[source]
apply(obj: Any, **kwargs)
apply(obj, **kwargs)

Applies alignment to obj

Parameters:

obj (object) – UNO object that supports com.sun.star.style.ParagraphProperties service.

Return type:

None

static convert_int_to_paragraph_adjust(num)[source]

Converts integer value to ParagraphAdjust.

When Writer saves ParagraphAdjust value into ParaAdjust it converts it to a integer value.

Parameters:

num (int) – Number to convert

Returns:

Number as ParagraphAdjust

Return type:

ParagraphAdjust

fmt_align(value)[source]

Gets copy of instance with horizontal alignment set or removed

Parameters:
  • value (ParagraphAdjust | None) – Alignment value

  • self (_TAlignment) –

Returns:

Alignment instance

Return type:

Alignment

fmt_align_last(value)[source]

Gets copy of instance with align last set or removed

Parameters:
  • value (LastLineKind | None) – Align last value

  • self (_TAlignment) –

Returns:

Alignment instance

Return type:

Alignment

fmt_align_vert(value)[source]

Gets copy of instance with vertical alignment set or removed

Parameters:
  • value (ParagraphVertAlignEnum | None) – Alignment value

  • self (_TAlignment) –

Returns:

Alignment instance

Return type:

Alignment

fmt_expand_single_word(value)[source]

Gets copy of instance with expand single word set or removed

Parameters:
  • value (LastLineKind | None) – Expand single word value

  • self (_TAlignment) –

Returns:

Alignment instance

Return type:

Alignment

fmt_snap_to_grid(value)[source]

Gets copy of instance with snap to grid set or removed

Parameters:
  • value (LastLineKind | None) – Snap to grid value

  • self (_TAlignment) –

Returns:

Alignment instance

Return type:

Alignment

fmt_txt_direction(value)[source]

Gets copy of instance with vertical alignment set or removed

Parameters:
  • value (ParagraphVertAlignEnum | None) – Alignment value

  • self (_TAlignment) –

Returns:

Alignment instance

Return type:

Alignment

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

Gets Padding instance from object

Parameters:

obj (object) – UNO object.

Raises:

NotSupportedError – If obj is not supported.

Returns:

Alignment that represents obj alignment.

Return type:

Alignment

property align_center: _TAlignment

Gets copy of instance with align set to center

Return type:

TypeVar(_TAlignment, bound= Alignment)

property align_left: _TAlignment

Gets copy of instance with align set to left

Return type:

TypeVar(_TAlignment, bound= Alignment)

property align_right: _TAlignment

Gets copy of instance with align set to left

Return type:

TypeVar(_TAlignment, bound= Alignment)

property default: _TAlignment

Gets Alignment default.

Return type:

TypeVar(_TAlignment, bound= Alignment)

property expand_single_word: _TAlignment

Gets copy of instance with expand single word set

Return type:

TypeVar(_TAlignment, bound= Alignment)

property justified: _TAlignment

Gets copy of instance with align set to block

Return type:

TypeVar(_TAlignment, bound= Alignment)

property prop_align: ParagraphAdjust | None

Gets/Sets horizontal alignment of a paragraph.

Return type:

ParagraphAdjust | None

property prop_align_last: LastLineKind | None

Gets/Sets the adjustment of the last line.

Return type:

LastLineKind | None

property prop_align_vert: ParagraphVertAlignEnum | None

Gets/Sets vertical alignment of a paragraph.

Return type:

ParagraphVertAlignEnum | None

property prop_expand_single_word: bool | None

Gets/Sets Determines if single words are stretched.

It is only valid if prop_align and prop_align_last are also valid.

Return type:

bool | None

property prop_format_kind: FormatKind

Gets the kind of style

Return type:

FormatKind

property prop_inner_mode: WritingMode | None

Gets Writing Mode (txt_direction) instance if exist.

Return type:

WritingMode | None

property prop_snap_to_grid: bool | None

Gets/Sets snap to text grid (if active).

Return type:

bool | None

property snap_to_grid: _TAlignment

Gets copy of instance with snap to grid set

Return type:

TypeVar(_TAlignment, bound= Alignment)

class ooodev.format.writer.direct.para.alignment.WritingMode(mode=None)[source]

Bases: AbstractWritingMode

Paragraph Writing Mode

Any properties starting with prop_ set or get current instance values.

All methods starting with fmt_ can be used to chain together properties.

New in version 0.9.0.

fmt_mode(value)[source]

Gets copy of instance with writing mode set or removed

Parameters:
  • value (WritingMode2Enum | None) – mode value

  • self (_TWritingMode) –

Returns:

WritingMode instance

Return type:

WritingMode

property bt_lr: _TWritingMode

Gets instance.

Text within a line is written bottom-to-top. Lines and blocks are placed left-to-right.

Return type:

TypeVar(_TWritingMode, bound= WritingMode)

property context: _TWritingMode

Gets instance.

Obtain actual writing mode from the context of the object.

Return type:

TypeVar(_TWritingMode, bound= WritingMode)

property lr_tb: _TWritingMode

Gets instance.

Text within lines is written left-to-right. Lines and blocks are placed top-to-bottom. Typically, this is the writing mode for normal alphabetic text.

Return type:

TypeVar(_TWritingMode, bound= WritingMode)

property page: _TWritingMode

Gets instance.

Obtain writing mode from the current page. May not be used in page styles.

Return type:

TypeVar(_TWritingMode, bound= WritingMode)

property rl_tb: _TWritingMode

Gets instance.

Text within a line are written right-to-left. Lines and blocks are placed top-to-bottom. Typically, this writing mode is used in Arabic and Hebrew text.

Return type:

TypeVar(_TWritingMode, bound= WritingMode)

property tb_lr: _TWritingMode

Gets instance.

Text within a line is written top-to-bottom. Lines and blocks are placed left-to-right. Typically, this writing mode is used in Mongolian text.

Return type:

TypeVar(_TWritingMode, bound= WritingMode)

property tb_rl: _TWritingMode

Gets instance.

Text within a line is written top-to-bottom. Lines and blocks are placed right-to-left. Typically, this writing mode is used in Chinese and Japanese text.

Return type:

TypeVar(_TWritingMode, bound= WritingMode)