Bug 157049 - Draw: macro: Export filter sets bad coordinates in exported SVG
Summary: Draw: macro: Export filter sets bad coordinates in exported SVG
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
7.3.2.2 release
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisected, bisected, filter:svg, regression
Depends on:
Blocks: SVG-Save
  Show dependency treegraph
 
Reported: 2023-09-01 10:47 UTC by Kamil Landa
Modified: 2023-09-08 09:27 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
ODT, example of shifted SVG, and printscreen for bug (36.98 KB, application/x-zip-compressed)
2023-09-01 10:47 UTC, Kamil Landa
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kamil Landa 2023-09-01 10:47:35 UTC
Created attachment 189302 [details]
ODT, example of shifted SVG, and printscreen for bug

1) open source.odg 
2) set args(0).Value="..." in macro to your url for exported SVG 
3) run macro 
4) open exported SVG in Draw -> and object will be shifted a little bit beyond page (as in printscreen.png) 


Sub export2SVG
	dim oDoc as object, oFilter as object,oSel as object
	oDoc=ThisComponent
	createUnoService("com.sun.star.frame.DispatchHelper").executeDispatch(oDoc.CurrentController.Frame , ".uno:SelectAll", "", 0, array()) 'select curve
	oSel=oDoc.CurrentController.Selection
	dim args(1) as new com.sun.star.beans.PropertyValue
		args(0).Name="URL"
		args(0).Value="file:///d:/bug.svg"
		args(1).Name="MediaType"
		args(1).Value="image/svg+xml"
	oFilter=CreateUnoService("com.sun.star.drawing.GraphicExportFilter")
	with oFilter
		.setSourceDocument(oSel) 'only Selection
		.filter(args())
	end with
End Sub


Version: 7.6.1.1 (X86_64) / LibreOffice Community
Build ID: c7cda394c5de06de37d8109c310df89a4d4c3a98
CPU threads: 8; OS: Windows 10.0 Build 17763; UI render: Skia/Raster; VCL: win
Locale: cs-CZ (cs_CZ); UI: cs-CZ
Calc: CL threaded
Comment 1 Stéphane Guillou (stragu) 2023-09-08 09:26:35 UTC
Reproduced the path shift towards left and top, relative to the viewbox, in recent master build:

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: beaea2e992912b4747d790070b26371f557b1f57
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

No repro in 7.2.7.2, repro in 7.3.7.2.

Running the macro gives the shift, whereas using the GUI and exporting a selection as SVG does not.

Bibisected with linux-64-7.3 repo to first bad commit 3f3bb1e4bd161910745836a2d3153aae54f65089 which points to core commit:

commit a9f6d98859321e1b9029acc0c6e9347f4c1cf3b7
author	Armin Le Grand (Allotropia) Mon Jan 31 19:44:19 2022 +0100
committer	Xisco Fauli Fri Feb 11 20:36:00 2022 +0100
tdf#126319 Corrected bitmap creation from metafile
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129235

With the sample file, I used a command of the type:

instdir/program/soffice --invisible --headless /home/stragu/Downloads/bad-export-svg/source.odg macro://./Standard.Module1.export2SVG

A diff between the before and after outputs shows only the d attribute of the path element has changed.

Armin, can you please have a look?
Xisco, copying you in because of your interest in SVG.