Bug 153909 - 2007 DOCX: Rectangle in header has unwanted offset (same MSO-LO if resaved in MSO)
Summary: 2007 DOCX: Rectangle in header has unwanted offset (same MSO-LO if resaved in...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version:
(earliest affected)
7.0.0.3 release
Hardware: All All
: medium minor
Assignee: Justin L
URL:
Whiteboard: compatibilityMode12 target:24.8.0 tar...
Keywords: bibisected, bisected, regression
Depends on:
Blocks: OOXML-Shapes layoutInCell
  Show dependency treegraph
 
Reported: 2023-03-01 21:43 UTC by Aron Budea
Modified: 2024-08-26 10:17 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Sample DOCX (179.54 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2023-03-01 21:43 UTC, Aron Budea
Details
PDF exported from Word (358.94 KB, application/pdf)
2023-03-01 21:45 UTC, Aron Budea
Details
PDF exported from LO 7.6 build (96.11 KB, application/pdf)
2023-03-01 21:46 UTC, Aron Budea
Details
Sample compared in MSO 2016, LO 7.6+ in Windows (142.44 KB, image/webp)
2023-03-02 12:24 UTC, Timur
Details
Sample DOCX resaved in MSO without compatibility (182.40 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2023-03-02 12:32 UTC, Timur
Details
Sample DOCX resaved in MSO compared MSO LO (205.29 KB, image/webp)
2023-03-02 12:33 UTC, Timur
Details
153909-min.docx: minimized version for easier debugging (29.92 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2024-01-19 13:59 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Aron Budea 2023-03-01 21:43:58 UTC
Created attachment 185680 [details]
Sample DOCX

Open the attached DOCX, originating from MS Word.

=> Note how the blue rectangle in the header is displaced, and partly overlaps the text "Enterprise Elite Services".

Observed using LO 7.6.0.0.alpha0+ (2da16ff9f018fae68c53a801e5a234dafc2ebcec) / Ubuntu.

This is a regression from the following commit, bibisected using repo linux-64-7.0. Adding CC: to Attila Bakos and László Németh.

https://cgit.freedesktop.org/libreoffice/core/commit/?id=27d04f6dbf38aa28fb7215590d578c4567db5770
author		Attila Bakos <bakos.attilakaroly@nisz.hu>	2020-03-19 14:40:36 +0100
committer	László Németh <nemeth@numbertext.org>	2020-04-07 12:44:17 +0200

tdf#119038 DOCX: fix FollowTextFlow handling
Comment 1 Aron Budea 2023-03-01 21:45:14 UTC
Created attachment 185681 [details]
PDF exported from Word
Comment 2 Aron Budea 2023-03-01 21:46:03 UTC
Created attachment 185682 [details]
PDF exported from LO 7.6 build
Comment 3 Timur 2023-03-02 12:24:54 UTC
Created attachment 185694 [details]
Sample compared in MSO 2016, LO 7.6+ in Windows

I set New.
Comment 4 Timur 2023-03-02 12:32:59 UTC
Created attachment 185695 [details]
Sample DOCX resaved in MSO without compatibility
Comment 5 Timur 2023-03-02 12:33:45 UTC
Created attachment 185696 [details]
Sample DOCX resaved in MSO compared MSO LO

Same for DOCX resaved without compatiblity.
Comment 6 Justin L 2024-01-19 13:37:46 UTC
The original is compat12 (DOC-level). The problem is also "fixed" if Word 2010 round-trips it without compatibility mode (into compat14).

I'm guessing the problem is related to the old style of creating a rectangle

<v:rect id="_x0000_s2050" style="position:absolute;margin-left:-36.9pt;margin-top:-25.2pt;width:612pt;height:21.6pt;z-index:251664384" fillcolor="#002060" stroked="f"/>

This doesn't say anything about layoutInCell status - which defaults to true (and is generally always forced to true for compat15), but is NOT true in LO for the round-tripped files, probably because of
    if (m_pImpl->m_nWrap == text::WrapTextMode_THROUGH
        && m_pImpl->m_nHoriRelation == text::RelOrientation::FRAME)
            // text::RelOrientation::FRAME is OOXML's "column", which behaves
            // as if layout-in-cell would be always off.
            m_pImpl->m_bLayoutInCell = false;

So I expect the trick is to add the same thing to the code path that creates these old-style rectangles.
Comment 7 Justin L 2024-01-19 13:59:23 UTC
Created attachment 192059 [details]
153909-min.docx: minimized version for easier debugging
Comment 8 Justin L 2024-01-19 14:01:12 UTC
I created bug 159285 because the original document hangs on opening in 24.2
Comment 9 Justin L 2024-01-19 15:06:11 UTC
Wow - I just took the very long path way around finding out that the problem code forcing FollowTextFlow to be true is in writerfilter/source/ooxml/OOXMLFastContextHandler.cxx - put there by the commit referenced in comment 0.
Comment 10 Commit Notification 2024-01-19 23:11:02 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

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

tdf#153909 docx import: wrap through shapes shouldn't FollowTextFlow

It will be available in 24.8.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 Commit Notification 2024-01-21 01:39:31 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/9aaf0f4b2c74d76d38460725b07c78e4aeabdbf3

tdf#153909: docx import: pre-emptive unit test for layoutInCell

It will be available in 24.8.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 12 Commit Notification 2024-01-22 10:25:46 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

https://git.libreoffice.org/core/commit/51a1ce9ca77c7559957abd8daf2e51b2e0f5d17b

tdf#153909 docx import: wrap through shapes shouldn't FollowTextFlow

It will be available in 24.2.1.

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 2024-01-22 21:20:49 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

https://git.libreoffice.org/core/commit/15d19f48dc9eaf74d37b3da36a4bfc68be483547

tdf#153909 docx import: wrap through shapes shouldn't FollowTextFlow

It will be available in 7.6.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 14 Commit Notification 2024-08-17 20:31:22 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/7144a9c791ab587b4621c2b35611ba2020baab58

tdf#162211 tdf#153909 layoutInCell vml: don't discard layoutInCell

It will be available in 25.2.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.