Tech Blog.

Thoughts, stories, ideas.

LibreOffice on iOS – some insights

20. December 2018

Together with our friends from Collabora we’re delighted to announce the porting effort of LibreOffice to yet another important platform: Apple iOS.

Find the announcement from Collabora as well as a sneak peak video here.

Where we came from

Our collaboration on this journey began in early 2018, as we realized, that for one of our projects, a native iOS app is a crucial part to gain end user acceptance.

While we totally love the flexibility and functionality Collabora Online offers (especially when it’s integrated with the ever awesome Nextcloud, we do also see the need for an offline solution to edit office documents.

There are other solutions out there targeting the iOS office and workplace market but we believe that an open source solution with a great community backing it was the missing piece. Together with Collabora the team at Adfinis SyGroup started to search for ways to bring LibreOffice to the iPad and to reuse as much code as possible.

Let me try to summarize some of the design decisions as well as the journey so far:

Technical considerations

Porting the VCL based UI familiar from the PC to iOS would have generated huge amounts of work and was not a feasible option to get something done within a narrow timeframe.

Thanks to the huge investment Collabora has made to get LibreOffice into the cloud we could reuse the online approach to build an app that essentially is an offline implementation of Collabora Online.

One really nice aspect of this approach is, that in the future, it should be possible to cover three major scenarios with essentially this approach:

  • Online – see e.g. Collabora Online
  • iOS – what we’re currently working on
  • Android – just an idea for now

The underlying base is LibreOfficeKit which uses the LibreOffice code base to essentially do tiled rendering and on top of that we use a HTML/JS solution to build the UI for platforms using VCL under the hood. That lets us re-use much of the rich functionality of LibreOffice’s UI.

By choosing this approach we’ll have the nice side effect that future improvements implemented for one platform will also benefit the other possible implementations.

The current state

As a first step the Collabora engineering heroes were busy porting the ‘Online’ code to iOS – all this efforts can be seen in the upstream repository. This involved implementing an internal socket-like system to collapse the client, server and Kit processes into a single process, as well as lots of cross-compilation work.

After the code compiled adjustments were needed in order to actually render a document. Tor landed a bunch of patches to achieve this and after some head banging he actually reached a point where documents started to get rendered properly. \o/

After this important milestone was reached, work on the surrounding elements followed. We now have an iOS app that uses the native file management view, integrates a template manager and uses the WebView functionality to do the actual work.

This new cool kid on the block is called Collabora Office for iOS and it will certainly need some more time until we’ve reached a point where it can be released as a stable product.

What’s next

The current state can be described as alpha level or MVP. Documents can be edited and saved and basic features work as expected. However there is still a long road ahead of us. We have the following things in mind (this is in no way guaranteed and might change):

  • Improve touch functionality
  • Adopt theming/styling to match iOS
  • Create some shiny templates
  • Implement Apple AirPrint (native printing)
  • Fix crashes
  • Remove usage of “right mouse click”

Our vision

In the end we want to achieve a state where LibreOffice runs smoothly on the iOS platform so people all around the world can use it to edit files in the Open Document Format instead of relying on proprietary solutions.

Furthermore we want to ensure, that the solution perfectly works in combination with Nextcloud. This includes template handling but also triggering a sync when saving, etc. The awesome iOS integration of Nextcloud really is a great help here. In the end existing Nextcloud users should be able to have a really nice user experience when combining the iOS app with Collabora Online (or LibreOffice Online) on the server.

Some words of thanks

This fantastic work would not be possible without the heavy backing and investment from Collabora. Their support and their outstanding expertise forms the solid base of this effort – without this, we could not have done it. A special thank goes to Tor Lillqvist who put a ton of work into this and did most of the engineering/coding work. I’m thrilled to be able to work with Tor on this and look forward to get even more done with him.

Of course we’re also standing on the shoulders of giants in the form of the outstanding work done by the community and many others. In particular the initial cross-compilation work was begun by Tor in 2011 at SUSE to support Windows cross-compilation. When Collabora spun out of SUSE, CloudOn invested in significant memory and performance optimization of the code for iOS to support their (proprietary) iOS document editor, and fit it into the app-store size limit. Subsequently an investment by SMOOSE and Collabora in 2015 created the initial viewer for Android. Then funding from TDF created a prototype editor on top of this. Other thanks go to Jan Iversen and Jon Nermut for their LibreOfficeLight prototype for iOS, and of course the man decades of work from Collabora that have gone into Online.

Our sincere thanks goes out to all of them! Merci!

Last but not least, Adfinis SyGroup is paying some of the bills here too – thanks to the whole crew who’s working hard every day to bring more Open Source solutions to the people out there!

Screenshots

The following pictures show the current state of the app.

FAQ

Q: how can I support this project?
A: the code is all public, you can also drop me an e-mail if you would like to get involved or want further guidance.

Q: will the app be available in the Apple store?
A: yes ultimately (if Apple approves it) – but we’re currently in a public beta testing phase.

Q: how can I test some binaries ?
A: A small number (around a hundred) of testers can install via TestFlight – developers are strongly preferred. Bugs can be filed here

Q: when can we expect a release?
A: most probably in H1 2019

Q: who can be credited?
A: Adfinis SyGroup and Collabora are the main drivers behind this.

Q: will Android follow?
A: That is hard to say, we think it would make sense to reuse this approach for Android too to share development cost across all mobile UIs.

Q: why iOS instead of $OTHER_PLATFORM
A: we both have customers that need this, so we had to prioritize, and there is already an app for Android.