ooodev.format.proto.style_t module

protocol ooodev.format.proto.style_t.StyleT[source]

Bases: Protocol

Style base Protocol

Classes that implement this protocol must have the following methods / attributes:

__init__(*args, **kwargs)
add_event_listener(event_name, callback)[source]

Add an event listener to current instance.

Parameters:
  • event_name (str) – Event Name.

  • callback (EventCallback) – Callback of the event listener.

Return type:

None

Note

This method is generally only used in the context of child classes.

add_event_observer(*args)[source]

Adds observers that gets their trigger method called when this class trigger method is called.

Parameters:

args (EventObserver) – One or more observers to add.

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.CharacterProperties service.

  • **kwargs (Any, optional) – Expandable list of key value pairs.

Return type:

None

backup(obj)[source]

Backs up Attributes that are to be changed by apply.

If used method should be called before apply.

Parameters:

obj (Any) – Object to backup properties from.

Return type:

None

copy() Any
copy(**kwargs) Any
copy(**kwds)

Helper for @overload to raise when called.

get_attrs()[source]

Gets the attributes that are slated for change in the current instance

Returns:

Tuple of attributes

Return type:

Tuple(str, …)

get_props()[source]

Gets instance properties

Returns:

Tuple of properties.

Return type:

Tuple[PropertyValue, …]

get_update_obj()[source]

Gets the update object for the style instance.

Return type:

Any

has_update_obj()[source]

Gets if the update object is set. for the style instance.

Return type:

bool

on_applied(source, event_args)[source]

Triggers after style/format is applied.

Parameters:
  • source (Any) – Event Source.

  • event_args (KeyValArgs) – Event Args

Return type:

None

on_applying(source, event_args)[source]

Triggers before style/format is applied.

Parameters:
  • source (Any) – Event Source.

  • event_args (CancelEventArgs) – Event Args

Return type:

None

on_property_backed_up(source, event_args)[source]

Triggers before each property that is about to be set during backup.

Parameters:
  • source (Any) – Event Source.

  • event_args (KeyValArgs) – Event Args

Return type:

None

on_property_backing_up(source, event_args)[source]

Triggers before each property that is about to be backup up during backup.

Parameters:
  • source (Any) – Event Source.

  • event_args (KeyValueCancelArgs) – Event Args.

Return type:

None

on_property_restore_set(source, event_args)[source]

Triggers for each property that has been set during restore

Parameters:
  • source (Any) – Event Source.

  • event_args (KeyValArgs) – Event Args

Return type:

None

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

on_property_set(source, event_args)[source]

Triggers for each property that is set.

Parameters:
  • source (Any) – Event Source.

  • event_args (KeyValArgs) – Event Args

Return type:

None

on_property_set_error(source, event_args)[source]

Triggers for each property that fails to set.

Parameters:
  • source (Any) – Event Source.

  • event_args (KeyValArgs) – Event Args

Return type:

None

remove_event_listener(event_name, callback)[source]

Remove an event listener from current instance.

Parameters:
  • event_name (str) – Event Name.

  • callback (EventCallback) – Callback of the event listener.

Return type:

None

Note

This method is generally only used in the context of child classes.

remove_event_observer(observer)[source]

Removes an observer.

Parameters:

observer (EventObserver) – Observers to remove.

Returns:

True if observer has been removed; Otherwise, False.

Return type:

bool

New in version 0.30.1.

restore(obj, clear=Ellipsis)[source]

Restores obj properties from backed up setting if any exist.

Restore can only be effective if backup() has be run before calling this method.

Parameters:
  • obj (Any) – Object to restore properties on.

  • clear (bool) – Determines if backup is cleared after restore. Default False

Return type:

None

set_update_obj(obj)[source]

Sets the update object for the style instance.

Parameters:

obj (Any) – Object used to apply style to when update is called.

Return type:

None

support_service(*service)[source]

Gets if service is supported.

Parameters:

service (str) – expandable list of service names of UNO services such as com.sun.star.text.TextFrame.

Returns:

True if service is supported; Otherwise, False.

Return type:

bool

update() bool
update(**kwargs: Any) bool
update(**kwds)

Helper for @overload to raise when called.

__protocol_attrs__ = {'add_event_listener', 'add_event_observer', 'apply', 'backup', 'copy', 'get_attrs', 'get_props', 'get_update_obj', 'has_update_obj', 'on_applied', 'on_applying', 'on_property_backed_up', 'on_property_backing_up', 'on_property_restore_set', 'on_property_restore_setting', 'on_property_set', 'on_property_set_error', 'prop_format_kind', 'prop_has_attribs', 'prop_has_backup', 'prop_parent', 'remove_event_listener', 'remove_event_observer', 'restore', 'set_update_obj', 'support_service', 'update'}
property prop_format_kind: FormatKind

Gets the kind of style

Return type:

FormatKind

property prop_has_attribs: bool

Gets If instance has any attributes set.

Return type:

bool

property prop_has_backup: bool

Gets If instance has backup data set.

Return type:

bool

property prop_parent: Any

Gets Parent Class

Return type:

Any