Friday, January 17, 2014

AbiWord import filter in LibreOffice: another tool for the swiss army knife

It all started by an innocent (?) question on 28th of November 2013. The inimitable Caolán asked whether anybody considered writing an import filter for AbiWord document format. And the distinguished readership of this blog knows well what makes your servant tick. So, the very evening, a skeleton was written and libabw, a library to read AbiWord file-format, started. It was pretty exciting to write -- after a host of libraries for file-formats that are not documented anywhere -- a filter for a file-format of our cousin. There was a hope that existence of a reference implementation whose source code is widely accessible would make the endavour easy. It is undeniable that grepping for values of different enums made the work a bit easier. Nonetheless, a huge part of the work was still figuring out what is permitted in AbiWord and how a change of one parameter affects the rendering of a document. Other thing to find out was how to map the concepts in the ABW files into the libwpd API that is heavily influenced by ODF concepts.

But the date of the start meant that soon came the Christmas and with it a possibility to spend some free time on the library. Eventually it became very usable and the import filter made it -- as a late feature -- into the LibreOffice 4.2 line and users of the upcoming LibreOffice 4.2.0 release.

The library currently supports both the plain xml ABW files as well as the gzipped ZABW files. The converted features include:

  • Tables, including nested tables
  • Headers and footers, including different left, right and first page headers/footers
  • Footnotes and endnotes
  • Multi-column sections
  • Embedded images

And since a picture speaks louder then hundred words, here are some screenshots:

 
A sample ABW file opened
in AbiWord
 The same ABW file opened
in the upcoming LibreOffice 4.2.0
 
A sample (zlib compressed) ZABW
file opened in AbiWord
 The same ZABW file opened
in the upcoming LibreOffice 4.2.0

As you can see from the screenshots, the world domination that we are actively seeking is having several contenders. But if you believe that we are the closest to its realization, please join the filter-writing fun! Show up on #libreoffice-dev channel at irc.freenode.net. You are also encouraged to follow my twitter and Google+ accounts. And stay tuned for more exciting news in the near future. We can promise you that you will have a lot of fun in the growing community of LibreOffice filter writers.