Documentation/How Tos/Edit Keyboard Configuration File
Customize Keybord by Editing a Configuration File
OpenOffice.org Version 2.0 to 3.0.1
Up to OOo3.0 it is not possible to define a shortcut key which includes the ALT-key using the Customize dialog, Issue 4756 . But you must edit the configuration file to get such a shortcut. This is a description, how to do it. Most of the sections below have only been tested with WinXP. Some information specifically for the Linux version can be found at the end of the page.
You need an editor, which preserves Unix line ends and the coding "UTF-8", and which will not set a byte order mark. I have used "PSPAD" or "jEdit" on WinXP. On WinXP neither WordPad nor NotePad is suitable. OOo itself can export in UTF-8 and Unix line ends, but sets a byte order mark, so you cannot use OOo.
On WinXP the keybord settings for the single modules are in the files
<..>\user\config\soffice.cfg\modules\<module name>\accelerator\<language code>\current.xml
and general keyboard settings are in the file
Older versions of OOo might not have these files by default. If they are missing, go to Tool | Customize | Keyboard and change something. Then the files will be generated.
- Close OOo and close quickstarter.
- Make a copy of the file, you will work on.
- Open the file in an editor.
- Edit the file and save it.
- Start OOo.
If something is wrong, OOo will crash when you press a key. Do not try to restore the document and do not sent a crash report. But restore the original file with the copy you have made in step 2.
To learn more about this file, see "StarOffice 7 Administration Guide" chapter 4 , "StarOffice 8 Administration Guide" chapter 3 and appendix A , and "OpenOffice.org XML File Format 1.0 Technical Reference Manual", chapter 9.2 .
Let us have a deeper look at the file. You will see something like
<?xml version="1.0" encoding="UTF-8"?> <accel:acceleratorlist xmlns:accel="http://openoffice.org/2001/accel" xmlns:xlink="http://www.w3.org/1999/xlink"> <accel:item accel:code="KEY_Q" accel:mod1="true" xlink:href=".uno:Quit"/> <accel:item accel:code="KEY_N" accel:shift="true" accel:mod1="true" xlink:href=".uno:NewDoc"/>
You will notice that the lines have all the same structure.
accel:itemEach such line defines a single short cut key.
You can use only keys which has got a name. I don't know where to find a actual list of all possible keys and which of them will work, dependent on keyboard, operating system and language. If you know something, please add the information.
Next the modifier keys are listed. You need only those, which are used, because the default value of the modifier keys is "false".
accel:mod1="true"That is the CRTL-key.
accel:mod2="true"That is the ALT-key.
accel:shift="true"That is the SHIFT-key.
Instead of pressing the keys CRTL and ALT together, you can also press the key AltGr That's on a German keyboard. Would be nice, if someone corrects this for an English keyboard.
The last position describes what the shortcut should do, for example
xlink:href=".uno:Quit"will close OOo.
Inside the quotes stands a Command URL. In older OOo versions the command URL could be build as
"slot:<number>"but that way should not be used for newer versions, if a ".uno" form exists. Therefore always use
You find those commands in the document  in the first column or in the above mentioned document "StarOffice 8 Administration Guide".
Some of the commands need parameters. There seems to be no list of those parameters, but you can get a hint, if you record a macro and look, which parameters the dispatcher gets. For example the macro record of inserting a special character gives you the Command URL ".uno:InsertSymbol" and the parameter "Symbols" with for example the value "δ" (Greek delta). Or look at the existing lines in the configuration files. Perhaps you can alter a parameter?
Such parameters follow the command after a ?. For inserting the character "δ" the complete Command URL is ".uno:InsertSymbol?Symbols:string=δ".
The first part after the character ? is the name of the parameter. It is followed be the character :. After this colon the type of the parameter value is given and then after the character = the value itself.
For example, inserting unformatted text is the command ".uno:ClipboardFormatItems?SelectedFormat:short=1".
Modifier keys and command URL may be exchanged.
The complete line for inserting the special character δ when pressing the keys AltGr (German) and D together is then
<accel:item accel:code="KEY_D" accel:mod1="true" accel:mod2="true" xlink:href=".uno:InsertSymbol?Symbols:string=δ" />
OpenOffice.org Version 3.1From OOo version 3.1 an xcu format is used for the keyboard configuration file. This format is common for other configurations too. The corresponding schema is defined in
...\OpenOffice.org 3\Basis\share\registry\schema\org\openoffice\Office\Accelerators.xcsThe default keyboard short cuts, which are valid for all users, are defined in the file
If you use another local than en-US, for example de, then the file
is used in addition.The personal settings are in the similar file in the user directory
These files are common for all modules. Each module has a separate section, for example
<node oor:name="com.sun.star.text.TextDocument">. Short cut keys, which are available in all modules, are defined in the section <node oor:name="Global">.
Such configuration file is divided into two sections,
<node oor:name="PrimaryKeys"> and <node oor:name="SecondaryKeys">.
If the user defines a short cut key for a command, which has already got a short cut key, then the old setting is moved to the SecondaryKeys section and in the PrimaryKeys section the value removed is noted, for example
<node oor:name="RIGHT_SHIFT_MOD1" oor:op="remove"/></node>. You will understand the structure of the file, when you read it.
Each short cut key is represented by a node element. The above example of AltGr+d to get δ now reads
<node oor:name="D_MOD1_MOD2" oor:op="replace"> <prop oor:name="Command"> <value xml:lang="en-US">.uno:InsertSymbol?Symbols:string=δ</value> </prop> </node>
oor:name="D_MOD1_MOD2"This sets the desired short cut. Write first the key identifier, then the modifiers, connected with an underscore.
oor:op="replace"The value replace is used for new keyboard short cuts too. For further details on the OpenOffice.org registry format, see http://util.openoffice.org/common/configuration/oor-document-format.html
xml:lang="en-US"This is the language of the user interface for which this short cut is valid.
.uno:InsertSymbol?symbol:string=δThis is the command to be executed with the short cut key. It is no longer an attribute, but the content of the value element.
OpenOffice.org Version 3.1 on (Ubuntu) Linux
On Ubuntu Linux, it seems that the functionality of the Alt-Gr key can't be modified by OpenOffice. Therefore D_MOD1_MOD2 (=ALT-Gr) won't work. However, D_MOD2 for the standard ALT key (on the left side of the long space key) works well as described in the section on OO 3.1 above.
Accelerators.xcu can be found in the home directory of the user (cd ~), .openoffice.org/3/user/registry/data/org/openoffice/Office/
Administrator rights are required to edit the file. To edit it with GEdit, a GUI based editor, use the 'sudo' command to get administrator rights (sudo gedit Accelerators.xcu)
|Content on this page is licensed under the Public Documentation License (PDL).|