Development of Basic Editing Capabilities for Libreoffice for Android – Milestone 1
Total Page:16
File Type:pdf, Size:1020Kb
Work Report: TDF0002 – Milestone 1 Development of Basic Editing Capabilities for LibreOffice for Android – Milestone 1 This project targets implementing basic editing in the LibreOffice for Android code. This first milestone demonstrates that the basic functionality required for the project is making good progress. Ta!le of ontents Development of Basic !diting "apabilities for LibreOffice for Android – $ilestone %...........................% Overvie& of the task...................................................................................................................................... ' '.%.1 (%).1.1* +ntegration of on,screen keyboard that is only visible in editing mode.......................' '.%.3 (%).1.3* Triggering updates of vie&s, /endering and invalidation of tiles..................................- '.%.2 (%).1.2* /outing Android events to LibreOffice app.......................................................................0 Keyboard events........................................................................................................................................ 0 Touch !vents.............................................................................................................................................. 0 "ursor overlay........................................................................................................................................... 2 '.%.4 (%).1.4* +nsertion and deletion of content........................................................................................2 '.%.5 (%).1.5* Threading................................................................................................................................ 3 +n progress features....................................................................................................................................... 4 '.1.6 (%).%.6* 6erformance considerations, 7upport for Open8L.....................................................4 '.1.7 (%).%.7* /endering of selections on overlays...............................................................................4 '.1.8 (%).%.8* /outing of application information from the program module9s core.....................: '.1.9 (%).%.9* Te;ts and lists. Tables for <riter and +mpress. Tables for "alc, 6ictures and shapes ..................................................................................................................................................................... : Development and Documentation.............................................................................................................: Project management................................................................................................................................... %) 8tkTiled=ie&er , a LibreOfficeKit test,bed..............................................................................................%) /isks > +ssues................................................................................................................................................. %% "ommunity engagement ? public promotion........................................................................................%% "onclusion..................................................................................................................................................... %% Appendi; A: "ommits /elated to Deliverables.......................................................................................%' Appendi; B: "ommits /elated to Android &ork.....................................................................................%3 8eneral Android bug,fi;ing..................................................................................................................%3 8eneral +nteroperability component inclusion..................................................................................%3 8tkTiled/enderer development test,bed...........................................................................................%4 [email protected] ☎ A00 %''- -5' :53 Work Report: TDF0002 – Milestone 1 #vervie& of t'e task This $ilestone &as to deliver five of the relevant '.% items from the contract # including relevant items from '.' and '.-. An analysis of five completed items. and status on all remaining items may be found belo&. Bnfortunately due to a cut?paste problem the final consolidated contract re,numbered the 7O< headings. Thus all headers marked %).%.; are referred to as '.%.; in the contract te;t. <e provide both numberings in the heading hoping to clarify things in this regard. The five items completed in their entirety for $ilestone % are@ '.%.% (%).%.%*. '.%.' (%).%.'*. '.%.- (%).%.-*. '.%.0 (%).%.0* and '.%.2 (%).%.2*. 2(1(1 )10(1(1) +ntegration of on,screen ke-!oard t'at is onl- visi!le in editing mode <e provided a &ay to trigger the visibility of the on-screen keyboard. y default. it is not visible. so the editor acts as a vie&er. Co&ever. as soon as the user taps inside a paragraph, the on-screen keyboard appears. <hen the “do&n” button belo& the on-screen keyboard is pressed, it gets hidden. <e added a LibreOffice1it callback mechanism to LibreOffice core. so that &hen in the future &e add support for e.g. selection of graphic objects &here sho&ing the on-screen keyboard does not make sense. &e can easily notify Android &hen to sho&?hide the on,screen keyboard automatically. Figure 1: Default, viewer mode: no on-screen keyboard. Figure 2: On-screen keyboard is shown after the user taps inside a paragra h. [email protected] ☎ A00 %''- -5' :53 Work Report: TDF0002 – Milestone 1 2(1(. )10(1(.) Triggering /pdates of vie&s, Rendering and invalidation of tiles "ommunication bet&een Android and LibreOffice is a t&o,&ay channel. To avoid implementing both at the same time. first &e &ent after the LibreOffice→ Android direction. This means that &hile the previous assumption &as that once a tile is rendered, it can be kept in a cache on the Android side forever # due to editing, &e need some &ay to invalidate a subset of that cache as part of the document is changed. The desktop rendering uses a mi; of direct painting and “invalidation. then repaint using a timerE. The e;pected approach &ould have been that &e al&ays just invalidate an area of the &indo& &hen &e &ant to repaint. and then the main loop &ould decide &hen to repaint. Bnfortunately at the moment our main loop has no priorities (this is being &orked on in the feature?priorities branch by $unich students*. so &hen &e need lo&,latency repaints on the desktop. &e must paint directly for no&. This is a problem for Android, &here &e &ant to subscribe to invalidations and repaint the Android vie& accordingly. <e solved this problem by making the applications a&are of being used in tiled editing mode. and if that's the case. then &e al&ays invalidate the to,be,repainted area. never paint directly. This required code changes in both <riter and EditEngine. The other problem is ho& to notify Android about &hat tiles to thro& a&ay. as LibreOffice doesn't kno& &hat tiles Android has. Android just asks for tiles. LibreOffice gives them a&ay. but their lifecycle is managed by Android. <e solved this by sending a rectangle of the invalidated area to Android (in document model coordinates*. and then Android evaluates &hat cached tiles intersect &ith the area. and discards those. Using this technique. &e e;tended the vcl::Window subclass of <riter. Impress. and "alc to emit such invalidation events to Android. Figure !: "linking te#t -- second paragraph is visible Figure $: "linking te#t -- second paragraph is hidden Gou can see this in action at http://youtu.be/EkGpCrGlhiY. [email protected] ☎ A00 %''- -5' :53 Work Report: TDF0002 – Milestone 1 2(1(2 )10(1(2) Routing Android events to "i!re#f$ce app 7ending events in the Android → LibreOffice direction is a bit more comple;. as LibreOffice is a desktop application. so &e had to find a &ay to map the events of the on,screen keyboard and the touchscreen to events e;pected by LibreOffice (keyboard, mouse*. and e;tend LibreOffice &hen such mapping &as not possible. There &ere - major sub-tasks here@ routing keyboard events. routing touch events and cursor overlay. 1e-!oard events oth Android and LibreOffice can handle real characters by their Unicode integer representation. Co&ever. for special keys. &e need to map bet&een them. as both Android and LibreOffice only provide constants for them. <e added mapping for the most frequent special keys like backspace and enter. The mapping is done on the Android side. the constants of LibreOffice are available to Android using the Hava BIO binding. Then the LibreOfficeKit implementation of the keypresses simply sends the event to the currently active frame # the benefit of this is that it &orks out of the bo; in all applications. To/ch Events <e map touch events to LibreOffice's ="L events. LibreOffice sees a long tap as a doubleclick and so on. <here that &as not possible. &e e;tended core to recogniJe the touch guestures. Kor e;ample the desktop application did not allo& adjusting the start of a selection # the ne& lok::Document::setTextSelection() A6+ allo&s to do that. The other problem is that Android sends the coordinates of the event in document model units (i.e. it's independent from the vie& state of the document*. but LibreOffice e;pects to get them in screen pi;els. $apping from document model coordinates to screen ones &ould not be clean, the pi;el position depends on the siJe of the menus. toolbars