Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Flat ODF as the Swiss Army Knife

Flat ODF as the Swiss Army Knife

Fridrich Strba

October 11, 2012
Tweet

More Decks by Fridrich Strba

Other Decks in Technology

Transcript

  1. Flat ODF
    as the Swiss Army Knife
    Fridrich Štrba
    Software Engineer
    SUSE/Attachmate

    View full-size slide

  2. What is Flat ODF

    View full-size slide

  3. 3
    “Normal” ODF File
    • Package OpenDocument File
    ‒ Chapter 3.1.3 of ODF 1.2 specifications
    ‒ Collection of xml files in a ZIP container




    ‒ Images and OLE objects sub-streams in the ZIP container
    ‒ Referenced by xlink:href attribute

    View full-size slide

  4. 4
    “Flat” ODF file
    • Single OpenDocument XML Files
    ‒ Chapter 3.1.2 of the ODF 1.2 specifications
    ‒ Contains the whole document
    ‒ root element
    ‒ office:mimetype and office:version attributes
    ‒ Images and OLE objects inlined
    ‒ [base64 data]

    View full-size slide

  5. 5
    ZIP Storage (1)
    • Main entry point is the Central Directory End
    located at the end of the ZIP file.
    ‒ Scanning for it towards the end of the file
    ‒ Whole file must be present
    • Pointing at the Central Directory containing entries
    ‒ For name access, iterate over them
    ‒ Need to seek back to read the entry
    • Which contains pointer to Local File Header
    ‒ Seek to local file-header offset
    ‒ Need to seek back again
    ‒ The content of the stream comes after the header

    View full-size slide

  6. 6
    ZIP Storage (2)
    FILE
    ENTRY 1

    FILE
    ENTRY 2

    FILE
    ENTRY 3

    FILE
    ENTRY 4

    Local header 1
    Local header 2
    Local header 3
    Local header n
    Relative offset 2
    Relative offset 1
    Relative offset 3
    Relative offset n
    File entry 1
    File entry 2
    File entry 3
    n
    CENTRAL
    DIRECTORY

    View full-size slide

  7. Advantages of Flat ODF

    View full-size slide

  8. 8
    No Need for Special tools
    • No need for compression and stream extraction
    tools
    ‒ ODF documents can be generated manually
    ‒ Developer modifying a document
    ‒ XSLT tools
    ‒ Programmatic generation of documents
    ‒ Further processing of documents
    ‒ Easier parsing of document and extraction of relevant information

    View full-size slide

  9. 9
    Sequential Access to File
    • Difference with ZIP file
    ‒ No need to know the end of the file to start to parse it
    • Exchange file-format par excellence
    ‒ Possibility to communicate document as SAX messages
    ‒ Communicate XML to an application sequentially
    ‒ Possibility to stream document over wire
    ‒ Collaboration protocol?
    ‒ Communication with CMS systems?

    View full-size slide

  10. 10
    Storing documents in SCM
    • Package ODF file
    ‒ Stored as binary file
    ‒ Impossibility to see reasonable diff to previous version
    • Simple XML ODF file
    ‒ A text file after all
    ‒ Difference are easily visible between revisions
    ‒ SCMs are designed to handle text files the best
    ‒ Example of LibreOffice templates
    ‒ Stored in git repository

    View full-size slide

  11. Examples of Flat ODF use

    View full-size slide

  12. 12
    LibreOffice UNO Filter API
    • XSLT based filters
    ‒ com.sun.star.comp.Writer.XMLOasisImporter
    ‒ pushes to LibreOffice flat ODT
    ‒ com.sun.star.comp.Calc.XMLOasisExporter
    ‒ receives from LibreOffice flat ODS
    • XML based filters
    ‒ com::sun::star::xml::sax::XDocumentHandler
    ‒ com.sun.star.document.ImportFilter pushes SAX messages to
    com::sun::star::xml::sax::XDocumentHandler
    ‒ com.sun.star.document.ExportFilter is itself a
    com::sun::star::xml::sax::XDocumentHandler and receives SAX
    messages from LibreOffice

    View full-size slide

  13. 13
    File importers
    • Writerperfect ODT generator
    ‒ Libwpd – WordPerfect documents
    ‒ Generates ODT with embedded WPG files as
    elements in flat ODG
    ‒ Libwps – Microsoft Works
    ‒ Generates ODT
    • Writerperfect ODG generator
    ‒ Libwpg – WordPerfect graphics
    ‒ Libvisio – Microsoft Visio diagrams
    ‒ Libcdr – CorelDraw drawings
    ‒ Libmspub – Microsoft Publisher publications
    ‒ Generate ODG documents

    View full-size slide

  14. Thank you.
    14
    Single XML OpenDocument
    representation is an important
    part of the ODF ecosystem

    View full-size slide

  15. Corporate Headquarters
    Maxfeldstrasse 5
    90409 Nuremberg
    Germany
    +49 911 740 53 0 (Worldwide)
    www.suse.com
    Join us on:
    www.opensuse.org
    15

    View full-size slide

  16. Unpublished Work of SUSE. All Rights Reserved.
    This work is an unpublished work and contains confidential, proprietary and trade secret information of SUSE.
    Access to this work is restricted to SUSE employees who have a need to know to perform tasks within the scope of
    their assignments. No part of this work may be practiced, performed, copied, distributed, revised, modified, translated,
    abridged, condensed, expanded, collected, or adapted without the prior written consent of SUSE.
    Any use or exploitation of this work without authorization could subject the perpetrator to criminal and civil liability.
    General Disclaimer
    This document is not to be construed as a promise by any participating company to develop, deliver, or market a
    product. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making
    purchasing decisions. SUSE makes no representations or warranties with respect to the contents of this document,
    and specifically disclaims any express or implied warranties of merchantability or fitness for any particular purpose. The
    development, release, and timing of features or functionality described for SUSE products remains at the sole
    discretion of SUSE. Further, SUSE reserves the right to revise this document and to make changes to its content, at
    any time, without obligation to notify any person or entity of such revisions or changes. All SUSE marks referenced in
    this presentation are trademarks or registered trademarks of Novell, Inc. in the United States and other countries. All
    third-party trademarks are the property of their respective owners.

    View full-size slide