Writing Import Filters for LibreOffice Fridrich Štrba, David Tardon (virtually) LibreOffice Productivity Suite
LibreOffice Productivity Suite Agenda Introduction to import filters Use of XSLT filter Example: Integration of a librevenge-based filter Example: setting up a new librevenge-based filter library LibreOffice Productivity Suite
Introduction to import filters You may add additional text here ... LibreOffice Productivity Suite
Why to write import filters? In an ideal world, everyone would just use ODF. However, we are not living in an ideal world. Proprietary document formats Legacy document formats We want to be nice and play along, even if others do not.
What options for writing import filters are there? XSLT filters “full-blown” filters Use one of the existing frameworks Librevenge Orcus (liborcus) Produce ODF (or Flat ODF) as intermediate format Directly use UNO Use internal LibreOffice structures Deprecated XMerge framework (only java)
XSLT filters Easiest to integrate Only for pure XML formats XSLT is not a good choice for anyting complex Only XSLT 1.0 is supported out-of-the box
Use one of the existing frameworks Librevenge (Document Liberation Project) Supports text, presentations, vector graphics and spreadsheets Uses ODF as itermediate format (libodfgen) A dozen of existing import libraries, supporting many formats: WordPerfect, MS Publisher, Visio and Works, CorelDRAW, Adobe PageMaker etc. Orcus (Kohei et al.) Supports spreadsheets Internally supports ODF, OpenXML, Gnumeric, CSV
Use one of the existing frameworks Easier to use than UNO Potentially unsupported features In our opinion the best choice for less important formats
Produce ODF as an intermediate format Slower, but there is no need to know any framework (or UNO) Existing filters: Lotus Word Pro (lotuswordpro) Hangul Writer (hwpfilter) It is probably easier to use librevenge instead
Directly use UNO Existing filters: OpenXML RTF ... Filters can be extensions openoffice.org-diafilter (Caolán)
Use internal LibreOffice structures Fastest, but a high potential to break things :-) Legacy filters (ww1, ww8, etc.) Hopefully nobody is considering doing that for a new filter :-) 'Nuff said LibreOffice Productivity Suite
Deprecated Xmerge framework Java only We removed all existing filters in 4.0 External filters could still exist (no idea about that)
You may add additional text here ... Use of XSLT filter You may add additional text here ... LibreOffice Productivity Suite
Integration of a librevenge-based filter You may add additional text here ... LibreOffice Productivity Suite
Filter configuration This is generic—the same configuration is needed for all non- XSLT filters
Filter description <node oor:name="Publisher Document" oor:op="replace"> <prop oor:name="Flags"> <value>IMPORT ALIEN USESOPTIONS 3RDPARTYFILTER PREFERRED</value> </prop> <prop oor:name="FilterService"> <value>com.sun.star.comp.Draw.MSPUBImportFilter</value> <prop oor:name="UIName"> <value xml:lang="x-default">Microsoft Publisher 97-2010</value> <prop oor:name="FileFormatVersion"> <value>0</value> <prop oor:name="Type"> <value>draw_Publisher_Document</value> <prop oor:name="DocumentService"> <value>com.sun.star.drawing.DrawingDocument</value> </node>
Setting up a new librevenge-based filter library You may add additional text here ... LibreOffice Productivity Suite
LibreOffice Productivity Suite Sources http://fridrich.blogspot.cz/2013/08/extending-swiss-army-knife- overview.html http://davetardon.wordpress.com/2014/05/06/writing-import- libraries-with-librevenge-part-i-getting-started/ LibreOffice Productivity Suite
LibreOffice Productivity Suite Pre-defined Shapes Here are some pre-defined shapes for your convenience: copy the shapes, copy their formatting, or use the LibO styles. Green Dark Green Bright You may add your code examples, XML statements, or debug output here ;-) Blue Dark Blue Bright Orange Dark Orange Bright Purple Dark Purple Bright Yellow Dark Yellow Bright LibreOffice Productivity Suite
LibreOffice Productivity Suite Thank you … … for not falling asleep! … for supporting LibreOffice! LibreOffice Productivity Suite