Index ¦ Archives ¦ RSS

Page-content-bottom vertical relation in Writer

Estimated read time: 3 minutes

Writer now has support for anchoring shapes relative to the bottom of the page content frame.

First, thanks to our partner SUSE for working with Collabora to make this possible.

Motivation

Users sometimes want to specify the vertical position of their shapes in text documents in a way that is relative from the bottom of the page content area. Also, this improves consistency, specifying a position that is relative from the top of the page content area is already possible.

Alternatively, it is possible to have the same calculated position when positioning from the top of the page content area. The downside of this approach is that the position changes when the page height changes. So if the user intention is to position a shape 2 cm above the bottom of the page content area and the page height changes, the shape has to be manually re-positioned. This manual re-positioning is not needed with the new page-content-bottom vertical relation.

For example, if a shape has a height of 10 cm and a 2 cm spacing is wanted between the bottom of the shape and the bottom of the page content area, the position can be set to -12 cm, and then the 2 cm spacing will be maintained, even after the page height changes.

Results so far

Here is how this works in practice:

Figure 1. Demo of a stable vertical position (relative to the bottom of the page content frame), during a page height change

You can see how the distance of the shape from the bottom is 2 cm, even if the page height changes.

How is this implemented?

If you would like to know a bit more about how this works, continue reading… :-)

  • the UNO API now supports a new PAGE_PRINT_AREA_BOTTOM relative orientation

  • the have the expected layout, SwToContentAnchoredObjectPosition::CalcPosition() now considers this from-bottom anchoring when handling the vertical relative orientation

  • the DOCX format already had a markup for this:

<wp:positionV relativeFrom="bottomMargin">
  <wp:posOffset>...</wp:posOffset>
</wp:positionV>

now the import/export code maps this markup to the new feature.

  • The UI allows setting a new "Page text area bottom" frame position. It turns out that the UI is quite nice here, it tries to prevent you from setting positions which would be outside the limits of the current page. This logic in SwFEShell::CalcBoundRect() now handles the new relative orientation.

  • The ODF filter now has a markup to represent the new vertical relation:

<style:graphic-properties ... loext:vertical-rel="page-content-bottom" .../>

There is a proposal to promote this from our extension namespace to normal ODF (thanks to Regina for the help there!).

Want to start using this?

You can get a snapshot / demo of Collabora Office and try it out yourself right now: try unstable snapshot. Collabora is a major contributor to LibreOffice and all of this work will be available in TDF’s next release too (7.1).

© Miklos Vajna. Built using Pelican. Theme by Giulio Fidente on github.