What is Miklos hacking

– Editing ReqIF-XHTML fragments in LibreOffice Writer (original) (raw)

https://farm2.staticflickr.com/1752/28703474708_bde744fb13_o.png

I worked on a small feature to use Writer as an editor for the XHTML fragments insideRequirements Interchange Format (ReqIF) files. First, thanks toVector for fundingCollabora to make this possible.

Writer already supported XHTML import and export before (see myprevious post) as a special mode of the HTML filter, this work builds on top of that. The main speciality around XHTML as used for fragments inside a ReqIF file is embedded objects.

The special mode to opt-in for ReqIF-XHTML behavior can actived like this:

Three different cases are handled:

  1. Image with native data we don’t understand and just preserve.
  2. Image with OLE2 data, which we hand out to external applications (at least on Windows). On the above video this is an embedded PPSX file, handled by PowerPoint.
  3. Image with ODF data, which we handle internally. This is a Draw document on the above video.

Regarding how it works, the import is a series of unwrapping containers till you get to the real data and the export is the opposite of this. Here are the layers:

On export we do the opposite: save the file, put it into OLE2, then into OLE1, then into RTF, finally into XHTML.

There is no specification on how to put ODF files into OLE2, so I extracted the relevant code from LibreOffice’s binary MSO filters and now the Writer HTML filter uses that as well. This avoids code duplication and also could avoid inventing some new markup this way.

All this is available in master (towards LibreOffice 6.2), or you can grab adaily build and try it out right now. :-)