Proposal v0.2


A new keyboard shortcut implementation



Due to our efforts making the office accessible we have to solve some problems regarding keyboard shortcuts. This is a chance to enhance our current implementation for a better user convenience.


The following list shows problems regarding our current keyboard shortcut implementation:


A new implementation should use our new XML configuration files. It should support sfx and non-sfx based components to enable a better integration of newly written components, like OpenOffice-based ones. So the new implementation must be based on UNO-interfaces and should support querying, changing, extending and applying configuration data through this API. This proposal describes an architecture that can be used for all our UI configuration data.


The new implementation has three configuration levels:

























































The implementation should work with two different kinds of configurations:



The one instance implementation gives access to the office configuration and can create all supported component based settings objects through a XMultiServiceFactory interface. The controller has references to two different kinds of configurations:


The controller implements an interface to give access to the component and document settings objects. These setting objects support loading/saving a XML based configuration (through XInput- XoutputStream) and to get, add, remove and replace keyboard shortcuts. These settings objects can be applied to the controller or the global configuration. So it is possible to have generic access to this data for example for an UI dialog that supports changing the configuration. As the access is granted through UNO interfaces an external developer is able to use this implementation, too.


Saving and loading a configuration would work in the following way. The controller knows its “component” and the current configuration type (for example keyboard ). It asks the “global configuration storage service” for a stream that stores data for a “writer keyboard” configuration. So the knowledge output the real storage is only known by this service, all other implementation uses XInputStream and XOutputStream to fulfill their work. This stream is given to the concrete settings object that knows how to store its data as an XML stream and Save( stream ) is called.


The controller supports a function MapKeyToFunction to get a mapping between a com.sun.star.awt.KeyEvent and a function. It should first make a lookup into the office configuration to find a valid mapping if this is not successful the controller has to ask the component settings object and last the document settings object. So the call hierachy would be:

“office cfg” ->

“component cfg” ->

“document cfg”.


The MapKeyToFunction function returns a string that is one of the following types:



The current sfx2 keyboard shortcut configuration implementation uses only a kind of merged “component shortcut configuration”. A closer look reveals that we can split this configuration into three different parts:



The last two configurations should be loaded and merged into the “component” shortcut configuration” to fit into our new architecture if we are running on a system with old configuration layout.


This proposal just presents a new design for the keyboard shortcut configuration but it isn't restricted to this special type. There should be no problem to use the design to support also: