Tuesday, August 19, 2014

LibreOffice on Android #2 - Draw and Impress documents

I am continuing working on LibreOffice on Android and now I had achieved a next milestone - support for Draw and Impress documents.

After some painful debugging experience, where an unavailable service in the Android build prevented the documents to be successfully opened, I finally managed to get a slide rendered on screen:
Impress slide rendered in the LibreOffice Android viewer
Draw and Impress documents share most of the code so if you get one working then you most likely get the other for free:
Draw page in LibreOffice Android viewer
Draw and Impress documents differ a little bit from Writer documents, as they are a collection of document parts - slides and pages (and in case of Calc - sheets). To be able to show different parts of the document I implemented a sidebar (using Android's DrawerLayout) which shows all available parts in a list. Clicking on a part in the list re-renders that part on the screen. The sidebar is hidden and can be activated using a left-to-right swipe on the left side of the screen. When activated it looks like this:
Sidebar to switch between slides/pages
In the future the static icons will be replaced with actual thumbnails of pages.

Additional to this I have worked on increasing the performance of tile rendering by auditing the life cycle of tiles and removing corner case bugs. There was a particular bug that removed corner tiles and right after that rendered the same (now missing) tiles for every redraw call (inconsistency in determining which tiles are still valid). Interestingly the impact on the performance was not so big as I thought. I am still not happy with the speed of tile rendering especially when faster scrolling a page.

All the work so far is summed up in this video.

Thanks again goes to Smoose for continuing the sponsoring of LibreOffice on Android work and my employer Collabora to make this project possible.



  1. Wow, nice Tomaž, great job indeed, congratz!

  2. Where are you hosting the code for this?

    1. All the code is in the LibreOffice git repository.

  3. This looks excellent. Just popped a £10 donation to TDF - very exciting.
    Arethere binaries available to download?

    1. Great, thank you!

      The binaries are build daily from the source by the Android builbots and are available at [1] (LibreOfficeViewer).

      Regards, Tomaž

      [1]: http://dev-builds.libreoffice.org/daily/master/Android-ARM@24-Bytemark-Hosting/current/

  4. It is crashing pretty hard on a Nexus 9 (Android 5.0).

    1. On a Nexus 7 (Android 4.4), it is not as bad, but still doesn't get anywhere useful.

      It loads a dark screen, says "LibreOffice Viewer" on the action bar, 3-dot menu including items "About" and "Parts". Gray main with a spinning circle. The about menu works. Parts opens an empty slider from the left.


      I was anticipating that it would actually be at a state where it could render a document. Is there something going wrong with the nightly builds? Or is this behavior expected?

    2. Hi,
      Thanks for reporting this - this issues are more or less known. There are issues with Android 4.4.x and Android 5 which I am trying to solve now. For some reason it works with Android 4.4.x on Nexus 7 2012 (which I used for developing) but not in an emulator or other devices. Anyway, I'm trying to solve this ASAP.

      Regards, Tomaž

  5. It seems to be coming along now.

    LibreOfficeViewer starts and is able to display a default document. Is there any way to open a different document?

    LibreOffice4Android starts and shows a file list, but crashes when selecting one.

    The two can't be installed simultaneously?

    What is the best way to actually try this out?

  6. Ok, figured out how to open a file.
    First bug report: It crashes when it tries to open a file where the filename has a space in it.