Attracted by virtual constructs

June 5, 2014

Calligra-powered Okular plugin for ODT, DOC & DOCX

Filed under: Calligra,KDE — by frinring @ 9:49 pm

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!

About these ads

6 Comments »

  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.

    Comment by STiAT — June 5, 2014 @ 11:44 pm |Reply

  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?

    Comment by Michael — June 6, 2014 @ 5:22 am |Reply

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

      Comment by redsteakraw — June 6, 2014 @ 10:01 pm |Reply

      • 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).

        Comment by frinring — June 6, 2014 @ 10:09 pm

  3. […] Calligra-powered Okular plugin for ODT, DOC & DOCX […]

    Pingback by Links 7/6/2014: ‘Linux is Everywhere’, Valve Games Milestone (500) | Techrights — June 7, 2014 @ 8:15 am |Reply

  4. Brilliant!
    Just added proposals for .kexi, .odb and some notes for .mdb: https://wiki.documentfoundation.org/DLP/Libraries

    I also suppose it would be possible to add useful KPart for previewing .kexi databases.

    Comment by jstaniek — June 7, 2014 @ 11:38 pm |Reply


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

The Toni Theme. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: