The talk aims at presenting the recent graphic import filters additions to LibreOffice. It will show the feature coverage and the way we developed them. The method allowed us to do quite substantial progress in short time. The APIs used will be also presented briefly.
Abortion Pills in Oman (+918133066128) Cytotec clinic buy Oman Muscat
Import filters for vector graphic formats in LibreOffice: the reverse- and straight engineering fun
1. LibreOffice import filters for vector graphic formats
The fun of reverse- and straight engineering
Fridrich Štrba – fridrich.strba@suse.com
The Document Foundation
Software Engineer, SUSE
LGM 2012 - LibreOffice Graphic Import filters
2. Who Am I?
Software Engineer in
SUSE LibreOffice Team
Diverse background
FLOSS enthusiast
Working in free time on
various projects
2
LGM 2012 - LibreOffice Graphic Import filters
3. Agenda
Vector graphic import filters resulting from the work of
LibreOffice community
How we did it
Framework used
Missing file-format documentation
Collaboration patterns
Incremental reverse-engineering
3
LGM 2012 - LibreOffice Graphic Import filters
4. Why do we handle legacy file-formats?
4
LGM 2012 - LibreOffice Graphic Import filters
5. Legacy formats out there
ODF is the future of the humanity
Nevertheless, humanity does not know about it as of now
Other de facto standards
Some people use other Office Suites and graphic
applications :(
Hard-disks full of bad teenage poetry and indecent drawings
in funny formats
LibreOffice offers the freedom to read that pile of …
5
LGM 2012 - LibreOffice Graphic Import filters
6. Pure intellectual exercise
Allows to program for LibreOffice without having to
understand its internals
Pretty stand-alone functionality communicating with
LibreOffice over well defined interfaces …
… almost
Happy users will reward you
You will be the hero of the people who can now read their
documents...
… and they will get on your nerves listing features that are
not converted.
6
LGM 2012 - LibreOffice Graphic Import filters
7. Import filters available to all resulting from
the work of LibreOffice community
7
LGM 2012 - LibreOffice Graphic Import filters
8. Vector graphics import filters based on libwpg
WordPerfect Graphics import filter and libwpg
Started by Marc Oude-Kotte and yours faithful
Google Summer of Code by Ariya Hidayat in 2006
MS Visio import filter and libvisio
Google Summer of Code by Eilidh McAdam in 2011
Guest appearance of re-lab's Valek Filippov
Corel Draw import filter and libcdr
Work in progress (kind of) started basically at the end of 2011
Will be in LibreOffice 3.6
Check http://dev-builds.libreoffice.org for preview fun
8
LGM 2012 - LibreOffice Graphic Import filters
9. Future directions
I prefer to speak about future when it becomes a feature
Too many projects with declarations of intentions and
nothing at the arrival
Code speaks louder then press releases
Google Summer of Code 2012
An attempt at MS Publisher file-format
Valek's personal pet file-format
Macromedia Freehand
Trying to crowd-source the development
9
LGM 2012 - LibreOffice Graphic Import filters
10. How we did it?
10
LGM 2012 - LibreOffice Graphic Import filters
11. Minimize the count of reinvented wheels
Reuse, embrace and extend
ODF as interchange format
Way import filters communicate with LibreOffice
libwpg's application programming interface
Reusing OdgGenerator class implementing this interface
Speedy development
No need to write any boilerplate code
LibreOffice import filter itself about 100 LOC
The core written as a standalone library
Faster testing
11
LGM 2012 - LibreOffice Graphic Import filters
13. Key Classes
OdgGenerator.?xx
Implementation of libwpg::WPGPaintInterface
OdfDocumentHandler.hxx
Abstract SAX interface to receive ODF document
Code that serializes the SAX calls into file (flat ODF and zip-
based ODF)
*SVGGenerator.?xx
Each library has an internal SVG Generator (suboptimal)
New libwpg will make the SVG Generator part of the public
API
13
LGM 2012 - LibreOffice Graphic Import filters
14. Advantages
Generating ODF is not trivial
Settings
Styles
Automatic styles
Content
Provide a linear interface
Reuse instead of copying the existing ODF generators
Developer does not waste time designing interface
Speeds up development by focusing on the essentials
14
LGM 2012 - LibreOffice Graphic Import filters
15. File-format documentation
Almost none
For libvisio
Marginally useful user and developer documentation of MSDN
Possibility to save using the VDX (xml) file-format
Basically XML dump of the binary (the same concepts)
For libcdr
Document explaining a bit the CMX exchange format (similar
concepts)
Reverse engineering
Based on re-lab's work
oletoy
15
LGM 2012 - LibreOffice Graphic Import filters
16. Development method
Focus on getting “some” result early
First embedded raster images
Libreoffice is able to render them without further processing
Next graphic primitives
“Everything is just a path”
Develop tools along the implementation
Introspection tool improved constantly
Driven by the need of the implementation
Reflecting growing understanding of file-format
Don't solve problems that don't exist
16
LGM 2012 - LibreOffice Graphic Import filters
17. The team
Valentin Filippov Fridrich Štrba Eilidh McAdam
17
LGM 2012 - LibreOffice Graphic Import filters
18. Development method II
Design the software as you go
Some code is better then an abstract design
Possibility to find and fix real bugs
Little communication overhead
Communication by code in git
Learning by doing mistakes and fixing
Release soon, release often
A release every 2-3 weeks
Good to have intermediary targets
18
LGM 2012 - LibreOffice Graphic Import filters
19. Extending the file-format coverage
Incremental reverse-engineering
Nobody reinvents a wheel completely
Two subsequent versions of the same file-format will have
some common DNA
Try to parse lower or higher version using the existing parser
Fix issues as they appear
Importance of a small number of reference documents
covering many features
Importance of having a working parser for other versions
Experience makes difference
Different ways of encoding the same information
Different ways of structuring
19
LGM 2012 - LibreOffice Graphic Import filters
20. Q&A and Stoning session
All text and image content in this document is licensed under the Creative Commons Attribution-Share Alike 3.0 License
(unless otherwise specified). "LibreOffice" and "The Document Foundation" are registered trademarks. Their respective logos
and icons are subject to international copyright laws. The use of these therefore is subject to the trademark policy.
20
LGM 2012 - LibreOffice Graphic Import filters