Bug 141463 - FILEOPEN DOCX Scale of group is wrongly applied to the childelements in the group
Summary: FILEOPEN DOCX Scale of group is wrongly applied to the childelements in the g...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.4 all versions
Hardware: All All
: medium normal
Assignee: Regina Henschel
URL:
Whiteboard: target:7.2.0 target:7.1.4
Keywords:
Depends on:
Blocks: DOCX-Grouped-Shapes
  Show dependency treegraph
 
Reported: 2021-04-02 16:41 UTC by Regina Henschel
Modified: 2021-05-20 13:51 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments
Scaling a group with transformed child elements (85.09 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2021-04-02 16:41 UTC, Regina Henschel
Details
Comparison LibreOffice 7.2 master and MSO 2010 (156.80 KB, image/png)
2021-04-20 07:51 UTC, Xisco Faulí
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Regina Henschel 2021-04-02 16:41:33 UTC
Created attachment 170922 [details]
Scaling a group with transformed child elements

Open attached document. It contains a group with two child elements. One is flipped and the other is rotated. There is screenshot where the group should be. The screenshot looks gray, because I have reduced its contrast.

One place were an error happens is statement
aTransformation = aParentTransformation*aTransformation;
in shape.cxx

https://opengrok.libreoffice.org/xref/core/oox/source/drawingml/shape.cxx?r=3e4eb070#821

Here aParentTransformation is a scaling matrix from the group and aTransformation contains the rotation of the green shape. When they are multiplied, they introduce a skew. Word cannot handle skew at all, but LibreOffice can. Therefore the scaling has to be applied  before rotation.

There are surely other error in addition, but this one I could identify.

Look at it with 96dpi, then the screenshots have the correct size and position and you can see, were the shapes should be.
Comment 1 Xisco Faulí 2021-04-20 07:51:09 UTC
Created attachment 171301 [details]
Comparison LibreOffice 7.2 master and  MSO 2010
Comment 2 Xisco Faulí 2021-04-20 07:51:29 UTC
Reproduced in

Version: 7.2.0.0.alpha0+ / LibreOffice Community
Build ID: a199e4ea389c934d169a178433f4b94033e60f93
CPU threads: 4; OS: Linux 5.7; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 3 Xisco Faulí 2021-04-20 07:52:18 UTC
Hi Regina,
Since you provided a code pointer, can we turn this issue into an easyhack ?
Comment 4 Xisco Faulí 2021-04-20 07:54:47 UTC
Also reproduced in

Version: 5.2.0.0.alpha0+
Build ID: 3ca42d8d51174010d5e8a32b96e9b4c0b3730a53
Threads 4; Ver: 5.7; Render: default; 

and

Version: 4.3.0.0.alpha1+
Build ID: c15927f20d4727c3b8de68497b6949e72f9e6e9e
Comment 5 Regina Henschel 2021-04-22 21:04:20 UTC
(In reply to Xisco Faulí from comment #3)
> Hi Regina,
> Since you provided a code pointer, can we turn this issue into an easyhack ?

I still want to implement the import of 3D extrusion. That will touch the same area of code, and I want to have this bug to be fixed before. So I think, it is not suitable for an easyhack, because that might linger around years. Or do you have someone who wants to work on it now?
Comment 6 Regina Henschel 2021-05-03 19:13:00 UTC
Likely not an easy hack at all, but I have an idea and will try to fix it together with bug 141953.
Comment 7 Commit Notification 2021-05-11 15:20:38 UTC
Regina Henschel committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/36499d8bf6cd5c6af7b2ceb6071baf5c7421bd0a

tdf#141463 avoid skew in shape group in ooxml import ..

It will be available in 7.2.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 8 Regina Henschel 2021-05-15 18:12:52 UTC
When you open the example document, you will notice, that the erroneous skew is fixed, but that the shape has a wrong position. I will track the wrong position in a new bug report.
Comment 9 Regina Henschel 2021-05-16 19:49:14 UTC
Follow up bug for wrong position is bug 142304.
Comment 10 Xisco Faulí 2021-05-17 15:32:49 UTC
*** Bug 93952 has been marked as a duplicate of this bug. ***
Comment 11 Xisco Faulí 2021-05-17 15:34:01 UTC
Verified in

Version: 7.2.0.0.alpha1+ / LibreOffice Community
Build ID: c781776f3c79bbe3175b1452d26c79ebb931a500
CPU threads: 4; OS: Linux 5.7; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded

@Regina, thanks for fixing this issue!!
Comment 12 Commit Notification 2021-05-17 19:03:38 UTC
Regina Henschel committed a patch related to this issue.
It has been pushed to "libreoffice-7-1":

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

tdf#141463 avoid skew in shape group in ooxml import ..

It will be available in 7.1.4.

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.