Opening LibreOffice’s source code for the first time, the amount of code that a new developer has to sift through can be intimidating and off-putting. So, here are some useful locations within the LibreOffice source directory structure that should help get you started.
LibreOffice consists of over a hundred interdependent modules, each contained within a subdirectory of the LibreOffice root directory. Please note that all paths hereafter are relative to this directory, unless otherwise specified. The layout of a module tends to follow a general pattern, with at least the following places of interest:
- Usually contains useful information about the module purpose and contents. A list of all modules and the first line of their README can be found at docs.libreoffice.org.
- gbuild makefiles for various build possibilities.
- Source code (usually C++). There is often some sort of division of code into submodules.
Headers may be found in several places, depending on the minimum required scope of the interface defined.
- Inter-module headers.
- Intra-module headers.
- Headers required only by a submodule.
Headers may also occasionally be found alongside their .cxx implementations.
For modules where a GUI is relevent, there are two main possibilities. Work on converting the user interface specifications from the older, inflexible legacy format (.src/.hrc) to the xml-based Glade/Gtk3 format (.ui) is currently underway throughout the codebase.
- New, Glade-style .ui files.
- Older .src files.
There’s an informative slide deck from the 2013 LibreOffice conference in Milan that discusses state of the LibreOffice build system. While you will find a brief overview below, this presentation goes into far more detail if that is what’s required.
- Contains many important parts of the build system.
- gbuild implementation.
- solenv/bin ; solenv/bin/modules/
- Perl build and packaging tools.
- Configuration of packinging and installation.
Once LibreOffice has been built using ./autogen.sh followed by make, a complete runnable installation can be found in:
There, soffice.bin and soffice can be found. The former is the main LibreOffice binary. On the first run, it creates the user profile and exits and can then be executed again as normal. To avoid this, the wrapper soffice should be used for running LibreOffice for testing purposes. When running LibreOffice via a debugger, soffice.bin should be used directly.
Due to LibreOffice’s history as a product of Sun’s StarDivision, the main application component paths contain hints toward this legacy. The Writer module, for example, is contained within the directory sw/ (StarWriter).
- Main Writer module.
- The mathematical formula editor.
- Shipped Writer extensions.
- Main Calc code.
- Implementation of charts for Calc.
LibreOffice Draw (and LibreOffice Impress)
- Draw and Impress share a module and quite a bit of code here.
- Extensions for Draw and Impress.
LibreOffice Impress only
- Slideshow engine for Impress.
- Contains graphics helper code shared by several major modules, but especially Draw and Impress.
- Provides an API for drawing objects.
- Contains the framework used by sw, sc and sd to dispatch actions to the document shells. This module includes document load and save handling, which invokes the correct import and export filters, respectively.
- Writer .rtf import filter and part of the .docx import filter.
- A family of Writer import filters including WordPerfect, Microsoft Publisher and Microsft Visio file format import filters.
- Suppport for parsing Microsoft’s OOXML format (.docx, .xlsx, etc.)
Hopefully you’ll now have an idea of where to get started if you want to tackle a bug or feature in LibreOffice. For more help and resources, see my LibreOffice Development Howto or, if you want professional support, don’t hesitate to contact us.