Bug 148321 - FILEOPEN PPTX: text on top of circular object misplaced
Summary: FILEOPEN PPTX: text on top of circular object misplaced
Status: VERIFIED 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: Not Assigned
URL:
Whiteboard: target:7.4.0 target:7.3.5
Keywords:
Depends on:
Blocks: PPTX
  Show dependency treegraph
 
Reported: 2022-04-02 08:48 UTC by Gerald Pfeifer
Modified: 2023-04-03 20:45 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Sample slide (PPTX) (33.20 KB, application/vnd.openxmlformats-officedocument.presentationml.presentation)
2022-04-02 08:48 UTC, Gerald Pfeifer
Details
Visual comparison Office 365 (left) vs LibreOffice 7.4 (right) (327.80 KB, image/png)
2022-04-02 08:50 UTC, Gerald Pfeifer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gerald Pfeifer 2022-04-02 08:48:22 UTC
Created attachment 179269 [details]
Sample slide (PPTX)

How to reproduce:
 
 - Open the sample slide in both Office 365 and LibreOffice.
 - Observe how the text "AI" and "ML" is misplaced in the latter:
   above the upper border of the circles instead of below.
Comment 1 Gerald Pfeifer 2022-04-02 08:50:56 UTC
Created attachment 179270 [details]
Visual comparison Office 365 (left) vs LibreOffice 7.4 (right)

Version: 7.4.0.0.alpha0+ / LibreOffice Community
Build ID: 678446780446ae568ee8b1b814158c54ea5e393f
CPU threads: 8; OS: Linux 5.16; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US

as well as 

Version: 6.4.8.0.0+
Build ID: 99b065ec31d032fc08ab14f66430dac4fef904a5
CPU threads: 8; OS: Linux 5.16; UI render: default; VCL: gtk3; 
TinderBox: Linux-rpm_deb-x86_64@86-TDF, Branch:libreoffice-6-4, Time: 2020-10-08_08:57:08
Comment 2 Regina Henschel 2022-04-02 18:07:23 UTC
PowerPoint switches the algorithm in case the sum of top and bottom margin is larger than the text area height. LO uses the same algorithm for all cases. So we need to adapt the values on import and export.

I have made some experiments and have got these results for PowerPoint:
If top margin + bottom margin < text area height
then in case anchor is top, shift text block down by top margin
             anchor is bottom, shift text block up by bottom margin.

In all other cases calculate V = (top margin - bottom margin)/2.
Place the text so that
In case anchor is top, middle of text area + V = top text block
        anchor is middle, middle of text area + V = middle of text block
        anchor is bottom, middle of text area + V = bottom of text block
As usual, y-values increase downwards.

(These are only first experiments and algorithm might be wrong, so verify before implementing.)
Comment 3 Commit Notification 2022-06-08 09:37:20 UTC
Tomaž Vajngerl committed a patch related to this issue.
It has been pushed to "master":

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

tdf148321: convert OOXML inset values to text distance values

It will be available in 7.4.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 Gerald Pfeifer 2022-06-09 08:45:52 UTC
(In reply to Commit Notification from comment #3)
> Affected users are encouraged to test the fix and report feedback.

I'm happy to report this fixes the sample in this report and also the
original, larger instance I destilled it from.

@Regina, what do you think (referring to your comment #2)?
Comment 5 Regina Henschel 2022-06-09 11:36:20 UTC
The patch contains test documents with a very large amount of examples covering various combinations of top and bottom padding and multi-line text.

@Tomaž: Thank you for these test files.

For all of the shapes the round-trip PPTX->LO->PPTX works fine. I have tested it in addition with some rotated shapes and found no problems. So I think, the issue is resolved.
Comment 6 Gerald Pfeifer 2022-06-09 16:10:37 UTC
(In reply to Regina Henschel from comment #5)
> @Tomaž: Thank you for these test files.

+1

> For all of the shapes the round-trip PPTX->LO->PPTX works fine. I have
> tested it in addition with some rotated shapes and found no problems. 

Great - thank you for that additional validation, Regina!
Comment 7 Commit Notification 2022-06-10 11:10:57 UTC
Tomaž Vajngerl committed a patch related to this issue.
It has been pushed to "libreoffice-7-3":

https://git.libreoffice.org/core/commit/5319087ab75a01793462c8c41cebfa1996cc688a

tdf148321: convert OOXML inset values to text distance values

It will be available in 7.3.5.

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 Gerald Pfeifer 2022-06-10 22:18:28 UTC
Verified by Regina and myself. Thank you!
Comment 9 Regina Henschel 2022-10-23 19:24:03 UTC
Export to OOXML is wrong. I will not reopen this one, but bug 150966 tracks the export problems.