ooodev.adapter.ui.accelerator_configuration_partial module

class ooodev.adapter.ui.accelerator_configuration_partial.AcceleratorConfigurationPartial(component, interface=com.sun.star.ui.XAcceleratorConfiguration)[source]

Bases: UIConfigurationPersistencePartial, UIConfigurationStoragePartial, UIConfigurationPartial

Partial Class for XAcceleratorConfiguration.

Parameters:
  • component (XAcceleratorConfiguration) –

  • interface (UnoInterface | None) –

__init__(component, interface=com.sun.star.ui.XAcceleratorConfiguration)[source]

Constructor

Parameters:
  • component (XAcceleratorConfiguration) – UNO Component that implements com.sun.star.ui.XAcceleratorConfiguration.

  • interface (UnoInterface, optional) – The interface to be validated. Defaults to XAcceleratorConfiguration.

Return type:

None

get_all_key_events()[source]

Gets the list of all key events, which are available at this configuration set.

The key events are the primary keys of this configuration sets. Means: Commands are registered for key events.

Such key event can be mapped to its bound command, using the method get_command_for_key_event().

Return type:

Tuple[KeyEvent, ...]

get_command_by_key_event(key_event)[source]

Gets the registered command for the specified key event.

This function can be used to:

Raises:

com.sun.star.container.NoSuchElementExceptionNoSuchElementException

Return type:

str

Parameters:

key_event (com.sun.star.awt.KeyEvent) –

get_key_events_by_command(cmd)[source]

Optimized access to the relation command-key instead of key-command which is provided normally by this interface.

It can be used to implement collision handling, if more than one key event match to the same command. The returned list contains all possible key events - and the outside code can select a possible one. Of course - mostly this list will contain only one key event.

Raises:

com.sun.star.container.NoSuchElementExceptionNoSuchElementException

Return type:

Tuple[KeyEvent, ...]

Parameters:

cmd (str) –

get_preferred_key_events_for_command_list(*cmd_args)[source]

Optimized function to map a list of commands to a corresponding list of key events.

It provides a fast mapping, which is e.g. needed by a menu or toolbar implementation. E.g. a sub menu is described by a list of commands - and the implementation of the menu must show the corresponding shortcuts. Iteration over all items of this configuration set can be very expensive.

Instead to the method get_key_events_for_command() the returned list contains only one(!) key event bound to one(!) requested command. If more than one key event is bound to a command - a selection is done inside this method. This internal selection can’t be influenced from outside.

Raises:
  • com.sun.star.lang.IllegalArgumentExceptionIllegalArgumentException

  • com.sun.star.container.NoSuchElementExceptionNoSuchElementException

Return type:

Tuple[KeyEvent, ...]

Parameters:

cmd_args (str) –

remove_command_from_all_key_events(cmd)[source]

search for a key-command-binding inside this configuration set, where the specified command is used.

If such binding could be located, the command will be removed from it. If as result of that the key binding will be empty, if will be removed too.

This is an optimized method, which can perform removing of commands from this configuration set. Because normally Commands are foreign keys and key identifier the primary keys - it needs some work to remove all commands outside this container.

Raises:

com.sun.star.container.NoSuchElementExceptionNoSuchElementException

Return type:

None

Parameters:

cmd (str) –

remove_key_event(key_event)[source]

Remove a key-command-binding from this configuration set.

Raises:

com.sun.star.container.NoSuchElementExceptionNoSuchElementException

Return type:

None

Parameters:

key_event (com.sun.star.awt.KeyEvent) –

set_key_event(key_event, cmd)[source]

Modify or create a key - command - binding.

If the specified key event does not already exists inside this configuration access, it will be created and the command will be registered for it. If the specified key event already exists, its command will be overwritten with the new command. There is no warning nor any error about that! The outside code has to use the method getCommandForKeyEvent() to check for possible collisions.

Note

This method can’t be used to remove entities from the configuration set. Empty parameters will result into an exception! Use the method remove_key_event() instead.

Raises:
  • com.sun.star.lang.IllegalArgumentExceptionIllegalArgumentException

  • com.sun.star.container.NoSuchElementExceptionNoSuchElementException

Return type:

None

Parameters:
  • key_event (com.sun.star.awt.KeyEvent) –

  • cmd (str) –

ooodev.adapter.ui.accelerator_configuration_partial.get_builder(component)[source]

Get the builder for the component.

Parameters:

component (Any) – The component.

Returns:

Builder instance.

Return type:

DefaultBuilder