Jump to content

LibreOffice SDK and Extensions Development

From Game in the Brain Wiki
Revision as of 12:02, 26 February 2026 by Ocjustin260223 (talk | contribs) ("Add LibreOffice SDK installation command with apt")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

LibreOffice SDK and Extensions Development

Complete guide for developing LibreOffice extensions using the LibreOffice SDK, based on the official LibreOffice Developer's Guide.

Overview

This documentation covers the LibreOffice Software Development Kit (SDK) with a focus on extension development. It serves as a local reference for Comfac interns and development teams working with LibreOffice UNO components and extensions.

Source Documentation

The primary source material is the LibreOffice Developer's Guide: Chapter 4 - Extensions available at:

License & Attribution

This documentation incorporates material from the LibreOffice Developer's Guide which is licensed under the Public Documentation License Version 1.0 (PDL).

Public Documentation License Notice

The contents of this Documentation are subject to the Public Documentation License Version 1.0 (the "License"); you may only use this Documentation if you comply with the terms of this License. A copy of the License is available at https://www.openoffice.org/licenses/PDL.html.

The Original Documentation is the LibreOffice Developer's Guide. The Initial Writer of the Original Documentation is The Document Foundation. Copyright (C) 2000-2024. All Rights Reserved.

Contributor(s): See individual page histories at https://wiki.documentfoundation.org

Portions created by Comfac are Copyright (C) 2025-2026. All Rights Reserved.

Full PDL License Text

The Public Documentation License Version 1.0 is reproduced below for reference:

1.0 DEFINITIONS

1.1. "Commercial Use"
means distribution or otherwise making the Documentation available to a third party.
1.2. "Contributor"
means a person or entity who creates or contributes to the creation of Modifications.
1.3. "Documentation"
means the Original Documentation or Modifications or the combination of the Original Documentation and Modifications, in each case including portions thereof.
1.4. "Electronic Distribution Mechanism"
means a mechanism generally accepted for the electronic transfer of data.
1.5. "Initial Writer"
means the individual or entity identified as the Initial Writer in the notice required by the Appendix.
1.6. "Larger Work"
means a work which combines Documentation or portions thereof with documentation or other writings not governed by the terms of this License.
1.7. "License"
means this document.
1.8. "Modifications"
means any addition to or deletion from the substance or structure of either the Original Documentation or any previous Modifications.
1.9. "Original Documentation"
means documentation described as Original Documentation in the notice required by the Appendix.
1.10. "Editable Form"
means the preferred form of the Documentation for making Modifications to it.
1.11. "You" (or "Your")
means an individual or a legal entity exercising rights under, and complying with all of the terms of this License.

2.0 LICENSE GRANTS

2.1 Initial Writer Grant

The Initial Writer hereby grants You a world-wide, royalty-free, non-exclusive license to use, reproduce, prepare Modifications of, compile, publicly perform, publicly display, demonstrate, market, disclose and distribute the Documentation in any form, on any media or via any Electronic Distribution Mechanism or other method now known or later discovered, and to sublicense the foregoing rights to third parties through multiple tiers of sublicensees in accordance with the terms of this License.

2.2. Contributor Grant

Each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license to use, reproduce, prepare Modifications of, compile, publicly perform, publicly display, demonstrate, market, disclose and distribute the Documentation in any form, on any media or via any Electronic Distribution Mechanism or other method now known or later discovered, and to sublicense the foregoing rights to third parties through multiple tiers of sublicensees in accordance with the terms of this License.

3.0 DISTRIBUTION OBLIGATIONS

3.1. Application of License

The Modifications which You create or to which you contribute are governed by the terms of this License. The Documentation may be distributed only under the terms of this License or a future version of this License, and You must include a copy of this License with every copy of the Documentation You distribute.

3.2. Availability of Documentation

Any Modification which You create or to which You contribute must be made available publicly in Editable Form under the terms of this License via a fixed medium or an accepted Electronic Distribution Mechanism.

3.3. Description of Modifications

All Documentation to which You contribute must identify the changes You made to create that Documentation and the date of any change. You must include a prominent statement that the Modification is derived, directly or indirectly, from Original Documentation provided by the Initial Writer.

3.5. Required Notices

You must duplicate the notice in the Appendix in each file of the Documentation. If it is not possible to put such notice in a particular Documentation file, then You must include such notice in a location where a reader would be likely to look for such a notice.

6.0 DISCLAIMER OF WARRANTY

DOCUMENTATION IS PROVIDED UNDER THIS LICENSE ON AN "AS IS BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE DOCUMENTATION IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY, ACCURACY, AND PERFORMANCE OF THE DOCUMENTATION IS WITH YOU.

7.0 TERMINATION

This License and the rights granted hereunder will terminate automatically if You fail to comply with terms herein and fail to cure such breach within 30 days of becoming aware of the breach.

8.0 LIMITATION OF LIABILITY

UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER IN TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL THE INITIAL WRITER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF DOCUMENTATION, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER.

[See https://www.openoffice.org/licenses/PDL.html for the complete license text]

Extensions Overview

An extension is a file intended for the distribution of code and/or data which is to be used by LibreOffice. The file has the file extension .oxt (formerly .uno.pkg and .zip), and it acts as a container for various items, such as:

  • Libraries and JAR files
  • Configuration data
  • Type libraries
  • Basic libraries
  • Basic dialogs
  • Help content
  • Templates

Before LibreOffice can use any content of the extension, it needs to be installed by the Extension Manager.

Extension Manager

The Extension Manager is a tool for managing extensions and other deployable items, such as separate libraries, JARs, configuration files, and description files. It is available as:

  • A command line tool: unopkg
  • A graphical dialog within LibreOffice
  • An API for programmatic access

Extension File Format

Extensions use the .oxt format which is essentially a ZIP archive containing:

  • description.xml - Metadata about the extension
  • manifest.xml - Lists all files in the extension
  • Code files (Java classes, Python scripts, C++ libraries)
  • Resources (icons, dialogs, help files)
  • Configuration files

SDK Setup

Prerequisites

Before developing LibreOffice extensions, ensure you have installed:

  • LibreOffice SDK (libreoffice-dev and libreoffice-dev-doc packages)
  • Java Development Kit (JDK) 11 or later
  • Apache Ant or GNU Make
  • Python 3 (for Python extensions)

Installation Command (Debian/Ubuntu)

sudo apt update
sudo apt install libreoffice-dev libreoffice-dev-doc

This installs:

  • libreoffice-dev — SDK headers, libraries, and development tools
  • libreoffice-dev-doc — SDK documentation and API reference (205 MB)

Environment Configuration

The SDK provides environment setup scripts:

  • Linux/Unix: setsdkenv_unix.sh
  • Windows: setsdkenv_windows.bat

These scripts configure necessary environment variables:

  • OO_SDK_HOME - Path to SDK installation
  • OFFICE_HOME - Path to LibreOffice installation
  • SDK_AUTO_DEPLOYMENT - Enable automatic deployment

Verifying Installation

To verify the SDK is properly configured:

source /usr/lib/libreoffice/sdk/setsdkenv_unix.sh
cppumaker -V

Extension Development Topics

Core Concepts

  1. Extension Manager API
  2. Extension Repositories
  3. The Active Extension
  4. Updating Extensions
  5. Processing Extensions
  6. Packaging Notes For Bundled Extensions
  7. Deployment Items
  8. Installing Extensions for All or a Single User
  9. Location of Installed Extensions
  10. Extension Layers
  11. Checklist for Writing Extensions

Extension Structure

description.xml

The description.xml file is the main metadata file for an extension:

<?xml version="1.0" encoding="UTF-8"?>
<description
    xmlns="http://openoffice.org/extensions/description/2006"
    xmlns:xlink="http://www.w3.org/1999/xlink">
    
    <version value="1.0"/>
    <identifier value="com.example.myextension"/>
    <display-name>
        <name lang="en">My Extension</name>
    </display-name>
    <platform value="all"/>
    
</description>

XML Elements Description

identifier
Unique identifier for the extension (reverse domain notation)
version
Version number in major.minor.revision format
display-name
Localized name shown in Extension Manager
icon
Icon file for the extension
extension-description
Localized description text
dependencies
Required LibreOffice version or other extensions
registration
UNO component registration information
update-information
URL for update checks

Language Bindings

Java Extensions

Java is the primary language for LibreOffice extension development:

  • Full access to UNO API
  • Platform independence
  • Rich ecosystem of tools and libraries
  • Excellent documentation and examples

Python Extensions

Python provides a simpler alternative:

  • Easier learning curve
  • Rapid prototyping
  • Good integration with UNO
  • Available in all modern LibreOffice versions

C++ Extensions

For performance-critical extensions:

  • Native performance
  • Direct access to internal structures
  • Complex build requirements
  • Platform-specific binaries

LibreOffice Basic Extensions

For macro-based solutions:

  • Simple and accessible
  • Good for automation tasks
  • Limited compared to compiled languages
  • Can be packaged as extensions

External Resources

Official Documentation

License Information

Source Code

See Also

References