Bug 149395 - FILEOPEN DOCX Rotated textboxes inside grouped shapes no longer rotated
Summary: FILEOPEN DOCX Rotated textboxes inside grouped shapes no longer rotated
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.4.0.0 alpha0+
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisected, bisected, regression
Depends on:
Blocks: DOCX-Grouped-Shapes
  Show dependency treegraph
 
Reported: 2022-05-31 09:38 UTC by Gabor Kelemen (allotropia)
Modified: 2024-06-09 10:59 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
attachment 118188 saved as docx by current master (16.38 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2022-05-31 09:38 UTC, Gabor Kelemen (allotropia)
Details
The docx example in Word 2016 and Writer (126.85 KB, image/png)
2022-05-31 09:38 UTC, Gabor Kelemen (allotropia)
Details
Rotated Grouped Shape (23.82 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2022-05-31 10:43 UTC, Attila Bakos (NISZ)
Details
Sample file before and after that commit (305.85 KB, image/jpeg)
2022-05-31 10:47 UTC, Attila Bakos (NISZ)
Details
Shape with simple text (19.62 KB, application/zip)
2022-05-31 12:43 UTC, Regina Henschel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gabor Kelemen (allotropia) 2022-05-31 09:38:18 UTC
Created attachment 180490 [details]
attachment 118188 [details] saved as docx by current master

This is found from the document in bug 93675 saved as docx 

The original attachment 118188 [details] contains a grouped shape, which is exported to DOCX okay-ish.
When reloading, the rotated text boxes are horizontal.

1. Save attachment 118188 [details] as docx from Writer
2. Open the saved file in Word and Writer.

Notice the rotated textboxes on the left curved arrows and the right side thick yellow arrows are now horizontal in Writer, but correctly rotated in Word.

Version: 7.4.0.0.alpha1+ (x64) / LibreOffice Community
Build ID: dfd5081ff3973d5d0f216b06dda6360fa490cc9c
CPU threads: 14; OS: Windows 10.0 Build 19044; UI render: default; VCL: win
Locale: en-US (hu_HU); UI: en-US
Calc: threaded

This was good in 7.3.0.

Bibisected with win-7.4 to:

https://git.libreoffice.org/core/+/2951cbdf3a6e2b62461665546b47e1d253fcb834

author	Attila Bakos (NISZ) <bakos.attilakaroly@nisz.hu>	Wed Nov 10 14:10:11 2021 +0100
committer	László Németh <nemeth@numbertext.org>	Mon Jan 03 14:28:15 2022 +0100

tdf#143574 OOXML export/import of textboxes in group shapes

Adding CC to: Attila Bakos
Comment 1 Gabor Kelemen (allotropia) 2022-05-31 09:38:51 UTC
Created attachment 180491 [details]
The docx example in Word 2016 and Writer
Comment 2 Attila Bakos (NISZ) 2022-05-31 10:43:12 UTC
Created attachment 180493 [details]
Rotated Grouped Shape

Hello Gabor!

This one probably the grouped version of https://bugs.documentfoundation.org/show_bug.cgi?id=82627
So not understood what is to point of this one.. That commit only changed the target of the read in this case to a text-frame which is still not rotatable.
Rather feature request than regression see my attachment, which never was good, unfortunately :( What do you think what can be the solution for this problem without having the feature? Any idea?
Comment 3 Attila Bakos (NISZ) 2022-05-31 10:47:52 UTC
Created attachment 180494 [details]
Sample file before and after that commit
Comment 4 Regina Henschel 2022-05-31 12:43:41 UTC
Created attachment 180501 [details]
Shape with simple text

My take is, that the import filter needs to be so changed, that in case the text is so simple that it can be expressed as label text, then no attached text frame is used.

With "label text" I mean the handling of text in custom shapes as it is done in Draw, Impress and Calc.

The attached document shows such example.

In the long run the Draw text rendering engine should be able to handle tables and objects anchored as characters too. Then the scope of "simple" can be expanded.
Comment 5 Gabor Kelemen (allotropia) 2022-05-31 14:45:14 UTC
Attila, Regina

Thanks for the insight, let's just add this to the "rotated text box from docx issues" pile.
Comment 6 Attila Bakos (NISZ) 2022-06-09 14:12:57 UTC
Gabor, Regina,

I have tried to investigate how the rotation can be developed. I think two way can be mentioned, in the first case the rotation only will be applied when the frame is rendered, so it will be seen rotated. I think this one the easier way, but not the better, it is quite hackish... The other way to implement it in the layout in the level of the frames. But i am afraid, now the rotation only happens in the drawing level (svx) not in the writer. In this case all of the frame types have to be known and -- if i remember well -- from the swlayutframe it have to be implemented for frames, texts, tables, etc.
Other interesting thing, when in word the textbox is under editing, the rotation is disabled, after the editing finished it rotates the content. That looks like the first case.
So it have to be properly investigated, planned, designed and it will take many time to do it, not to mention how many mistake can be made. This is a so complex situation, i think, and it needs a far more experienced developer than me. Hopefully one day i can try it, but not now i afraid. :)

@Regina: Thank you for your idea. Unfortunately i do not know how to realize that, because the filter reads the xml sequentially, line by line. In the case, when the complex content is at the end of the textbox and we read it into the shape (as editeng text), it will be lost and there is no possibility to  turn back, because the read is done line by line. So the filter have to decide where the content have to be read, before the content is known. There might be a solution, but i have no idea about it for now.

Sorry for the novel, as always i have written a it a bit long... :)
Comment 7 QA Administrators 2024-06-09 03:14:54 UTC Comment hidden (obsolete)
Comment 8 Regina Henschel 2024-06-09 10:59:34 UTC
(In reply to Attila Bakos (NISZ) from comment #6)
> @Regina: Thank you for your idea. Unfortunately i do not know how to realize
> that, because the filter reads the xml sequentially, line by line. In the
> case, when the complex content is at the end of the textbox and we read it
> into the shape (as editeng text), it will be lost and there is no
> possibility to  turn back, because the read is done line by line. So the
> filter have to decide where the content have to be read, before the content
> is known. There might be a solution, but i have no idea about it for now.

I think it can be done in WpsContext::onEndElement(). The challenge is, that the simple solution
OUString sFrameContent(xText->getString());
pCustomShape->NbcSetText(sFrameContent);
xShapePropertySet->setPropertyValue("TextBox", uno::Any(false));
as done for Fontwork will not work in this case, because it looses character formattings.