Bug 141880 - SHAPES: Negative top and bottom wrap margins are wrongly rendered
Summary: SHAPES: Negative top and bottom wrap margins are wrongly rendered
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisected, bisected
Depends on:
Blocks: Shapes
  Show dependency treegraph
 
Reported: 2021-04-24 18:15 UTC by Regina Henschel
Modified: 2023-08-01 10:27 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Document with negative wrap margin values (16.25 KB, application/vnd.oasis.opendocument.text)
2021-04-24 18:15 UTC, Regina Henschel
Details
Screenshot compare Writer with TextMaker (115.61 KB, image/png)
2021-05-10 12:31 UTC, Regina Henschel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Regina Henschel 2021-04-24 18:15:15 UTC
Created attachment 171387 [details]
Document with negative wrap margin values

ODF allows negative margins. For left and right margins, negative values are implemented in LibreOffice. For top and bottom margins, negative values are wrongly implemented. Bottom margin uses 0 instead and top margin uses a totally wrong value.

The attached file has "margin = -1cm" on all four sides.

Negative values are useful for importing shapes in docx-documents. Word uses the unrotated shape as wrap rectangle in wrap mode "Square" (="parallel" in UI in LO). If a shape is rotated, additional space is needed to extent the wrap rectangle to the size and position of the bounding box of the rotated shape. Word puts this additional space into the element 'effectExtent' of the anchor element.

LibreOffice uses the bounding box of the rotated shape as wrap rectangle. So if a docx-document contains a shape, where the 'effectExtent' is set to zero, then LibreOffice would need to set the margin to negative values to get the same rendering.

Word extents the wrap rectangle for glow and shadow effects as well.

Fortunately there is not UI in Word to directly set 'effectExtent' values. But nevertheless negative values are allowed in ODF and LibreOffice should render them correctly.
Comment 1 Dieter 2021-05-10 07:09:38 UTC
(In reply to Regina Henschel from comment #0)
> Created attachment 171387 [details]
> Document with negative wrap margin values
> 
> For left and right margins, negative values are
> implemented in LibreOffice. For top and bottom margins, negative values are
> wrongly implemented. Bottom margin uses 0 instead and top margin uses a
> totally wrong value.
> 
> The attached file has "margin = -1cm" on all four sides.

If I open attached document and page style dialog, LO shows 1cm for every magin. So how can I reproduce the behaviour you describe?
=> NEEDINFO
Comment 2 Regina Henschel 2021-05-10 12:31:34 UTC
Created attachment 171825 [details]
Screenshot compare Writer with TextMaker

It is not about page margins, but about the wrap margins of the shape.

The text consists of single characters with spaces. That makes the area of the rectangle given by the wrap settings visible. TextMaker interprets the negative margins correctly. The area for the shape becomes smaller than the bounding box of the shape, so that the text is partly behind the shape. Word does not import the shape at all, so is not useful for comparison.
Comment 3 Dieter 2021-05-10 14:08:33 UTC
Regina, thanks for the hint and the screenshot. But I still don't know how to reproduce

1. Open file
2. Select shape => Wrap => Edit
3. ???

There are settings for spacing:
Settings for top and bottom are the same than in your description, but left and right are 0cm and I can't change them to -1cm. I also can't find a setting that is named "Margin".

Could you please add some steps to reproduce? Thank you. => NEEDINFO
Comment 4 Regina Henschel 2021-05-10 14:57:38 UTC
You only need to open the document to reproduce the error. If it does not look a rendered by TextMaker in the screenshot, then it is wrong.

"Spacing" in the UI is the same as "fo:margin-top" (and similar) in file. The attribute is in the graphic style of the shape in file.

The UI in LO is currently restricted to non-negative values. You need to edit the file to get negative values. Changing the UI makes only sense after the margin is correctly implemented.
Comment 5 Dieter 2021-05-16 16:41:58 UTC
(In reply to Regina Henschel from comment #4)
> You only need to open the document to reproduce the error. If it does not
> look a rendered by TextMaker in the screenshot, then it is wrong.

O. K. , I can confirm, that it doesn't look like TextMaker in the screenshot. Spacing is 0 cm for left, right and bottom. Spacing for top is 99,99 cm. And I also confirm, that it is not possible to insert a negative value.
Comment 6 Aron Budea 2021-07-31 15:56:07 UTC
(In reply to Regina Henschel from comment #0)
> wrongly implemented. Bottom margin uses 0 instead and top margin uses a
> totally wrong value.
While this was already bad (worse, as no shape was shown) in 3.3.0, the bogus value in the top margin started with the following commit. Previously it was the same as the bottom margin.

https://cgit.freedesktop.org/libreoffice/core/commit/?id=ebceee31d92f04b58e795d02a26f62b717c47737
author		Miklos Vajna <vmiklos@collabora.com>	2021-03-01 10:37:49 +0100
committer	Miklos Vajna <vmiklos@collabora.com>	2021-03-01 20:56:03 +0100

tdf#140342 sw layout: remove explicit gutter handling when positioning borders
Comment 7 QA Administrators 2023-08-01 03:16:36 UTC Comment hidden (obsolete)
Comment 8 Regina Henschel 2023-08-01 10:27:27 UTC
Negative top and bottom margins are still wrong in Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: cf8f7b91f41821b79495c0388359c4cb1156ea67
CPU threads: 8; OS: Windows 10.0 Build 19045; UI render: default; VCL: win
Locale: de-DE (en_US); UI: en-US
Calc: CL threaded