Bug 149551 - OOXML bad import of attribute 'rot' of <bodyPr> element
Summary: OOXML bad import of attribute 'rot' of <bodyPr> element
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Impress (show other bugs)
Version:
(earliest affected)
7.4.0.0 alpha0+
Hardware: All All
: medium normal
Assignee: Regina Henschel
URL:
Whiteboard: target:7.5.0
Keywords:
: 127457 (view as bug list)
Depends on:
Blocks:
 
Reported: 2022-06-13 13:27 UTC by Regina Henschel
Modified: 2022-09-16 18:13 UTC (History)
1 user (show)

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


Attachments
writing mode 'vert' plus text area rotation (16.55 KB, application/zip)
2022-06-13 13:27 UTC, Regina Henschel
Details
Compare original and resaved version of attachement 180727 in PowerPoint (110.64 KB, image/png)
2022-06-13 13:28 UTC, Regina Henschel
Details
normal writing mode with text area rotation (16.45 KB, application/zip)
2022-06-13 13:29 UTC, Regina Henschel
Details
Compare attachment 180729 in Powerpoint and LibreOffice (49.12 KB, image/png)
2022-06-13 13:30 UTC, Regina Henschel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Regina Henschel 2022-06-13 13:27:13 UTC
Created attachment 180727 [details]
writing mode 'vert' plus text area rotation

The attribute 'rot' of <bodyPr> element specifies an additional rotation of the text area. It has the same meaning as the attribute 'draw:text-rotate-angle' of <draw:enhanced-geometry> in ODF.

Open attached document 'Vert plus rotation.pptx' in PowerPoint and in LibreOffice. The additional text area rotation is missing in LO. Save it from LO to pptx and open the saved file in PowerPoint. The additional rotation is missing.

Open the file 'only rotation.pptx' in PowerPoint and in LO. Notice that the text in LO is sheared.

Reason of the problems is this: LO reads the 'rot' attribute into the property 'TextPreRotateAngle'. But that property is designed to carry the writing-mode rotations from attributes 'vert' and 'vert270'. Using it with arbitrary angles produces shearing. In the first case the read values from 'rot' are overwritten with the angle from 'vert' and so 'rot' is lost.

When this will be fixed, the export to ODF needs to be fixed too. It has in  /core/xmloff/source/draw/shapeexport.cxx the lines 
4280   case EAS_TextPreRotateAngle :
4281   case EAS_TextRotateAngle :
4282   {
4283        double fTextRotateAngle = 0;
4284        if ( ( rGeoProp.Value >>= fTextRotateAngle ) && fTextRotateAngle != 0 )
4285        {
4286            ::sax::Converter::convertDouble(
4287                aStrBuffer, fTextRotateAngle );
4288            aStr = aStrBuffer.makeStringAndClear();
4289            rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_TEXT_ROTATE_ANGLE, aStr );
4290        }

That will produce a "duplicate attribute" file format error, if both attributes are set. Such is possible independent from OOXML import, when the property values are set by a macro.

So it boils down to implementation errors of properties "TextPreRotateAngle" and "TextRotateAngle".
Comment 1 Regina Henschel 2022-06-13 13:28:37 UTC
Created attachment 180728 [details]
Compare original and resaved version of attachement 180727 in PowerPoint
Comment 2 Regina Henschel 2022-06-13 13:29:21 UTC
Created attachment 180729 [details]
normal writing mode with text area rotation
Comment 3 Regina Henschel 2022-06-13 13:30:11 UTC
Created attachment 180730 [details]
Compare attachment 180729 [details] in Powerpoint and LibreOffice
Comment 4 Commit Notification 2022-06-15 22:58:28 UTC
Regina Henschel committed a patch related to this issue.
It has been pushed to "master":

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

tdf#149551 write draw:text-rotate-angle only once

It will be available in 7.5.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 2022-06-16 10:43:33 UTC
The submitted patch is not a solution, but a first aid to fix the file format error. It is suitable for ODF strict, but I'm looking for a better solution for ODF extended.
Comment 6 Regina Henschel 2022-07-19 22:58:18 UTC
The next step is to separate the rotation of the text area rectangle from the text pre-rotation for vertical writing directions in core.

The patch is ready besides some missing unit tests.
https://gerrit.libreoffice.org/c/core/+/136447

Would be nice to get some feedback.
Comment 7 Commit Notification 2022-07-20 06:16:35 UTC
Regina Henschel committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/7e23cbdbb6ec0247a29ed8a8f744c01e10963ea0

tdf#149551 separate TextRotateAngle from TextPreRotateAngle

It will be available in 7.5.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 Commit Notification 2022-07-20 18:49:24 UTC
Regina Henschel committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/2f3b87d18a688b022a18a8b20b69b10cd6af7748

tdf#149551 Unit tests for insets in SmartArt

It will be available in 7.5.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 9 Regina Henschel 2022-07-20 20:43:06 UTC
That was a big step forward. Now "only" the saving and loading with the ODF format is missing. This will still take some time, because I first have to discuss with the ODF TC a suitable change of the standard. So the bug is not completely fixed yet.
Comment 10 Commit Notification 2022-09-14 06:32:43 UTC
Regina Henschel committed a patch related to this issue.
It has been pushed to "master":

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

tdf#149551 use 'WritingMode' instead of TextPreRotateAngle

It will be available in 7.5.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 11 Regina Henschel 2022-09-14 14:52:15 UTC
This has been a larger change. If you find problems please report them in new bug reports.

Not all cases of OOXML-ODF round-trips will work well, because LibreOffice or MS Office lacks some features, for example:
Frames in Writer cannot rotate and cannot render a writing mode which corresponds to vert="vert". Thus these features are not available for shapes in Writer, which have an attached text box.
Shapes cannot render a writing mode which corresponds to vert="mongolianVert".
Right-to-left in shapes in Writer is not available on shape level, but only on paragraph level.
Shapes cannot use the writing mode "context".
Word is not able to render the 'rot' attribute of the <bodyPr> element of a shape.
Comment 12 Commit Notification 2022-09-15 09:17:48 UTC
Regina Henschel committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/7d06665b7f5e7a7d1e9ac608c3bb827003fa3cb4

tdf#149551 unit test mongolianVert in shape in Writer

It will be available in 7.5.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 13 Commit Notification 2022-09-16 16:05:27 UTC
Regina Henschel committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/6c635fb11af389d88f36d4bf6b43421af062086a

tdf#149551 unit test writing mode in shape in Impress

It will be available in 7.5.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 14 Regina Henschel 2022-09-16 18:13:53 UTC
*** Bug 127457 has been marked as a duplicate of this bug. ***