Development/NotebookBar/Extensions

From The Document Foundation Wiki
Jump to: navigation, search


We should allow extensions to register their own tabs in the Notebookbar.

This page is a work-in-progress scratch pad for the extension format.

Requirements

Must have

  • Tab title
  • Tab can be grouped in sections
  • Each section can contain multiple controls
    • These controls are laid out in two rows (for now)
    • The control can have one of (text, icon+text, icon)
    • More options will come later (double height buttons etc.)

Nice to have

Proposal

Instead of creating a new format, we should integrate the Notebookbar UI definition in the Addons.xcu file where also the menubar and toolbar are defined.

So this proposal tries to stay as close as possible to the current toolbar format. See for reference: https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/AddOns/Toolbars

Structure

  • The AddonUI node contains one OfficeNotebookbar node.
  • The OfficeNotebookbar contains a Title and a NotebookbarSections node.
  • The NotebookbarSections node contains one or more section.
  • Each section contains one or more buttons.

Example

<?xml version='1.0' encoding='UTF-8'?>
<oor:component-data xmlns:oor="http://openoffice.org/2001/registry"
                     xmlns:xs="http://www.w3.org/2001/XMLSchema" 
                     oor:name="Addons" 
                     oor:package="org.openoffice.Office">
  <node oor:name="AddonUI">
    <node oor:name="OfficeNotebookbar">
      <node oor:name="org.libreoffice.addon.example" oor:op="replace">
        <prop oor:name="Title" oor:type="xs:string">
          <value xml:lang="en-US">Tab Title</value>
        </prop>
        <node oor:name="NotebookbarSections">
          <node oor:name="section1" oor:op="replace">
            <node oor:name="button1" oor:op="replace">
              <prop oor:name="Title" oor:type="xs:string">
                <value xml:lang="en-US">Action 1</value>
              </prop>
              <prop oor:name="URL" oor:type="xs:string">
                <value>vnd.sun.star.script:myts?language=Basic&amp;location=application</value>
              </prop>
              <prop oor:name="Target" oor:type="xs:string">
                <value>_self</value>
              </prop>
              <prop oor:name="Context" oor:type="xs:string">
                <value>com.sun.star.text.TextDocument</value>
              </prop>
              <prop oor:name="Style" oor:type="xs:string">
                <value>icon+text</value>
              </prop>
            </node>
          </node>
        </node>
      </node>
    </node>
  </node>
</oor:component-data>

Additional notes

Images are defined in an extra section and associated via the URL: https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/AddOns/Images_for_Toolbars_and_Menus