Configuration is located in the XML file: officecfg/registry/data/org/openoffice/Office/UI/Notebookbar.xcu It describes all available notebook implementations for Writer, Calc and Impress (used names, path to the *.ui files, and menubar visibility). There are also defined currently used modes. Notebookbar is active if current ToolbarMode has set property "HasNotebookbar" (officecfg/registry/data/org/openoffice/Office/UI/ToolbarMode.xcu)
The most important file is sfx2/source/notebookbar/SfxNotebookBar.cxx. It contains methods to load Notebookbar, check its state and toggle visibility of the menubar.
When StateMethod is called and Notebookbar is set as active in the configuration files then according .ui file is loaded. That method also adds binding to the context listener for the Notebookbar control.
When user change the Notebookbar’s implementation then ExecMethod is called. It saves new value in the configuration and calls StateMethod to refresh the UI.
Methods to temporary block the StateMethod from creating Notebookbar (even when is active). It was used to avoid showing menubar in the slideshow (tdf#103355).
After calling that method notebookbar is destroyed and menubar is shown.
Method to determine if in the current configuration Notebookbar is active.
Menubar can be controlled using ShowMenubar and ToggleMenubar.
Notebookbar in vcl
After notebokbar .ui file is loaded, special method to handle the context is registered in the ContextMultiplexer. Notebookbar control looks for widget named "ContextContainer" or ("ContextContainerX" where X >= 1) with type inherited from NotebookbarContextControl. Two context containers are available:
Child containers should have defined context in which they are shown. That property have to be placed inside <style><class> block. Value shoud match pattern "context-X". Where X should be one of defined enum values in vcl::EnumContext::Context.
<child type="tab"> <object class="GtkLabel" id="ImageLabel"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="label" translatable="yes">Image</property> <property name="use_underline">True</property> <style> <class name="context-Graphic"/> </style> </object> ...
Possibility to add multiple context containers. Each container should have name "ContextContainer" or "ContextContainerX" where X >= 1
PriorityHBox and DropdownBox
To show content in the Notebookbar according to the screen size two containers were created. PriorityHBox is a master container which manages its children. All containers placed directly inside the PriorityHBox shoud have type of DropdownBox.
DropdownBox is a container with possibility to collapse its content. When is collapsed, button with small arrow is shown and user can access previous content by clicking on that (popup with widgets is created). Important notice: DropdownBox should have only one child (eg. GtkBox) otherwise popup is not working correctly.
PrioirtyHBox sets its required width to minimal width needed to show all embodied controls which cannot be collapsed. That special container expands DropdownBoxes when additional space is provided or collapses otherwise.
It is possible to change the collapsing order using priority marks in the ui file. That property have to be placed inside <style><class> block. Value should match pattern "priority-X". X should be a number. If priority mark won’t be provided, control will be always visible.
<object class="sfxlo-DropdownBox" id="box63"> <property name="visible">True</property> <property name="can_focus">False</property> <child> ... </child> <style> <class name="priority-2"/> </style> </object>
.The customization feature was previously available for traditional toolbars. Toolbars have .xml files whereas Notebookbar has .ui files. In backend the code modify the .ui files.Then, store and reload them from the user directory. It also store the modified data in registry modifications.xcu so that configurations can be retrieved if there is a version update.
Customization dialog class SvxNotebookbarConfigPage is inherited from SvxConfigPage. SvxConfigPage is a base class for all the customization dialog in LibreOffice.The dialog provide ui to hide/show the buttons.
- There are many features still locked and need to finish.
- The use registrymodifications.xcu to retrieve the configuration and use them during an update is not complete.
- It would be better to open the customization dialog based on the tab opened in the Notebookbar interface.