Contextual spacing in DOCX tables in Collabora Online Writer

Motivation

A DOCX table can have a style that turns on contextual spacing. When every cell holds one paragraph and all those paragraphs use the same paragraph style, the spacing that style sets should not appear between the rows. Writer already handled this between two paragraphs in the same text flow, but not across a cell boundary. The paragraph that ends a cell always kept its space below, and the paragraph that starts a cell always kept its space above, because the cell holds no earlier paragraph to compare with. So these tables came out with much taller rows than intended.

The fix

Now both ends of a cell look at the neighboring paragraph in the document. If contextual spacing is on and that paragraph uses the same style, the spacing on that side is dropped. After the fix, each row is only as tall as its line of text. The space stays only where the table meets a paragraph of another style: below the last row of the upper table, and above the first row of the lower one, because a heading comes next to them. Paragraphs outside tables, for example at the top of a page or in a header, lay out as before.

The Patches

Did the work in two patches.

1. The first one makes Writer use the contextual spacing that a table style in a DOCX file turns on.

2. The second one lets that spacing reach across the boundary between two cells. Both are merged on main and backported to the co-26.04 branch.