shameless self-promoting website
»Rejourn root
»LibreOffice Community Blogs
Posted Sunday, 03 May 2015 by Miklos
Tags: en libreoffice

TL;DR: Import of old-style (pre-2010 for RTF, pre-2007 for DOCX) math equations embedded into text documents should be now imported as editable embedded math objects.

Longer version: if you want to embed math equations into RTF or DOCX files, you have two choices. The older approach is to embed a MathType OLE object into the file, the newer one is a native OOXML markup, which has an RTF markup equivalent as well. Handling of the later has been implemented by Luboš Luňák for DOCX a long time ago, and I contributed the RTF equivalent almost 3 years ago.

What remains is the handling of the older version, the embedded OLE object. Previously only the replacement graphic was imported, so regardless of the Tools → Options → Load / Save → Microsoft Office → MathType to Math checkbox, the result was never editable.

Here is how it looks like now:


Given that the RTF and the DOCX importers share lots of code in the writerfilter/ module, I implemented the same for the DOCX import at the same time, too. The interesting challenge was that writerfilter wants an XFilter implementation for the embedded object if it is to be handled internally by LibreOffice, but the MathType filter (originally created to handle math objects inside binary DOC files) didn’t have one. Once I implemented such a filter wrapper, the rest wasn’t too hard.

Here are test documents if you want to try it yourself. You’ll need a 5.0 daily build for that, though. ;-)

If I’m at describing features new in LibreOffice Writer 5.0 file filters, here are a few more:

And a number of bugfixes for the RTF filter:

  • tdf#86182 better RTL paragraph handling

  • tdf#80708 related to the improved old-style Writer table export handling work

  • tdf#90421 hyperlink export tweak

Do these sound interesting? Look at what others did for LibreOffice 5.0 on the TDF wiki, even if it’s far from complete, as the 5.0 branch is not yet created. :-)