The NotebookBar (NBB) or tabbed interface is a modernization of LibreOffice’s user interface. In the second part of this series, I explain the way the NotebookBar takes icons and text to create the final output that you see on the screen.
Creating NotebookBar is LibreOffice Code
Currently, the NotebookBar is not exactly like the other UI files that in LibreOffice with weld mechanism. In the first part of these series of blog posts on this topic, I discussed the custom widgets in notebookbars and how to edit them using Glade.
The custom widgets rely on C++ code, especially for sizing and other characteristics. For example, Priority Merged Horizontal Box (sfxlo-PriorityMergedHBox) is a “horizontal box hiding children depending on its priorities”. It needs C++ code to implement the priority display of the children. If you search for it in C++ files, you will reach builder.cxx:
$ git grep -l sfxlo-PriorityMergedHBox "*.cxx" vcl/source/window/builder.cxx
The above file is a huge > 100 KB C++ source code that handles NotebookBar custom widgets, but also handles every other VCL widget.
The other parts of the relevant code for the NotebookBar resides in below files. Search for both “Notebookbar” and “notebookbar” in C++ files:
$ git ls-files "*otebook*cxx" sfx2/source/notebookbar/NotebookbarTabControl.cxx sfx2/source/notebookbar/SfxNotebookBar.cxx vcl/qt5/QtInstanceNotebook.cxx vcl/qt6/QtInstanceNotebook.cxx vcl/source/control/NotebookbarPopup.cxx vcl/source/control/notebookbar.cxx vcl/source/window/NotebookBarAddonsMerger.cxx
Icons in Notebookbar
If you open the NotebookBar UI for LibreOffice Writer or other components like Calc, etc., what you see lacks two important things: icons and text.
Notebookbar widgetsFirst, let’s look into icons. The icon files come from the set of icon themes that are available with LibreOffice. The icon theme of LibreOffice is configurable, therefore you do not see some specific LibreOffice icon in the design. That makes the work of UI designers harder, but lets LibreOffice choose among different icon themes.
You may find more information in the icon-themes/ module README.md file, which describes how to create new icon themes, and how to link the icons to specific icons via .xcu files. For example, in officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu you see:
<node oor:name=".uno:OpenFromCalc" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">~Open...</value>
</prop>
<prop oor:name="Properties" oor:type="xs:int">
<value>1</value>
</prop>
</node>
This is defined for the UNO dispatch command, .uno:OpenFromCalc, which opens a file for Calc. The complete list of UNO dispatch commands can be found here:
For each command, two icon sizes are created, one small and one big icon. lc_<command name>.png and sc_<command name>.png, if not in SVG format. At first, one should add the icons for a new command to the colibre theme, in order to be usable also with other themes.
Here, the filenames will be lc_openfromcalc.png and sc_openfromcalc.png, which …











