Bug 162541 - FILEOPEN DOC/X NOT-layoutInCell: horizontal para-placement is better represented as relative to page margin, not cell
Summary: FILEOPEN DOC/X NOT-layoutInCell: horizontal para-placement is better represen...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Justin L
URL:
Whiteboard: target:25.2.0
Keywords:
: 157161 (view as bug list)
Depends on:
Blocks: DOCX-Anchor-and-Text-Wrap DOC-Anchor-and-Text-Wrap DOCX-compatibilityMode-15 layoutInCell
  Show dependency treegraph
 
Reported: 2024-08-21 15:57 UTC by Justin L
Modified: 2024-09-04 19:26 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
notLayoutInCell_para_left_compat12.docx: interestingly, wrap is ignored by MS Word 2010 (49.15 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2024-08-21 15:57 UTC, Justin L
Details
notLayoutInCell_para_left_compat12-mso2010.pdf: How it looks in Word 2010 (25.75 KB, application/pdf)
2024-08-21 15:58 UTC, Justin L
Details
layoutInCell_paraLeft_lineTop.doc: another exception - vert line affects horizontal position (71.00 KB, application/msword)
2024-08-21 18:02 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Justin L 2024-08-21 15:57:18 UTC
Created attachment 195930 [details]
notLayoutInCell_para_left_compat12.docx: interestingly, wrap is ignored by MS Word 2010

MS Office treats the paragraph-oriented placement of an image that is NOT layoutInCell as if it was laid out against the paragraph containing the entire table. (Only compat14 or lower can be NOT layoutInCell).

Since LO currently has no such layout capabilities, there are two choices.
1.) implement a matching layout for pre-2013 document formats (bug 133522)
2.) tweak the import to match the desired effect.

DOC import tweaks wrap-through this way
    if (!bIsObjectLayoutInTableCell && m_nInTable &&
            (eHoriRel == text::RelOrientation::FRAME
             || eHoriRel == text::RelOrientation::CHAR)
       && rFSPA.nwr == 3)
    {
        eHoriRel = text::RelOrientation::PAGE_PRINT_AREA;

But why limit it to wrap-through? Word only has the choice of "column" which does not include paragraph margins - which is equivalent to hori page margin.

I assume someone was just being careful as they fixed a specific bug.
commit 4372b0357cab4f0ed952f1132a508bb0cb87521a
Author: Vladimir Glazounov on Wed Feb 16 16:02:17 2005 +0000
    #118546# conversion of horizontal position under certain condition
Comment 1 Justin L 2024-08-21 15:58:47 UTC
Created attachment 195931 [details]
notLayoutInCell_para_left_compat12-mso2010.pdf: How it looks in Word 2010
Comment 2 Justin L 2024-08-21 18:02:06 UTC
Created attachment 195935 [details]
layoutInCell_paraLeft_lineTop.doc: another exception - vert line affects horizontal position

Go figure. It's hard to find something about layoutInCell that doesn't have some kind of bizarre exception.

So, if vertical is oriented to the line, then that cell paragraph once again becomes "the paragraph" that horizontal is oriented against, instead of the table-paragraph.
Comment 3 Justin L 2024-08-22 12:56:28 UTC
(In reply to Justin L from comment #2)
> vert line affects horizontal position
Yes - it seems like the use of "line" or "character" forces layoutInCell.
Comment 4 Commit Notification 2024-08-24 12:37:19 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/34f04196575fd52bb117696df92177c3b7d2d190

tdf#162541 doc import NOT-layoutInCell: hori-para => PAGE_PRINT_AREA

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.
Comment 5 Commit Notification 2024-08-24 12:38:22 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

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

tdf#162541 docx import NOT-layoutInCell: hori-para => PAGE_PRINT_AREA

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.
Comment 6 Justin L 2024-08-26 10:47:29 UTC
*** Bug 157161 has been marked as a duplicate of this bug. ***
Comment 7 Justin L 2024-09-04 19:26:47 UTC
tables are rarely inserted into columns, but I'll bet my patch falls apart when columns come into play.