ooodev.format.inner.partial.factory_styler module

class ooodev.format.inner.partial.factory_styler.FactoryStyler(factory_name, component, lo_inst=None)[source]

Bases: FactoryNameBase

Class for Generic Styler.

This class is generally used as a helper to create partial classes that can style components, such as, ooodev.format.inner.partial.font.font_only_partial.FontOnlyPartial.

Parameters:
  • factory_name (str) –

  • component (Any) –

  • lo_inst (LoInst | None) –

__init__(factory_name, component, lo_inst=None)[source]

Constructor.

Parameters:
  • factory_name (str) – The name that the factory will use to get a style object.

  • component (Any) – The component the style will be applied to.

  • lo_inst (LoInst | None, optional) – Loader instance. Defaults to None. Used in multi-document environments.

Return type:

None

style(factory, **kwargs)[source]

Style Font.

Raises:

CancelEventError – If the before_* event is cancelled and not handled.

Returns:

Style instance or None if cancelled.

Return type:

Any

Parameters:
  • factory (Callable[[str], Any]) –

  • kwargs (Any) –

style_apply(style, **kwargs)[source]

Applies a know style to this component.

Parameters:
  • style (StyleT) – Style to Apply.

  • kwargs (Any) –

Returns:

Style that was Applied or None if cancelled.

Return type:

StyleT | None

style_get(factory, call_method_name='from_obj', event_name_suffix='_get', obj_arg_name='obj', **kwargs)[source]

Gets the Style.

Parameters:
  • factory (Callable[[str], Any]) – Factory function.

  • call_method_name (str) – Method name to call. Defaults to “from_obj”.

  • event_name_suffix (str) – Event name suffix. Defaults to “_get”.

  • obj_arg_name (str) – Object argument name. Defaults to “obj”. If empty, the object is not passed to the method.

  • kwargs (Any) – Keyword arguments to pass to factory method.

Raises:

CancelEventError – If the event is cancelled and not handled.

Returns:

Area transparency style or None if cancelled.

Return type:

TransparencyT | None