Bug 127785 - Flip (mirror) generates wrong text box
Summary: Flip (mirror) generates wrong text box
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Impress (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Regina Henschel
URL:
Whiteboard: target:6.4.0
Keywords:
Depends on:
Blocks:
 
Reported: 2019-09-26 12:22 UTC by Regina Henschel
Modified: 2019-10-09 22:25 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments
Example to test flip (13.51 KB, application/vnd.oasis.opendocument.presentation)
2019-09-26 12:22 UTC, Regina Henschel
Details
ExampleCollection.pptx contains shapes with 'rot' attribute on textbox (35.52 KB, application/vnd.openxmlformats-officedocument.presentationml.presentation)
2019-10-06 13:15 UTC, Regina Henschel
Details
ExampleCollectionSimilarToPPTX.odp contains similar shapes, but defined with ODF means (16.38 KB, application/vnd.oasis.opendocument.presentation)
2019-10-06 13:32 UTC, Regina Henschel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Regina Henschel 2019-09-26 12:22:18 UTC
Created attachment 154543 [details]
Example to test flip

Open attached document. It has a parallelogram with some dummy text. A parallelogram has a text box, which is smaller than the shape frame rectangle.
Flip the shape vertically or flip it horizontally.

Expected: The text remains in the center.

Observed: The text is outside its text box and is rendered at the edge of the shape frame rectangle.

(The shape frame rectangle corresponds to the resize-handles, which you see when you click on the shape.)

This happens for all shapes, which have a text box that is smaller than the shape frame rectangle, e.g diamond, circle.

It is a bug in rendering.

[I wonder, that there exists no bug report already. At least I have not found any.]
Comment 1 Commit Notification 2019-09-28 18:01:55 UTC
Regina Henschel committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/7830a9d42926a9c5265230d42fce4a4858b303c1

tdf#127785 correct calculation of text rectangle in flipped shape

It will be available in 6.4.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 2 Regina Henschel 2019-09-29 14:30:06 UTC
It is not totally fixed. The size of the text rectangle is correct now, but the position of the text rectangle is still wrong.
Comment 3 Regina Henschel 2019-10-02 07:37:55 UTC
*** Bug 127439 has been marked as a duplicate of this bug. ***
Comment 4 Commit Notification 2019-10-02 11:36:49 UTC
Regina Henschel committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/caaa8fe7c4bb88185b5b11591ee8a619cff0eced

tdf#127785 compensate 180deg rotation for position of text box

It will be available in 6.4.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 5 Regina Henschel 2019-10-04 12:52:45 UTC
Sorry, still not fixed. The provided solution does not work in case of TextRotateAngle other than zero.
Comment 6 Regina Henschel 2019-10-06 13:15:34 UTC
Created attachment 154780 [details]
ExampleCollection.pptx contains shapes with 'rot' attribute on textbox

The first series in the collection has a shape, that contains a 'rot' attribute on the textbox and in addition a shape rotation, so that the text box look upright.
The second series has a shape, that contains only a 'rot' attribute on the textbox, so that the text is rotated.
The triangle shape, which is transformed, has a gray background. The hatched triangle shows the original position of the shape and the blue rectangle shows the original position of the text box.
For each series the triangle is transformed by
180° rotation
180° rotation plus horizontal flip
horizontal flip
vertical flip

Notice, that '180° rotation plus horizontal flip' is the same as 'vertical flip'.

You need to open the file in PowerPoint for comparison, because the import from pptx is still buggy.
Comment 7 Regina Henschel 2019-10-06 13:32:40 UTC
Created attachment 154781 [details]
ExampleCollectionSimilarToPPTX.odp contains similar shapes, but defined with ODF means

This collection contains the same kind of shapes as in the attached pptx file, but defined as ODF shapes and not imported.

The proposed new patch [https://gerrit.libreoffice.org/#/c/80310/] results in the same position and orientation as you see with the other file in PowerPoint. I like to keep the interpretation of the file content that way for interoperability. The ODF standard has no exact description, how shape rotation, mirroring and text box rotation are combined.
For example in ODF1.2 part 1, 19.226 draw:text-rotate-angle
"The draw:text-rotate-angle attribute specifies the angle by which text within a custom shape is rotated in addition to the rotation included in the shape's draw:transform attribute."
and in ODF1.2 part 1, 19.193 draw:mirror-vertical 
"The draw:mirror-vertical attribute specifies if the vertical geometry of a shape is to be mirrored."

We might think of an additional UI element, which changes the text box orientation in a way, that it looks mirrored too, when the shape is mirrored. For example, to get an upright text box on slide 2. Currently the user needs macros to set the desired text box rotation.
Comment 8 Regina Henschel 2019-10-06 13:44:29 UTC
on slide 2  --> in slide 5
Comment 9 Commit Notification 2019-10-09 18:44:14 UTC
Regina Henschel committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/5e68f0e2a13cc21f95a875cf694e926e01642050

tdf#127785 Apply 180deg compensation for flipV to text range

It will be available in 6.4.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 10 Regina Henschel 2019-10-09 22:25:43 UTC
I thing, now it is OK.