3 Jan 2024

Outlook for the new year 2024

Now that year 2024 has come, I want to briefly discuss the year 2023 around the development blog, and the outlook for 2024 here.

My goal is to help people understand LibreOffice code better, and ultimately get involved in LibreOffice core development to make LibreOffice better for everyone. In 2023, I wrote 23 posts around LibreOffice development in the dev blog (3 of them are unpublished drafts).

At The Document Foundation (TDF), our aim is to improve LibreOffice, the leading free/open source office software that you and many other people around the world use. Our work is community-driven, and we need your help.

LibreOffice conference 2023

LibreOffice conference 2023

Outlook For the New Year

My focus for 2024 in this blog will be:

  1. Introducing new EasyHacks
  2. Discussing how to fix crashes
  3. Explaining LibreOffice architecture
  4. Describing user interface creation with VCL
  5. Explaining LibreOffice extensions

You can give feedback by writing a comment here, or sending an email to hossein AT libreoffice DOT org.

I provide mentoring support to those who want to start LibreOffice development. You are welcome to contact me if you need help to build LibreOffice and do some EasyHacks via the above email address.

I hope the best for you in the new year 2024.

21 Dec 2023

Custom string literals: two EasyHacks

In the previous part of the series on C/C++ strings, I described the string literal, plus how and why to use them. Then I introduced the new custom string literals and their benefits: (more…)

14 Dec 2023

LibreOffice extensions with Python – part 2: Debugging

In my previous blog post on creating LibreOffice extensions with Python, I have discussed how to write a Python code that works with LibreOffice API, and can be run and debugged in an IDE, and packed later in an extension. Now I discuss how to debug the Python code. (more…)

25 Nov 2023

LibreOffice extensions with Python – part 1

Ever wondered how to create a LibreOffice extension? Here I discuss how to do that via Python programming language. It is possible to run and debug the resulting Python code in an IDE, and then package the content as an extension. (more…)

16 Nov 2023

String literals: C/C++ string data types part 2

In the first part of the series on string types in LibreOffice, I discussed some of the string data types that are in use in various places of the LibreOffice code. I discussed various character and string data types briefly: OString, OUString, char/char*, sal_Unicode, sal_Unicode*, rtl_String, rtl_uString and also std::string. Now I want to explain string literals. (more…)

2 Nov 2023

Integer data types improvement – EasyHack

Many different data types are used in LibreOffice code. During the long history of the LibreOffice, and before that in OpenOffice, there were integer data types that are no longer in use today. The task I discuss here is to choose appropriate data types to use instead of sal_uLong and similar deprecated integer data types. (more…)

26 Oct 2023

UNO API error reporting improvement – EasyHack

In this blog post, I discuss the EayHack for improving UNO API error reporting. EasyHacks are good if you want to become familiar with LibreOffice programming, and this specific task is a good choice for beginners as it is a difficultyBeginner task. (more…)

5 Oct 2023

LibreOffice conference 2023 workshop presentation slides

LibreOffice conference (LibOCon) 2023 was held in Bucharest from 20 to 23 September 2023. Among the other programs, an important part was the workshop “Introduction to LibreOffice Development”. Here you will find the slides for the presentations. (more…)

14 Sep 2023

Catalog and schema support for SQL functions – difficulty interesting EasyHack

LibreOffice has a database application called Base. It can connect to various database management systems, and is integrated with two internal database engines: Firebird and HSQLDB. Here I discuss how to add catalog and schema support for SQL functions in LibreOffice Base. (more…)

31 Aug 2023

Warning for low disk space – difficulty interesting EasyHack

Without enough space, one may face data corruption, which is really a terrible thing that can possibly happen for someones important data. In order to avoid falling into such a situation, it is good idea to give warning to the users in advance.

Code Pointers for generating warning for low disk space

To implement such a feature in LibreOffice, first place to look is this file sfx2/source/doc/sfxbasemodel.cxx.

The method to query the free space method should be added to the sal/osl folder in LibreOffice core source code. To add OS specific code, one may use unx and w32 folders inside it.

Please note that LibreOffice needs to know the disk space on different devices, so passing a vector containing path and free disk space is a good suggestion here.

You should know that guessing the required disk space to save the file is not easy. So, the idea is to have several megabytes free to avoid facing problems. That is in cases the file is not actually very huge. It is possible to add that limit as an option, placed in Tools > Options. These days, even 100-200 megabyte is not that much when comparing it to the very fast disk consumption by different applications like browsers and other similar huge software that people use regularly.

Another nice feature to implement is a handler that runs with low priority every several seconds and checks the available temporary space. That will help avoiding problems with saving images in that specifc temp directory.

Testing the Warning for Low Disk Space

One needs to create a test environment to actually test the patch in action. Using a small RAM drive, it is possible to do that. These commands are useful to create a 20 MB partition for testing:

mkdir /tmp/small
sudo /bin/mount -t tmpfs -o size=20m,mode=0700,uid=$USER,gid=$GROUP /dev/shm /tmp/small

After invoking the above instructions and filling the disk space, you can invoke LibreOffice with the below command to use temp drive. As a result, you will get the below error message:

No disk space error

No disk space error

But, no warning message is shown when you have some small disk space which is < 1 MB.

$ instdir/program/soffice -env:SAL_USE_VCLPLUGIN=gen -env:UserInstallation=file:///tmp/small /tmp/small/1.pptx

While having < 1 MB disk space, you will get this warning in the terminal, but not when the space is between 1 and 2 MBs.

warn:configmgr:57868:58063:configmgr/source/components.cxx:190: error writing modifications com.sun.star.uno.RuntimeException message: "cannot write to file:///tmp/small/user/nnePqE at ~/Projects/libreoffice/core/configmgr/source/writemodfile.cxx:109"

Please note that both the profile and the opened file were inside /tmp/small.

Final Words

The above issue is tdf#60909. If you like it, just follow the Bugzilla link to see more information.

To implement this feature, first you have to build LibreOffice from the sources. If you have not done that yet, please refer to this guide first:

Getting Started (Video Tutorial)