Bug 100037 - FILEOPEN DOCX As-Char Image arrangement (in Z dimension) not respected
Summary: FILEOPEN DOCX As-Char Image arrangement (in Z dimension) not respected
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: VML-Shapes
  Show dependency treegraph
 
Reported: 2016-05-24 20:32 UTC by Julien Nabet
Modified: 2024-09-28 14:39 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
original docx file (1.01 MB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2016-05-24 20:32 UTC, Julien Nabet
Details
pdf generated from LO master sources updated today (438.63 KB, application/pdf)
2016-05-24 20:33 UTC, Julien Nabet
Details
pdf from Word2013 + pdfcreator (358.85 KB, application/pdf)
2016-05-24 20:35 UTC, Julien Nabet
Details
console logs (23.11 KB, text/plain)
2016-05-24 20:35 UTC, Julien Nabet
Details
pdf generated from LO master sources updated today (Win10) (294.05 KB, application/pdf)
2019-11-15 14:21 UTC, Julien Nabet
Details
console logs (10.58 KB, text/plain)
2019-11-15 14:26 UTC, Julien Nabet
Details
test when resaving (908.11 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2019-11-15 15:40 UTC, Julien Nabet
Details
Minimal .docx document on which the arrange issue is visible (205.32 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2019-11-15 15:44 UTC, Bartosz
Details
Smallest .docx document on which the arrange issue is visible (152.92 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2019-11-15 16:01 UTC, Bartosz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Julien Nabet 2016-05-24 20:32:13 UTC
Created attachment 125266 [details]
original docx file

On pc Debian x86-64 with master sources updated today, the layout of the file attached is different between LO and Word 2013.
(see attachments)
Comment 1 Julien Nabet 2016-05-24 20:33:34 UTC
Created attachment 125267 [details]
pdf generated from LO master sources updated today

pdf export seems to correspond with LO display.
Comment 2 Julien Nabet 2016-05-24 20:35:16 UTC
Created attachment 125268 [details]
pdf from Word2013 + pdfcreator
Comment 3 Julien Nabet 2016-05-24 20:35:45 UTC
Created attachment 125269 [details]
console logs

Here are console logs I noticed
Comment 4 Buovjaga 2016-05-27 11:34:23 UTC
Ok, so the arrangement of the field and ball images is on top. We can send them to back (right click - arrange) to fix it.
Then there are several extra ball images we can delete.
Also several extra Sport 2000 images we can delete (on top of each other like the tennis balls).

Julien: do you consider the extra images as user errors and only keep this report for the arrangement issue or..?

Arch Linux 64-bit, KDE Plasma 5
Version: 5.3.0.0.alpha0+
Build ID: 60041cb237ea73c2c1885dd6afd99d88780c2dfc
CPU Threads: 8; OS Version: Linux 4.5; UI Render: default; 
Locale: fi-FI (fi_FI.UTF-8)
Built on May 26th 2016

64-bit, KDE Plasma 5
Build ID: 5.1.3.2 Arch Linux build-1
CPU Threads: 8; OS Version: Linux 4.5; UI Render: default; 
Locale: fi-FI (fi_FI.UTF-8)
Comment 5 Julien Nabet 2016-05-27 11:43:27 UTC
(In reply to Buovjaga from comment #4)
> ...
> 
> Julien: do you consider the extra images as user errors and only keep this
> report for the arrangement issue or..?
>...

First, thank you for your detailed feedback.
Indeed, we can consider the extra images as user issue and I suppose we can keep the report for arrangement issue.
However, I hope Word's layout doesn't depend on some internal bugs. I mean perhaps it displays like this just because of bugs and, eg, Word > 2013 would display problems.
In this case, I would't like LO mimicks these bugs :-)
Comment 6 QA Administrators 2017-11-17 09:10:24 UTC Comment hidden (obsolete)
Comment 7 Julien Nabet 2017-11-24 19:59:36 UTC
On pc Debian x86-64 with master sources updated today, I could reproduce this.
Comment 8 QA Administrators 2018-11-25 03:40:32 UTC Comment hidden (obsolete)
Comment 9 Julien Nabet 2019-11-15 14:21:15 UTC
Created attachment 155847 [details]
pdf generated from LO master sources updated today (Win10)

It's a bit better but it's not equivalent to Word now.
Comment 10 Julien Nabet 2019-11-15 14:26:13 UTC
Created attachment 155848 [details]
console logs
Comment 11 Bartosz 2019-11-15 15:36:03 UTC
It seems that after opening .docx document with LibreOffice and resave it (into .docx), the arrange is correct.
Comment 12 Julien Nabet 2019-11-15 15:40:26 UTC
Created attachment 155850 [details]
test when resaving

(In reply to Bartosz from comment #11)
> It seems that after opening .docx document with LibreOffice and resave it
> (into .docx), the arrange is correct.

Hmm, I just did the test:
- open initial tournoi.docx file
- save it into docx tournoi2.docx
it's a mess!
Comment 13 Bartosz 2019-11-15 15:44:07 UTC
Created attachment 155851 [details]
Minimal .docx document on which the arrange issue is visible
Comment 14 Julien Nabet 2019-11-15 15:49:36 UTC
The remaining pb when opening tournoi.docx is the tennis ball where we can see the frame.
The resaving is a bit scary (see my previous comment) but I suppose it should be a new bugtracker.

The minimal doc shows only the tennis court so no pb here obviously.
Comment 15 Bartosz 2019-11-15 16:01:53 UTC
Created attachment 155853 [details]
Smallest .docx document on which the arrange issue is visible
Comment 16 NISZ LibreOffice Team 2020-11-25 15:03:17 UTC
That's a VML textbox with the yellow text in front of the tennis court image. Likely a duplicate to bug #67759 but let's keep this alive just in case.

Still bad in current nightly:
Version: 7.2.0.0.alpha0+ (x64)
Build ID: cb084f475db33a2cfc62bc9c8de37b8c3c87b3c7
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win
Locale: hu-HU (hu_HU); UI: en-US
Calc: CL
Comment 17 Julien Nabet 2022-04-09 09:37:46 UTC
On pc Debian x86-64 with master sources updated today, I still reproduce this.

Attila: thought you might be interested in this one since you already fixed some z-order pbs in docx import.
Comment 18 Julien Nabet 2022-09-28 13:07:40 UTC
Tünde/László: noticing tdf#124333 (PPTX import: fix Z-order of embedded OLE objects), thought you might interested in this one. Of course, if it's not the case, don't hesitate to uncc yourself.
Comment 19 Julien Nabet 2022-09-28 13:08:23 UTC
I forgot to tell I gave a new try on pc Debian x86-64 with master sources updated today (42a73e2259d5937ffb8896f7cd24991f83b1ad82)
Comment 20 Julien Nabet 2024-06-06 13:40:32 UTC
Just for the record, I gave a new try with master sources updated today, I got the same.
Comment 21 Justin L 2024-06-07 01:36:21 UTC
proposed fix at https://gerrit.libreoffice.org/c/core/+/168511

Things are more or less in the correct zOrder now. (There is one button-in-a-textframe that should be above the tennis-ball-in-body-text, but I'm not sure how that kind of complexity should be handled).

OOo 3.3 didn't read the textbox or images.
LO 3.5 displayed everything, but rather badly, and on multiple pages.
Comment 22 Commit Notification 2024-06-07 10:41:37 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/69dd3061882971d18bb07e829c20241916f26fc5

NFC related tdf#100037: unify duplicate PropertySets, etc

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 23 Commit Notification 2024-06-07 10:41:39 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/6c2ab0f3ca440f6e10b438e6ee0e235cbe155216

tdf#100037 vml import: add AS_CHAR images to zOrder calculation

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 24 Julien Nabet 2024-06-07 11:06:54 UTC
Thank you Justin,

I gave a try and it's indeed far better since we can read the text which is on top of the ball.
However there's still a pb, the logo "Sport 2000" is cropped at the right (see https://bugs.documentfoundation.org/attachment.cgi?id=125268, the third attachment to see the result on Word).
But perhaps you already have something on mind about this too?
Comment 25 Justin L 2024-06-07 12:25:03 UTC
"tournoi.docx" opens OK if first round-tripped by Word 2010 into its own format (DML-based CompatibilityMode 14).

(In reply to Justin L from comment #21)
> (There is one button-in-a-textframe (Image 20) that should be above
> the tennis-ball-in-body-text (Image 10)  [also mentioned in comment 24]
This particular document would look better if /*LastDuplicateWins*/false, but I doubt it would be correct to do that. In general, AS_CHAR images should never be able to overlap anyway - so if anything the zOrder should probably be tied to the parent fly's zOrder.

IIUC, the DML also just "punts" in the case of IsInShape(), so the last AS_CHAR-in-fly wins, but for VML we are always considered IsInShape, and so far I don't see how to detect that the VML is in something else.
[Not m_StreamStateStack.top().bIsInTextBox or m_StreamStateStack.size() or embedded["<<m_StreamStateStack.top().xEmbedded.is() or HasTopAnchoredObjects() ]
But even then, you just "get lucky" depending on how the flies are positioned. 

In any case, "tournoi.docx" round-trips in LO terribly anyway, so I'm not going to worry too much about an extreme edge case in this emulation game.
Comment 26 Julien Nabet 2024-06-07 13:41:47 UTC
OK fair enough.

Let's put this one to VERIFIED then.
Comment 27 Commit Notification 2024-06-07 22:44:12 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

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

tdf#100037 vml import: set fly-anchored AS_CHARs above fly's zOrder

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 28 Justin L 2024-06-08 01:14:26 UTC
Somehow LO 7.2 fixed the DML version of the unit tests in comment 27
with commit 0e6d963fbca16f98a3dbb6ef2fee3736a89d055b
Author: Attila Bakos (NISZ) on Fri May 7 10:18:01 2021 +0200
    tdf#138141 sw: fix textbox z-order
Comment 29 Julien Nabet 2024-06-08 07:34:27 UTC
(In reply to Commit Notification from comment #27)
> Justin Luth committed a patch related to this issue.
> It has been pushed to "master":
> 
> https://git.libreoffice.org/core/commit/
> f714fb262ad8561afcababf4b7a97dedb1b72c15
> 
> tdf#100037 vml import: set fly-anchored AS_CHARs above fly's zOrder
> ...

Now it's perfect! Thank you Justin! :-)
Comment 30 Commit Notification 2024-09-13 01:46:32 UTC Comment hidden (obsolete)
Comment 31 Commit Notification 2024-09-13 01:46:36 UTC Comment hidden (obsolete)
Comment 32 Julien Nabet 2024-09-13 05:39:53 UTC Comment hidden (no-value)
Comment 33 Commit Notification 2024-09-13 05:51:06 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-24-8":

https://git.libreoffice.org/core/commit/12c6c9166d3ba74e0c22253dd4d8e90a03800a82

tdf#162926 Revert "tdf#100037 vml import: set fly-anchored AS_CHARs...

It will be available in 24.8.2.

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 34 Commit Notification 2024-09-13 05:51:10 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-24-8":

https://git.libreoffice.org/core/commit/679e61934c62744b43a60c73fc4f796d9de144dc

tdf#162926 Revert "tdf#100037 vml import: add AS_CHAR images...

It will be available in 24.8.2.

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 35 Justin L 2024-09-14 14:59:20 UTC
reverted because of bug 162926, where at least one graphics type (or type of import) didn't paint properly. I'm assuming it is a paint or layout issue underlying this, and that my patches were basically correct.