From Apache OpenOffice Wiki
< Documentation‎ | DevGuide
Revision as of 12:40, 1 November 2007 by Jsc (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

An add-on can also be integrated into the Function Bar of The org.openoffice.Office.Addons configuration branch has a set called OfficeToolBar where you can add toolbar items for an add-on. The toolbar structure uses an embedded set called ToolbarItems, which is used by to group toolbar items from different add-ons. automatically inserts a separator between different add-ons toolbar items.

Documentation caution.png The space of the Function Bar is limited, so only the most used/important functions should be added to the OfficeToolBar set. Otherwise will add scroll-up/down buttons at the end of the Function Bar and the user has to scroll the toolbar to have access to all toolbar buttons.
Properties of template ToolBarItems
oor:name string. The name of the configuration node. The name must begin with an ASCII letter character. It must be unique within the OfficeMenuBar set. Therefore it is mandatory to use a schema such as org.openoffice.<developer>.<product>.<addon name> or com.<company>.<product>.<addon name> to avoid name conflicts. Please keep in mind that your configuration file will be merged into the configuration branch. You do not know what add-ons, or how many add-ons, are currently installed.

The ToolBarItems set is a container for the ToolBarItem nodes.

Properties of template ToolBarItem
oor:name string. The name of the configuration node. It must be unique inside your own ToolBarItems set. A configuration set cannot guarantee the order of its entries, therefore use a schema such as string + number, for example "m1", as the name is used to sort the entries. Please be aware that the name must begin with an ASCII letter character.
URL string. Specifies the command URL that should be dispatched when the user activates the menu entry. To define a separator you can use the special command URL "private:separator". A separator ignores all other properties.
Title string. Contains the title of a top-level menu item. This property supports localization: The default string, which is used when cannot find a string definition for its current language, uses the value element without an attribute. You define a string for a certain language with the xml:lang attribute. Assign the language/locale to the attribute, for example <value xml:lang="en-US">string</value><code>.
<code>ImageIdentifier<code> string. Defines an optional image URL that could address an internal image or an external user-defined image. The syntax of an internal image URL is: private:image/<number> where number specifies the image.

External user-defined images are supported using the placeholder variable %origin%, representing the folder where the component will be installed by the pkgchk tool. The pkgchk tool exchanges %origin% with another placeholder, which is substituted during runtime by to the real installation folder. Since supports two different configuration folders ( user and share ) this mechanism is necessary to determine the installation folder of a component.

For example the URL %origin%/image will be substituted with something like$UNO_USER_PACKAGES_CACHE/uno_packages/ 

The placeholder$UNO_USER_PACKAGES_CACHE is then substituted during runtime with the real path.

Since the <code>ImageIdentifier<code> property can only hold one URL but supports four different images (small/large image, and both as high contrast), a naming schema is used to address them. adds _16.bmp and _26.bmp to the provided URL to address the small and large image. _16h.bmp and _26h.bmp is added to address the high contrast images. If the high contrast images are omitted, the normal images are used instead. supports bitmaps with 1, 4, 8, 16, 24 bit color depth. Magenta (color value red=0xffff, green=0x0000, blue=0xffff) is used as the transparent color, which means that the background color of the display is used instead of the image pixel color when the image is drawn.

For optimal results, the size of small images should be 16x16 pixel, and for big images 26x26 pixel. Other image sizes are scaled automatically by no high contrast image is provided, uses the normal image for high contrast environments. Images that are not valid are ignored.This property has a higher priority than the Images set when searches for images.

<code>Target<code> string. Specifies the target frame for the command URL. Normally an add-on will use one of the predefined target names:


Returns the top frame of the called frame, which is the first frame where isTop() returns true when traversing up the hierarchy.


Returns the next frame above in the frame hierarchy.


Returns the frame itself, same as an empty target frame name. This means you are searching for a frame you already have, but it is legal to do so.


Creates a new top-level frame whose parent is the desktop frame.
<code>Context<code> string. A list of service names, separated by a comma, that specifies in which context the add-on menu should be visible. An empty context means that the function should be visible in all contexts. The application modules use the following services names:
  • Writer:
  • Spreadsheet:
  • Presentation:
  • Draw:
  • Chart:
  • Bibliography:

The context service name for add-ons is determined by the service name of the model that is bound to the frame, which is associated with an UI element (toolbar, menu bar, ...). Thus the service name of the Writer model is <code><code>. That means, the context name is bound to the model of an application module. If you implement a new desktop component that has a model, it is possible to use its service name as a context for add-on UI items.

The following example defines one toolbar button for the function called <code>org.openoffice.Office.addon.example:Function1<code>. The toolbar button is only visible when using the Writer module.

 <?xml version='1.0' encoding='UTF-8'?>
  <oor:component-data xmlns:oor="" xmlns:xs="" oor:name="Addons" oor:package="org.openoffice.Office">
      <node oor:name="AddonUI">
          <node oor:name="OfficeToolBar">
              <node oor:name="org.openoffice.Office.addon.example" oor:op="replace">
                  <node oor:name=”m1”>
                      <prop oor:name="URL" oor:type="xs:string">
                      <prop oor:name="Title" oor:type="xs:string">
                          <value xml:lang=”en-US”>Function 1</value>
                          <value xml:lang="de">Funktion 1</value>
                      <prop oor:name="Target" oor:type="xs:string">
                      <prop oor:name="Context" oor:type="xs:string">
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools