Calligra-powered Okular plugin for ODT, DOC & DOCX

You might know that Okular has a plugin system, for adding support for more document formats. And you might know that Calligra since years also provides a plugin to Okular, which adds support to view slides from files in the OpenDocument Presentation (ODP) format. And not only for the ODP format: by simply using the Calligra import filters for PPT and PPTX you can also view the slides locked away in those formats.

The different apps of Calligra used to be built on the KParts system, so any files in formats supported by them would be also viewable in KPart-embedding programs like Konqueror or KDevelop. But due to the currently on-going creation of a new MVC-oriented foundation for the Calligra programs this has changed, the Calligra modules are no more KParts.

Now I happen to now and then read ODT files directly in KDevelop. And Okular has some native support for ODT. But it is not as powerful as what I am used to from Calligra, so I wanted that back. The best thing of course would be to write a Calligra-plugin directly for KDevelop (like done for the Okteta integration). But I wanted something quicker, and with less work. Writing KPart-wrappers around the Calligra modules would have been the next option. But then I remembered that Sven, who did the Calligra ODP generator plugin for Okular, had also once started an ODT generator, but left it in a branch. And Okular also has an UI optimized for document reading. So a commit cherry-pick and some bit-rot fixes later I had ODT files nicely displayed in KDevelop again, thanks to the chain Calligra Words engine -> Okular KPart -> KDevelop 🙂

See here Okular displaying the ODT 1.2 spec, of course in ODT format:
Calligra-based ODT generator for Okular

And like the ODP generator plugin adds support for PPT and PPTX by simply using the existing filters, the very same is possible with the ODT generator plugin and the import filters for documents locked away in DOC and DOCX formats. A link on a webpage to a file in DOCX format? Click it and view the file directly in the Okular KPart, powered by Calligra’s ODT generator plugin and DOCX import filter:
Calligra-based DOCX generator for Okular

Currently the generators are just simple rendering ones. Of course we want the generators to be proper extended ones, including TextPage support, so you get all the comfort as you have when reading PDF files in Okular. Come and join the coding fun: navigate your editor to the generators’ code in extras/ and your browser to the excellent Okular generator Howto.

You instead would like to extend the support to other formats that Calligra has import filters for (Stage, Words)? Then take a look at the commit which added support for DOC and DOCX: just adding desktop files, per format one for the Application, one for the KPart and one for the generator itself 🙂

Waiting for your review request on the Review board (group “calligra”)!

Your preferred format is not yet there? Consider adding it, e.g. by joining the Document Liberation Project and adding also a import filter to Calligra.

So look forward to Calligra 2.9 later this year, bringing a better ODT viewer and some for DOC & DOCX to an Okular near your fingertips 🙂 And perhaps more, at your will!

8 thoughts on “Calligra-powered Okular plugin for ODT, DOC & DOCX

  1. Great. Okular is one of the most handy tools in KDE, seeing it getting even more file format support is great. Though, I have no clue about file formats or formatting in general (but hey, I can read :D), but as a user using it a lot – great work. I really enjoy it. Thanks for all the effort put in Okular, it is for sure one of the “hidden gems”. Something which just works, and people don’t even realize it too much opening documents day by day with it.

  2. Awesome!! A bit of a mind-warp to understand, but can’t wait to try it out. I guess this also means that other programs will be able to display ODT in a viewer, like Ark?

    • I guess any app that uses the okular kpart would gain the ability to display any formats okular can open.

      • Yes, exactly.
        (And to make sure I just tested the mentioned example with Ark, and as expected the preview showed all pages of an ODT file and also of a DOCX file with the Okular KPart).

  3. […] Traveling 8+ hours on the train all the way through Germany to Geneva in Switzerland, where CERN is located (its area spreading across the border to France actually), the place of the WikiToLearn-Plasma-VDG-TechbaseOverhaul meeting, was also a good chance to first spend some time again on a sprint-unrelated, but still KDE-related item, which is adding support for text selection to the Calligra-powered Okular plugin. […]

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.