Document Foundation Planet - Latest News

  • Official TDF Blog: Video: Government moving 30,000 PCs from Microsoft to LibreOffice (2024/12/03 11:45)
    Here’s a video from our recent LibreOffice Conference 2024. It details the ongoing migration of 30,000 PCs from Microsoft Office/365 to LibreOffice in the northern German state of Schleswig-Holstein. (The video is also available on PeerTube.) Please confirm that you want to play a YouTube video. By accepting, you will be accessing content from YouTube, a service provided by an external third party. YouTube privacy policy If you accept this notice, your choice will be saved and the page will refresh. Accept YouTube Content
  • Michael Meeks: 2024-12-02 Monday (2024/12/02 14:14)
    Mail chew, 1:1's with Miklos & Lily, lunch. Set off to Paris via the Eurostar.
  • Official TDF Blog: Community Member Monday: Moritz Duge (2024/12/02 12:31)
    Tell us a bit about yourself! I live in the north of Germany, in the city of Hamburg. Probably not so far away from where the first lines of what was called StarWriter where written, just a year before I was born. I remember downloading StarOffice over a 64 kbit/sec line around the year 1997. And since it turned into OpenOffice.org I used it for a lot of home work in high school, student jobs and finally my bachelor thesis in computer science. For StarOffice and OpenOffice I mainly used Windows. But around the time LibreOffice started I had shifted to Linux as a daily driver. My first contact with the LibreOffice community was when I got into a conversation with a few people at the Chaos Computer Club Congress around 2013. And as most of the last 15 years I’ll be around at the CCC too this year. As a hobby I’m engaged in politics, pushing Open Source, data protection, privacy as well as environmental protection topics. And to calm down I’m cycling, pursuing my interest for astrophysics and recently started doing Yoga. What are you working on in the LibreOffice project right now? In summer I’ve reworked some parts of the GPG / OpenPGP and X.509 integration in LibreOffice. Drastically improving the performance for users with large GPG keyrings like me. But also making the GPG and X.509 workflows in the LibreOffice UI more user friendly. Knowing there’s still much work left to do. Beside I’m mostly working on the web integration of LibreOffice. I’m spending a lot of time with LOWA (LibreOffice Web Assembly) builds, improving them with my colleague Stephan Bergmann, and even committed my first patch to Emscripten to improve LOWA debugging. My top priority is currently to work on ZetaJS, which wraps UNO into a native JavaScript API. It’s being used to integrate LibreOffice into web apps without the need for a huge server running server side LibreOffice processes. I’ve also written some nice example use cases like this one. Why did you choose to join the project, and how was the experience? I’ve worked with Linux for many years. Mainly as Ruby developer and web administrator. But I’ve always had a big interest into more classical technical environments. I really like strong typing. And I’ve collected some experience with big C code bases. Like when bisecting Wine to keep old Star Trek games running, or when debugging the amdgpu Linux driver for my notebook. Although not without great help from the AMD guys! So when looking for new tasks, I remembered the LibreOffice guys I met at the CCC and I had some talks with Thorsten Behrens who kindly offered me a job at allotropia. For me LibreOffice is one of the flagship projects of Open Source beside the Linux kernel and Firefox. And I’m enthusiastically absorbing all the C++ insider knowledge I can get from my colleague Stephan Surely I’m a little bit of a uncommon guy. In my old job I was usually the one who had an eye for what code did, which was written by people who left the company years ago. Maybe I should say something like “you can’t improve a software if you’re unwilling to understand the existing code base”. And I like to call LibreOffice “your friendly code base from the 90s” So there’s much archaeology I can do in LibreOffice. But I also love, that because of the code base being Open Source, many developers from 10, 20 or even more years ago are still in the community. So they might still remember what some code line was for. I’ve always preferred decentralized solutions. And I know quite well how to get around with IRC, mailinglist and Bugzilla. So I’m probably not the regular guy of today, who’s conveniently doing everything via GitHub. Nevertheless, I hope I’m forgiven when stumbling over a few conventions I didn’t know before Beside I very much enjoyed all the nice conversations at my first LibreOffice Conference this year. And I’ve held a few conference talks about my work with ZetaJS and the LibreOffice-GPG improvements in the recent months. Please confirm that you want to play a YouTube video. By accepting, you will be accessing content from YouTube, a service provided by an external third party. YouTube privacy policy If you accept this notice, your choice will be saved and the page will refresh. Accept YouTube Content Anything else you plan to do in the future? What does LibreOffice really need? Surely web, mobile and collaborative editing are important topics. I’m myself using Collabora Online even outside IT communities since years. But I like to see it work even better with low end servers like a Raspberry Pi, to enable everyone with a small home server to serve a LibreOffice-Online instance. So moving the actual LibreOffice binary from the server into the browser’s WASM engine and enabling P2P collaborative editing is definitely a long-term goal. Besides that, I also see that machine learning, some call it AI, can help with a lot of simple tasks. Knowing that more difficult tasks like programming often end in quite disastrous results, machine learning might be a good opportunity to help beginners to create great documents quickly with LibreOffice. And free software like SpeechNote shows me, that there’s no need to run stuff through a questionable online service. But instead only the proper training models need to be provided. Beside I always cherish rock-solid software. Nobody will continue to use an app which constantly crashes or stores data in a broken file, resulting in many hours of writing being lost. So as in many software projects, a big priority is always to just keep things running as well as they ran before.
  • Michael Meeks: 2024-12-01 Sunday (2024/12/01 21:00)
    All Saints, family service + Baptism in the morning, caught up with wider church family; home for Pizza lunch with E. Put up Christmas decorations left & right. Slugged variously, watched Night Action some Fallout - gratuitous gore, but interesting effects & characters.
  • Michael Meeks: 2024-11-30 Saturday (2024/11/30 21:00)
    Got up very late; wrote another four abstracts for various conference talks, and submitted them. Got a number of presents and fixes done. Managed to get permanent marker off the fridge white-board with isopropyl alcohol. Pottered about a bit. J. home for dinner - watched Night Action with E.
  • Chris Sherlock: The mess that is the VCL (2024/11/29 22:58)
     Let me count the ways, in no particular order and in no way exhaustive:OutputDevice is the base class for printing, windowing and PDFs. It doesn't just do output. OutputDevice has GetOutDevType() because the base class needs to know what child class is using it. Ugh. OutputDevice drawing primitives not only draw, but they record a metafile. There are literally functions that turn off drawing and just let it record the metafile. I made an attempt at seperating the concerns, but it got nowhere. VCL relies on DrawingLayer and DrawingLayer relies on the VCL. There is a concept of a VirtualDevice, which is derived from OutputDevice. VirtualDevice does a bunch of things, but one of which is alpha-handling. In OutputDevice, there is a member which is a VirtualDevice. Each drawing function in Outputdevice calls upon the correlated drawing function in this member VirtualDevice. Bitmaps don't get modified via the Bitmap class. Instead, you have to use BitmapInfoAccess, BitmapReadAccess and BitmapWriteAccess. I'm still puzzling out why these are seperate classes. Bitmaps are transformed in SalGraphics indirectly via OutputDevice. Except when they aren't, in which case it fails, whereby OutputDevice tries an alternative way via SalGraphics. Otherwise, it tries its own poor man approach at drawing the bitmap. Consequently, often times you bypass the platform optimized ways of doing things, because its not been implemented. Fonts are lazy loaded from OutputDevice. There is no central font manager. To get the fonts, you have to go through SalGraphics. To get a SalGraphics, you need to initialize a lot of stuff not related to fonts. Font caching is done from OutputDevice. Lazily. Font data is updated for all frames. Frames are a concept needed for Windows. Frames are not a concept needed by Printers and VirtualDevices, or even PDFs. Note that Printers, VirtualDevices and PDFs all inherit from OutputDevice.  OutputDevice converts between "logical" units and display units. It's a nightmare to know what each function needs what sort of units. For the mapping between units, I refer you to vcl/source/gdi/mapmod.cxx and vcl/source/outdev/map.cxxThere is tools and basegfx. They do the same thing, though basegfx is considerably better written. You have Size and B2DSize, Point and B2DPoint, Polygon and B2DPolygon, PolyPolygon and B2DPolyPolygon. OutputDevice must handle it all. Gradient handling is sort of half baked in OutputDevice, much of gradient handling is done in other modules.  Font substitution is truly, truly weird. PhysicalFontSelect::FindFontFamilyByAttributes() has clearly got a bug in it - (e.g. ImplFontAttrs::None == ((nSearchType ^ nMatchType) & ImplFontAttrs::Rounded an XOR?) and it is a truly strange weighting scheme. Yes, I did try to untangle that beast with proper unit tests, but gave up after being told I was being unreasonable. There is VCL, canvas, cppcanvas and drawinglayer. drawinglayer is way better than VCL, but we are stuck with VCL for everything. Consider the following Window hierarchy: WorkWindow inherits from SystemWindow, which inherits from Window. Window holds an OutputDevice to do stuff. WindowOutputDevice derives from OutputDevice. This is needed because OutputDevice often needs to know if it is doing Window operations, via WindowOutputDevice. Try untangling this in your head. Text layout is its own beast, and has its own set of classes. A lot of text layout is worked out in OutputDevice.  Text layout is done via OutputDevice::ImplLayout(). I present to you the ImplLayout function signature: std::unique_ptr<SalLayout> ImplLayout( const OUString&, sal_Int32 nIndex, sal_Int32 nLen, const Point& rLogicPos = Point(0, 0), tools::Long nLogicWidth = 0, KernArraySpan aKernArray = KernArraySpan(), std::span<const sal_Bool> pKashidaArray = {}, SalLayoutFlags flags = SalLayoutFlags::NONE, vcl::text::TextLayoutCache const* = nullptr, const SalLayoutGlyphs* pGlyphs = nullptr, std::optional<sal_Int32> nDrawOriginCluster = std::nullopt, std::optional<sal_Int32> nDrawMinCharPos = std::nullopt, std::optional<sal_Int32> nDrawEndCharPos = std::nullopt) const;  
  • Michael Meeks: 2024-11-29 Friday (2024/11/29 21:00)
    Up early, run with J. sync with Dave, partner meeting, cancelled TTT for another surreal TDF Town Hall. Final review budget & other bits call with Tracie - handed over to Deirdre. More admin, and finally a bit of hacking - looked into getting my dpiscale patch finally in to communicate client per-view DPI for some pieces. Poked at conference bits - OS-XP Panel on Why pay for Free Software for next week - pulled together and circulated some questions.
  • LibreOffice QA Blog: LibreOffice 25.2 Alpha1 is available for testing (2024/11/29 17:06)
    LibreOffice 25.2 will be released as final at the beginning of February, 2025 ( Check the Release Plan ) being LibreOffice 25.2 Alpha1 the first pre-release since the development of version 25.2 started in mid Juny, 2024. Since then, 5184 commits have been submitted to the code repository and 710 bugs were set to FIXED in Bugzilla. Check the release notes to find the new features included in this version of LibreOffice. LibreOffice 25.2 Alpha1 can be downloaded for Linux, macOS and Windows, and it can be installed alongside the standard version. In case you find any problem in this pre-release, please report it in Bugzilla ( You just need a legit email account in order to create a new account ). For help, you can contact the QA Team directly in the QA IRC channel or via Matrix. LibreOffice is a volunteer-driven community project, so please help us to test – we appreciate it! Happy testing!! …
  • Michael Meeks: 2024-11-28 Thursday (2024/11/28 21:00)
    Tech planning call, customer project wrap-up call with Lily. sync with Karen, finally got to last stage annual review moderation. Home group in the evening, interrupted by a more surreal TDF / Town Hall meeting.
  • allotropia: Precision-engineering for JavaScript (2024/11/26 09:00)
    This post is about recent improvements for ZetaJS, the JavaScript wrapper library for ZetaOffice’s WebAssembly version of LibreOffice: There is something of a mismatch between the UNO type system and the JavaScript types used by zetajs. For example, JavaScript only has a single number type for both integer and floating point values, while UNO has a whole slew of different numeric types (BYTE, SHORT, UNSIGNED SHORT, LONG, UNSIGNED LONG, FLOAT, DOUBLE) that all map to that one JavaScript type. Similarly, the different UNO sequence<T> types all map to JavaScript arrays, where information about the UNO element type T is lost. Normally, that’s not an issue. When you call a UNO method that returns a LONG, you get a number just like when you call a UNO method that returns a DOUBLE, and your JavaScript code then has a number to work with, and that’s all. Similarly, when you call a UNO method that returns a sequence<LONG>, you get an array of numbers you can work with, just like when you call a UNO method that returns a sequence<DOUBLE>. And when you then call a UNO method that takes a seaquence<LONG> as an argument, you pass in an array of numbers, and the zetajs runtimes figures out how to dress that array up as a UNO sequence<LONG>, and all is well. However, one place where UNO’s insistance on more precise typing gets in the way is the UNO ANY type. It is not just a means to transport any kind of UNO value, it also carries precise type information. A UNO ANY value that contains a LONG of value 1 is something different than a UNO ANY vlaue that contains an UNSIGNED LONG of value 1. And a UNO ANY value that contains a reference of type css.uno.XInterface to some UNO object is something different than a UNO ANY value that contains a reference of type css.lang.XComponent to the same UNO object. Again, most of the time, those precise distinctions are irrelevant to most of the code. When you call a UNO method that returns an ANY, and you know that that ANY value must contain a LONG, you just want to get a JavaScript number out, regardless of what precise numeric UNO type was encoded in that ANY value. Similarly, when you call a UNO method that returns an ANY that must contain a css.uno.XInterface reference, you just want to get some JavaScript object that you can do further UNO method calls on (or null), regardless of what precise UNO interface type was encoded in that ANY value. And when you then call a UNO method that takes an ANY that must contain a LONG, you want to just pass in a JavaScript number, and the zetajs runtime shall figure out how to dress that up as a UNO ANY containing a LONG (or throw an exception, if you passed something that just can’t be dressed up accordingly). But, sometimes, you need more fine-grained control. There might be a UNO method that takes an ANY argument and behaves completely differently when you pass it a LONG of value 1 or an UNSIGNED LONG of value 1. But when you call that UNO method with the JavaScript number 1, zetajs will always dress that up as a UNO ANY of type LONG for you, never as an UNSIGNED LONG. To solve that issue, the zetajs UNO binding also has the notion of a zetajs.Any JavaScript type, which records a value along with its precise UNO type. You can thus pass either a new zetajs.Any(zetajs.type.long, 1) or a new zetajs.Any(zetajs.type.unsigned_long, 1) when you call that picky UNO method. Now, when a UNO method returns an ANY value, the zetajs binding used to be conservative: You might want to know exactly what UNO type it contains (even though, most of the time you don’t actually care), so it always returned those wrapped zetajs.Any objects that carry the precise contained UNO type. But that lead to awkward code. When you call e.g. x.nextElement() to get a UNO ANY that contains a reference to another UNO object, you had to unwrap that first (with zetajs.fromAny) before you could do any further calls on the obtained UNO object: zetajs.fromAny(x.nextElement()).doSomething(). But you know that this call to x.nextElement() will return an ANY containing an interface reference, and you don’t care about the exact UNO interface type—you just want to do another method call on the obtained object. So, recently (in Let zetajs return unwrapped ANY representations), the zetajs binding was changed so that it now always returns unwrapped UNO ANY values: x.nextElement() no longer returns a zetajs.Any wrapper (on which you would need to call zetajs.fromAny first), it directly returns the relevant JavaScript object. And the resulting overall code looks way better: x.nextElement().doSomething(). When, in the other direction, you pass something into a UNO method that takes an ANY argument, you still have the same options you had before: Either, you simply pass the JavaScript number 1, and zetajs figures out for you that that should be dressed up as a UNO ANY of type LONG, or you want to be picky and pass in either a new zetajs.Any(zetajs.type.long, 1) or a new zetajs.Any(zetajs.type.unsigned_long, 1). And when it comes time that you do want to be picky about the ANY values that you obtain as return values from UNO method calls, there’s now a $precise way to do that: x.$precise.nextElement() (and same for any other UNO method call) will always give you back a wrapped zetajs.Any value. See the updated The zetajs UNO Mapping for all the details.
  • LibreOffice Dev Blog: VCL weld: create LibreOffice GUI from design files (2024/11/22 17:07)
    LibreOffice uses VCL (Visual Class Library) as its internal widget toolkit to create the graphical user interface (GUI) of LibreOffice. Here I discuss how to use UI files designed with Glade interface designer to create LibreOffice user interfaces with a framework called weld, which is part of LibreOffice core source code. Creating a Minimal VCL Weld Application In my previous blog post, you can find out about the structure of a minimal VCL application. Please refer to the below blog post to see how a Window is created in VCL, and how it can be used as a test workbench called minvcl. You can run it with ./bin/run minvcl after you build LibreOffice. VCL application in its minimal form Here I discuss how to go further, and create user interface with Glade interface designer, and do most of the things without writing code. VCL Weld Mechanism In order to simplify user interface creation in LibreOffice, experienced LibreOffice developer, Caolán, has introduced a mechanism to load UI files created with Glade interface designer, and use them as if they are UI files for each and every GUI framework that LibreOffice supports: from GTK itself to Qt, Windows, macOS and even the so-called gen backend that only requires the X11 library on Linux. To illustrate how the VCL weld mechanism works, I have added a minimal example, minweld, as a test workbench. The structure of the code is very similar to the previous example, minvcl, but there are some changes in the code. In the new code, UI is created from a .ui file that is designed visually with Glade interface designer. The .ui file is an XML file which contains placement of widgets that should be displayed on the screen. The complete code for minweld is available in the LibreOffice core source code repository, which can also be viewed online: OpenGrok: LibreOffice core source: vcl/workben/minweld.cxx Glade UI File In minweld, I have used an existing Glade UI file, tipofthedaydialog.ui. This is the user interface for displaying a tip of the day in LibreOffice at startup. Heiko, the TDF design mentor, has discussed this dialog box in detail before: Easyhacking: How to create a new “Tip-Of-The-Day” dialog But, you can assume that it is a simple .ui file, that one can create with Glade. Here, we use it to create our own user interface in C++. You may use any other .ui file that you have created with almost the same code. Tip of the day displayed at LibreOffice startup This UI file is found in cui/uiconfig/ui/tipofthedaydialog.ui, and minweld loads it. This is how it looks when you open it in Glade interface designer: tipofthedaydialog.ui in Glade user interface designer Let’s look into the specifics of minweld.cxx. Header Includes Headers are almost the same, but here we use vcl/weld.hxx instead of vcl/wrkwin.hxx. Therefore, you can see this line in the code: #include <vcl/weld.hxx> Then we have the C++ code for the application. The TipOfTheDayDialog class is defined with: class TipOfTheDayDialog : public weld::GenericDialogController { public: TipOfTheDayDialog(weld::Window* pParent = nullptr); DECL_LINK(OnNextClick, weld::Button&, void); private: std::unique_ptr<weld::Label> m_pTextLabel; std::unique_ptr<weld::Button> m_pNextButton; sal_Int32 m_nCounter = 0; }; ... } As you can see, TipOfTheDayDialog inherits from weld::GenericDialogController, and not Application class as before. Also, TipOfTheDayDialog constructor receives a parent of type weld::Window*, which is nullptr now. The reason is that there is no parent window in this example. Using weld:: prefix is also done for other types of widgets that we use in LibreOffice. For example, we use weld::Button to denote a push button in LibreOffice, or in any application that is created with the vcl::weld mechanism. Class Constructor This is the code for the TipOfTheDayDialog constructor. Here, we initialize two member variables, m_pTextLabel and m_pNextButton which point to a label and a button, respectively. We will interact with these two in our code. There are string literals like lbText and btnNext , which are the IDs of those widgets in Glade. The IDs should be unique for linking to specific variables in the code. TipOfTheDayDialog::TipOfTheDayDialog(weld::Window* pParent) : weld::GenericDialogController(pParent, u"cui/ui/tipofthedaydialog.ui"_ustr, u"TipOfTheDayDialog"_ustr) , m_pTextLabel(m_xBuilder->weld_label(u"lbText"_ustr)) , m_pNextButton(m_xBuilder->weld_button(u"btnNext"_ustr)) { m_pNextButton->connect_clicked(LINK(this, TipOfTheDayDialog, OnNextClick)); } One last step is linking the events with functions in the code. You may do that with the LINK macro. In the last line, connect_clicked activates OnNextClick from the class TipOfTheDayDialog, whenever m_pNextButton is clicked. Event Handler This is the implementation of the event handler. It should be started with IMPL_LINK macro, in the form of IMPL_LINK_NOARG(Class, Member, ArgType, RetType). The code is straightforward: It increases a counter which is initially zero, and displays it alongside a text: IMPL_LINK_NOARG(TipOfTheDayDialog, OnNextClick, weld::Button&, void) { ++m_nCounter; m_pTextLabel->set_label(u"Here you will see tip of the day #"_ustr + OUString::number(m_nCounter) + "."); } With a call to set_label function, m_pTextLabel is updated every time that you click on “Next Tip” button. Running the Example You may run the example after you have built LibreOffice from sources. Then, you may simply invoke: ./bin/run minweld The result is a little bit different from the tipoftheday dialog in LibreOffice, as it does not use a picture. But, it has a nice feature: if you click on “Next Tip”, it will show a text and a counter that goes up whenever you click on it again. Final Notes You may look into the original “tip of the day” dialog box in cui/source/dialogs/tipofthedaydlg.cxx, which is more complex than the one that we created here, as it reads some data from the configuration and uses images. But, the idea is the same. Inherit a class from GenericDialogController, define and link variables to the widgets with their IDs, add event handlers. Now, the application with VCL graphical user interface is ready to use! This is somehow similar to the way one creates dialog boxes with Qt and other widget toolkits. On the other hand, the VCL weld mechanism is different in the way that it uses such a toolkit to create UI on the fly. Therefore, if you choose a desired VCL UI plugin, then it will use that specific library for creating user interface. For example, you can run minweld example with Qt this way: export SAL_USE_VCLPLUGIN=qt5 ./bin/run minweld The minweld example in Qt (light theme) You may also run it with GTK3 UI, this way: export SAL_USE_VCLPLUGIN=gtk3 export GTK_THEME=Adwaita:light # For light/dark theme ./bin/run minweld The minweld example in GTK3 (light theme) I hope that this explanation was helpful for you to understand the basics of GUI design and implementation in LibreOffice. You can try doing small improvements in LibreOffice GUI by looking into the EasyHacks that with the tag “Design“: TDF Wiki: EasyHacks categorized by “Design” as the required skill We welcome your code submissions to improve LibreOffice. If you would like to start contributing to LibreOffice, please take a look at our video tutorial: Getting Started (Video Tutorial)
  • Marius Popa Adrian: Read free book "Detailed New Featuires Of Firebird 5": available as HTML and as PDF (2024/11/21 09:05)
    Dive deep into the revolutionary features of Firebird 5.0 with this comprehensive guide written by database expert Denis Simonov and edited by Alexey Kovyazin.This book offers an in-depth exploration of the significant advancements that make Firebird 5.0 a pivotal release in the world of relational databases.Whether you're a seasoned database administrator, a curious developer, or an IT
  • Official TDF Blog: LibreOffice Podcast, Episode #1 – Marketing Free Software (2024/11/19 15:34)
    Italo Vignoli and Mike Saunders from The Document Foundation, the non-profit organisation behind LibreOffice, discuss marketing free and open source software (FOSS). This video is also available on PeerTube. Please confirm that you want to play a YouTube video. By accepting, you will be accessing content from YouTube, a service provided by an external third party. YouTube privacy policy If you accept this notice, your choice will be saved and the page will refresh. Accept YouTube Content
  • Official TDF Blog: Month of LibreOffice, November 2024 – Half-way point! (2024/11/17 10:59)
    Yes, we’re half-way through the Month of LibreOffice, November 2024. And already, 206 contributors have already won cool LibreOffice sticker packs! Details on how to claim them will be provided at the end of the month, but if you don’t see your name (or username) on that page, it’s not too late to join… How to take part There are many ways you can help out – and you don’t need to be a developer. For instance, you can be a: Handy Helper, answering questions from users on Ask LibreOffice. We’re keeping an eye on that site so if you give someone useful advice, you can claim your shiny stickers. First Responder, helping to confirm new bug reports: Go to our Bugzilla page and look for new bugs. If you can recreate one, add a comment like “CONFIRMED on Windows 11 and LibreOffice 24.8.3”. Drum Beater, spreading the word: Tell everyone about LibreOffice on Mastodon, Bluesky or X (Twitter)! Just say why you love it or what you’re using it for, add the #libreoffice hashtag, and at the end of the month you can claim your stickers. Globetrotter, translating the user interface: LibreOffice is available in a wide range of languages, but its interface translations need to be kept up-to-date. Or maybe you want to translate the suite to a whole new language? Get involved here. Code Cruncher, contributing source code: The codebase is big, but there are lots of places to get involved with small jobs. See our Developers page on the website and this page on the wiki to get started. Docs Doctor, writing documentation: Whether you want to update the online help or add chapters to the handbooks, here’s where to start. So, two more weeks to go! We’ll be posting more updates on this blog and our Mastodon, Bluesky and X (Twitter) accounts…
  • Official TDF Blog: Another eight videos from the LibreOffice Conference 2024 (2024/11/15 11:26)
    The next batch is here! We’re editing and uploading more videos from our recent conference – these ones covering C++, the LibreOffice WebAssembly port from Allotropia, and Collabora Online. Use the icon in the top-right to choose videos from the playlist: Please confirm that you want to play a YouTube video. By accepting, you will be accessing content from YouTube, a service provided by an external third party. YouTube privacy policy If you accept this notice, your choice will be saved and the page will refresh. Accept YouTube Content
  • LibreOffice Dev Blog: Notebookbar part 1: custom widgets for the tabbed interface (2024/11/14 15:04)
    Notebookbar, or tabbed interface is an attempt to modernize LibreOffice user interface. In these series, I try to explain the implementation in LibreOffice code. In the first part, I discuss custom Glade widgets that are building blocks of Notebookbar user interface. Building LibreOffice From Sources If you haven’t built LibreOffice from sources before, you can refer to can refer to this tutorial: Getting Started (Video Tutorial) The next sections assume that you have a working build environment. Custom Widgets in Glade Catalogs Notebookbar implementation consists of .ui files, configuration files and C++ implementation. Let’s look into the user interface files. First time that you clone LibreOffice source code, and try to open a Notebookbar UI file like this, you may see error: $ glade ./sc/uiconfig/scalc/ui/notebookbar.ui You may see an error, which indicates that a required catalog related to LibreOffice is not available. Glade error To fix this issue, you have to know that Notebookbar uses custom widgets that with the Glade interface designer. These custom widgets are available from a Glade catalog with the name of LibreOffice. Inside sc/uiconfig/scalc/ui/notebookbar.ui, you may see these two lines: <requires lib="gtk+" version="3.20"/> <requires lib="LibreOffice" version="1.0"/> Glade catalogs are xml files with the keyword glade-catalog inside them, so we can search for this keyword: $ git grep -l glade-catalog extras/source/glade/libreoffice-catalog.xml.in extras/source/glade/makewidgetgroup.xslt The .in files is an input file in which the build process creates the final xml file out of it. Searching for glade-catalog inside the build folder results: $ grep -lr glade-catalog ... instdir/share/glade/libreoffice-catalog.xml As you can see, the result goes inside the folder instdir/share/glade/, so to be able to use the catalog, you should add this folder to the glade catalog search path. One of the easiest ways to do this, is to add it via Glade interface itself. Use ☰ (hamburger menu), go to “Glade Preferences”, and add instdir/share/glade/ to the “Extra Catalog & Template paths”. Then, reload a notebookbar UI file, and the error should go away. This setting is saved inside ~/.config/glade.conf configuration file. Custom Widgets for the Notebookbar Inside the Glade custom catalog instdir/share/glade/libreoffice-catalog.xml, you can see 10 custom widgets: $ grep "glade-widget-class\ " instdir/share/glade/libreoffice-catalog.xml <glade-widget-class title="Notebookbar ToolBox" name="sfxlo-NotebookbarToolBox" generic-name="Notebookbar ToolBox" parent="GtkToolbar" icon-name="widget-gtk-toolbar"> <glade-widget-class title="Notebook switching tabs depending on context" name="sfxlo-NotebookbarTabControl" generic-name="NotebookbarTabControl" parent="GtkNotebook" icon-name="widget-gtk-notebook"/> <glade-widget-class title="Horizontal box hiding children depending on its priorities" name="sfxlo-PriorityHBox" generic-name="PriorityHBox" parent="GtkBox" icon-name="widget-gtk-box"/> <glade-widget-class title="Horizontal box hiding children depending on its priorities" name="sfxlo-PriorityMergedHBox" generic-name="PriorityMergedHBox" parent="GtkBox" icon-name="widget-gtk-box"/> <glade-widget-class title="Box which can move own content to the popup" name="sfxlo-DropdownBox" generic-name="DropdownBox" parent="GtkBox" icon-name="widget-gtk-box"/> <glade-widget-class title="Box which can hide own content" name="VclOptionalBox" generic-name="VclOptionalBox" parent="GtkBox" icon-name="widget-gtk-box"/> <glade-widget-class title="Vertical box hiding children depending on context" name="sfxlo-ContextVBox" generic-name="ContextVBox" parent="GtkBox" icon-name="widget-gtk-box"/> <glade-widget-class title="Managed Menu Button" name="svtlo-ManagedMenuButton" generic-name="ManagedMenuButton" parent="GtkButton" icon-name="widget-gtk-button"/> <glade-widget-class title="NotebookBar Toolbar Addons" name="NotebookBarAddonsToolMergePoint" generic-name="ShowText" parent="GtkToolButton" icon-name="widget-gtk-toolbutton"/> <glade-widget-class title="NotebookBar MenuItem Addons" name="NotebookBarAddonsMenuMergePoint" generic-name="ShowText" parent="GtkMenuItem" icon-name="widget-gtk-menuitem"/> The previous xml shows the custom widgets that are building blocks of building Notebookbar. Let’s look into each of them, based on their title and names. Notebookbar widgets In the next picture, you can see the notebookbar in LibreOffice, and compare it to what is visible in Glade user interface designer. As you can see, not everything is visible in the designer. Specifically, icons and text are not visible in the designer but are visible in the final application.   Notebookbar in LibreOffice Main Widget 1. Notebookbar Tab Control: This widget has the name sfxlo-NotebookbarTabControl, and is the primary widget for Notebookbar. It can change the set of visible tabs based on the user context. Its parent class is GtkNotebook and provides context-sensitive tab switching. Container Widgets 2. NotebookbarToolBox: This widget is named sfxlo-NotebookbarToolBox,  its parent class is GtkToolbar. It can contain toolbar elements. NotebookbarTabControl 3. Priority Horizontal Box: This widget has the name sfxlo-PriorityHBox, and its parent class is GtkBox. It is the horizontal box hiding children depending on its priorities. In this way, lower priority widgets becomes hidden to give the more important widgets room to be displayed on a screen that is not big enough to show all the available elements. 4. Priority Merged Horizontal Box: This widget has the name sfxlo-PriorityMergedHBox, and its parent class is GtkBox. It is the “horizontal box hiding children depending on its priorities”. This widget is also related to the previous one for creating more room for important widgets, but it is used inside the PriorityHBox. 5. Optional Box: This widget has the name VclOptionalBox, and its parent class is GtkBox. This “box which can hide own content”, is a widget that is useful for creating small areas dedicated to a specific purpose. For example, you may see Home-Section-Clipboard, which is used to define an area for clipboard related tasks inside Home tab. 6. Contextual Vertical Box: This widget has the name sfxlo-ContextVBox and is a “vertical box hiding children depending on context” and its parent class is GtkBox. It provides a box that can act based on the context, showing and hiding its children accordingly. You may look into sw/uiconfig/swriter/ui/notebookbar_single.ui, which provides an example use. Here is the correct control hierarchy, as depicted and described in the TDF Wiki: Correct Notebookbar controls hierarchy Menu Widgets 7. Dropdown Box: This widget has the name sfxlo-DropdownBox, its parent class is GtkBox and is a “box which can move own content to the popup”. This is also useful where the space for the tabbed interface is not big enough. The menu, is what you can see in “File” and “Help” menu in every notebookbar in LibreOffice tabbed interface. Please note that only 1 GtkBox child should be inside it, so that the popup works properly. In fact, the above diagram shows the correct usage. 8. Managed Menu Button: This widget has the name svtlo-ManagedMenuButton, and its parent class is GtkButton. It is a “Managed Menu Button”. It provides a button that opens a dynamic menu which is populated according to the context. Custom Widgets for the Extensions 9. NotebookBar MenuItem Addons: This widget has the name NotebookBarAddonsToolMergePoint, and its parent class is GtkToolButton. Specifically, LibreOffice extensions can use it for adding additional tools to the notebookbar. 10. NotebookBar MenuItem Addons: This widget has the name NotebookBarAddonsMenuMergePoint, and its parent class is GtkMenuItem. This is also used for adding extra items into the notebookbar. Final Notes You can find useful information about Notebookbar in the design team blog: Easyhacking: How to set up your environment DIY UI: How to create your own Notebookbar Evolving Past the Restrictions of Toolbars And at last, these are some useful Wiki articles around Notebookbar in the TDF Wiki: TDF Wiki – Notebookbar TDF Wiki – Notebookbar implementation TDF Wiki – Create new dialog in Impress
  • LibreOffice QA Blog: QA/Dev Report: October 2024 (2024/11/10 12:31)
    General Activities LibreOffice 24.2.7 was released on October 31 Olivier Hallot (TDF) continued with a massive Help bookmark cleanup effort and improved the help for BASIC’s Option Explicit statement Pierre F. reorganised some help pages for Calc functions Bogdan Buzea fixed nearly 70 issues pointed out by PVS-Studio static analyser Miklós Vajna (Collabora) made the Hide Whitespace feature in Writer more robust, fixed an issue with losing the character position of an anchor point when copying content and fixed an issue with frames becoming disconnected from their content after dragging Tomaž Vajngerl, Szymon Kłos, Skyler Grey, Vivek Javiya, Marco Cecchetti, Rashesh Padia, Jaume Pujantell and Henry Castro (Collabora) worked on LOKit used by Collabora Online Julien Nabet synchronised the API code with Java Database Connectivity version 4.3 and fixed several issues pointed out by static analysers Xisco Faulí (TDF) fixed nearly 80 issues pointed out by PVS-Studio static analyser, improved the support for context-fill and context-stroke in SVG files, converted many Java tests to CppUnit tests, added support for “greater than or equal” attribute in conditional formatting, added many automated tests while also simplifying code used across tests, upgraded many dependencies and fixed some crashes Michael Stahl (allotropia) did some fixes in Writer’s automated tests and made the zip package handling more robust Mike Kaganski (Collabora) made the breaking of Writer tables across pages more robust, improved the handling of time durations in ODS files, fixed an issue with in-document custom toolbar icons not showing in versions earlier than 6.4, made cycling from first to last tab in Calc configurable as an expert configuration option, improved grammar check popups from Duden and made assigning fixed-length strings in BASIC work. He also fixed crashes and did code cleanups Caolán McNamara (Collabora) made it possible to create rich content comments in Writer via the UNO API, improved the loading time of Impress/Draw documents with lots of master slides/pages, made presentations work on fractionally scaled displays on Linux with gtk3 UI, made it so an infobar will appear in case an opened Impress/Draw document has over a 100 master slides/pages, improved the saving speed of spreadsheets and added handling of div elements into Calc’s HTML cell content support. He also fixed many issues found by static analysers and fuzzers and did code cleanups Stephan Bergmann (allotropia) worked on WASM build. He also adapted the code to compiler changes Noel Grandin (Collabora) did a big Skia upgrade going from release m116 to m130 requiring a lot of patch rework, made it faster to open ODS files with large merged ranges and XLS files with lots of conditional formatting or query formulas, made PPTX chart importing more robust, made saving metafiles as images work, fixed lack of metadata in images or drawings exported as PNG, fixed an issue with opening RTF files with broken images and fixed an Impress/draw comment issue after a still-unreleased code rework. He also did many code cleanups and fixed many issues found by static analysers Justin Luth (Collabora) fixed unwanted content when importing DOCX files with IF fields, fixed an issue with 3D textbox form controls being imported with flat style, fixed presentations getting marked as modified when clicking into and away from an empty placeholder box, made it so keyboard shortcuts can be used for setting the font foreground and background colour based on the colour selection in the toolbar, fixed view options such as formatting characters being lost when exporting an image from Writer, improved handling of Excel’s bugs in text wrapping and improved a developer tool for diffing PDF files Michael Weghorn (TDF) worked around a Windows 11 bug affecting toolbar button backgrounds with dark themes, fixed a freeze when installing the same extension twice with kf5/kf6 UIs, made Microsoft Narrator and Microsoft Accessibility Insights for Windows work out of the box and fixed an issue with duplex printing on Linux with certain Brother printers. He also worked on using native widgets in Qt UIs Balázs Varga (allotropia) implemented support for all the “Resize shape to fit text” behaviours in PPTX files and implemented support for “Summary below data” option for Subtotal dialog in Calc Patrick Luby worked around an issue caused by Apple adding system fonts with a new and undocumented hvgl font table, fixed pasting issues with Dvorak – QWERTY keyboards on macOS, made it so child windows are no longer hidden when dragged to a different screen on macOS and fixed misleading unresponsive mouse moved events in Writer on macOS Jim Raykowski fixed issues with moving headings via the Content Navigation View in Navigator and fixed renaming a document macro library not removing the original library Armin Le Grand (allotropia/Collabora) worked on a renovation of graphics rendering on Linux with Cairo library Oliver Specht (CIB) fixed an issue with images being clipped with wrap contour applied, fixed list attributes not being overwritten by pasting in Writer, fixed cell fills being imported incorrectly from RTF files, made it so clicking into a text field in Writer selects the full field, if it still has the placeholder text and fixed print preview not updating after changing the option to print automatically inserted blank pages Heiko Tietze (TDF) added illustrations for Writer’s break options and decoupled boundary view options from non-printing characters László Németh continued polishing the support for smart justify and style separators in DOCX files Ilmari Lauhakangas (TDF) made Start Center pin icon highlighting work again, fixed Display Snap Guides toggle not working, fixed a regression that caused online Help to not be opened when trying to access Help with the option “Warn if local help is not installed” activated and aliased the obsolete .uno:InsertHyperlinkDlg command to HyperlinkDialog Christian Lohmaier (TDF) improved the WSL Windows build method and took the first steps into streamlining the dependency installation process on Windows using winget and Dev Home Eike Rathke (Red Hat) made support for Excel 3D references more robust and added support for Santali, Ol Chiki language Jonathan Clark (TDF) fixed RTL/LTR toolbar buttons not updating after direction change in Writer page style, improved the Microsoft Word compatibility of document grid layout when importing DOC/DOCX files and made kashida justification work with AAT fonts Tibor Nagy (allotropia) made it so the document opening process is hidden when opening a linked presentation Sahil Gautam improved the user experience of the new Duplicate Records dialog Mohit Marathe continued polishing the new Comments Sidebar deck Rafael Lima implemented Sensitivity Report in Calc’s LpSolve solver Jean-Pierre Ledure worked on the ScriptForge library Andreas Heinisch fixed an issue with pinned documents in the Start Center causing the scrollbar to disappear sometimes Bartosz Kosiorek did many improvements to libvisio which are now available in version 0.1.8. He also fixed a crash in libcdr and did build and documentation improvements to libetonyek Chris Sherlock did code cleanups in VCL Eloi Montañés fixed duplication of TSA URLs in the Signing tab of the Export as PDF dialog Hossein Nourikhah (TDF) fixed Additions Dialog not working in Start Center Đoàn Trần Công Danh implemented support for cross-compiling with KDE 6 and fixed a compatibility issue in the build configure script Marc Mondesir improved scrolling behaviour Thorsten Behrens (allotropia) fixed missing highlight colour for outline text during slideshow Pranam Lashkari (Collabora) improved the new easy Conditional Formatting dialog and the automatic assignment of font colour in Calc per the cell background colour Samuel Adesola added a couple of automated tests and made it possible to set the compatibility option for ignoring tabs and blanks for line calculation via the UI Gábor Kelemen (allotropia) improved the developer tool for finding unneeded includes David Gilbert implemented handling of clipToStrokePath in imported PDFs Xuan Chen improved the compatibility with riscv64 CPUs Vladislav Tarakanov did initial work on supporting tint/shade values for textboxes in DOCX files Vasily Melenchuk (CIB) fixed section break between tables not imported in RTF files Kudos to Ilmari Lauhakangas for helping to elaborate this list. Reported Bugs 468 bugs, 83 of which are enhancements, have been reported by 301 people. Top 10 Reporters Eyal Rozenberg ( 50 ) Gabor Kelemen (allotropia) ( 24 ) Mike Kaganski ( 9 ) Jeff Fortin Tam ( 9 ) Michael Otto ( 7 ) peter josvai ( 7 ) Xisco Faulí ( 6 ) Hossein ( 4 ) Rafael Lima ( 4 ) Buovjaga ( 4 ) Triaged Bugs 356 bugs have been triaged by 65 people. Top 10 Triagers Buovjaga ( 56 ) m_a_riosv ( 44 ) Heiko Tietze ( 33 ) Julien Nabet ( 25 ) V Stuart Foote ( 20 ) Dieter ( 17 ) Mike Kaganski ( 17 ) Michael Weghorn ( 12 ) Xisco Faulí ( 11 ) raal ( 10 ) Resolution of resolved bugs 349 bugs have been set to RESOLVED. Check the following sections for more information about bugs resolved as FIXED, WORKSFORME and DUPLICATE. Fixed Bugs 126 bugs have been fixed by 32 people. Top 10 Fixers Noel Grandin ( 11 ) Mike Kaganski ( 10 ) Michael Weghorn ( 8 ) Justin Luth ( 6 ) Heiko Tietze ( 5 ) László Németh ( 5 ) Xisco Fauli ( 5 ) Jim Raykowski ( 4 ) Jonathan Clark ( 3 ) Miklos Vajna ( 3 ) List of critical bugs fixed tdf#163019 Calc 24.8.1 crashes if Copy Paste Paste special are executed (steps in comment 6) ( Thanks to Andreas Heinisch ) tdf#163543 File crash in LibreOffice Writer when selecting and copying content ( Thanks to Xisco Fauli ) List of high severity bugs fixed tdf#100894 FILEOPEN FILESAVE IMPORT Conditional formatting: xls file with a lot of Conditional formatting freeze Calc when opening Styles sidebar ( Thanks to Noel Grandin ) tdf#152534 Win11 dark theme support–Active selections have light blue background which makes white icons and text almost invisible ( Thanks to Michael Weghorn ) tdf#159690 Manual line break forces automatic Wrap Text – comment 17 ( Thanks to Justin Luth ) tdf#161919 Two programatically composed UI strings, not suitable for localization – “Delete All” %s and “Delete %s” ( Thanks to Jim Raykowski ) tdf#161986 ODS fileopen got much slower in 7.4 ( Thanks to Noel Grandin ) tdf#163231 Correttore ortografico italiano non funziona ( Thanks to Julien Nabet ) tdf#163275 Typing “-(!1)” into a spreadsheet cell and then clicking no in the dialog about formula error crashes libreoffice ( Thanks to Caolán McNamara ) tdf#163375 Calc crash when type-in a range in Formula Wizard ( Thanks to Balazs Varga ) List of crashes fixed tdf#161968 UI Assign macro to shape crashes CALC ( Thanks to Noel Grandin ) tdf#163019 Calc 24.8.1 crashes if Copy Paste Paste special are executed (steps in comment 6) ( Thanks to Andreas Heinisch ) tdf#163191 Dragging headings in Writer navigator crashes LO Writer ( Thanks to Jim Raykowski ) tdf#163219 ScriptForge library crash ( Thanks to Jean-Pierre Ledure ) tdf#163275 Typing “-(!1)” into a spreadsheet cell and then clicking no in the dialog about formula error crashes libreoffice ( Thanks to Caolán McNamara ) tdf#163295 LibreOffice crashes when processing XML files containing the string “pwi”. ( Thanks to Mike Kaganski ) tdf#163375 Calc crash when type-in a range in Formula Wizard ( Thanks to Balazs Varga ) tdf#163543 File crash in LibreOffice Writer when selecting and copying content ( Thanks to Xisco Fauli ) tdf#163575 sw smart justify: crash/assert during odt conversion of an Arabic DOCX document ( Thanks to László Németh ) tdf#163697 Inserting new lines in Basic IDE causes crash/triggers assert when assistive technology is active on Windows ( Thanks to Mike Kaganski ) tdf#163699 LO crashes when double-clicking an image in the navigator. ( Thanks to László Németh ) List of performance issues fixed tdf#100894 FILEOPEN FILESAVE IMPORT Conditional formatting: xls file with a lot of Conditional formatting freeze Calc when opening Styles sidebar ( Thanks to Noel Grandin ) tdf#161986 ODS fileopen got much slower in 7.4 ( Thanks to Noel Grandin ) List of old bugs ( more than 4 years old ) fixed tdf#100894 FILEOPEN FILESAVE IMPORT Conditional …
  • allotropia: Announcing ZetaOffice, a new LibreOffice Technology product for web, mobile & desktop (2024/11/08 10:59)
    Hamburg and Bolzano, November 8th, 2024 – During the two-day annual South Tyrol Free Software Conference, allotropia software GmbH today announces beta versions of its new product line “ZetaOffice”. ZetaOffice is a new set of applications, libraries and services, all powered by the LibreOffice Technology stack. Featured among its products is ZetaJS, an innovative browser-based plugin, with unique programmability & embeddability – the perfect tool for complex office editing, process automation and line-of-business applications in the web. Additionally, leveraging the unique portability and flexibility of the LibreOffice Technology stack, ZetaOffice will be available in bit-by-bit identical versions (allowing for perfect interoperability and feature parity) also for open-source-based mobile operating systems (Android, and derived OS), as well as for all relevant desktop operating systems (Windows, macOS, Linux – via flatpak and snapcraft). “We’re very excited being able to offer powerful, data-sovereign Open Source office functionality on even more platforms today”, says Thorsten Behrens, owner and managing director of allotropia software. “In particular our innovative, WASM-based browser version of LibreOffice will be a game-changer for every web developer in need of processing, analysing or integrating with office documents.” “This could not have come at a better time”, says Michiel Leenaars, director of strategy at philanthropic investor NLnet Foundation. “It is long overdue but certainly in the wake of the recent geo-political developments, we all recognise the urgent need for Europe to regain its technological independence when it comes to core technologies – as boring as these may seem. ZetaOffice shows that Europe has the talent and capacity to break with the past and create new paradigms and use innovation and collaboration to save the day.” “ZetaOffice is the perfect addition to our portfolio of tools for document and business process automation”, says Uli Brandner, CEO and owner of CIB Group. “With solutions like CIB flow for workflow modeling and CIB coSys for high-quality template management, CIB Group already offers powerful digitalization tools. As demand grows to bring proven applications to the web and stay on the cutting edge of technology, ZetaOffice stands out as an innovative solution precisely tailored to our customers’ needs.” A detailed blog post, including links to beta versions of the software, is available here. For the products, please refer to our website at zetaoffice.net. ZetaOffice and the team at allotropia thanks the European Commission’s Next Generation Internet initiative/NGI Zero for its financial contribution to the development of this software. About ZetaOffice: ZetaOffice is a product line based on LibreOffice Technology, comprising of desktop LTS products for classical office productivity requirements; a browser-native version based on WebAssembly for fast, client-side integration and automation of office technology; and anupcoming mobile app widget, for deep integration in mobile line-of-business applications. ZetaOffice is focused on speed, superb embeddability, excellent inter-product as well as Office compatibility, and geared towards digital-sovereign & data protection needs. About ZetaJS: ZetaJS is a JavaScript library, available via the npm package manager, to enable developers to quickly & conveniently embed ZetaOffice WebAssembly in web applications. ZetaJS makes available the entire gamut of the LibreOffice programmability interfaces, providing a web-native component for JavaScript developers to deeply embed an office suite into their web apps. In contrast to classical cloud-office setups, ZetaJS can be used as an integral, client-side part of any web application – permitting users to interact with office documents as part of a larger application framework, with very low latency. That way, e.g. direct integration for editing, suggestions or running calculations in complex spreadsheets can be provided. Similarly, it’s trivially easy to implement direct, client-side rendering and export of office documents into PDF or HTML – all via a self-hostable, digital-sovereign Open Source solution. About allotropia software GmbH: The company allotropia software GmbH provides services, consulting and products around LibreOffice and related opensource projects. Founded in 2020 by long-time developers of the project, its stated mission is to make LibreOffice shine – in as many different shapes and forms as necessary to serve modern needs towards office productivity software. allotropia software GmbH is headquartered in Hamburg, Germany at the birthplace of the OpenOffice/LibreOffice project. For more information, visit allotropia.de, or follow fosstodon.org/@allotropia on Mastodon and LinkedIn: www.linkedin.com/company/allotropia-software-gmbh
  • allotropia: Launching ZetaJS for ZetaOffice (2024/11/08 10:58)
    Today allotropia has launched the ZetaOffice range of products at the SFSCON in South Tyrol. ZetaOffice is a LibreOffice Technology built & designed for professional use in the browser, on the desktop and on mobile. We are excited to additionally announce a massively improved way for which LibreOffice Technology can be used fully client-side on the web. As an additional building block, we have developed the ZetaJS wrapper, which enables convenient embedding and automating WASM (WebAssembly) builds of ZetaOffice via JavaScript. With that, all of the LibreOffice Technology APIs and features are available to web applications – and by leveraging WASM, which runs ZetaOffice client-side, no server or cloud services are needed. All processing is taking place on the client browser, which minimizes latencies & load (of course, a minimal static delivery of web application code, assets and the WASM binary is still needed, but that’s extremely light-weight).  Examples Let’s look at some simple examples to give you an idea, how easy ZetaOffice integration is. All comprise of an HTML and a JavaScript file. A ZetaOffice WASM build will automatically be included from the following URL. To replace it with a custom WASM build see config.sample.js of each demo. https://cdn.zetaoffice.net/zetaoffice_latest/ Next you need to upload the zetajs/ folder onto a webserver of your choice, which sets the following HTTP headers (see developer.mozilla.org for further details): Cross-Origin-Opener-Policy "same-origin"Cross-Origin-Embedder-Policy "require-corp" So back to the example code. The HTML files for all examples embed ZetaOffice and some JavaScript loading code. Please check the actual JavaScript file for the code interacting with ZetaOffice. Lets have a look at the simple.html (see live). ZetaOffice displays its content using an HTML canvas. So in line 14 we initialize this canvas. Currently a list of attributes like is needed for the canvas. But we will migrate those attributes to the ZetaJS wrapper, so they won’t be needed anymore in the HTML code. <canvas id="qtcanvas" contenteditable="true" oncontextmenu="event.preventDefault()" onkeydown="event.preventDefault()" style="height:100%; width:100%; border:0px none; padding:0;"/> The Module variable on line 30 passes the information needed to initialize WASM binaries. First is the canvas. And second is an array of JavaScript files which will be executed in the main Web Worker running the WASM binary. Web Workers are a process like feature of the browsers WASM runtime environment. We pass the ZetaJS wrapper and a file with custom JavaScript code, in this example the simple.js. You may need to ensure, that the zeta.js is reachable under the given URL path. Line 33 to 39 preload the soffice.js file to ensure, it’s not being blocked by the browsers origin policy when loaded from a foreign origin. Line 42 triggers a website resize event, to make ZetaOffice display nicely inside the canvas. This can be done more precise, as shown in the more complex demos. But for the start the resize event will be triggered after a fixed interval. And finally the soffice.js document is finally loaded which triggers the start of the WASM binary. Second is the simple.js file. It’s running inside the same Web Worker as the WASM binary to enable interaction. When running in Chromium / Google Chrome you will find a dropdown list labeled “top” at the upper left of the “Console” tab in the developer tools. There you can select the em-pthread_1 Web Worker to debug code in the simple.js file. Inside the simple.js you will find pretty much the same code as when controlling a LibreOffice running naively on Linux, Windows or any other native OS. It is using LibreOffice’s UNO interface. Most existing examples using UNO via Python or Basic can be easily moved to JavaScript. The control flow is being passed by the Module.zetajs.thenwhich gets called as soon as the WASM binary is loaded. It passes the zetajs object from which we first get the common com.sun.star object (do not confuse it’s abbreviation css with HTML CSS). In the lines 11 to 21 we get some control objects via UNO, which allow us to trigger the load of an example office document example.odt which is embedded in the WASM binary. Module.zetajs.then(function(zetajs) { function getTextDocument() { const css = zetajs.uno.com.sun.star; const context = zetajs.getUnoComponentContext(); const desktop = css.frame.Desktop.create(context); let xModel = desktop.getCurrentFrame().getController().getModel(); if (xModel === null || !zetajs.fromAny( xModel.queryInterface(zetajs.type.interface(css.text.XTextDocument)))) { xModel = desktop.loadComponentFromURL( 'file:///android/default-document/example.odt', '_default', 0, []); } const toolkit = css.awt.Toolkit.create(context); Line 27 is where the actual application logic starts. In this simple example we get a cursor object from the document to insert the text string here! at the top. In the final section from line 32 to 38 each paragraph of the office document becomes colored in a random color. const xText = xModel.getText(); const xTextCursor = xText.createTextCursor(); xTextCursor.setString("string here!"); } { const xModel = getTextDocument(); const xText = xModel.getText(); const xParaEnumeration = xText.createEnumeration(); for (const next of xParaEnumeration) { const xParagraph = zetajs.fromAny(next); const color = Math.floor(Math.random() * 0xFFFFFF); xParagraph.setPropertyValue("CharColor", color); } This other simple-examples/ show you a little more interesting tasks you can do with the same basic techniques as shown here. While the HTML files are all the same, the simple_key_handler.js (see live) shows you how to register to ZetaOffice event handlers. And finally rainbow_writer.js (see live) uses this to implement a small tool coloring text as you write it. More Complex Examples The next big step is in the standalone/ (see live) example. It adds a nice loading animation and shows you how to pass messages between the WASM Web Worker and the browsers main thread, handling the HTML page. This is being used to implement some simple controls on the HTML page for formatting text inside ZetaOffice. The demo is build as a npm package and can be run according to the contained README.md. Don’t forget to pass an URL to the soffice_base_url variable as explained above! Additional examples are vuejs3-ping-tool/ (see live) and letter-address-tool/ (see live). The vuejs3-ping-tool/is again a npm package, and show-cases how to automatically fill spreadsheets documents with values, displaying them in nicely animated Calc charts. The other letter-address-tool/ example gives you an impression how to connect ZetaOffice with external data sources to automatically create letters from templates, and export the result as office document or PDF file. Please share your feedback as a comment in the blog, or use the GitHub issue tracker for suggestions or bugs in the code!
  • Miklos Vajna: Handling page captures for Writer TextBoxes (2024/11/08 07:58)
    Writer TextBoxes provide the user with shapes that can have complex geometry and complex content. There is also a feature to capture shapes inside page boundaries: now the two features interact with each other better. This work is primarily for Collabora Online, but the feature is available in desktop Writer as well. Motivation¶ As described in a previous post, Writer implements the TextBox feature with a pair of objects: a Draw shape (with complex geometry) and a (hidden) Writer TextFrame, providing complex content. To avoid wrapping problems, the underlying TextFrame always has its wrap type set to "through", i.e. text may wrap around the Draw shape, but the hidden TextFrame is always ignored during text wrapping. In most cases this provides the expected behavior, because the user sees one object, so wrapping around at most one object is not surprising. However, there is also an other feature, that shapes may be captured inside page frames: if their position would be outside the page frame, Writer corrects this, so they are not off-page. This also makes sense, so it can't happen that your document has a shape that is hard to find, due to a silly position. The trouble comes when these two are combined: the Draw shape's position gets adjusted to be captured inside the page frame, but the TextFrame's wrap type is "through", and objects with this wrap type are an exception from the capturing mechanism, so the position of the two shapes get out of sync. Results so far¶ The problem is now solved by improving the layout, so in case the TextFrame is actually part of a Draw shape + TextFrame pair (forming a TextBox), then we calculate the effective wrap type of the TextFrame based on the wrap type of its Draw shape, so either both objects are captured or none, which results in consistent render result. Here is a sample document where all margins are configured to be equal, but capturing corrected the Draw shape (and not the TextFrame): Bugdoc: old Writer render And here is the same document, with consistent positioning: Bugdoc: new Writer render As you can see, now the rendered margins actually equal, as wanted. How is this implemented?¶ If you would like to know a bit more about how this works, continue reading... :-) The bugfix commit was sw textbox: capture fly when its draw object is captured. The tracking bug was tdf#138711. Want to start using this?¶ You can get a development edition of Collabora Online 24.04 and try it out yourself right now: try the development edition. Collabora intends to continue supporting and contributing to LibreOffice, the code is merged so we expect all of this work will be available in TDF's next release too (25.2).
  • LibreOffice Dev Blog: Crash fix part 5: crash report tool (2024/10/24 14:05)
    In previous blog posts about crashes in LibreOffice, I have discussed how to debug and fix some of crashes. Now I discuss a nice tool to keep track of the crash reports from volunteers: Crash report tool. Crash Report Statistics Crash report is available via this LibreOffice website: https://crashreport.libreoffice.org/stats/ You can see that different versions of LibreOffice listed there, and for each and every tracked version, number of crashes during the previous 1, 3, 7, 14 and 28 days can be seen. This is possible using the appropriate buttons on the top. This data is gathered from those to volunteer to submit reports to make LibreOffice better. This statistic is very helpful to understand the robustness of the builds in different versions. Crash Signatures If you choose a specific version, you may see signatures of the crashes. This is helpful when trying to fix crashes. For example, this is one of the crash signatures found in LibreOffice 24.8.0.3: SwTextINetFormat::GetCharFormat() This shows that the crash happens in GetCharFormat() function. One may use this information to track and fix the problem. Looking into one of the crashes, one may see the details of the crash, including the stack trace in the crashing thread, and link to the exact place of the source code that leads to the crash. As an example, you can see this crash report. Sometimes, experienced developers may be able to reproduce the bug using crash signatures while knowing some background. Otherwise, in most cases, filing a bug with documents and instructions to reproduce the bug is essential. Adding a link to the crash report can be helpful.
  • LibreOffice Dev Blog: WSL for building LibreOffice (2024/10/17 14:01)
    Windows Subsystem for Linux (WSL) is a mechanism to use complete Linux distributions on Windows. Here I discuss how to use it to build LibreOffice for both Linux and Windows binaries. What is WSL? WSL is the relatively new mechanism in Windows that lets you use a complete Linux distribution alongside your Windows. Interoperability between WSL and Windows lets you to share files and utilities between Windows and Linux. That is where it becomes helpful for LibreOffice, as LibreOffice make depends heavily on GNU tools, which are available in Linux. Linux or Windows? You can use WSL for 2 different scenarios: 1. Building for Linux: this is the full Linux build, in which Linux compilers, libraries and utilities will be used to create a Linux binary. You can then run or package the Linux build. You can find more information here: TDF Wiki – BuildingOnWSL Using WSL2 is recommended, as it is supposed to be faster, and also you can simply use the graphical interface of LibreOffice. LibreOffice build on WSL with Linux binaries, displayed on Windows When you run the resulting binary, the graphical interface is usable, and it will use GTK fronted by default. 2. Building for Windows: this is the WSL as helper mode, where it uses only a few Linux utilities like pkg-config, make, automake and a few other utilities to configure the project.  Then, GNU Make for Windows will be the tool to build the project. More information is available here: TDF Wiki: BuildingOnWSLWindows The results are Windows .exe files, and you can simply run them on Windows as native programs. Build Options on Windows You can build LibreOffice on different platforms. On Windows, it is possible to use Cygwin, but using WSL can be faster, and considering some issues with recent Cygwin versions, WSL is an alternative. One can imagine of other ways to build LibreOffice on Windows, including MinGW. But, at the moment, MinGW, both as a helper to use Visual Studio, and also as an independent distribution to build LibreOffice, is not usable due to various reasons. And last note: if you do not have prior experience with LibreOffice development but you are interested, you can start from our video tutorial for getting started with LibreOffice development.
  • LibreOffice QA Blog: QA/Dev Report: September 2024 (2024/10/15 11:25)
    General Activities LibreOffice 24.2.6 was released on September 5 LibreOffice 24.8.1 was released on September 12 LibreOffice 24.8.2 was released on September 27 Olivier Hallot (TDF) continued with a massive Help bookmark cleanup effort, updated help for BASIC Now() function, improved the help for regular expressions by including a description of \w and \W patterns and extended the Document Type Definition of Help XML Pierre F. improved readability and maintainability of the Document Type Definition of Help XML and updated help for Navigator in Calc after the addition of comment deletion functionality Dione Maddern added help pages for Properties Sidebar decks, updated help for Styles Sidebar deck and added a help page for database table references Adolfo Jayme Barrientos improved UI strings in Calc and updated Help pages accordingly Bogdan Buzea improved UI strings and updated Help pages accordingly Laurent Balland did many updates and cleanups to Impress templates, for example replacing images with vector graphics for better quality Miklós Vajna (Collabora) implemented per-paragraph semi-transparent shape text in Impress and added digital signing support to LOKit Michael Meeks, Tomaž Vajngerl, Bayram Çiçek, Rashesh Padia, Gülşah Köse and Marco Cecchetti (Collabora) worked on LOKit used by Collabora Online Jaume Pujantell (Collabora) added a command to promote a Writer reply comment to a new main one and fixed an issue with comment threads breaking when exporting ODT files as DOCX Julien Nabet fixed database queries being saved corrupted, fixed incorrectly included values with BETWEEN and NOT BETWEEN statements in dBASE file connections, fixed an issue preventing the use of Report Builder Wizard and added the new Histogram chart type to Sidebar’s Chart deck Xisco Faulí (TDF) added the schema for ODF 1.4 while doing several fixes and adaptations related to it, converted many Java tests to CppUnit tests, fixed an issue with Position and Size dialog showing dimensions in incorrect measurement units, upgraded many dependencies and fixed some crashes Michael Stahl (allotropia) fixed issues with hiding of FlyFrames in hidden sections, made zip file handling more robust, made the display of hidden text with a non-hidden paragraph marker in Microsoft document formats match that of MS Word and fixed an issue related to widow paragraphs in sections Mike Kaganski (Collabora) made BASIC’s CStr() and Format() functions produce localized output for currency values, fixed a DOCX table layout issue, fixed an issue with undo history being populated simply by opening a certain Impress presentation, implemented a fallback for inline formulas in imported PPTX files, implemented handling of Exit Property for Property Set in BASIC, improved the performance of Writer table row height calculation while also making it correct and fixed an issue resulting in broken OLE objects when re-exporting some PPTX files. He also fixed many crashes and did code cleanups Caolán McNamara (Collabora) improved the layout of Start Center and made Impress/Draw Navigator focus handling more robust. He also fixed many issues found by static analysers and fuzzers, this time tackling a particularly massive batch of Coverity findings, including lots of Java issues Stephan Bergmann (allotropia) worked on WASM build. He also adapted the code to compiler changes Noel Grandin (Collabora) made it faster to import PDFs with lots of pages and optimised Writer code after the big item handling rework. He also did many code cleanups and fixed many issues found by static analysers Justin Luth (Collabora) fixed an issue with localised footnote style, implemented support for ToCs with no page numbers in DOCX import, continued improving the handling of OOXML layoutInCell property, adapted the DOCX shape handling code to strange new inconsistencies from Microsoft and fixed crashes Michael Weghorn (TDF) worked on the accessibility features of Windows, GTK4 and Qt UIs in areas such as switching sheets in Calc, selecting elements in Writer tables and toolbar positions. He also worked on using native widgets in Qt UIs Balázs Varga (allotropia) continued polishing support for uniform Glow effect for text in shapes, fixed missing table borders in PPTX files and worked on the accessibility checker Patrick Luby improved the look of the active cell indicator in Calc on macOS, adapted the code to changes in restorable state handling in macOS Sonoma and made colorspace handling more robust on macOS Jim Raykowski made the Quick Find Sidebar deck inherit the search string from the Quick Find toolbar, fixed an issue with importing macro libraries as read-only, fixed an undo issue affecting style manipulation via the Sidebar, got rid of annoying page jumping behaviour when switching between page view modes in Writer, enriched the Quick Find Sidebar deck by adding match numbers and made comment tracking in Writer Navigator work also when focusing into comment boxes Armin Le Grand (allotropia/Collabora) worked on a renovation of graphics rendering on Linux with Cairo library Oliver Specht (CIB) added the ability to define default zoom values in global options, fixed an RTF issue with incorrect frame positioning and made it so character formatting and styles are cleared, if a paragraph or a character style is applied by holding down Ctrl while double-clicking in the Sidebar Heiko Tietze (TDF) improved the user experience of the direct SQL dialog, added an option to disable the warning that only the active sheet will be saved when exporting to CSV (based on work by Martin van Zijl), improved the layout of document properties dialog, made it so double-clicking on document information fields in Writer opens the Properties dialog when relevant, made text in Calc cells with line breaks respect application colour setting, differentiated the context menu labels per the various index types and changed certain default bullet characters László Németh improved the support for smart justify in DOCX files and added support for style separators in DOCX files Ilmari Lauhakangas (TDF) updated Help after UI changes and did many fixes and optimisations to icon themes Christian Lohmaier (TDF) did build-related cleanups Eike Rathke (Red Hat) continued polishing the handling of custom Add-In function names Jonathan Clark (TDF) further improved large paragraph layout performance, especially affecting languages such as Tibetan, fixed several issues related to kashida characters, fixed an issue with incorrect textbox positions when anchored As character inside RTL text, added base text group and mono features to Asian Phonetic Guide, implemented missing support for RTL text in EMF graphics, implemented Syriac justification and fixed issues with text grid spacing in DOC import Regina Henschel implemented support for exporting the database range property TotalsRow to ODF Tibor Nagy (allotropia) fixed issues with exporting comments as PDF annotations and made it so a linked presentation opens in slideshow or editing mode depending on what the mode is in the source presentation Adam Seskunas worked on the GSoC project to port Java tests to C++ Ritobroto Mukherjee worked on the GSoC project to implement cross platform .NET bindings for UNO API Ahmed Hamed worked on the GSoC project for improving the Functions Sidebar deck in Calc Sahil Gautam worked on the GSoC project to implement themes and added a “Handle Duplicate Records” command to Calc while creating a Help page for it Mohit Marathe worked on the GSoC project for adding a Comments Sidebar deck Rafael Lima made it so Solver Options dialog accepts parameters of TypeClass BYTE and SHORT, made it possible to set solver settings at the sheet level via the UNO API and improved the stability of the solver and fixed issues with resizing the Comments Sidebar deck Kira Tubo removed redundant Open and Save buttons from Notebookbar and updated Help accordingly, moved “Protect” section to “Position and Size” tab in Properties dialogs of document elements while updating the layout of the dialogs, defined some default Comment style attributes and made Hanging Indent command create a hanging indent when used on a paragraph without one Jean-Pierre Ledure worked on the ScriptForge library Andreas Heinisch added a check for missing parameters to BASIC Arnaud Versini did some code cleanups Bartosz Kosiorek added support for MS Visio Template format with .vstx extension Sohrab Kazak added a checkbox to toggle the title in a ToC/Index Chris Sherlock did code cleanups in VCL Eloi Montañés fixed an issue with unverifiable timestamps in signatures when using the NSS backend Rico Tzschichholz (Ubuntu) made some build fixes DaeHyun Sung improved the Korean UI font priority Henry Castro (Collabora) fixed an issue with currency format previews in Calc Kudos to Ilmari Lauhakangas for helping to elaborate this list. Reported Bugs 479 bugs, 69 of which are enhancements, have been reported by 297 people. Top 10 Reporters Mike Kaganski ( 15 ) Eyal Rozenberg ( 15 ) yoylasfpgas ( 13 ) Gabor Kelemen (allotropia) ( 10 ) peter josvai ( 10 ) Buovjaga ( 9 ) nobu ( 8 ) Hossein ( 8 ) Rafael Lima ( 8 ) Regina Henschel ( 7 ) Triaged Bugs 464 bugs have been triaged by 66 people. Top 10 Triagers Buovjaga ( 115 ) m_a_riosv ( 65 ) Xisco Faulí ( 41 ) V Stuart Foote ( 35 ) Heiko Tietze ( 24 ) Mike Kaganski ( 22 ) Julien Nabet ( 21 ) Dieter ( 14 ) raal ( 11 ) ady ( 11 ) Resolution of resolved bugs 446 bugs have been set to RESOLVED. Check the following sections for more information about bugs resolved as FIXED, WORKSFORME and DUPLICATE. Fixed Bugs 161 bugs have been fixed by 36 people. Top 10 Fixers Mike Kaganski ( 14 ) Heiko Tietze ( 13 ) Jonathan Clark ( 10 ) Xisco Fauli ( 9 ) Caolán McNamara ( 7 ) Julien Nabet ( 7 ) Justin Luth ( 6 ) Rafael Lima ( 6 ) Patrick Luby ( 6 ) László Németh ( 5 ) List of critical bugs fixed tdf#162911 Inserting multiple Hyperlinks and undoing an insertion (Ctrl-Z) crashes Writer ( Thanks to Michael Stahl ) List of high severity bugs fixed tdf#160937 Document Properties pages in all modules do not fit screen and cannot be resized (gtk3/gtk4) ( Thanks to Heiko Tietze ) tdf#161724 FILEOPEN PPTX: image completely disappears, other quite off (zoomed in?) ( Thanks to Xisco Fauli ) tdf#162507 Page layout reflow after pressing delete causes hang (involving tables) ( Thanks to Miklos Vajna ) tdf#162728 Crash on saving in Math Formula editor ( Thanks to Noel Grandin ) tdf#162746 Cannot open DOCX file from 24.8 ( Thanks to Mike Kaganski ) tdf#162829 CRASH: Editing Formula Bar with two views ( Thanks to Xisco Fauli ) List of crashes fixed tdf#158323 CRASH when switch back from HTML View to Normal View after edit in HTML source code ( Thanks to Julien Nabet ) tdf#160945 LibreOffice crashes in vtableCall at startup (Windows ARM) ( Thanks to Stephan Bergmann ) tdf#161256 Libreoffice crashes using gtk4 VCL on kde plasma wayland ( Thanks to Michael Weghorn ) tdf#162405 Multiple password dialogs + crash in file save dialog with configured OpenPGP key signing key ( Thanks to Sarper Akdemir ) tdf#162728 Crash on saving in Math Formula editor ( Thanks to Noel Grandin ) tdf#162760 Calc solver crashes on large spreadsheet but runs in LO 7.6.7 ( Thanks to Rafael Lima ) tdf#162764 CRASH: closing LibreOffice while TextControlParagraphPropertiesDialog/TextControlCharacterPropertiesDialog are open (gen) ( Thanks to Xisco Fauli ) tdf#162772 Crash in “Target in Document” in Hyperlink dialog, if path is not suitable ( Thanks to Noel Grandin ) tdf#162782 FILESAVE SVG: semi-transparent shape text in a bullet list crashes ( Thanks to Miklos Vajna ) tdf#162829 CRASH: Editing Formula Bar with two views ( Thanks to Xisco Fauli ) tdf#162887 CRASH: xpdfimport crash on textual tiling pattern ( Thanks to Dr. David Alan Gilbert ) tdf#162911 Inserting multiple Hyperlinks and undoing an insertion (Ctrl-Z) crashes Writer ( Thanks to Michael Stahl ) tdf#162987 Executing .uno:DataFilterAutoFilter on a hidden spreadsheet crashes ( Thanks to Mike Kaganski ) tdf#163091 crash the file with macro ( Thanks to Mike Kaganski ) List of performance issues fixed tdf#152298 FILEOPEN DOCX Copying and pasting between table cells is slow (steps in comment 7) ( Thanks to Mike Kaganski ) tdf#161562 Sluggish scrolling after saving and …
  • Miklos Vajna: Per-paragraph semi-transparent shape text in Impress (2024/10/04 06:22)
    The SVG export in Impress now supports a per-paragraph setting to handle semi-transparent shape text, while previously this was only possible to control at a per-shape level. This work is primarily for Collabora Online, but the feature is available in desktop Impress as well. Motivation¶ As described in a previous post, Impress already had the capability to have semi-transparent shape text, but the SVG export of this for the case when not all paragraphs have the same setting was broken. Transparency in SVG can be described as a property of a group (<g style="opacity: 0.5">...</g>) and it can be also a property of the text (<tspan fill-opacity="0.5">...</tspan>). The SVG export works with the metafile of the shape, so when looking for meta actions, it tries to guess if the transparency will be for text: if so, it needs to use the tspan markup, otherwise going with the g markup is OK. What happened here is that meta action for a normal text started, so the SVG export assumed the text is not semi-transparent, but later the second line was still transparent, so we started a group element, and this resulted in a not even well-formed XML output. Results so far¶ The relevant part of the test document is simple: just 3 paragraphs, the second one is semi-transparent (and also has a bullet, as an extra): Bugdoc: original Impress render Once this was exported to SVG, this resulted in a non-well-formed XML, so you got this error in a web browser: Bugdoc: old SVG render Once tweaking the transparency mask writer to check if text started already, we get the correct SVG render: Bugdoc: new SVG render How is this implemented?¶ If you would like to know a bit more about how this works, continue reading... :-) The bugfix commit was SVG export: fix handling of semi-transparent text inside a list. The tracking bug was tdf#162782. Want to start using this?¶ You can get a development edition of Collabora Online 24.04 and try it out yourself right now: try the development edition. Collabora intends to continue supporting and contributing to LibreOffice, the code is merged so we expect all of this work will be available in TDF's next release too (25.2).
  • LibreOffice Dev Blog: Setting dialogs that are available via UNO Commands (2024/10/03 14:01)
    LibreOffice options page provides rich set of settings for everyone who wants to tune LibreOffice to match their needs. But, what if you as a developer, need setting dialogs that are needed elsewhere in the LibreOffice application? Here I discuss some of such use cases, which are handled by defining UNO commands. Options Page The code for providing “Tools > Options” is not in a single module, but main part resides in cui module, which contains code which is used across different modules. Looking into cui/source/options/ folder from LibreOffice core source code, you can see various different source files related to the options. The biggest file there is cui/source/options/treeopt.cxx, which is the actual implementation of the tree-based dialog that you see when you open Tools > Options dialog. There are other C++ files that handle .ui files related to options. You can find those UI files in cui/uiconfig/ui/ folder with a name like opt*.ui: $ ls cui/uiconfig/ui/opt*.ui These files can be edited and they are used as described in the LibreOffice design blog: LibreOffice Design Blog: Easyhacking: How to create a new “Tip-Of-The-Day” dialog UNO Dispatch Commands Only some of the dialogs can be opened available via UNO dispatch commands. As an example, you may see “.uno:AdditionsDialog” is used both in cui/source/options/optgdlg.cxx for creating a dialog in Tools > Options (when you click for “more icons”), and also in sfx2/source/appl/appserv.cxx. You can try running this UNO command in LibreOffice BASIC editor with this code snippet: Sub Main() Set oDispatch = CreateUnoService("com.sun.star.frame.DispatchHelper") Dim args(0) As New com.sun.star.beans.PropertyValue Set oFrame = StarDesktop.Frames.getByIndex(0) oDispatch.executeDispatch(oFrame, ".uno:AdditionsDialog", "", 0, args) End Sub The above command is defined specifically to help developers use the “Extensions” dialog, anywhere in LibreOffice UI, from top menus to context menus and toolbars and also in code, in a simple way. There is another dialog titled “Security Options and Warnings”, which is opened through .uno:OptionsSecurityDialog UNO command. In this way, it can be used easily in other modules of LibreOffice. SecurityOptionsDialog Implementing UNO Command Adding a new UNO command was discussed before, in a separate blog post: Adding a new UNO command Adding a new UNO command for an options dialog is basically the same. There can be differences regarding the configurations and the data that is passed between the dialog and the caller. When you create a dialog box directly like the code snippet below, you have access to the member functions defined for that specific dialog: IMPL_LINK_NOARG( SwGlossaryDlg, PathHdl, weld::Button&, void ) { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); ScopedVclPtr<AbstractSvxMultiPathDialog> pDlg(pFact->CreateSvxPathSelectDialog(m_xDialog.get())); SvtPathOptions aPathOpt; const OUString sGlosPath( aPathOpt.GetAutoTextPath() ); pDlg->SetPath(sGlosPath); if(RET_OK == pDlg->Execute()) { const OUString sTmp(pDlg->GetPath()); if(sTmp != sGlosPath) { aPathOpt.SetAutoTextPath( sTmp ); ::GetGlossaries()->UpdateGlosPath( true ); Init(); } } } As you can see, pDlg->GetPath() is accessible here, and you can use it to pass data. But when you are using UNO commands, those functions will not be available directly. Instead, you may pass values that denote the data that will be read from somewhere else, like the configuration. For example, consider there are multiple paths that you may want to edit using this UNO command with the same dialog. In this case, you can pass a value that shows the associated path that you are changing. It can be passed as an enumeration, and then you set and/or get the value directly from the configuration. In this way, the callers in the C++ code will have much easier task to do, as it is only calling the UNO command, and the rest is done in the implementation of the UNO command. For AdditionsDialog, the calling code is as simple as this in cui/source/options/optgdlg.cxx: IMPL_STATIC_LINK_NOARG(OfaViewTabPage, OnMoreIconsClick, weld::Button&, void) { css::uno::Sequence<css::beans::PropertyValue> aArgs{ comphelper::makePropertyValue( u"AdditionsTag"_ustr, u"Icons"_ustr) }; comphelper::dispatchCommand(u".uno:AdditionsDialog"_ustr, aArgs); } Passing Parameters to UNO Commands UNO dispatch commands can take parameters. As an example, take a look at .uno:NewDoc defined in sfx2/sdi/sfx.sdi: SfxStringItem NewDoc SID_NEWDOC (SfxStringItem Region SID_TEMPLATE_REGIONNAME,SfxStringItem Name SID_TEMPLATE_NAME) [ ... ] As you can see, there are two parameters: SfxStringItem Region SID_TEMPLATE_REGIONNAME SfxStringItem Name SID_TEMPLATE_NAME The SfxStringItem is the type, Region and Name are the names of the parameters, SID_TEMPLATE_REGIONNAME and SID_TEMPLATE_NAME are the constants used for passing parameters. The parameter type is not limited to numbers and strings, and it can be any defined class. To set and get data for this parameters, you may use appropriate Set and Put functions. For example, this gets the parameter if set: const SfxStringItem *pItem = rSet.GetItemIfSet( SID_TEMPLATE_REGIONNAME, false) Or, this sets the data: OUString sVal = u"test"_ustr; rSet.Put( SfxStringItem( SID_TEMPLATE_REGIONNAME, sVal ) ); Final Notes To get to know better how to implement more complex UNO dispatch commands, you can refer to the implementation of the existing UNO commands to get idea about how they are implemented. You can see a comprehensive list of UNO commands here: TDF Wiki – UNO Dispatch Commands
  • Björn Michaelsen: Nothing ever happens (2024/09/19 23:30)
    Nothing ever happens. And nothing ever happens, nothing happens at all The needle returns to the start of the song And we all sing along like before -- Del Amitri, Nothing Ever Happens In my last post on Libreoffice I promised to talk about Writer changes once in a while, but then ... nothing ever happened. However, given that I had an annoying motorcycle accident in the meantime that turned out much more persistently annoying than originally thought, I think I have a bit of an excuse. So ... what did happen? For one, I fixed quite a few regressions with my name on them, but ... is there much to talk about here? Mostly not: If you look at the fixes, they are often oneliners fixing something that seems rather obvious in retrospect. The more tricky question is: how did these get in in the first place? Its hard for me to say that, as the introducing commits are from even longer ago. One thing is certain though: Often a unittest would have caught them, so whenever possible, I tried to create a reproducer adding such a test with the fix. To anyone writing bug reports: Creating minimal reproduction test is hugely valuable in this -- not just for finding the issue, but also as a starting point for a regression test. So if a bug bugs you and it is missing a minimal reproduction scenario, adding one is a great way to move this forward. Oh, and maybe verifying a bugfix, if someone provided a fix and the friendly bot say affected users are "encouraged to test the fix and report feedback". While doing these fixes, I stumbled over Noel suggesting to speed up bookmarks in writer which is of course great, but I noticed that the code could be optimized a bit more as the bookmarks of a document are now sorted by their starting position (which was one of the first changes I made back on OpenOffice.org about more than a decade ago). Thus we can use bisectional search on the bookmarks here, which should be even faster. Now, it would be great if the discussion on this between Noel and me would available for others to learn from, wouldnt it? The cool thing is: it is. All discussion happened on gerrit in the comments so if you want to learn about bookmark in Writer and how to maybe speed them up for documents that have a lot of them, that is a great starting point! Is there anything to add? Well maybe the following: Currently the bookmarks starting at the same position are currently not sorted. If one would sort them by their end position, the bisectional search could maybe cover even more? This would also remove one extra loop of logic and make the code simpler and easier to read. The performance improvement is likely irrelevant -- esp. since there will be not that many documents with lots of bookmarks starting at the same position. The simpler code might be worth it though. So why wasnt it done? It still can be tried in a follow-up, but speaking about regressions earlier: This has some obscure regression risk, because if we change the order of bookmarks starting at the same position from undefined to something ordered by the end position it might impact a lot of code using bookmarks. The function in question might actually be faster, but other functions (e.g. the inserting of new bookmarks) might actually be slower. So ... this is left as an exercise to the reader. Comments? Feedback? Additions? Most welcome here on the fediverse !
  • LibreOffice QA Blog: QA/Dev Report: August 2024 (2024/09/09 15:23)
    General Activities LibreOffice 24.8.0 was released on August 22 Olivier Hallot (TDF) continued with improvements to Calc function help pages, added help pages for Sidebar settings and graphics export via command line, improved help pages for Writer Status Bar, Calc’s Similarity Search and database ranges, updated menu item paths in Help, did lots of Help cleanups, added some extended tooltips, improved the dialog for easy conditional formatting in Calc and removed a misleading Restore Default button from Sidebar Settings Alain Romedenne improved help for BASIC’s If statement and added unit tests for IF THEN statements in BASIC and VBA Pierre F. made two dozen improvements to help, in areas such as Calc functions, word count, change tracking, BASIC, regular expressions, AutoRecovery and backup, and freezing of rows and columns in Calc Dione Maddern added a help page for Quick Find Sidebar deck, updated the help for Writing Aids, reworked help pages for Navigator and Navigation toolbar and updated the instructions for enabling remote control in Impress Remote user guide Adolfo Jayme Barrientos updated help pages about digital signatures after UI changes Laurent Balland did cleanups in Resume Writer template and Beehive, Blue Curve, DNA, Blueprint Plans, Focus, Inspiration, Light, DNA, Midnightblue, Piano, Portfolio, and Progress Impress templates Miklós Vajna (Collabora) made it faster to open DOCX files with many shapes and sections, and headers/footers activated, fixed a layout loop in a certain DOCX file with a complex full-page group shape, fixed losing paragraph styles with many numberings in DOCX export and made Writer layouting smarter, improving performance in LOKit Sven Göthel, Skyler Grey, Hubert Figuière, Andras Timar, Michael Meeks and Áron Budea (Collabora) worked on LOKit used by Collabora Online. Michael also optimised loading times by reducing the frequency of progress bar updates Jaume Pujantell (Collabora) implemented handling of firstHeaderRow attibute in XLSX pivot tables and fixed a crash seen when editing text in shapes in Collabora Online Tomaž Vajngerl (Collabora) worked on the new histogram chart type Julien Nabet fixed an issue preventing deletion of MySQL/MariaDB tables with spaces in their names and did some code cleanups Xisco Faulí (TDF) fixed a PDF export crash, improved the contrast accessibility check and did many dependency updates Michael Stahl (allotropia) improved some automated tests, fixed issues with hidden sections, made HTML pasting more robust when dealing with placeholder fields in Writer, fixed a wrapping issue with long index entries, simplified the code for JPEG quality levels in PDF export and made UA PDFs compatible with Adobe Acrobat Pro’s accessibility checker Mike Kaganski (Collabora) worked around a bug in MS Access ODBC 64-bit driver preventing database table editing, fixed an issue in Insert Special Character dialog related to changing the font selection and made it possible to filter characters in the dialog by Unicode value, fixed an issue with Calc’s EXACT function when working in array context, improved stability by preventing the closing of a document while it is being layouted in the background, made anti-aliasing code more robust on Windows in the context of bitmap export, made the BASIC With statement implementation behave correctly, fixed an issue with BASIC for loop evaluation in VBA support mode, made it possible to deselect all tables in Base by clicking outside of the table list, fixed an issue with some Writer tables showing as collapsed, fixed some issues in the Unicode notation toggle command (Alt+X) and fixed a pasting issue related to document themes. He also fixed many crashes and did code cleanups Caolán McNamara (Collabora) fixed an issue with not being able to rotate the page when printing labels on Linux, fixed embedded formulas not being shown completely when in edit mode and fixed an issue blocking chart data range editing. He also fixed many issues found by static analysers and fuzzers Stephan Bergmann (allotropia) worked on WASM build, enabling WebDAV use Noel Grandin (Collabora) improved loading time for DOCX files with lots of headers and footers and optimised the handling of Writer bookmarks Justin Luth (Collabora) did many improvements to the handling of OOXML layoutInCell property controlling VML shape behaviour in tables, fixed an issue with inherited styles not updating after font size change in Writer, fixed incorrect object anchoring in DOC export and fixed a crash related to undoing header activation Michael Weghorn (TDF) fixed detecting the default printer on Linux, worked on handling accessible object attributes, fixed an issue with font attributes in form control properties, fixed license text getting selected when installing an extension with certain Linux UIs, implemented support for reading whole documents from top to bottom in NVDA screen reader, made dark mode detection more robust in Qt/KDE UIs and worked on using native widgets in Qt UIs Balázs Varga (allotropia) fixed an auto-fitted shape size issue in PPTX import and implemented support for uniform Glow effect for text in shapes Patrick Luby improved the look of the active cell indicator in Calc on macOS, made the Tabbed UI centered on macOS and fixed a couple of crashes Jim Raykowski fixed a visual glitch in the Animation Sidebar deck of Impress, made it possible to jump to a heading by pressing Enter in a read-only Table of Contents in Writer, made word count information of headings outline content show in Navigator tooltips, made it possible to delete all content of a content type via the Navigator (except headings), made the initially selected tracked change in Manage Changes dialog be the current or next one in the document, fixed a mouse wheel focus issue in the Sidebar and made it so the source paths of linked libraries are shown in Macro Organizer Sarper Akdemir (allotropia) continued improving the UX of the encryption dialog Armin Le Grand (allotropia/Collabora) worked on a renovation of graphics rendering with Cairo library Oliver Specht (CIB) fixed an issue with tables having rows with “At least” height setting in imported Microsoft formats Heiko Tietze (TDF) made comment background colours customisable in Writer, Impress and Draw, made it possible to toggle the display mode of the most recent documents list between current module and all modules, made it possible to customise the colours of non-printable characters and improved the luminance calculation for automatic colour setting alongside dark mode colour improvements László Németh made it possible to adjust hyphenation settings via the Sidebar Ilmari Lauhakangas (TDF) did some Python code cleanups, improved a build error message, unified API docs a bit and did some help page cleanups Christian Lohmaier (TDF) worked on Windows Subsystem for Linux build improvements Pranam Lashkari (Collabora) made it quicker to add new conditional formatting rules via the Manage dialog, implemented loading of comment author names from XLSX files and improved dark mode handling for text box content Thorsten Behrens (allotropia) switched the MAR-based auto-updater to be on by default Eike Rathke (Red Hat) made the Calc function search in the Sidebar more robust and made custom Add-In function names imported from OOXML be handled properly Jonathan Clark (TDF) made numbering formats with repeated characters more accurate, fixed several issues related to diacritics and kashida characters, fixed incorrect output after editing Ruby base text, worked on reducing visible jittering when laying out right-aligned text and fixed an issue with RTL as-character anchored textbox positioning Regina Henschel fixed a display scaling issue affecting crop markers on Windows Tibor Nagy (allotropia) fixed a “Stack empty” error in tagged PDF export Adam Seskunas worked on the GSoC project to port Java tests to C++ Ritobroto Mukherjee worked on the GSoC project to implement cross platform .NET bindings for UNO API Devansh Varshney worked on the GSoC project for adding histogram charts Ahmed Hamed worked on the GSoC project for improving the Functions Sidebar deck in Calc Sahil Gautam worked on the GSoC project to implement themes Rafael Lima made tooltips wrap properly in Qt-based UIs, fixed a layout issue when resizing the Comments Sidebar deck and improved the look of the active cell indicator in Calc Hossein Nourikhah (TDF) worked on Windows Subsystem for Linux build improvements Kira Tubo improved the grouping of styles in the Sidebar Moritz Duge (allotropia) continued improving the UI of certificate handling and digital signing Bayram Çiçek (Collabora) continued working on Excel Power Query round trip support Jean-Pierre Ledure worked on the ScriptForge library Vladislav Tarakanov finalised the support of audio files in PPT/X files Kurt Nordback improved the alignment of pie-of-pie and bar-of-pie chart data labels and took the first steps in adding support for invertIfNegative in bar and bubble charts Gülşah Köse (Collabora) added a command to invert document background colour to be used in Collabora Online David Gilbert made it so PDF import makes use of clip paths René Engelhard (Debian) fixed a build issue affecting armhf platform Andreas Heinisch made it so Calc’s Manage names dialog checks, if a formula is a valid print range Per99 made it so the user can choose which animation settings to use via accessibility options (related to hypersensitivity) Kudos to Ilmari Lauhakangas for helping to elaborate this list. Reported Bugs 436 bugs, 53 of which are enhancements, have been reported by 258 people. Top 10 Reporters Eyal Rozenberg ( 26 ) Mike Kaganski ( 19 ) Regina Henschel ( 12 ) Buovjaga ( 10 ) Justin L ( 8 ) Heiko Tietze ( 7 ) fpy ( 7 ) Jeff Fortin Tam ( 7 ) peter josvai ( 5 ) Gabor Kelemen (allotropia) ( 5 ) Triaged Bugs 424 bugs have been triaged by 67 people. Top 10 Triagers Buovjaga ( 92 ) m_a_riosv ( 38 ) Heiko Tietze ( 34 ) Mike Kaganski ( 23 ) raal ( 21 ) V Stuart Foote ( 19 ) ady ( 18 ) Dieter ( 17 ) Julien Nabet ( 13 ) Michael Weghorn ( 11 ) Resolution of resolved bugs 475 bugs have been set to RESOLVED. Check the following sections for more information about bugs resolved as FIXED, WORKSFORME and DUPLICATE. Fixed Bugs 213 bugs have been fixed by 45 people. Top 10 Fixers Mike Kaganski ( 21 ) Pierre F ( 16 ) Justin Luth ( 15 ) Caolán McNamara ( 13 ) Michael Weghorn ( 11 ) Heiko Tietze ( 10 ) Jonathan Clark ( 9 ) Olivier Hallot ( 6 ) Jim Raykowski ( 6 ) Miklos Vajna ( 6 ) List of critical bugs fixed tdf#162589 LibreOffice doesn’t start on Windows (erorr messages about nss3.dll and nspr4.dll) ( Thanks to Xisco Fauli ) List of high severity bugs fixed tdf#148367 EDITING MS Access through 64-bit ODBC doesn’t work and returns an Invalid Bookmark error ( Thanks to Mike Kaganski ) tdf#157851 FILEOPEN XLSX “Author” information about notes is not read ( Thanks to Pranam Lashkari ) tdf#161139 FILEOPEN DOCX SaxException when opening specific file ( Thanks to Justin Luth ) tdf#161705 LO crashes with undo/redo of page numbering wizard’s created bookmarks ( Thanks to Justin Luth ) tdf#161725 Add option to toggle module-specific file types in Recent Documents (MRU) menu ( Thanks to Heiko Tietze ) tdf#161741 LO crashes with undo/redo of new header + some other change ( Thanks to Justin Luth ) tdf#162065 can’t clone “format” of a shape anymore ( Thanks to Oliver Specht ) tdf#162586 Crash after exporting an odt document to pdf ( Thanks to Xisco Fauli ) tdf#61242 Customise comments background color in Writer ( Thanks to Heiko Tietze ) tdf#68274 provide better update mechanism — Mozilla ARchive (mar) based incrementals on all supported platforms ( Thanks to Thorsten Behrens ) List of crashes fixed tdf#140061 Crash swlo!sw::WriterMultiListener::StartListening ( Thanks to Patrick Luby ) tdf#155459 Point to the relevant section of Privacy Policy from the Options->LibreOffice->General help, “Send crash reports to The Document Foundation” section ( Thanks to Ilmari Lauhakangas ) tdf#161705 LO crashes with undo/redo of page numbering wizard’s created bookmarks ( Thanks to Justin Luth ) tdf#161741 LO crashes with undo/redo of new header + some other change ( Thanks to Justin Luth ) tdf#162004 [CRASH] Enabling the Notes Pane and closing the document will crash LibreOffice ( …
  • Miklos Vajna: Improved interactivity for LOK clients in Writer's layout (2024/09/03 06:08)
    Writer now has support for doing partial layout passes when LOK clients have pending events, which sometimes improves interactivity a lot. This work is primarily for Collabora Online, but the feature is useful for any LOK clients. Motivation¶ I recently worked with a document that has relatively simple structure, but it has 300 pages, and most of the content is part of a numbered list. Pasting a simple string (like an URL) into the end of a paragraph resulted in a short, but annoying hang. It turns out we updated Writer's layout for all the 300 pages before the content was repainted on the single visible page. In theory, you could reorder events, so you first calculate the first page, you paint the first page, then you calculate the remaining 299 pages. Is this possible in practice? Let's try! Results so far¶ The relevant part of the test document is simple: just an empty numbered paragraph, so we can paste somewhere: Bugdoc: empty paragraph, part of a numbered list and then pasting an URL there This is a good sample, because pasting into a numbered list requires invalidating all list items in that list, since possibly the paste operation created a new list item, and then the number portion has to be updated for all items in the rest of the list. So if you paste into a numbered list, you need to re-calculate the entire document if all the document is just a numbered list. The first problem was that Writer tracks its visible area, but LOK needs two kinds of visible areas. The first kind decides if invalidations are interesting for part of the document area. LOK wants to get all invalidations, so in case we cache some document content in the client that is near the visible area, we need to know when to throw away that cache. On the other hand, we want to still track the actually visible viewport of the client, so we can prioritize visible vs hidden parts of the document. Writer in LOK mode thought that all parts of the document are a priority, but this could improved by taking the client's viewport into account. The second problem was that even if Writer had two layout passes (first is synchronous, for the visible area; second is async, for the rest of the document), both passes were performed before allowing a LOK client to request tiles for the issued invalidations. This is now solved by a new registerAnyInputCallback() API, which allows the LOK client to signal if it has pending events (e.g. unprocessed callbacks, tiles to be painted) or it's OK for Writer layout to finish its idle job first. The end result for pasting a URL into this 300 pages document, when measuring end-to-end (from sending the paste command to getting the first updated tile) is a decrease in response time, from 963 ms to 14 ms. How is this implemented?¶ If you would like to know a bit more about how this works, continue reading... :-) As usual, the high-level problem was addressed by a series of small changes: cool#9735 sw lok: take LOK vis area into account when deciding idle layout Related: cool#9735 vcl lok: add an AnyInput() callback Related: cool#9735 sw lok: handle the AnyInput() callback during idle layout sfx2: fix crash in SfxObjectShell::IsHelpDocument() The tracking issue for this problem was cool#9735. Want to start using this?¶ You can get a development edition of Collabora Online 24.04 and try it out yourself right now: try the development edition. Collabora intends to continue supporting and contributing to LibreOffice, the code is merged so we expect all of this work will be available in TDF's next release too (25.2).
  • Roman Kuznetsov: The best LibreOffice extensions. Code Highlighter 2 (2024/08/26 11:18)
    When I translated one book about Python to Russian which contained many examples of Python code I though quite long how to highlight them in the normal text. For book writing I used LibreOffice Writer (of course) but Writer has no a standard tool for code highlighting.So after some searching I found the LibreOffice extension - Code Highlighter 2. It is also available on our extension site. This extension makes code highlighting using Pygments Python library. There is support for many programming languages and many color styles for highlighting there.The extension worked fine, but I didn't like that for highlighting I should manually select every code example in the text, then press some shortcut, then select another code example, etc...I wrote an issue on the extension github page and after some discussions the extension author Jean-Marc Zambon implemented a new feature that allows to highlight all code example in the book in only one action using Paragraph style!So my workflow in this case will be as follows:Create a snippet for the AutoText with code example that has a special paragraph style (for example, with font name Consolas and font size 12pt) with name, for example too - 'Python_code'.Use this snippet to insert code examplesIn the end of book writing just use the new feature in the extension and highlight all code examples in only one action!  Above you can see examples of the Code Highlighter work with some light and some dark styles.
  • Caolán McNamara: Linux Namespaces and Collabora Online (2024/08/23 11:17)
    In Collabora Online (for the normal mode of operation) we have a single server process (coolwsd) that spawns a separate process (kit) to load and manage each individual document. Each of those per-document kit processes runs in its own isolated environment. See architecture for details.Each environment contains a minimal file system (ideally bind mounted from a template dir for speed, but linked/copied if not possible) that each kit chroots into, limiting its access to that subtree.That chroot requires the CAP_SYS_CHROOT capability (and the desirable mount requires the CAP_SYS_ADMIN capability), and granting those capabilities to the coolforkit and coolmount binaries is a root privilege that, for typical deb/rpm packages, is done automatically at install time.But it would be far more convenient not to require these capabilities to be set to do this isolation. They grant online more ability to affect its host system than it uses, we only want to mount dirs and chroot into dirs that belong to online and have no need or desire to make them available to any other process or user, and it's awkward, especially during development. to require root privileges to set these capabilities.This scenario is not unique, and Linux provides namespaces, typically used by container implementations, to support achieving this. So recent work in Collabora Online leverages these namespaces to do its own layer of per-document kit isolation. (There's a good series of articles by Steve Ovens on the various namespaces, with the mount namespaces the most relevant one here.)In essence, a user level process can create its own namespace in which it is apparently root from its own perspective, but as the original uid from the outside perspective and limited to operating on resources that the original uid is limited to accessing. So for each forkit, instead of requiring initial system capabilities and creating a system level bind mount we instead have no specific initial capabilities, enter a new namespace, unique to each forkit, in which that forkit becomes king of its own castle with apparent full capabilities, and can create bind mounts and chroot into its minimal file system.Which is pretty magical to me as the whole existence of namespaces passed me by entirely without notice despite debuting over a decade ago.Nothing is ever simple however, so some hurdles along the way.Entering the namespace "requires that the calling process is not threaded" (man 2 unshare) which is not a problem for the normal use case in each kit, but did pose a problem for the test coolwsd does in advance to probe if there are working namespaces on the system in determine if it should operate kits in namespace mode or not. There it turned out that the Poco::Logger we use backups existing logs when it creates a new one, and then by default spawns a  thread to compress the old log.I initially had the vague notion that I could treat a namespace as a sort pseudo-sudo and switch back and forth freely between them, but that's not the model, typically it's a one way journey. But namespaces can be stacked instead with a namespace where the original uid is mapped to (apparent) root then containing another namespace where the user is mapped back to the original uid again. So we do that, each forkit enters its initial namespace and is mapped to root, does the mounts, enters another nested namespace mapped back to the original uid, chroots and drops all of the capabilities gained on entering a namespace.  Which aligns the namespace mode with the expectations of the non-namespaces mode as to what effective uid the kit appears to run as.The mounts that each forkit does are private to that forkit, so while in the non-namespace case the mounts are visible system-wide, in the namespace case the mounts are not visible either to other forkits or to the parent coolwsd. So how the document is provided by coolwsd to a child kit had to be adapted for the new mode of even less potential leakage between components.There was a glitch in mounting, because when we bind mounts dirs from our system template we want them to be readonly, which requires the typical Linux 2 step process of mount and remount with readonly flags. This worked for the non namespace case, but failed for namespaces even though the initial mount succeeded. Here we had an extra flag of MS_NOATIME when remounting to potentially shave a little time off use of the kit jail, but in namespaces removing that option from the underlying system mount isn't permitted.Despite that mount flag change giving working namespace-using kits directly inside toplevel OS, one of our lxc-using ci systems still refused to allow a readonly remount in a namespace to work. The catch here was that lxc is bundled with default apparmor rules which additionally restrict a readonly remount call to a certain set of arguments which our remount effort didn't match, so that had to be adjusted. Specifically the rather obscure MS_SILENT use.Performance-wise, an unexpected (to me at least) side effect of using namespaces is that the coolwsd measurement of the time to spawn a forkit on my hardware has reduced from an average of 39.63ms per spawn to an average of an average of 6.15ms per spawn, which wasn't the primary goal but is a nice benefit.Surveying distros where namespaces are available by default suggests:RHEL/CENTOS8.0+ works with namespaces out of the box7.9 (EOL) not enabled by default, possible withecho 10000 > /proc/sys/user/max_user_namespacesDebian 11+ (bullseye) works with namespaces out of the box10 (buster) EOL, not enabled by default, possible withsudo sysctl -w kernel.unprivileged_userns_clone=1Ubuntu16.04+ works with namespaces out of the boxUbuntu 24.04 however, while supporting namespaces out of the box, has restricted namespaces via apparmor rules, which complicates things again so Collabora Online .deb packages install an apparmor profile to enable it to use namespaces out of the box.
  • LibreOffice QA Blog: QA/Dev Report: July 2024 (2024/08/21 17:18)
    General Activities LibreOffice 24.2.5 was released on July, 25 Olivier Hallot (TDF) did many improvements to Calc function help pages and added documentation for wildcards in the Find & Replace help content Alain Romedenne added a help page for supported MS Office VBA object features and improved the help for IF Basic statement Pierre F. did many improvements to Calc function help pages and clarified the help text on crash reporter Dione Maddern reworked the help pages concerning Styles Sidebar deck and added a help page for Page Sidebar deck Stanislav Horáček updated help for Calc’s XMATCH function Gábor Kelemen (allotropia) did code cleanups in the area of warnings Laurent Balland did cleanups in Yellow Idea, Candy, Freshes and Growing Liberty Impress templates Miklós Vajna (Collabora) continued polishing support for content controls, improved the performance of working with documents having an unusually large number of bulleted lists, disabled export of form fields as PDF forms by default to match user expectations better and improved font fallback in DOCX import Szymon Kłos, Jaume Pujantell, Attila Szűcs, Michael Meeks, Pranam Lashkari, Marco Cecchetti, Áron Budea and Henry Castro (Collabora) worked on LOKit used by Collabora Online Tomaž Vajngerl (Collabora) continued refactoring and improving the code for Impress annotations Julien Nabet fixed crashes and did code cleanups especially in Python code Xisco Faulí (TDF) fixed an issue with deleting empty columns in Calc removing formatting from adjacent column, fixed a table copying crash, did simplifications in automated tests, added a dozen new tests, converted some tests from Java to Cppunit and upgraded Python to 3.10 alongside other dependency updates Michael Stahl (allotropia) made document repairing code more robust and made it possible to remove autoformatting from a Writer table while adding a configuration option to disable automatic updates of autoformatting when editing a table Mike Kaganski (Collabora) fixed rendering issues with GDI and EMF metafiles, made clipboard handling more robust on Windows, made UI tests more stable on Windows, fixed many issues related to database functionality, also making the Firebird integration better, made HTML/ReqIF export more robust and improved the performance of Calc autoformatting when applying to whole rows. He also did many code cleanups and optimisations Caolán McNamara (Collabora) fixed incorrect font emphasis in Expert Configuration dialog, fixed an issue with a certain type of imported PDF appearing as blank after exporting, improved font fallback automated tests and fixed crashes. He also fixed many issues found by static analysers and fuzzers Stephan Bergmann (allotropia) worked on WASM build, finishing the UNO bridge for it and enabling Start Center Noel Grandin (Collabora) greatly improved the export time of complex XLS/X spreadsheets to ODS, made UI tests more stable by making them use a generic clipboard rather than the system one, improved the performance of rendering animated GIFs in Impress and improved the saving time of ODS files with lots of comments Justin Luth (Collabora) implemented an option to the page number wizard that inserts headers/footers while fitting them into existing margins, fixed a style inheritance refresh issue after changing font sizes, implemented RTF export of different first header, fixed an issue causing headers/footers to be emptied after pasting RTF content into Writer, fixed an issue with images overlapping when separated by line breaks in DOCX files, fixed a content control regression causing extra characters to appear and fixed a visual glitch in content control dropdowns Michael Weghorn (TDF) made vertical tab dialogs beautiful, implemented accessibility support for the spelling dialog, worked on the Android version and worked on using native widgets in Qt UIs Balázs Varga (allotropia) worked on the accessibility checker Patrick Luby fixed an issue with contour wrap clipping semi-transparent pixels, fixed several crashes and hangs, fixed content not being visible in exported WEBP images, made tabbed dialogs accessible on macOS, implemented support for accessing toolbar dropdowns via VoiceOver macOS accessibility software, made it so Command-w shortcut on macOS closes the currently active window and fixed an issue preventing pasting into the search field in Calc, when using a non-Western keyboard Jim Raykowski added a feature for deleting all content of a certain type via the Navigator and made it so the actions applicable to a selected item show up as buttons in the top part of the Navigator. He also enhanced the Manage Changes dialog by fixing a focus issue, making the changes appear in the order they appear in the document and made it so clicking on a change in the document highlights the related change in the Manage dialog Sarper Akdemir (allotropia) made the new Impress Notes pane searchable, improved the UX of the encryption dialog by making it modal and added an option to the Save dialog for easy digital signing with default certificate Samuel Mehrbrodt (allotropia) expanded the coverage of ignored author data when exporting DOC files in privacy mode, made comment author initials handling more robust with PPT/X files, made it so changes in Bullets and Numbering dialog are not saved, if the user cancels, changed the bulleted list toolbar dropdown to display the customised bullet symbol and improved the UX of signing documents with password protected GPG keys Armin Le Grand (allotropia/Collabora) worked on a renovation of graphics rendering with Cairo library and continued the rework of handling attributes and properties Oliver Specht (CIB) implemented support for number formats in Writer tables when cloning formatting, fixed an issue with table cell widths in RTF import, fixed an issue with character properties not being applied to bullet symbols in RTF import, made it so paragraphs with empty mail merge fields are not hidden in Microsoft format imports, made the user field display in Edit Fields dialog harmonious, made VML shape visibility property be respected in DOCX import, made the handling of bullets in conditional paragraphs more robust in RTF import and corrected the calculation of paragraph heights in RTF/DOCX import with regards to tab stops and spaces Heiko Tietze (TDF) added a donate button to Start Center and made shipped palette names translatable László Németh added some Writer automated tests Ilmari Lauhakangas (TDF) did many Python code cleanups Christian Lohmaier (TDF) fixed several build issues Thorsten Behrens (allotropia) improved the newly-added Impress Notes pane search Eike Rathke (Red Hat) optimised the use of date & time calculations in the code, fixed an issue with database range keywords not being detected when using English function names in Calc and fixed function wizard breaking formula references to database ranges Jonathan Clark (TDF) fixed an issue causing Writer textbox direction to change depending on zoom, made line breaking more robust in bidirectional text, fixed inconsistencies in proportional line spacing in Writer, improved the layout performance of Tibetan text in Writer, fixed a Hebrew spell-checking issue related to quotes, made Korean word counting work properly, fixed overlapping CJK characters in PDF export and fixed incorrect baseline adjustment for vertical bidirectional text Regina Henschel continued working on angle unit import support and corrected the importing of Excel keywords like [#Data] and [#Totals] together with Eike Rathke Tibor Nagy (allotropia) made connector adjustments work in PPTX import, fixed an accessibility issue with Figure tag placement attribute when exporting to PDF and added support for Windows touch gestures for panning and zooming Adam Seskunas worked on the GSoC project to port Java tests to C++ Ritobroto Mukherjee worked on the GSoC project to implement cross platform .NET bindings for UNO API Devansh Varshney worked on the GSoC project for adding histogram charts Ahmed Hamed worked on the GSoC project for improving the Functions Sidebar deck in Calc Rafael Lima fixed the rendering of Calc’s AutoFill overlay with certain zoom levels or after scrolling, made the new Calc active cell rectangle symmetric at any zoom level, made Calc’s column/row highlighting repaint when changing window size, gave better contrast for AutoFill handle, improved the look of vertical tabs in dialogs and fixed an issue with the newly-added translatability of palette names Leonard Sasse did Python code cleanups Hossein Nourikhah (TDF) did Calc code cleanups, made it so LibreOfficeKit headers and library files are now shipped with the SDK packages and added an ODK example for converting a file to PDF using LibreOfficeKit library Kira Tubo added a couple of Writer cppunit tests Stéphane Guillou (TDF) fixed infobar text colours not being adapted to background colour Moritz Duge (allotropia) added a Python example to ODK for key and mouse handlers and listeners and did several improvements to the UI of certificate handling and digital signing Peter Hagen optimised macOS clipboard handling code Bayram Çiçek (Collabora) worked on Excel Power Query round trip support Taichi Haradaguchi upgraded some dependencies Jean-Pierre Ledure worked on the ScriptForge library Jürgen Funk (CIB) fixed an issue with an unwanted empty page appearing in DOCX and RTF files with mirrored margins and made the placeholder text of fields reset to their defaults, if their content is deleted Vladislav Tarakanov improved the support of audio files in PPT/X files Vasily Melenchuk (CIB) continued working on the use of Windows attention-grabbing FlashWindow API Kurt Nordback continued polishing the pie-of-pie and bar-of-pie chart implementations Kudos to Ilmari Lauhakangas for helping to elaborate this list. Reported Bugs 430 bugs, 64 of which are enhancements, have been reported by 245 people. Top 10 Reporters Eyal Rozenberg ( 25 ) Mike Kaganski ( 12 ) peter josvai ( 12 ) Daniele ( 11 ) Stéphane Guillou (stragu) ( 10 ) Regina Henschel ( 10 ) Gabor Kelemen (allotropia) ( 10 ) Xisco Faulí ( 9 ) Faisal ( 7 ) Telesto ( 7 ) Triaged Bugs 440 bugs have been triaged by 65 people. Top 10 Triagers Stéphane Guillou (stragu) ( 95 ) m_a_riosv ( 58 ) Buovjaga ( 54 ) Heiko Tietze ( 29 ) Mike Kaganski ( 23 ) ady ( 17 ) raal ( 16 ) V Stuart Foote ( 15 ) Xisco Faulí ( 14 ) Julien Nabet ( 9 ) Resolution of resolved bugs 403 bugs have been set to RESOLVED. Check the following sections for more information about bugs resolved as FIXED, WORKSFORME and DUPLICATE. Fixed Bugs 162 bugs have been fixed by 39 people. Top 10 Fixers Mike Kaganski ( 13 ) Jonathan Clark ( 10 ) Patrick Luby ( 10 ) Caolán McNamara ( 9 ) Justin Luth ( 7 ) Heiko Tietze ( 6 ) Miklos Vajna ( 6 ) Michael Weghorn ( 5 ) Balazs Varga ( 5 ) Rafael Lima ( 5 ) List of critical bugs fixed tdf#161865 Base’s Table Design View and Create View not editable anymore (Windows) ( Thanks to Noel Grandin ) List of high severity bugs fixed tdf#114160 ZWJ shouldn’t be treated as breaking character ( Thanks to Jonathan Clark ) tdf#148647 LO pastes previous clipboard content instead of latest copied from other app, depending on apps opened (Windows; see comment 11) ( Thanks to Mike Kaganski ) tdf#152104 Long export to ods from xls / xlsx since 7.4.0beta1 ( Thanks to Noel Grandin ) tdf#156530 FIREBIRD: Copying a table from one database file to another gives wrong decimal numbers. ( Thanks to Mike Kaganski ) tdf#156689 Deleting empty column(s) removes styling / formatting of adjacent column ( Thanks to Xisco Fauli ) tdf#160139 Header/footer contents removed and cannot be restored after some paste actions (from shape; as RTF; Zotero refresh…) (steps in comment 2) ( Thanks to Justin Luth ) tdf#160976 FILESAVE RTF Footer content lost after saving from DOCX to RTF ( Thanks to Justin Luth ) tdf#161421 Not all hyphenation separators (hyphens) are displayed in app, but are visible in blue in PDF export / print ( Thanks to Heiko Tietze ) tdf#161568 VIEWING: Message for “no Search Results” sometimes not visible in Toolbar ( Thanks to Heiko Tietze ) tdf#161653 The numbering toolbar dropdown no longer can select from the 8-block of options ( Thanks to Samuel Mehrbrodt ) tdf#162174 Crash when opening Bullets and Numbering dialog a second time ( Thanks to Julien Nabet ) tdf#162180 CRASH: copying table from document, or selecting it with 2 …
  • Miklos Vajna: Improved font fallback in the DOCX import of Writer (2024/08/07 07:05)
    Writer now has improved support for font fallback when you open a DOCX file that refers to fonts which are not available currently. This work is primarily for Collabora Online, but the feature is fully available in desktop Writer as well. Motivation¶ Font embedding is meant to solve the problems around missing fonts, but you can also find documents with stub embedded fonts that are to be ignored and our code didn't have any sanity check on such fonts, leading to unexpected glyph-level fallbacks. Additionally, once font-level fallback happened, we didn't take the font style (e.g. sans vs serif) into account, which is expected to work when finding a good replacement for the missing font. Results so far¶ Here is how to the original rendering looked like: Bugdoc, before: ugly glyph-level fallback Once the handler for the embedded fonts in ODT/DOCX was improved to ignore stub fonts where even basic glyphs were not available, the result was a bit more consistent, but still bad. Here is a different document to show the problem: Bugdoc, first improvement: no glyph fallback but the result is sans Note how now we used the same font, but the glyphs are always sans, not serif. So the final step was to import the font type from DOCX and consider that while deciding font fallback: Bugdoc, second improvement: no glyph fallback and the result is sans / serif With this, we ignore stub embedded fonts from DOCX, we import the font type and in general font fallback on Linux takes the font type into account while deciding font fallback. How is this implemented?¶ If you would like to know a bit more about how this works, continue reading... :-) As usual, the high-level problem was addressed by a series of small changes: tdf#162002 DOCX import: ignore subsetted embedded fonts for editing tdf#162002 DOCX import, font embed: only discard subset fonts with few glyphs tdf#162072 vcl, fontconfig: consider font-family-generic for substitute Related: tdf#162072 DOCX import: handle font family for characters tdf#162280 vcl: consider font family type for glyph caching Want to start using this?¶ You can get a development edition of Collabora Online 24.04 and try it out yourself right now: try the development edition. Collabora intends to continue supporting and contributing to LibreOffice, the code is merged so we expect all of this work will be available in TDF's next release too (24.8).
  • LibreOffice Design Blog: Peer-to-peer collaboration with LibreOffice (2024/07/17 08:22)
    A while ago, Simon Phipps, member of the Board of Directors at The Document Foundation, shared the idea to introduce a peer-to-peer collaboration built in to desktop LibreOffice without the requirement for a cloud provider. This idea has received a lot of attention inside the organization and the design team has started to outline the project now.…
  • Miklos Vajna: Fixing handling of line object transformations in the DOCX import of Writer (2024/07/09 12:46)
    Writer now has improved support for toplevel line shapes when you import those from DOCX. This work is primarily for Collabora Online, but the feature is fully available in desktop Writer as well. Motivation¶ As described in a post from 2014, Writer reads the drawingML markup for shapes in DOCX files, including line shapes. While investigating a simple-looking problem around a horizontal vs vertical line, it turns out that there is a deeper issue here, and it looks like now have proper fix for this bug. Results so far¶ Imagine that your company template has a nice footer in two columns, and the content in the columns are separated by a vertical line shape, but when you open your DOCX in Writer, it crosses the text of that footer instead: Bugdoc, before: reference is red, Writer result is painted on top of it While researching how line shapes are represented in our document model and how ODT import works, it turned out that the proper way to create a line shape is to only consider size / scaling when it comes to the individual points of the line, everything else (e.g. position / translation) should go to the transform matrix of the shape, then the render result will be as expected: Bugdoc, after: reference is red, Writer result is painted on top of it It was also interesting to see that this also improved other, existing test documents, e.g. core.git sw/qa/extras/ooxmlimport/data/line-rotation.docx looked like this before: 3 rotated lines, before: reference is red, Writer result is painted on top of it And the same fix makes it perfect: 3 rotated lines, after: reference is red, Writer result is painted on top of it Just stick to the rule: scaling goes to the points -- translation, rotation and horizontal shear goes to the shape. For now, this is only there for toplevel Writer lines, but in-groupshape and Calc/Impress lines could also follow this technique if there is a practical need. The "after" screenshots show ~no red, which means there is ~no reference output, where the Writer output would be missing. How is this implemented?¶ If you would like to know a bit more about how this works, continue reading... :-) The bugfix commit was tdf#161779 DOCX import, drawingML: fix handling of translation for lines. The tracking bug was tdf#161779. Want to start using this?¶ You can get a development edition of Collabora Online 24.04 and try it out yourself right now: try the development edition. Collabora intends to continue supporting and contributing to LibreOffice, the code is merged so we expect all of this work will be available in TDF's next release too (24.8).
  • Collabora Community: Hacking LibreOffice in Budapest (2024/06/19 11:00)
    Earlier this month, we were pleased to sponsor the Libreoffice Technology Hackfest in Budapest, Hungary, and enjoyed meeting up with some of our fellow LibreOffice Technology hackers. Over two days, a dozen developers from Collabora Productivity and the wider community met up in the Eco Community Space to work on the LibreOffice codebase, and reap the benefits of spending time together.   A hackfest is an event where developers from multiple organisations meet each other, work on what they want and also more freely exchange ideas while being together in person. While having an international community working remotely on the codebase is excellent, there are still many benefits to more directly seeing what problems are being tackled by other developer sitting next to you; and this friendly environment allows building relationships that can then help even more in the future (even remotely). As one attendee Miklos Vajna shared with us after the event, “It was really great to spend a couple of days with the other developers. I found it very helpful seeing what other people are working on, sharing ideas about the future feature possibilities, and especially enjoyed going out for a dinner with everyone in Budapest after a hard day’s work!” For this reason, we were very pleased to sponsor this most recent meet up. Many thanks to all who joined us in Budapest, we look forward to seeing you soon at the next meeting! If you would like to find out more about joining the Collabora Online or LibreOffice community, we would encourage you to join the Collabora Online Community Forum or have a look at the Collabora Online Github to learn about how to get started. For more information about our upcoming events, and to learn where you could meet us next, do have a look at our events page.
  • LibreOffice Design Blog: Convenient handling of shortcuts (2024/06/05 13:35)
    Shortcuts are a major topic for user experience. Novices are advised to learn basic shortcuts beyond the famous Ctrl+C/X/V like Ctrl+1/2/3.. to quickly change the paragraph style to heading 1/2/3… in Writer. Once you have learned those combinations you never want to unlearn and to change the muscle memory.…
  • Björn Michaelsen: Writer Again! (2024/05/27 12:14)
    Writer Again! After resigning from the Board of Directors of TDF over the weekend, I hope I will again find more time to look into the technical details of LibreOffice Writer. I will also try to do my best to write some good article here about the depth of that application. While a text processor in itself is not that interesting anymore these days, the challenges of migrating that big old legacy code might be fascinating quite often. Hope to have you as a reader for that soon! Comments? Feedback? Additions? Most welcome here on the fediverse !
  • allotropia: LibreOffice, JavaScript’ed (2024/04/30 11:32)
    LOWA is LibreOffice built with Emscripten as a Wasm executable that runs in the browser. Controlling that LibreOffice through UNO with JavaScript looks like a natural fit. Enter Embind, a mechanism to generate the binding glue between JavaScript and Wasm/C++. As we will see, the Embind vs. UNO match is not perfect, but it kind-of gets the job done, at least for a first iteration. Mappings To dive straight into technical matters, the UNO type system is mapped to JavaScript as follows. (If you would like to see some example code first, jump ahead to the Starting Points and come back here later for reference.) UNO BOOLEAN, depending on context and somewhat inconsistently maps to JavaScript Boolean and to JavaScript Number values 0 and 1. (The C/C++ representation of UNO BOOLEAN is sal_Bool, which is an alias for unsigned char, which Embind maps to JavaScript Number. So in places where we directly rely on Embind, like for the return value of a UNO interface method invocation, we get the Embind mapping to Number. But in places where we have more control, like for the JavaScript get method for a UNO ANY, we can be a bit more fancy and use a mapping to Boolean.) UNO BYTE, SHORT, UNSIGNED SHORT, LONG, UNSIGNED LONG, FLOAT, and DOUBLE all map to JavaScript Number (with restricted value ranges for everything but UNO DOUBLE). UNO HYPER and UNSIGNED HYPER both map to JavaScript BigInt (with restricted value ranges). UNO CHAR and STRING both map to JavaScript String (with single UTF-16 code unit strings for UNO CHAR). UNO TYPE maps to JavaScript Module.uno_Type objects. There are construction functions Module.uno_Type.Void, Module.uno_Type.Boolean, Module.uno_Type.Byte, Module.uno_Type.Short, Module.uno_Type.UnsignedShort, Module.uno_Type.Long, Module.uno_Type.UnsignedLong, Module.uno_Type.Hyper, Module.uno_Type.UnsignedHyper, Module.uno_Type.Float, Module.uno_Type.Double, Module.uno_Type.Char, Module.uno_Type.String, Module.uno_Type.Type, Module.uno_Type.Any, Module.uno_Type.Sequence, Module.uno_Type.Enum, Module.uno_Type.Struct, Module.uno_Type.Exception, and Module.uno_Type.Interface for representations of all the UNO TYPE values. The Module.uno_Type.Sequence construction function recursively takes a UNO TYPE argument for the component type, while the Module.uno_Type.Enum, Module.uno_Type.Struct, Module.uno_Type.Exception, and Module.uno_Type.Interface construction functions each take a string argument denoting the given type’s name in dotted notation (e.g., Module.uno_Type.Interface('com.sun.star.uno.XInterface')). Those JavaScript objects implement toString, which is also used for equality checks (e.g., type === 'com.sun.star.uno.XInterface'). UNO ANY maps to JavaScript Module.uno_Any objects. There is a constructor taking a UNO TYPE argument and a corresponding value (using an undefined value for UNO type VOID). Those JavaScript objects implement a method get that returns the JavaScript representation of the contained UNO value. UNO sequence types map to a pre-canned variety of JavaScript Module.uno_Sequence_... objects. The problem is that Embind does not let us have a generic mapping to the C++ com::sun::star::uno::Sequence<T> class template; we can only have individual Embind mappings to specific class template instantiations. As a hack, for every UNO sequence type that appears somewhere in the LibreOffice UNO API, we generate a specific JavaScript Module.uno_Sequence_.... The naming is Module.uno_Sequence_boolean, Module.uno_Sequence_byte, Module.uno_Sequence_short, Module.uno_Sequence_unsigned_short, Module.uno_Sequence_long, Module.uno_Sequence_unsigned_long, Module.uno_Sequence_hyper, Module.uno_Sequence_unsigned_hyper, Module.uno_Sequence_float, Module.uno_Sequence_double, Module.uno_Sequence_char, Module.uno_Sequence_string, Module.uno_Sequence_type, and Module.uno_Sequence_any for the simple UNO component types; Module.uno_Sequence_... followed by the UNO type name in dollar-separated notation (e.g., Module.uno_Sequence_com$sun$star$uno$XInterface) for enum, struct, and interface component types; and Module.uno_SequenceN_..., with N greater than 1, for sequence component types (e.g., Module.uno_Sequence2_long for the UNO type “sequence of sequence of LONG“). That means that there currently is just no way to come up with e.g. a JavaScript representation of the UNO type “sequence of interface com.sun.star.frame.XDesktop“, as that sequence type happens to not be mentioned anywhere in the LibreOffice UNO API. (But for those sequence types that are used as interface method parameter or return types, corresponding JavaScript representations are provided. That should hopefully cover all relevant use cases for now; a future overhaul of this part of the mapping is likely.) These JavaScript sequence objects have two constructors, one taking a JavaScript array of member values (e.g., new Module.uno_Sequence_long([1, 2, 3])) and one taking a size and a Module.FromSize marker (as Emind does not allow to have multiple constructors with the same number of arguments) whose members will have default values (e.g., new Module.uno_Sequence_long(3, Module.FromSize)). Additional methods are resize (taking the new length as argument), size (returning the current length), get (taking an index as argument and returning the member at that index), and set (taking an index and a new member value as arguments). (The naming of those resize, size, get, and set methods is modelled after Embind’s emscripten::register_vector.) UNO enum types are mapped to Embind-provided enums named Module.uno_Type_... followed by the UNO type name in dollar-separated notation (e.g., Module.uno_Type_com$sun$star$uno$TypeClass). Plain UNO struct types and UNO exception types are mapped to Embind-provided value objects named Module.uno_Type_... followed by the UNO type name in dollar-separated notation (e.g., Module.uno_Type_com$sun$star$beans$NamedValue, Module.uno_Type_com$sun$star$uno$Exception). Polymorphic UNO struct types face a similar issue to sequence types, in that Embind does not allow to directly map their corresponding C++ class templates. It would be possible to do a similar hack and add specific mappings for all instantiated polymorphic struct types that are mentioned anywhere in the LibreOffice UNO API, but that has not been implemented so far. (And, similar to sequence types, a future overhaul of this part of the mapping is likely.) UNO interface types are mapped to Embind-provided classes named Module.uno_Type_... followed by the UNO type name in dollar-separated notation (e.g., Module.uno_Type_com$sun$star$uno$XInterface). Null references are mapped to JavaScript null. The special com.sun.star.uno.XInterface UNO interface methods queryInterface, acquire, and release are not exposed to JavaScript client code. UNOIDL single-interface–based service constructors are mapped to JavaScript functions named Module.uno_Function_...$$... followed by the service’s name in dollar-separated notation, followed by the constructor’s name set of by two dollar signs (e.g., Module.uno_Function_com$sun$star$beans$Introspection$$create). Like with other UNO language bindings, those functions take the com.sun.star.uno.XComponentContext as an additional first argument. UNOIDL service-based singletons are mapped to JavaScript functions named Module.uno_Function_... followed by the singleton’s name in dollar-separated notation (e.g., Module.uno_Function_com$sun$star$frame$theDesktop). Like with other UNO language bindings, those functions take the com.sun.star.uno.XComponentContext as their (sole) argument. Starting Points To make all this work, the Embind mapping of the LibreOffice UNO API needs to be set up first. This is done by a call to const uno = init_unoembind_uno(Module); which also returns a wrapper object uno that allows for more natural access to all the UNOIDL entities whose mappings use that dollar-separated notation: Instead of Module.uno_Type_com$sun$star$uno$XInterface one can write uno.com.sun.star.uno.XInterface, and a call to uno_Function_com$sun$star$beans$Introspection$$create(context) can be written as uno.com.sun.star.beans.Introspection.create(context). If you want to cut down on the common uno.com.sun.star prefix even further, const css = uno.com.sun.star; lets you reduce that to just css.uno.XInterface and css.beans.Introspection.create(context). The starting points to access the LibreOffice UNO API from JavaScript are Module.getUnoComponentContext() (returning the central css.uno.XComponentContext, through which all the services and singletons are reachable) and a Module.getCurrentModelFromViewSh() convenience function (returning the css.frame.XModel of the currently showing document). The gitlab.com/allotropia/lowa-demos repository is a growing site of example code showing all of this in action. Summing this up, here is some example code that iterates over all the paragraphs of a Writer document and gives each of them a random foreground text color: const uno = init_unoembind_uno(Module); const css = uno.com.sun.star; const model = Module.getCurrentModelFromViewSh(); const document = css.text.XTextDocument.query(model); const text = document.getText(); const access = css.container.XEnumerationAccess.query(text); const paragraphs = access.createEnumeration(); while (paragraphs.hasMoreElements()) { const paragraph = css.text.XTextRange.query( paragraphs.nextElement().get()); const props = css.beans.XPropertySet.query(paragraph); const color = new Module.uno_Any( Module.uno_Type.Long(), Math.floor(Math.random() * 0xFFFFFF)); props.setPropertyValue("CharColor", color); color.delete(); } Cleanup Embind is built on the concept that whatever C++ objects you reference from JavaScript, you manually and explicitly need to declare those references as no longer needed once you are done, by calling delete() methods on the corresponding JavaScript objects. (Or else, you risk memory leaks.) This can be quite cumbersome and would pollute the code with tons of such delete() calls. Luckily, JavaScript grew a FinalizationRegistry mechanism that allows code to be executed when the JavaScript garbage collector finds an objet to be unused and reclaims it. (And that code can thus transparently do the delete() call for us.) Embind implements such FinalizationRegistry-support for some types (those that are modelled based on some “smart poiner”) but not for others. That means that (besides all the primitive types) JavaScript mappings of UNO string, type, enums, sequences, exceptions, and interfaces all do not need explicit delete() calls, while the mappings of UNO any and UNO sequences, and the various Module.uno_InOutParam_... all need explicit delete() calls. Even though we expect that the JavaScript engines that we target do support the FinalizationRegistry mechanism, Embind is prepared to work with older engines that do not support it. Therefore, whenever an object is transparently cleaned up, Embind logs a somewhat unhelpful warning to the JavaScript console, stating that it “found a leaked C++ instance” (and that it will “free it automatically”). Interfaces For each UNO interface type there is a JavaScript class method query taking any JavaScript UNO object reference (in the form of the common com.sun.star.uno.XInterface base interface) as argument (and internally using UNO’s queryInterface to obtain either a correspondingly-typed reference to that object, or a null reference). There is also a JavaScript helper function Module.sameUnoObject, taking two interface references as arguments and returning whether both are references to the same UNO object. UNO interface methods taking out or in-out parameters need special treatment. There are Module.uno_InOutParam_... wrappers (with a val property carrying the actual value) that need to be set up and passed into the UNO method. Such wrappers have a constructor taking no arguments (creating a dummy object, suitable for pure out parameters) and another constructor taking one argument of the wrapped type (suitable for in-out parameters). For example, to read data from a com.sun.star.io.XInputStream: const stream = ...; const input = css.io.XInputStream.query(stream); if (input) { const data = new Module.uno_InOutParam_sequence_byte; input.readBytes(data, 100); for (let i = 0; i != data.val.size(); ++i) { console.log('read byte ' + data.val.get(i)); } data.delete(); } Exception Handling Support for throwing and catching exceptions between JavaScript and C++ is rather rough: JavaScript code can use try ... catch (e) ... to catch a UNO exception thrown from C++, but all the information it can get about that exception is e.name stating the exception’s type. Also, for technical reasons, the catch block needs some increment– and decrementExceptionRefcount boilerplate, try { ... } catch (e) { incrementExceptionRefcount(e); //TODO, needed when building with JS-based -fexceptions, // see // <https://github.com/emscripten-core/emscripten/issues/17115> // "[EH] Fix inconsistency of refcounting in Emscripten // EH vs. Wasm EH" if (e.name === 'com::sun::star::uno::RuntimeException') { ... } decrementExceptionRefcount(e); } To throw UNO exceptions from JavaScript code, there is a helper function Module.throwUnoException that takes a UNO (exception) type and an instance of that type: Module.throwUnoException( Module.uno_Type.Exception( 'com.sun.star.lang.IllegalArgumentException'), {Message: 'bad argument', Context: null, ArgumentPosition: 0}); UNO Objects The JavaSript-to-UNO binding is a full mapping, so you can even implement new UNO objects in JavaScript. This requires quite some boilerplate, though. For example, the below obj implements com.sun.star.lang.XTypeProvider and com.sun.star.task.XJob: const obj = { // Implementation details: implRefcount: 0, implTypes: new Module.uno_Sequence_type([ Module.uno_Type.Interface( 'com.sun.star.lang.XTypeProvider'), Module.uno_Type.Interface( 'com.sun.star.task.XJob')]), implImplementationId: new Module.uno_Sequence_byte([]), // The methods of XInterface: queryInterface(type) { if (type == 'com.sun.star.uno.XInterface') { return new Module.uno_Any( type, css.uno.XInterface.reference( this.implXTypeProvider)); } else if (type == 'com.sun.star.lang.XTypeProvider') { return new Module.uno_Any( type, css.lang.XTypeProvider.reference( this.implXTypeProvider)); } else if (type == 'com.sun.star.task.XJob') { return new Module.uno_Any( type, css.task.XJob.reference( this.implXJob)); } else { return new Module.uno_Any( Module.uno_Type.Void(), undefined); } }, acquire() { ++this.implRefcount; }, release() { if (--this.implRefcount === 0) { this.implXTypeProvider.delete(); this.implXJob.delete(); this.implTypes.delete(); this.implImplementationId.delete(); } }, // The methods of XTypeProvider: getTypes() { return this.implTypes; }, getImplementationId() { return this.implImplementationId; }, // The methods of XJob: execute(args) { if (args.size() !== 1 || args.get(0).Name !== 'name') { Module.throwUnoException( Module.uno_Type.Exception( 'com.sun.star.lang.IllegalArgumentException'), {Message: 'bad args', Context: null, ArgumentPosition: 0}); } console.log( 'Hello, my name is ' + args.get(0).Value.get()); return new Module.uno_Any( Module.uno_Type.Void(), undefined); }, }; obj.implXTypeProvider = css.lang.XTypeProvider.implement(obj); obj.implXJob = css.task.XJob.implement(obj); obj.acquire(); // ... pass obj to UNO here ... obj.release();
  • Jean Hollis Weber: LibreOffice 24.2 Writer Guide published (2024/03/12 01:34)
    LibreOffice 24.2 Writer Guide has been published. It is available for free download (PDF, ODT) from the Documentation page on the LibreOffice website. Printed copies can be purchased from the Documentation Team’s store at Lulu.com. The numbering system for LibreOffice releases has changed to year.month. LibreOffice will continue to be updated twice a year, but current plans are to update each user guide only once a year.
  • Jean Hollis Weber: Getting Started Guide 7.6 published (2024/02/18 01:18)
    LibreOffice 7.6 Getting Started Guide has been published. It is available for free download (PDF, ODT) from the Documentation page on the LibreOffice website. Printed copies can be purchased from the Documentation Team’s store at Lulu.com.
Enter your comment. Wiki syntax is allowed:
F Q R P P
 
  • news/planet/documentfoundation.txt
  • Last modified: 2021/10/30 11:41
  • by 127.0.0.1