Difference between revisions of "Framework/Article/Tool Panels"
(Created page with '= Tool Panels = Starting with OpenOffice.org 3.3, the application framework supports so-called tool panels, grouped into a task pane. From previous OpenOffice.org versions, you …')
|Line 1:||Line 1:|
= Tool Panels =
= Tool Panels =
Revision as of 09:08, 27 April 2010
Starting with OpenOffice.org 3.3, the application framework supports so-called tool panels, grouped into a task pane. From previous OpenOffice.org versions, you already know the task pane from Impress, where there are 5 standard tool panels (called "Master Pages", "Layouts", "Table Design", "Custom Animation", and "Slide Transition"). With OpenOffice.org 3.3, you can write your own extension, which adds one or more tool panel/s to one or more of OpenOffice.org's applications.
Conceptually, a tool panel is an UI element, just like tool bars, menu bars, and status bars (to name the most prominent ones). This implies that a toolpanel is identified by a resource URL, starting with
private:resource/, followed by a keyword describing the class of the UI element -
toolpanel, in our case.
Everything following the mandatory
private:resource/toolpanel/ part of the URL is at your discretion. However, remember that your URL must be globally unique, so you should, for example, use your company's name, or something like this.
For instance, an example tool panel provided by OOo itself could have an URL like
private:resource/toolpanel/org.openoffice.example/ToolPanel, which makes name collisions with other tool panels quite unlikely.
To make your new tool panel UI element known to the application framework, you need to add meta data about it to the
org.openoffice.Office.UI.<Module>WindowState configuration, where
<Module> denotes the short name of the application where your panel should appear. Exemplarily, the following configuration fragment registers an examplarily panel for Writer's task pane:
<?xml version='1.0' encoding='UTF-8'?> <oor:component-data oor:name="WriterWindowState" oor:package="org.openoffice.Office.UI" xmlns:install="http://openoffice.org/2004/installation" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <node oor:name="UIElements"> <node oor:name="States"> <node oor:name="private:resource/toolpanel/org.openoffice.example/SoylentGreen" oor:op="replace"> <prop oor:name="UIName" oor:type="xs:string"> <value xml:lang="en-US">Soylent Green</value> </prop> <prop oor:name="ImageURL" oor:type="xs:string"> <value>vnd.sun.star.extension://extension-identifier/green.png</value> </prop> </node> </node> </node> </oor:component-data>
Note that the node describing your UI element is a
WindowStateType, as defined by the org.openoffice.Office.UI.WindowState configuration scheme. Most of its properties are not used for tool panels, but one of them is mandatory:
UIName defines the name of the tool panel, and must not be empty.
ImageURL describes an image to associate with the panel. If you deploy an image with your extension, you can use the extension-UCP, which allows you to refer to a file within your extension package, without knowing the actual location to which the package is deployed later on.