Created attachment 181071 [details]
Test document from unit test
This is a follow-up to bug 87924.
The attached document is the test document from unit test DECLARE_OOXMLIMPORT_TEST(testTdf87924, "tdf87924.docx").
Open the saved document in Word. Notice, that the text appears horizontal. In fact the text is with text direction "Rotate all text 270°" which compensates the 90° shape rotation.
Now open the document in LO. The text appears horizontal. Reason is, that the text was set to "Rotate all text 0°".
Now save the document without any change to .docx format and open the saved document in Word. Notice, that the text is vertical.
The fix for bug 87924 does not really work. But removing the matrix and the rotation test does not solve the problem, since then the text is vertical because the frame does not has the needed rotation for compensation.
[The matrix is wrong, but works accidentally for 90° and -90° rotations.]
A solution is complicated. I see several ways:
A) Keep "Rotate all text 270°" on import and export. But because the attached frame is not able to rotate but honors writing modes, fake the writing direction on rendering, so that it is looks as if the frame could rotate.
B) Set "Rotate all text 0°" on import and set it back to "Rotate all text 270°" on export by considering the shape rotation on export too.
C) Do not use frames in case the shape is rotated.
D) Implement rotation for text frames at least for multiples of 90°.
My favorite is to use C) as short term solution. That would solve in addition the error, that the text has a wrong position. Solution D) should be used in the long term.
Solution C) would in addition allow to implement a true "upright" in Writer too. Currently the text looks upright because the frame cannot rotate. But saving and opening the saved document in Word shows that "upright" is not handled correctly.
Confirm Version: 184.108.40.206.alpha0+ / LibreOffice Community
Build ID: 28daee8a3252e03a67484dc8d3dd26fd73af4826
CPU threads: 4; OS: Linux 5.13; UI render: default; VCL: gtk3
Locale: cs-CZ (cs_CZ.UTF-8); UI: en-US