Bug 147776

Summary: Add option to export slides from Impress as SVG without JavaScript
Product: LibreOffice Reporter: skierpage <info>
Component: ImpressAssignee: Not Assigned <libreoffice-bugs>
Status: NEW ---    
Severity: enhancement CC: aron.budea, heiko.tietze, ilmari.lauhakangas
Priority: medium Keywords: needsDevAdvice
Version: 7.3.1.3 release   
Hardware: All   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=117708
https://bugs.documentfoundation.org/show_bug.cgi?id=105641
Whiteboard:
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 111450    
Attachments: simple slide whose "TEXT ON MASTER SLIDE" doesn't appear in Inkscape when exported as SVG
simple slide exported as SVG whose "TEXT ON MASTER SLIDE" doesn't appear in Inkscape and doesn't work without JavaScript

Description skierpage 2022-03-05 03:35:03 UTC
Description:
If you export a slide from Impress as SVG, it won't display properly in other programs unless they execute JavaScript in the SVG. a) You may not see any text from the slide, and b) You will not see any text and background from its Master Slide. a) is because the slide contents are set visibility="hidden"; b)is because the elements from the Master Slide are nested in a <def>. The exported SVG depends on JavaScript to adjust these XML blocks to make content visible, but for a single slide with no animation this is unexpected and unnecessary complication.

Steps to Reproduce:
1. Create a new presentation in LibreOffice (Impress). I chose the Vivid template.
2. Switch to View > Master Slide and add some text. (I did Insert > Text Box, drag out a text box on the master slide, enter "TEXT ON MASTER SLIDE", then select it and make it bold and red.)
3. Go to the first slide, it should be using this master, and enter some text on it.
4. File > Export, export as SVG.
5. View the SVG in a browser like Firefox or Konqueror.
6. Open the SVG in Inkscape
7. Import the SVG into LibreOffice Draw

Actual Results:
You see the background and the text from the master slide when you view the SVG in Firefox and Konqueror (unless you disable JavaScript, in which case you see nothing). But in Inkscape and LibreOffice Draw, the background and text from the master slide isn't visible.

Expected Results:
The SVG should Just Work. There's no animation, there is only a single slide, so there's no reason to require JavaScript. The behavior is counterintuitive. All the visual elements you see in Impress are in the SVG, they're just hidden and nested.


Reproducible: Always


User Profile Reset: No



Additional Info:
You can edit the SVG's XML to make it work everywhere, as discussed in bug 105588#c12. To make the SVG from the STR to display correctly everywhere I had to:
* To show the slide's content with JavaScript disabled, change the <g class="SlideGroup"> object's <g visibility="hidden"> to <g visibility="visible">
* To show the Master Slide's content everywhere, find the top-level <defs> tag that encloses its content (probably the <defs> tag that contains <g ... class="Master_Slide">) and remove or comment out the opening and closing <defs> - </defs> tags.
* I think at this point the <script> tag is no longer needed and you can delete it.
Comment 1 skierpage 2022-03-20 01:33:02 UTC
Created attachment 178977 [details]
simple slide whose "TEXT ON MASTER SLIDE" doesn't appear in Inkscape when exported as SVG
Comment 2 skierpage 2022-03-20 01:55:16 UTC
Created attachment 178979 [details]
simple slide exported as SVG whose "TEXT ON MASTER SLIDE" doesn't appear in Inkscape and doesn't work without JavaScript

This simple slide exported from Libre Office Impress has 450 kB of JavaScript in it, and won't render properly unless the SVG viewer runs the script.
Comment 3 skierpage 2022-03-20 02:00:45 UTC
A slide exported from Impress as SVG also won't preview in the KDE Dolphin file manager, and the cairosvg converter converts it to a blank PNG, and you can't upload it to Wikipedia; all because it contains 450 kB of JavaScript.
Comment 4 Buovjaga 2023-01-02 11:12:46 UTC
If this is implemented as optional, it seems the export dialog envisioned in bug 117708 would be a good way to present all the options.
Comment 5 Heiko Tietze 2023-01-04 10:47:01 UTC
(In reply to skierpage from comment #0)
> The SVG should Just Work. There's no animation, there is only a single
> slide, so there's no reason to require JavaScript. The behavior is
> counterintuitive. All the visual elements you see in Impress are in the SVG,
> they're just hidden and nested.

My first thought was to make it optional, which seems to be a fact according comment 4. But actually I don't see such an option in ooO.Common.Filter.Graphic.Export.SVG. 

=> needsDevAdvice

See also the potential duplicate bug 105641 "export of single objects should produce SVG without javascript" with a preliminary patch.