Exploring the LibreOffice code base


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.

General layout

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.

Build system

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.

Main components

LibreOffice Writer

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.

LibreOffice Calc

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.

Graphics modules

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.

Share on Google+Tweet about this on TwitterShare on LinkedInShare on FacebookFlattr the authorBuffer this pageShare on RedditDigg thisPin on PinterestShare on StumbleUponShare on TumblrEmail this to someone

Eilidh McAdam is a programmer from Scotland who works on open source project LibreOffice. She also enjoys coding for fun, reading, music and writing. Eilidh got involved with the open source community through the Google Summer of Code program several years ago (libvisio – reading .vsd files produced by Microsoft Visio and importing them into LibreOffice Draw). Eilidh enjoys learning new languages and paradigms. You can contact Eilidh and her team for professional consulting on our contact page.

Posted in Blog, Development, LibreOffice Tagged with: ,
One comment on “Exploring the LibreOffice code base
  1. Rohan Kumar says:

    Thanks a lot, it was extremely helpful. It is much more helpful as compared to the module diagram that is present on the libre wiki website

Leave a Reply

Your email address will not be published. Required fields are marked *