Jump to content

Development/VCL

From The Document Foundation Wiki

Introduction

vcldemo

LibreOffice uses VCL (Visual Class Library) as its internal widget toolkit to create the graphical user interface (GUI) of LibreOffice. This library is responsible for creating the GUI widgets for LibreOffice, providing abstraction from the operating system including the basic rendering.

VCL is responsible for the widgets (windowing, buttons, controls, file-pickers etc.), operating system abstraction, including basic rendering (e.g. the output device). It should not be confused with Borland’s Visual Component Library, which is entirely unrelated.

VCL provides a graphical toolkit similar to wxWidgets, and in the software stack it has the place on the top of toolkits like GTK, Qt, meaning that it uses those toolkits.

User interface design

Main article: VCL weld mechanism.

VCL is capable of loading user interface definition files in Glade XML format (.ui) at runtime, and use native widgets of specific platform to match the look and feel of other user interfaces. This can be changed simply by setting an environment variable, to select among the platform-specific user interface libraries that are available.

Supported Widgets

Main article: Widgets supported by VCL.

VCL works on top of different GUI toolkits including GTK3, GTK4, Qt and many others, which have different sets of widgets. GTK has more than 200 different widgets, and Qt also has a huge set of widgets and related classes. Not each of these widgets are supported. VCL can only provide support for a subset of these widgets. But, the good news is that those widgets can be used across different GUI toolkits. One can choose at runtime, which supported GUI toolkit to use.

Examples

These are the examples that can help to become familiar with the way LibreOffice GUI is created using VCL.

Getting Started Examples

First example, minvcl, uses some primitive constructs from VCL to create and display a Window on the screen.

This is a more interesting example, minweld, which uses weld mechanism to display a .ui user interface designed with Glade.

Workbenches

Main article: VCL workbenches.

If you take a look into the vcl/workben, you will see several workbenches that are actually built during the build process. Other than VCL demo, there are various image and font tools alongside some VCL Fuzzers.

Debugging

There are various ways to debug VCL applications. Using GTK provided utilities is one of them. By setting GTK_DEBUG to interactive environment variable, you may use GTK inspector.

GTK_DEBUG=interactive

Environment Variables