Contents
Index
Search

1. Bindings specific to a document type

A configuration file such as XXE_install_dir/addon/config/docbook/docbook.xxe can contain binding elements. A binding element specifies:

  • a keystroke or a sequence of keystrokes which triggers a command,

  • OR a mouse input which triggers a command or displays a custom popup menu.

For example, adding the following binding element to docbook.xxe will allow to convert selected text to emphasis (with role attribute set to bold) by pressing on function key F5:

<binding>
  <keyPressed code="F5" />
  <command name="docb.convertToBold" />
</binding>

<command name="docb.convertToBold">
  <macro>
    <sequence>
      <command name="convert" parameter="[implicitElement] emphasis" />
      <command name="putAttribute" parameter="role bold" />
    </sequence>
  </macro>
</command>

It is recommended to add custom bindings into a separate file and to include this file in configurations files bundled with XXE rather than directly modifying the bundled configuration files.

For example, if you want to use the F5 key for converting text to emphasis in all documents belonging to the DocBook family (DocBook, Simplified DocBook, Slides), add the elements of the previous example to a file called /opt/xxe-custom/extrabindings.incl and include this file in XXE_install_dir/addon/config/docbook/docbook.xxe.

<include location="file:///opt/xxe-custom/extrabindings.incl" />

In next chapter, we will learn how to that without modifying the bundled configuration files.

[Important]

XXE does not allow bindings defined in document type specific configuration files to override its menu accelerators.

Example 1: you cannot bind Ctrl+Q to command docb.convertToBold because Ctrl+Q is used to quit XXE.

Example 2: you cannot bind Ctrl+I to command docb.convertToBold because, by default, Ctrl+I triggers command "insert" with parameter "into" (menu item EditInsert).