Collapsed paragraphs in words are the empty paragraphs that are hidden in nested tables. Those paragraphs are shown only when the cursor is inside them. When importing a Word document, OpenOffice.org Writer currently does some magic to remove these empty paragraphs in order to have a similar render to the one in Word. The problem is that the magic is sometimes not powerful enough, e.g. in issue i#102630.

Here are some screenshots of OpenOffice.org with the patch showing what collapsed paragraphs are:

A collapsed paraph is hidden

A hidden collapsed paraph

A collapsed pararaph is shown

A shown collapsed pararaph

I was having a look at the latter issue and Florian told me of one of his unfinished patches about collapsed paragraphs: that was a good occasion to complete it. Florian's idea was to remove the magic on import and implement the collapsed paragraphs in Writer. In order to implement this, the patch is playing with the paragraph's frame height. The fixes I have made took me quite a long time, because the layout wasn't properly updated when showing the collapsed paragraph. Here is what was missing:

  • Actually removing the Word import magic
  • Fix the layout refreshing
  • Add a compatibility option to ODF
  • Change the IsCollapse() method to check if any drawing object is anchored on the collapsed paragraph.

Here are some screenshots of a document with an image anchored to a collapsed paragraph (which is no longer hidden in Word). This very same document was making OpenOffice.org crash during the import because the empty paragraph was removed as if it was a collapsed one.

In Word

In Word

In OpenOffice.org

In OpenOffice.org

As usual, the patch is updated in the go-oo git repo and attached to the upstream issue. Here are the links again: