Bug 151518 - FILEOPEN DOCX Text is wrongly placed in some SmartArt types
Summary: FILEOPEN DOCX Text is wrongly placed in some SmartArt types
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.4.1.2 release
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Regina Henschel
URL:
Whiteboard: target:7.5.0
Keywords:
Depends on:
Blocks: OOXML-SmartArt
  Show dependency treegraph
 
Reported: 2022-10-13 22:47 UTC by Regina Henschel
Modified: 2022-10-19 21:41 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Example for the problem (62.30 KB, application/zip)
2022-10-13 22:47 UTC, Regina Henschel
Details
screenshot (151.52 KB, image/png)
2022-10-19 14:50 UTC, BogdanB
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Regina Henschel 2022-10-13 22:47:50 UTC
Created attachment 183032 [details]
Example for the problem

Check option "SmartArt to LibreOffice shapes or reverse" in Tools > Options > Load/Save > Microsoft Office.

Open attached document. It contains a SmartArt shape and a picture, how it looks in Word. The red rectangles are semitransparent to allow to see the text of the blue shapes in case it is behind the red rectangles.

The fix for bug 148321 has introduced, that the position of the text considers the special way Microsoft Office calculates it, in case a vertical distance to text is so large, that the text is outside the text area. That works fine for shapes in PowerPoint. But it conflicts with text in SmartArt in Writer.

Reason is, that the calculation in TextBodyPropertiew::readjustTextDistances() uses the text area rectangle of the SdrObjCustomShape. These values are used in expressions with text distances. But in Writer text area rectangle is in Twips whereas the text distances at import time are in Hmm. So the special calculation is triggered, although in fact there is no such situation.

The problem is not visible with normal shapes in Word, because Word does not allow to use so large distances. You can enter such values, but the overflowing text is not displayed in Word.

SmartArts would not need this special corrections, because TextBodyProperties::pushTextDistances() already results in correct text location. Unfortunately I see no easy way to exclude SmartArt shapes in Writer from using TextBodyPropertiew::readjustTextDistances().

Effected are those SmartArt types which use the text distances to shift the text from its center position up or down. I have not inspected all types, but see the problem with types "Target List", "Nested Target", "Stacked Venn" and "Grouped List" so far.

This is not a regression from the fix for bug 148321 because before the fix the text position was wrong too, albeit in a different way.
Comment 1 Regina Henschel 2022-10-14 15:37:45 UTC
It is not the missing Twip->Hmm conversion but something different.
Comment 2 raal 2022-10-15 13:35:44 UTC
Confirm with Version: 7.5.0.0.alpha0+ / LibreOffice Community
Build ID: 2e887e04c0008a4eb6cbf34050b6fa463a33599f
CPU threads: 4; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: cs-CZ (cs_CZ.UTF-8); UI: en-US
Calc: threaded
Comment 3 Commit Notification 2022-10-18 14:23:43 UTC
Regina Henschel committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/2969900b75e288e8c626a34277250aa233dc944c

tdf#151518 Do not tweak text area distances 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 4 BogdanB 2022-10-19 14:50:41 UTC
Created attachment 183133 [details]
screenshot

Regina, you could mark this bug as solved.
I attached a screenshot, before and after.

It's ok in
Version: 7.5.0.0.alpha0+ / LibreOffice Community
Build ID: f3a82a8ba51195cf31b0f78164735acc7ebbcd2f
CPU threads: 16; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: ro-RO (ro_RO.UTF-8); UI: en-US
Calc: threaded

Was not ok in
Version: 7.3.6.2 / LibreOffice Community
Build ID: 30(Build:2)
CPU threads: 16; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: ro-RO (ro_RO.UTF-8); UI: en-US
Ubuntu package version: 1:7.3.6-0ubuntu0.22.04.1
Calc: threaded
Comment 5 Regina Henschel 2022-10-19 21:41:54 UTC
@BogdanB: Thanks for testing.