Bug 121890 - enhanced path formula values "left" and "top" are wrongly calculated for general custom shapes
Summary: enhanced path formula values "left" and "top" are wrongly calculated for gene...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:6.3.0
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-03 22:08 UTC by Regina Henschel
Modified: 2018-12-25 11:51 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Document showing the wrong positions (11.10 KB, application/vnd.oasis.opendocument.presentation)
2018-12-03 22:08 UTC, Regina Henschel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Regina Henschel 2018-12-03 22:08:25 UTC
Created attachment 147255 [details]
Document showing the wrong positions

The attached file has three custom shapes in red and for each a blue rectangle indicating size and position as given by the svg:x, svg:y, svg:width and svg:height attributes.

The top-left custom shape has a viewBox of svg:viewBox="0 0 21600 21600" and a constant path draw:enhanced-path="M 5400 0 L 5400 21600 M 0 5400 L 21600 5400 F N". It is rendered correctly.

The bottom-left custom shape has the values shifted be -5400. So it is svg:viewBox="-5400 -5400 21600 21600" and draw:enhanced-path="M 0 -5400 L 0 16200 M -5400 0 L 16200 0 F N". It is rendered correctly too. LibreOffice is able to use a svg:viewBox, where the top/left coordinates are not zero.

The top-right custom shape has the values for the path not given directly but using formulas with left, right, top and bottom.
draw:enhanced-path="M 0 ?f1 L 0 ?f3 M ?f0 0 L ?f2 0 F N">
     <draw:equation draw:name="f0" draw:formula="left" />
     <draw:equation draw:name="f1" draw:formula="top" />
     <draw:equation draw:name="f2" draw:formula="right" />
     <draw:equation draw:name="f3" draw:formula="bottom" />
Now the lines start in 0|0 instead of -5400|0 and 0|-5400. The values for left and top are apparently set to 0. Such is the default value for MS custom shapes, but not for the general case of ODF "non-primitive" type custom shapes. In ODF left and top are specified in table 11:
left| The left position of the svg:viewBox attribute is used.
top | The top position of the svg:viewBox attribute is used.
http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#attribute-draw_formula
Comment 1 Xisco Faulí 2018-12-06 14:35:22 UTC
Patch in gerrit: https://gerrit.libreoffice.org/#/c/64704/
Moving to NEW
Comment 2 Commit Notification 2018-12-13 11:36:52 UTC
Regina Henschel committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/25f059a423d42b546e319d0860df0de9c1580101%5E%21

tdf#121890 ODF custom shapes use left and top from viewBox

It will be available in 6.3.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 3 Regina Henschel 2018-12-25 11:51:13 UTC
Fixed in Version: 6.3.0.0.alpha0+ (x64)
Build ID: 49fcd3bbb30f93763fc5cb80fa6ac5cec5d00834
CPU threads: 8; OS: Windows 10.0; UI render: GL; VCL: win; 
TinderBox: Win-x86_64@42, Branch:master, Time: 2018-12-24_22:40:25
Locale: de-DE (en_US); UI-Language: en-US
Calc: threaded