Issue 121128

Summary: "Save Graphics..." exports SVG as hex-encoded PNG image
Product: Writer Reporter: Ariel Constenla-Haile <arielch>
Component: codeAssignee: Armin Le Grand <Armin.Le.Grand>
Status: CLOSED FIXED QA Contact:
Severity: Normal    
Priority: P3 CC: Armin.Le.Grand, binbjguo
Version: 3.4.1   
Target Milestone: 4.0.0   
Hardware: All   
OS: All   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---
Description Flags
Writer document with an SVG graphic embedded
Original SVG image, embedded in Writer
Exported SVG graphic none

Description Ariel Constenla-Haile 2012-09-27 15:12:46 UTC
Created attachment 79660 [details]
Writer document with an SVG graphic embedded

* Insert an SVG image in Writer
* Select the graphic
* Right click to open the context menu
* Select the context menu item “Save Graphics...”
* On the Save dialog, select the “SVG – Scalable Vector Graphics” filter, enter a file name, and save the graphic
* Open the exported SVG graphic with a text editor: you'll see that the image was exported as an embedded, base 64 encoded, PNG image inside the SVG file <image xlink:href="data:image/png;base64,[IMAGE DATA]"/>

Exporting using AOO API works ok
Comment 1 Ariel Constenla-Haile 2012-09-27 15:13:35 UTC
Created attachment 79661 [details]
Original SVG image, embedded in Writer
Comment 2 Ariel Constenla-Haile 2012-09-27 15:14:38 UTC
Created attachment 79662 [details]
Exported SVG graphic

The original SVG image is exported as an hex-encoded PNG image embedded in the SVG file
Comment 3 Armin Le Grand 2012-09-27 15:37:57 UTC
ALG: Indeed, the image gets converted to bitmap content and then exported as SVG cotaining a big base64-encoded bitmap. Taking a look...
Comment 4 Armin Le Grand 2012-09-27 15:40:23 UTC
ALG: Same mechanism works in draw/impress. No context menu to export inserted graphic in SC.
Comment 5 Ariel Constenla-Haile 2012-09-27 15:46:13 UTC

some code I've found:

- void SwGrfShell::Execute(SfxRequest &rReq) in
main/sw/source/ui/shells/grfsh.cxx calls ExportGraphic( *pGraphic, sGrfNm );

- ExportGraphic in main/sw/source/ui/docvw/romenu.cxx call XOutBitmap::WriteGraphic

- XOutBitmap::WriteGraphic in main/svx/source/xoutdev/_xoutbmp.cxx 
does it handle SVG source graphics?
Comment 6 Armin Le Grand 2012-09-27 15:56:24 UTC
ALG: Thanks Ariel, I'm on it. I already got SwGrfShell::Execute and I'm compiling SW with debug (let's see if I will be able to link it , though :-)).
Other fingings show that SW does it it's own way, a way where saving is not yet implemented to take shortcuts if possible (if target format is original format...).
Comment 7 Armin Le Grand 2012-09-27 16:32:40 UTC
ALG: Added missing original data export for SVG in XOutBitmap::WriteGraphic, committed as revision 1391088.
Comment 8 binguo 2012-11-14 09:02:37 UTC
Verified on Aoo_Trunk_20121109.1800 rev 1407366
Comment 9 binguo 2012-11-14 09:02:56 UTC
close it.