Par Eric Bachard le samedi 3 décembre 2011, 09:30 - OpenOffice.org
English version :
Apache OpenOffice.org is gradually recovering from his transfer to the
Apache Foundation. Until the release of the first version, new features appear. Here's one:
the native support for graphics files of type .svg (for Scalable Vector Graphics)
The announcement, however, is passed virtually unnoticed when
Armin Le Grand (ex Oracle, one of the
Impress original authors) said he was working on the implementation of the import of SVG natively in
Apache OpenOffice.org.This feature was one of the most requested (see
Issue 2497), and Armin did it!
Wow :-)But what is he doing? Simply to use graphics files in svg format in Apache OpenOffice.org, without headhache to install a thing or something, . This feature was expected for years in OpenOffice.org (one wonders why this has never been done before?). So I proposed to Armin test its code, and help to the best of my ability.
After quickly compiled the sources, this is what happens:
Links files used for the screenshot:
Technically, this native implementation has eliminated several outbuildings, including libraries librsvg, libcroco, libgsf, gdk-pixbuf, glib, and pango gettext, causing a big simplification, if not the elimination of a large knot in the code .
As wrote Armin : "The new Svg implementation does no longer hide the Svg in an attached Metafile as binary in a new Metafile action, it is (as it should be in ODF) added as link and to the Pictures subdirectory (was it pictures ? Not sure currently). I have implemented a MultiImage support for Frames as allowed in the ODF spec which will not only work with Svg. The office now takes the Image with highest value to use further, e.g. preferring vector graphics over bitmap and bitmap with transparency over bitmap without and loseless compress over compress with loss, YOu get the idea. For Svg it saves a png as replacerplacement and the Svg which is used at reload. Older offices will use the Png, since those implementations only load one (and thus the first) image. "
On my side, I will (try to) fully analyze the code written, and I hope to better understand the impressive work has been done. Very briefly, the patch has requested changes in 19 modules, and called for the rewriting engine svg, including the parser, and the import (export does not seem to work properly). To this must be added the removal of support for the old record (mainly in vcl). There is a significant use of basegfx (already used in the new drawingLayer, also written by Armin).
Sources are available in the svgreplacement branch, and for now, the compilation can not be completed if one is not familiar with the code of OpenOffice. Org (see http://incubator.apache.org/openofficeorg/source . html). Problems, especially due to the cleaning of the code that is not compatible with the Apache license, however, should be resolved soon.
Possible improvements: Integrate OpenCLipart in Apache OpenOffice.org (and in OOo4Kids and
OOoLight of course).
Stay tuned;-)
Usefull links :
Version Française :
Apache OpenOffice.org se remet progressivement de son transfert à la
Fondation Apache. En attendant la sortie de la première version, de nouvelles fonctionnalités apparaissent. En voici une :
la prise en charge native des fichiers graphiques de type .svg
L'annonce est pourtant passée quasi inaperçue quand
Armin Le Grand (ex Oracle, auteur original d'Impress), à expliqué qu'il travaillait sur l'implémentation de l'import du SVG natif dans
Apache OpenOffice.org.
Cette fonctionnalité était une des plus demandées (voir
Issue 2497), et il l'a fait !!
Wow :-)
Mais de quoi s'agit-il en fait ?
Tout simplement, pouvoir utiliser, sans se prendre la tête à installer un truc ou un machin, des fichiers graphiques au
format svg dans Apache OpenOffice.org. Cette fonctionnalité était attendue depuis des années dans OpenOffice.org (on se demande pourquoi cela n'a jamais été fait avant ?).
J'ai donc proposé à Armin de tester son code, et de l'aider dans la mesure de mes possibilités.
Après avoir rapidement compilé les sources, voilà ce que cela donne :
Liens des fichiers utilisés pour la copie d'écran :
Techniquement, cette implémentation native a permis de supprimer plusieurs dépendances, dont les bibliothèques librsvg, libcroco, libgsf, gdk-pixbuf, glib, gettext et pango, entraînant une grosse simplification, pour ne pas dire la suppression d'un gros noeud dans le code.
Je vais (essayer d') analyser complètement le code écrit, et j'espère ainsi mieux comprendre le travail impressionnant qui a été réalisé.
Très succintement, le patch a demandé des modifications dans 19 modules, et a demandé la réécriture du moteur svg, comprenant le parseur, et l'import (l'export ne semble pas encore fonctionner correctement).
À celà, il faut ajouter la suppression de la prise en charge de l'ancien rendu (principalement dans vcl). On note une utilisation importante de basegfx (déjà utilisé dans le nouveau drawinglayer, lui aussi écrit par Armin).
Cette implémentation évite aussi de devoir inclure le fichier SVG dans un métafichier, en tant que binaire mais plutôt en tant qu'image, dans un sous répertoire, conformément à ce que demande l'ODF. Toujours en conformité avec ce que permet la spécification ODF, un support pour les Cadres MultiImage a été aussi implémenté.
À suivre: je suis en train de déchiffrer le code pour essayer de comprendre ce qui est affiché, mais il semble que le SVG soit interprété et transformé en .png.
Ce .png sera l'image réellement affichée. Ceci jusqu'à une éventuelle modification, ce qui créera alors un nouveau .png ..etc
Les sources sont disponibles dans la branche svgreplacement, et pour l'instant, la compilation ne peut pas se terminer si on ne connaît pas bien le code d'OpenOffice.org (voir http://incubator.apache.org/openofficeorg/source.html ). Les problèmes, surtout dûs au nettoyage du code qui n'est pas compatible avec la licence Apache, devraient toutefois être résolus prochainement.
Améliorations possibles: intégrer
OpenCLipart dans Apache OpenOffice.org (et dans
OOo4Kids et
OOoLight bien sûr !).
À suivre ;-)