DOKK Library

Integrating LibreOffice with Gnome Documents

Authors Markus Mohrhard Pranav Kant

License CC-BY-SA-3.0

Plaintext
Integrating LibreOffice with Gnome
Documents
 Markus Mohrhard, Pranav Kant
 2015-08-09




                                                                             1
                   GUADEC 2015 -- Integrating LibreOffice with Gnome Documents
Integrating LibreOffice with Gnome
Documents
 Pranav Kant




                                                                           2
                 GUADEC 2015 -- Integrating LibreOffice with Gnome Documents
History

 GSoC 2014 (Andrzej Hunt)
  Document rendered as single huge tile

 January 2015 (Miklos Vajna)
   Render the document using 256x256px tiles but …
   Would still render whole document

 Still a Gtk2 widget
 Blocks the main thread
 Can only use from applications written in C/C++
 Used GtkTable for rendered tiles, and required lot of polishing.

                                                                                      3
                            GUADEC 2015 -- Integrating LibreOffice with Gnome Documents
This summer


      Mozilla




                 LibreOffice




                                                  GNOME




                                                                          4
                GUADEC 2015 -- Integrating LibreOffice with Gnome Documents
LibreOfficeKit – Re-using LO core

 A very simple C/C++ API for LibreOffice
 Exposes the core value of LibreOffice :
   File format filters
   Tiled rendering ( documents → pixels)
   Exposes editing, selections etc.
 A very simple header only API – no linking
   Fully abstract: function pointers, opaque structs etc.
   No socket opened, no plugins/simple init.
   Global error message
 LibreOffice online, Android, 'loconv' built on this.



                                                                                       5
                             GUADEC 2015 -- Integrating LibreOffice with Gnome Documents
LOKDocView inside LO tree

 libreofficekit/
    source
      gtk
       lokdocview.cxx
       tilebuffer.cxx
       tilebuffer.hxx
     qa
       gtktiledviewer
         gtktiledviewer.cxx (test-bed)




                                                                                             6
                                   GUADEC 2015 -- Integrating LibreOffice with Gnome Documents
Tiled Rendering

 Divide the document into smaller tiles

 Render these small tiles independently based on demand

 Unstable as of now.
  Use #LOK_USE_UNSTABLE_API

 Only bitmap-buffer rendering, with 32-bit RGBA colorspace




                                                                                      7
                            GUADEC 2015 -- Integrating LibreOffice with Gnome Documents
Fast Tiled Rendering in textures
  Tablet display


                                                     Large
                                                     Pre-rendered
                                                    area for fast
                                                    pan / zoom etc.




                                                                                  8
                        GUADEC 2015 -- Integrating LibreOffice with Gnome Documents
LOK client - LO core communication

 A two way channel

 LOK Client → LO Core
 InitializeForRendering(), postMouseEvent(), postKeyEvent()

 LO Core → LOK Client
 Implemented using callbacks
 LOK_CALLBACK_INVALIDATE_TILES: drop all given tiles
 cached on client-side
 LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR: set the
 new position of your cursor
 LOK_CALLBACK_TEXT_SELECTION: set the selection
 overlay rectangle
                                                                                     9
                           GUADEC 2015 -- Integrating LibreOffice with Gnome Documents
Existing clients

 Gtktiledviewer – a test application inside the LO source code
 tree

 LibreOffice Android

 LibreOffice Online

 Unoconv – python frontend for LibreOffice document
 conversion




                                                                                     10
                            GUADEC 2015 -- Integrating LibreOffice with Gnome Documents
LOKDocView - Architecture

                                                         LibreOffice Core




                 TileBuffer




       LOKDocView
                                                  GThreadPool (single thread)

      GtkDrawingArea

                                                                                       11
                              GUADEC 2015 -- Integrating LibreOffice with Gnome Documents
LOKDocView - APIs

 lok_doc_view_new (GInitable)
 lok_doc_view_open_document
 lok_doc_view_set_zoom
 lok_doc_view_get_zoom
 lok_doc_view_post_command
 lok_doc_view_set_edit




                                                                                  12
                         GUADEC 2015 -- Integrating LibreOffice with Gnome Documents
LOKDocView – Future

 OpenGL for rendering ? GtkGLArea ?

 Better tile buffer algorithms

 Ship .gir and .typelib files




                                                                                          13
                                 GUADEC 2015 -- Integrating LibreOffice with Gnome Documents
Using from C

 pDocView = lok_doc_view_new (instpath, cancellable, error);

 lok_doc_view_open_document(pDocView, docpath,
 cancellable, callback, userdata);




                                                                                    14
                           GUADEC 2015 -- Integrating LibreOffice with Gnome Documents
Use from any language bindings




                  Using from javascript


                                                                                 15
                        GUADEC 2015 -- Integrating LibreOffice with Gnome Documents
feature/gsoc-tiled-rendering




                                                                           16
                  GUADEC 2015 -- Integrating LibreOffice with Gnome Documents
LibreOffice 5.0




                                                                           17
                  GUADEC 2015 -- Integrating LibreOffice with Gnome Documents
Emoji and in-word replacement support

 Fast insertion of common emoji and special unicode
 characters
 e.g.
   ⌨            as     :keyboard:
   ×            as     :x:
   �            as     :smile:
   –            as     :--:
   ⅞            as     :7/8:

 Done through the correction tables



                                                                                    18
                           GUADEC 2015 -- Integrating LibreOffice with Gnome Documents
Better Inteoperability

 DOC, DOCX, RTF, XLSX interoperability fixes

 Support for MSO 2007 OOXML vs OOXML spec

 Improved Keynote import filter

 Improved Freehand import filter

 Many ODF, OOXML validation fixes




                                                                                    19
                           GUADEC 2015 -- Integrating LibreOffice with Gnome Documents
Conditional formatting

 Gradient or solid




    Minimum and maximum length




Show/Hide value




                                                                                          20
                                 GUADEC 2015 -- Integrating LibreOffice with Gnome Documents
Spreadsheet formula improvements

 Table structured references
   Last huge missing formula interoperability feature



 A:A / 1:1 entire column/row references
   Allows to address whole columns and ranges easily
   Better interoperability

 New formulas
   ENCODEURL, ERROR.TYPE, CEILING.MATH,
   FLOOR.MATH

                                                                                     21
                            GUADEC 2015 -- Integrating LibreOffice with Gnome Documents
RenderContext

 Previously direct rendering
 Now double buffered rendering (for many places already)




  Previously:




                                                                                    22
                           GUADEC 2015 -- Integrating LibreOffice with Gnome Documents
Idle handling

 Previously fixed timeouts for different tasks
  Rendering (30ms)
  Resizing (50ms)



 Now work is done when main loop is idle
  Still different priorities
  Snappier
  As fast as possible




                                                                                      23
                             GUADEC 2015 -- Integrating LibreOffice with Gnome Documents
Code Quality

 Coverity
  0.00 score for some time now
  More than 10k issues resolved
 Crash testing
  Testing import and export with 75k bugzilla documents
 Unit testing

  Growth in unit tests over time
      count of various CPPUNIT macros

  25,000
  20,000                         Asserts
  15,000                         Tests
  10,000
   5,000
      0
              3.6 4.1 4.3 5.0
           3.5 4.0 4.2 4.4


                                                                                                    24
                                           GUADEC 2015 -- Integrating LibreOffice with Gnome Documents
Compiler plugins

 Many new custom clang compiler plugins
  simplifybool: return bTest : false : true; to return !bTest;
  de-virtualization: avoid unncessary virtual calls
  staticmethods: methods that don't access member variables
  Many more

 Asan (Address sanitizer)

 Ubsan (Undefined behavior sanitizer)

 Leak sanitizer

                                                                                     25
                            GUADEC 2015 -- Integrating LibreOffice with Gnome Documents
Android

 tdf.io/androidviewer
 Successful tender to get the
 project going
   Limited editing (disabled in
   the official builds)
   Uses tiled editing
   On LibreOffice core side
   same callbacks as iOS,
   LibreOffice Online, Gnome
   Documents




                                                                                      26
                             GUADEC 2015 -- Integrating LibreOffice with Gnome Documents
Web – LibreOffice Online

 First prototype based on Broadway
   Learned a lot of lessons from it
 New design
   tdf.io/onlinerepo
   Based on LibreOfficeKit
   Shares the LibreOffice abstraction with Android, Gnome
   Docs, iOS
   LibreOffice runs on server
   Tiled rendering
   Javascript library to interact with server (based on Leaflet)
   Developed by Collabora & IceWrap

                                                                                      27
                             GUADEC 2015 -- Integrating LibreOffice with Gnome Documents
5.1 and the future




                                                                              28
                     GUADEC 2015 -- Integrating LibreOffice with Gnome Documents
Reuse Mozilla updater for LibreOffice

 Existing update experience is horrible
  Get update notification
  Go to website
  Download new version (more than 100MB)
  Install new version
 Automatic updater
  Only a differential package
  Happens in the background

                  Nathan Yee (through GSoC)




                                                                                    29
                           GUADEC 2015 -- Integrating LibreOffice with Gnome Documents
Improve user experience with CMIS
                                                Szymon Kłos (through GSoC)
 Gdrive, Alfresco, OneDrive, ...
 Was integrated in LibreOffice's own file picker
  Not available in gtk, gtk3, windows, OSX, ... file picker
  Bad user experience
 New menu entry: “Open Remote File...”




                                                                                      30
                             GUADEC 2015 -- Integrating LibreOffice with Gnome Documents
Automated error checking in Calc

 How to help user prevent
 spreadsheet errors?
   Spreadsheets are complex
   Finding errors is difficult
   Surveys shows every
   complex spreadsheet
   contains errors
 Show results in formula
 wizard
 Unit feature (started by
 Andrezj Hunt)
 Check for common errors

                                                                                     31
                            GUADEC 2015 -- Integrating LibreOffice with Gnome Documents
Other GSoC tasks

 Implement Apple Numbers filter (Anurag Kanugo)
 Haskell UNO Language Bindings (Jorge Mendes)
 Finish integration of Firebird backend (Popa Adrian Marius)
 Dynamic Text Chaining (Matteo Campanelli)
 Cleanup internal Calc drawing units (Krisztian Pinter)
 Review of the sidebar & its functionality (Rishabh Kumar)
 More and better Tests (Varun Dhall)




                                                                                    32
                           GUADEC 2015 -- Integrating LibreOffice with Gnome Documents
                                                         33
GUADEC 2015 -- Integrating LibreOffice with Gnome Documents
Contribute to LibreOffice

 https://wiki.documentfoundation.org/Development/Easy_Hack
 s
 Also tasks related to Gnome
   Improve Gtk backends
   Better system integration
   Libraries provided by LibreOffice to other projects
     DLP
     libcmis
     ...
 LibreOffice conference
   23rd to 25th September in Aarhus, Denmark


                                                                                   34
                          GUADEC 2015 -- Integrating LibreOffice with Gnome Documents
Thank you …
 … listening!




        All text and image content in this document is licensed under the Creative Commons Attribution-Share Alike 3.0 License
        (unless otherwise specified). "LibreOffice" and "The Document Foundation" are registered trademarks. Their respective logos
        and icons are subject to international copyright laws. The use of these therefore is subject to the trademark policy.




                                                                                                       35
                                              GUADEC 2015 -- Integrating LibreOffice with Gnome Documents