12 April 2014: The OpenOffice Wiki is not, and never was, affected by the heartbleed bug. Users' passwords are safe and wiki users do not need take any actions.

SVG Import Filter (internal)

From Apache OpenOffice Wiki
Jump to: navigation, search

Implementation of internal SVG import filter is a Google Summer of Code project. You might be also interested in the general SVG Import Filter page.

The Plan

To get a nice import filter with reasonable progress, the progress should be like the following:

  • filter recognized by OOo, detection of SVG (proof-of-concept)
  • basic shapes [rectangle, ellipse] (proof-of-concept)
  • basic attributes [color, line thickness, fill color] (proof-of-concept)
  • transformations (proof-of-concept)
  • paths
  • text
  • advanced attributes [gradients, patterns]
  • clipping, masking
  • [and more, if time permits ;-)]

The original plan was to use FastParser, and throw away the current proof of concept implementation (that uses libsvg). Now it seems better to stick to libsvg for now, and throw away the dependency later. The work that was done before the GSoC is marked as (proof-of-concept) - but it needs fixes to get stable (mainly the transformations).

SVG specification (1.1) is the answer for any questions about SVG :-)

Building OOo

  • Getting It - ooo-build is the preferred way ;-)
  • apply svg-import.diff - in ooo-build by editing patches/src680/apply so that it gets applied
  • Building
  • Installing - with ooo-build, the -l option given to ooinstall is important to be able to hack easily
  • save the 'filter' submodule (in ooo-build it's in build/*680-m*/filter) so that you can do diffs later (see linkoo below)
  • Running
  • Hacking - let the fun begin ;-)
    • linkoo - links the build tree into the installed tree so that you don't have to create an install set after each change
    • build - if you have sourced the environment, builds the module (typically for SVG import filter you have to do that in 'filter'; use build debug=true - to have the debug symbols (for debugging)

Hacking the SVG Import Filter

  • Detection
    • general description
    • XML-based file formats one can use com.sun.star.comp.filters.XMLFilterDetect as the service (it is done so in svg-import.diff)
  • Making the filter visible in OOo: export filter, but very similar for import one as well; and this is done in svg-import.diff already anyway
  • IDL's with declaration of all the UNO Drawing services, etc. are in offapi/com/sun/star/drawing online here
  • Coding guidelines:
    • older document - but well readable
    • Cpp Coding Standards Wiki page
    • tab character should be set to 4 spaces (otherwise is the code unsteadable), spaces (no tab character) are preferred
    • mimic from the code around - some modules use m_xName for attributes, some mxName (where x is 'p' for pointers, 'n' for integer types, 'a' for OUStrings etc., 'e' for enums, ...] with the help of the above documents
    • methods usually use CapitalFirstLetters(), private methods are usually impl_TheMethod().
  • Files in filter/source/svg/ (that are touched by svg-import.diff):
    • SOTranscoder.java: remove ;-) It is some external Java stuff to render SVG to a bitmap, and import just the bitmap
    • svgexport.cxx, svgfontexport.[ch]xx, svgscript.hxx, svgwriter.[ch]xx: exporter, nothing for us
    • svgfilter.[ch]xx: small changes needed to announce that we support import (see the patch)
    • svgimport.cxx: most your work will probably go here :-) I've also introduced svgreader.[ch]xx for the core functionality - similarly to svgwriter.[ch]xx so that svgimport.cxx is not too big
    • svguno.cxx: registration stuff, you probably don't have to touch this
  • Debugging (on Linux): gdb comes with gdbtui - simple but nice text user interface to gdb that is fast and more or less reliable (whith programs like ddd I used to have performance problems when they were started on OOo)
  • A simple test .svg that is known to be parsed OK by libsvg: snehulak.svg

Deadlines

  • May 28: Hacking starts
  • July 9: Students upload the code to Google (mid-term evaluation)
  • August 20: Students upload the code to Google (final evaluation)
Personal tools