Apache OpenOffice (AOO) Bugzilla – Full Text Issue Listing
|Summary:||svg export produces invalid file|
|Product:||Draw||Reporter:||Regina Henschel <rb.henschel>|
|Component:||save-export||Assignee:||Armin Le Grand <Armin.Le.Grand>|
|Status:||CLOSED FIXED||QA Contact:|
|Priority:||P5 (lowest)||CC:||Armin.Le.Grand, issues|
|Issue Type:||DEFECT||Latest Confirmation in:||---|
Description Regina Henschel 2012-01-14 16:15:16 UTC
Created attachment 77131 [details] Source for the svg file. Open the attached document and export the combined rectangles to svg. I get the attached result. It is not valid, because (1) an id value must be unique, but is assigned twice. (2) an id value must not contain the characters ( or ) .
Comment 1 Regina Henschel 2012-01-14 16:16:17 UTC
Created attachment 77132 [details] result of export to svg
Comment 2 Armin Le Grand 2012-01-14 18:09:17 UTC
ALG: Taking alook...
Comment 3 Regina Henschel 2012-01-14 19:23:35 UTC
There is no need for the second path element for the inner stroke, because svg handles elements with more then one closed subpath as AOO handles polypolygons. So on export it is sufficient to export the polypolygon itself. And with the new svg import those paths are shown correct too. So I suggest to drop the additional path element as solution for problem (1).
Comment 4 Armin Le Grand 2012-01-16 10:45:44 UTC
ALG: Doing what is explained does not export the original Svg file, but uses the built-in existing Svg exporter, so the exported Svg will not be equal to the original one. To export the original one, use 'Save as Picture...' in the context menu of the graphic object. ALG: Looking at the existing Svg export...
Comment 5 Armin Le Grand 2012-01-16 12:07:38 UTC
ALG: (2) Seems to be correct, checked (http://www.w3.org/TR/2008/REC-xml-20081126/#NT-Name). I think about replacing '(' and ')' by just '_'. (1) Is more complicated: The 1st path is already the PolyPolygon suggested (see the 'Z' statements in svg:d or delete 2nd path in an editor). The question is more why the 2nd path is written at all, describing the inner polygon of a PolyPolygon. Investigating...
Comment 6 Armin Le Grand 2012-01-16 12:37:25 UTC
ALG: (1) is tricky; The current Svg exporter works using Metafiles, not primitives. In Metafiles the stroke actions (even the SvtGraphicStroke helper in the comment action) use no PolyPolygon, but single polygons. Thus, the resulting Metafile has thee basic polygon actions: - the filled PolyPolygon - the outer stroke polygon - the inner stroke polygon what is correct so far. The Svg exporter tries to combine the 1st SvtGraphicFill with the 2nd SvtGraphicStroke WITHOUT comparing the paths on equality, thus the 1st and 2nd action get combined to one path statement in the export. The 3rd starts a new path segment, this time only stroked. The error happens in the Svg exporter; it cannot combine PolyPolygon fill with Polygon stroke actions (also to mark: basing the Svg exporter to primitives would also solve this). Thus, in the case of stroked PolyPolygons it will either be possible to more intelligently combine those or not. Checking if this is possible; it's not planned to be done, this can be read from looking at the code...
Comment 7 Armin Le Grand 2012-01-16 14:24:28 UTC
ALG: Solved (1) by forcing write of fill data when stroke data is not equal, also need to add a 2nd number to the ID since ID is not only object number but multiple svg elements could be written per shape. Solved (2) by using '_' instead of '(' and ')'. Also made 'Z' svg:d creation dependent of closed state of the tool spolygon (1st and last point are equal), not only on fill and/or line. Also had to be very careful for polygon comarison; operator== does not do what YOu expect, there is a method IsEqual() instead. Argh! Old classes...
Comment 8 Armin Le Grand 2012-01-16 14:31:08 UTC
ALG: Comitted, done.