Skip to content

Instantly share code, notes, and snippets.

@VenetiaFurtado
Last active November 11, 2024 05:57
Show Gist options
  • Save VenetiaFurtado/08c232bfa39cacda134bb0a978bb7398 to your computer and use it in GitHub Desktop.
Save VenetiaFurtado/08c232bfa39cacda134bb0a978bb7398 to your computer and use it in GitHub Desktop.
GSoC 2024 Final Report - Venetia Furtado

Google Summer of Code 2024 - Final Report

Organization - LibreOffice

Project Title - LUA UNO Language Binding in Libreoffice

Overview

This project developed a Lua interface with UNO for LibreOffice, focusing on enhancing scripting capabilities by supporting complex method calls and exception handling. This integration enables Lua scripts to interact directly with LibreOffice components.

Proposed deliverables

  • Make it possible to use LibreOffice’s UNO API with LUA.
  • Map the various UNO constructs to suitable LUA types.

Key contributions

  • Lua-UNO Integration: Developed Lua bindings for UNO, allowing Lua scripts to interact with LibreOffice components.
  • Exception Handling: Implemented comprehensive error handling for both Lua and UNO, ensuring stability.
  • Support for Complex Operations: Added support for UNO methods, and in/out parameters in Lua scripts.
  • Testing: Created test scripts, including one that opens a LibreOffice Writer document and writes "Hello World."

Languages and tools used

  • Languages: Lua, C++.
  • Tools: Gerrit, Git, Make, LibreOffice SDK.
  • Methodologies: Test-Driven Development (TDD), Agile development.

Commits and Repositories

Challenges

  • UNO framework: Navigating the code-base, understanding the interactions between UNO components, and the associated APIs required substantial effort.
  • Mastering Lua Stack Indexing: Learning how to manage the Lua stack for efficient data handling between C/C++ and Lua.
  • Exception Handling in Lua: Implementing robust error handling to catch and manage exceptions in Lua scripts.
  • Setting Up a Test Environment: Creating a test setup for validating in, out, and in-out parameters in the Lua scripts.

Key learnings

  • Understanding Invoke and Parameter Passing: Gained an understanding of the Invoke function and how to handle different types of parameter passing (in, out, in-out).
  • LUA C API: Developed a thorough understanding of the Lua C API, including its functions and mechanisms for interacting with Lua from C/C++. This knowledge encompasses managing the Lua stack, interfacing with Lua objects, handling data exchange between C/C++ and Lua, and utilizing the API to extend Lua's functionality and integrate Lua scripts into C/C++ applications.
  • Recursive Functions Implementation: Successfully implemented recursive functions in practice.

Future improvements

  • Support for UNO Interface Attributes.
  • Support for UNO objects implemented in Lua (so that they can be passed into LO for callbacks, like css.lang.Xcomponent::addEventListener).
  • Better support in LUA for UNO enum values (than just using their raw integer values)

Conclusion and thanks

Working on this project has been challenging yet incredibly rewarding. It has not only sharpened my coding abilities but also allowed me to acquire new skills along the way. I'm deeply grateful to my mentor, Stephan Bergmann, for his constant guidance and support throughout this journey. A special thanks to Thorsten Behrens for co-mentoring, and to the LibreOffice community for being so helpful and welcoming to new contributors like myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment