ooodev.format.writer.direct.obj.area package

Module contents

ooodev.format.writer.direct.obj.area.Color

alias of FillColor

class ooodev.format.writer.direct.obj.area.Gradient(*, style=GradientStyle.LINEAR, step_count=0, offset=Offset(x=50, y=50), angle=0, border=0, grad_color=ColorRange(start=0, end=16777215), grad_intensity=IntensityRange(start=100, end=100), name='')[source]

Bases: StyleMulti

Paragraph Gradient Color

New in version 0.9.0.

__init__(*, style=GradientStyle.LINEAR, step_count=0, offset=Offset(x=50, y=50), angle=0, border=0, grad_color=ColorRange(start=0, end=16777215), grad_intensity=IntensityRange(start=100, end=100), name='')[source]

Constructor

Parameters:
  • style (GradientStyle, optional) – Specifies the style of the gradient. Defaults to GradientStyle.LINEAR.

  • step_count (int, optional) – Specifies the number of steps of change color. Defaults to 0.

  • offset (Offset, int, optional) – Specifies the X and Y coordinate, where the gradient begins. X is effectively the center of the RADIAL, ELLIPTICAL, SQUARE and RECT style gradients. Defaults to Offset(50, 50).

  • angle (Angle, int, optional) – Specifies angle of the gradient. Defaults to 0.

  • border (int, optional) – Specifies percent of the total width where just the start color is used. Defaults to 0.

  • grad_color (ColorRange, optional) – Specifies the color at the start point and stop point of the gradient. Defaults to ColorRange(Color(0), Color(16777215)).

  • grad_intensity (IntensityRange, optional) – Specifies the intensity at the start point and stop point of the gradient. Defaults to IntensityRange(100, 100).

  • name (str, optional) – Specifies the Fill Gradient Name.

Return type:

None

copy()[source]
copy(**kwargs)
copy(**kwargs)

Gets a copy of instance as a new instance

Return type:

TypeVar(_TGradient, bound= Gradient)

Parameters:

self (_TGradient) –

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

Gets instance from object.

Parameters:

obj (object) – UNO object.

Raises:

NotSupportedError – If obj is not supported.

Returns:

Instance that represents Gradient color.

Return type:

Gradient

classmethod from_preset(preset)[source]
classmethod from_preset(preset, **kwargs)
classmethod from_preset(preset, **kwargs)

Gets instance from preset.

Parameters:

preset (PresetGradientKind) – Preset.

Returns:

Gradient from a preset.

Return type:

Gradient

classmethod from_struct(struct, name='', **kwargs)[source]

Gets instance from GradientStruct instance

Parameters:
  • struct (GradientStruct) – Gradient Struct instance.

  • name (str, optional) – Name of Gradient.

Return type:

Gradient

property default: _TGradient

Gets Gradient empty.

Return type:

TypeVar(_TGradient, bound= Gradient)

property prop_format_kind: FormatKind

Gets the kind of style

Return type:

FormatKind

property prop_inner: GradientStruct

Gets Fill styles instance

Return type:

GradientStruct

property prop_name: str

Gets Current gradient Name

Return type:

str

class ooodev.format.writer.direct.obj.area.Hatch(*, style=HatchStyle.SINGLE, color=0, space=0.0, angle=0, bg_color=-1)[source]

Bases: StyleMulti

Class for Fill Properties Fill Hatch.

New in version 0.9.0.

__init__(*, style=HatchStyle.SINGLE, color=0, space=0.0, angle=0, bg_color=-1)[source]

Constructor

Parameters:
  • style (HatchStyle, optional) – Specifies the kind of lines used to draw this hatch. Default HatchStyle.SINGLE.

  • color (Color, optional) – Specifies the color of the hatch lines. Default 0.

  • space (float, UnitT, optional) – Specifies the space between the lines in the hatch (in mm units) or Class UnitT. Default 0.0

  • angle (Angle, int, optional) – Specifies angle of the hatch in degrees. Default to 0.

  • bg_color (Color, optional) – Specifies the background Color. Set this -1 (default) for no background color.

Return type:

None

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

Applies styles to object

Parameters:

obj (object) – UNO object that has supports com.sun.star.style.FillProperties or com.sun.star.beans.PropertySet service.

Return type:

None

copy()[source]
copy(**kwargs)
copy(**kwargs)

Gets a copy of instance as a new instance

Return type:

TypeVar(_THatch, bound= Hatch)

Parameters:

self (_THatch) –

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

Gets instance from object

Parameters:

obj (object) – UNO object.

Raises:

NotSupportedError – If obj is not supported.

Returns:

Hatch instance that represents obj hatch pattern.

Return type:

Hatch

classmethod from_preset(preset)[source]
classmethod from_preset(preset, **kwargs)
classmethod from_preset(preset, **kwargs)

Gets an instance from a preset.

Parameters:

preset (PresetHatchKind) – Preset.

Returns:

Instance from preset.

Return type:

Hatch

property prop_angle: Angle

Gets/Sets angle of the hatch.

Return type:

Angle

property prop_bg_color: Color

Gets sets if fill image is tiled

Return type:

NewType()(Color, int)

property prop_color: Color

Gets/Sets the color of the hatch lines.

Return type:

NewType()(Color, int)

property prop_distance: UnitMM

Alias of prop_space

Return type:

UnitMM

property prop_format_kind: FormatKind

Gets the kind of style

Return type:

FormatKind

property prop_inner_color: FillColor

Gets/Sets Fill Color instance

Return type:

FillColor

property prop_inner_hatch: HatchStruct

Gets/Sets Hatch Struct instance

Return type:

HatchStruct

property prop_space: UnitMM

Gets/Sets the distance between the lines in the hatch (in mm units).

Return type:

UnitMM

property prop_style: HatchStyle

Gets/Sets the style of the hatch.

Return type:

HatchStyle

class ooodev.format.writer.direct.obj.area.Img(*, bitmap=None, name='', mode=ImgStyleKind.TILED, size=None, position=None, pos_offset=None, tile_offset=None, auto_name=False)[source]

Bases: StyleBase

Class for Fill Properties Fill Image.

New in version 0.9.0.

__init__(*, bitmap=None, name='', mode=ImgStyleKind.TILED, size=None, position=None, pos_offset=None, tile_offset=None, auto_name=False)[source]

Constructor

Parameters:
  • bitmap (XBitmap, optional) – Bitmap instance. If name is not already in the Bitmap Table then this property is required.

  • name (str, optional) – Specifies the name of the image. This is also the name that is used to store bitmap in LibreOffice Bitmap Table.

  • mode (ImgStyleKind, optional) – Specifies the image style, tiled, stretched etc. Default ImgStyleKind.TILED.

  • size (SizePercent, SizeMM, optional) – Size in percent (0 - 100) or size in mm units.

  • position (RectanglePoint) – Tiling position of Image.

  • pos_offset (Offset, optional) – Tiling position offset.

  • tile_offset (OffsetColumn, OffsetRow, optional) – The tiling offset.

  • auto_name (bool, optional) – Specifies if name is ensured to be unique. Defaults to False.

Return type:

None

Note

If auto_name is False then a bitmap for a given name is only required the first call. All subsequent call of the same name will retrieve the bitmap form the LibreOffice Bitmap Table.

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

Applies styles to object

Parameters:

obj (object) – UNO object that has supports com.sun.star.style.FillProperties or com.sun.star.beans.PropertySet service.

Return type:

None

copy()[source]
copy(**kwargs)
copy(**kwargs)

Gets a copy of instance as a new instance

Return type:

TypeVar(_TImg, bound= Img)

Parameters:

self (_TImg) –

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

Gets instance from object

Parameters:

obj (object) – UNO object.

Raises:

NotSupportedError – If obj is not supported.

Returns:

Img instance that represents obj fill image.

Return type:

Img

classmethod from_preset(preset)[source]
classmethod from_preset(preset, **kwargs)
classmethod from_preset(preset, **kwargs)

Gets an instance from a preset.

Parameters:

preset (PresetImageKind) – Preset.

Returns:

Instance from preset.

Return type:

Img

on_property_restore_setting(source, event_args)[source]

Triggers before each property that is about to be set during restore

Parameters:
  • source (Any) – Event Source.

  • event_args (KeyValueCancelArgs) – Event Args

Return type:

None

property prop_bitmap: XBitmap | None

Gets bitmap

Return type:

XBitmap | None

property prop_format_kind: FormatKind

Gets the kind of style

Return type:

FormatKind

property prop_is_offset_column: bool

Gets if the offset value is a column offset.

Return type:

bool

property prop_is_offset_row: bool

Gets if the offset value is a row offset.

Return type:

bool

property prop_is_size_mm: bool

Gets if size is stored in mm units.

Return type:

bool

property prop_is_size_percent: bool

Gets if size is stored in percentage units.

Return type:

bool

property prop_mode: ImgStyleKind | None

Gets/Sets if fill image is tiled

Return type:

ImgStyleKind | None

property prop_pos_offset: Offset | None

Gets/Sets Position Offset

Return type:

Offset | None

property prop_position: RectanglePoint | None

Gets/Sets if fill image is tiled

Return type:

RectanglePoint | None

property prop_size: SizePercent | SizeMM | None

Gets/Sets if fill image is stretched

Return type:

SizePercent | SizeMM | None

property prop_tile_offset: OffsetColumn | OffsetRow | None

Gets/Sets Tile Offset

Return type:

OffsetColumn | OffsetRow | None

class ooodev.format.writer.direct.obj.area.Pattern(*, bitmap=None, name='', tile=True, stretch=False, auto_name=False)[source]

Bases: StyleBase

Class for Fill Properties Fill Pattern.

New in version 0.9.0.

__init__(*, bitmap=None, name='', tile=True, stretch=False, auto_name=False)[source]

Constructor

Parameters:
  • bitmap (XBitmap, optional) – Bitmap instance. If name is not already in the Bitmap Table then this property is required.

  • name (str, optional) – Specifies the name of the pattern. This is also the name that is used to store bitmap in LibreOffice Bitmap Table.

  • tile (bool, optional) – Specified if bitmap is tiled. Defaults to True.

  • stretch (bool, optional) – Specifies if bitmap is stretched. Defaults to False.

  • auto_name (bool, optional) – Specifies if name is ensured to be unique. Defaults to False.

Return type:

None

Note

If auto_name is False then a bitmap for a given name is only required the first call. All subsequent call of the same name will retrieve the bitmap form the LibreOffice Bitmap Table.

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

Applies styles to object

Parameters:

obj (object) – UNO object that has supports com.sun.star.style.FillProperties or com.sun.star.beans.PropertySet service.

Return type:

None

copy()[source]
copy(**kwargs)
copy(**kwargs)

Gets a copy of instance as a new instance

Return type:

TypeVar(_TPattern, bound= Pattern)

Parameters:

self (_TPattern) –

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

Gets instance from object

Parameters:

obj (object) – UNO object.

Raises:

NotSupportedError – If obj is not supported.

Returns:

Pattern instance that represents obj fill pattern.

Return type:

Pattern

classmethod from_preset(preset)[source]
classmethod from_preset(preset, **kwargs)
classmethod from_preset(preset, **kwargs)

Gets an instance from a preset.

Parameters:

preset (PresetPatternKind) – Preset.

Returns:

Pattern instance from preset.

Return type:

Pattern

on_property_restore_setting(source, event_args)[source]

Triggers before each property that is about to be set during restore

Parameters:
  • source (Any) – Event Source.

  • event_args (KeyValueCancelArgs) – Event Args

Return type:

None

property prop_format_kind: FormatKind

Gets the kind of style

Return type:

FormatKind

property prop_stretch: bool

Gets sets if fill image is stretched

Return type:

bool

property prop_tile: bool

Gets sets if fill image is tiled

Return type:

bool