Implementing Canvas Slide in Impress
Overview #
With support for differently-sized slides now in place, the next step towards implementing Infinite Canvas in Collabora Online was to create the canvas slide itself. This new slide type allows slides to be arranged freely on an expansive canvas, as well as presenting the overall outline of the whole presentation in a visual way which users can intuitively grasp.
Thanks to nlnet Foundation for sponsoring this project!
How it works? #
An uno command .uno:InsertCanvasSlide was created [1], which when dispatched will insert canvas slide at the top. The canvas slide contains page previews of all the slides, which initially is arranged as a grid at the center of the canvas [2].
Since users are free to move the page previews, it helps to have some kind of a visual indicator for the page order. Hence, all the previews are connected by connectors ending with arrows for denoting the order [?].
It also allows changing the order of the slides based on the position of the previews. So by moving the previews, and then dispatching .uno:ReshufflePages will change the order of the slides in the presentation.
For allowing quick editing (instead of scrolling the slide sorter to find the correct page), double clicking on a preview will switch to that page [4].
Since the canvas page is a “special” slide, some work needed to be done in export and import logic. For exporting to .odp, a “HasCanvasPage” property was added to settings.xml (this way we don’t need to modify the ODF specs) [6].
The “HasCanvasPage” property will be processed while importing , such that it will validate the canvas slide, and repair it if necessary [5].
Importing page previews inside canvas pages also needed some special handling as while adding those shapes their corresponding pages does not exist (as canvas slide is the first slide) [8].
Also, to ensure that the canvas page remains at the top, special handling was required for it [10]
Now that all the functionalities are in place, next part is about ergonomics. Since canvas slide is unusually larger than other normal slides, it makes sense to have a different zoom for canvas slide than the rest of the slides [6]. And due to the same reason, its quite useful to remember the last visible part of the canvas page (otherwise users would need to scroll the large canvas page to reach the desired part) [7]
Also, after creating the canvas page, the view will be set to the center of the canvas slide (as initially all the previews are at the center) [9]
Github Issue and test document #
- Github Issue: https://github.com/CollaboraOnline/online/issues/13863
- Test Document: canvas_slide_demo.odp
Related patches #
Some core.git patches implementing new features: #
[1] sd: add uno command for inserting a canvas page
[2] sd: populate page previews grid in canvas page
[3] 192940: sd: add support for shuffling slides from canvas page
[4] sd: switch to corresponding page on double clicking page preview
[5] sd: store “HasCanvasPage” boolean in settings.xml
[6] sd: remember canvas page zoom
[7] sd: remember last client visible area of canvas page
[8] xmloff: sd: handle import of page shapes that are inside canvas page
[9] sd: lok: send CanvasPageCenter command to client on canvas page creation
[10] sd: make sure canvas page remains as the first page
All the core.git patches can be found here:
https://gerrit.libreoffice.org/q/topic:"infinite-canvas"