Bug 81956 - FILEOPEN: Z-ordering of GroupShape not preserved properly for docx file.
Summary: FILEOPEN: Z-ordering of GroupShape not preserved properly for docx file.
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.0.0.3 release
Hardware: All All
: medium normal
Assignee: Justin L
URL:
Whiteboard: BSA target:24.8.0
Keywords: filter:docx
: 67759 (view as bug list)
Depends on:
Blocks: VML-Shapes Z-Order
  Show dependency treegraph
 
Reported: 2014-07-31 09:59 UTC by Sushil Shinde
Modified: 2024-04-22 09:53 UTC (History)
8 users (show)

See Also:
Crash report or crash signature:


Attachments
Attached file contain two images. (43.23 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2014-07-31 09:59 UTC, Sushil Shinde
Details
Comparison between Word 2010 (left) and Libreoffice 5.0.0.5 (right) (53.41 KB, image/jpeg)
2015-08-20 12:46 UTC, Xisco Faulí
Details
Screenshot of the example file in Word 2016 and Writer master (59.02 KB, image/png)
2024-04-22 09:53 UTC, Gabor Kelemen (allotropia)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sushil Shinde 2014-07-31 09:59:11 UTC
Created attachment 103740 [details]
Attached file contain two images.

Problem description: In attached file there are two images. In original file first image is behind of second image. But on LO rendered second image behind of first image and exported the same.

Steps to reproduce:
1. Open attached file on latest LO master
2. Save file as docx file again.
3. Open saved file on MS Office

Current behavior:
Z-ordering is rendered/saved incorrectly.

Expected behavior:
LO should render and save z-order properly.

              
Operating System: Ubuntu
Version: 4.4.0.0.alpha0+ Master
Comment 1 Jorendc 2014-07-31 12:03:03 UTC
Synerzip -> NEW
Comment 2 Xisco Faulí 2015-08-20 12:46:57 UTC
Created attachment 118043 [details]
Comparison between Word 2010 (left) and Libreoffice 5.0.0.5 (right)

Problem still present in

Version: 5.0.0.5
Build ID: 1b1a90865e348b492231e1c451437d7a15bb262b
Locale: es-ES (es_ES)

on Windows 7 (64-bit)
Comment 3 QA Administrators 2016-09-20 10:26:05 UTC Comment hidden (obsolete)
Comment 4 Regina Henschel 2017-07-17 13:15:24 UTC
The problem is still present in Version: 5.4.0.0.alpha1+
Build-ID: 8c0be54a7da6262dffe04357121814dd22b5d7fe
CPU-Threads: 4; Betriebssystem:Windows 6.1; UI-Render: Standard; 
TinderBox: Win-x86@62-TDF, Branch:MASTER, Time: 2017-05-15_01:35:45
Gebietsschema: de-DE (de_DE); Calc: group

and in

Version: 6.0.0.0.alpha0+
Build ID: 9f3814af7264ce90685a82cbf4eb015a38f22bf7
CPU threads: 4; OS: Windows 6.1; UI render: default; 
TinderBox: Win-x86@42, Branch:master, Time: 2017-06-28_00:47:42
Locale: de-DE (de_DE); Calc: group

It is an imported error.
Comment 5 Regina Henschel 2017-07-17 13:15:53 UTC Comment hidden (no-value)
Comment 6 Justin L 2017-11-02 14:00:06 UTC
The rose-rings image is placed inside of a textbox (so it gets placed in the foreground instead of the background during import). The 30-image is grouped with various shapes and bits.

If anyone decides to waste their time with this one, also noticed that in LO the people have a transparent background (so that the rings show up behind them), while in MSWord the background is solid white.
Comment 7 QA Administrators 2018-11-03 03:51:00 UTC Comment hidden (obsolete)
Comment 8 QA Administrators 2022-09-30 03:53:52 UTC Comment hidden (obsolete)
Comment 9 Stéphane Guillou (stragu) 2024-01-12 12:36:42 UTC
reproduced in recent trunk build:

Version: 24.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 3cb1ed4339fc9aec414c0f112a69705a7a4d9cc6
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

Using "bring to front" on the People/30 image doesn't even bring it in front of the flower image.
Note that the People/30 image isn't even listed in the Navigator.
Comment 10 Stéphane Guillou (stragu) 2024-01-12 12:46:33 UTC
(In reply to Stéphane Guillou (stragu) from comment #9)
> Using "bring to front" on the People/30 image doesn't even bring it in front
> of the flower image.
That's because it's in the background. It needs to be brought to the foreground first.
> Note that the People/30 image isn't even listed in the Navigator.
Its parts are visible once it's ungrouped (as drawing shapes).
Comment 11 Justin L 2024-01-12 17:53:40 UTC
the flower (MC900412450[1].WMF) has a z-index:251661312 and the two people/30 image (MC900283119[1].WMF) has a higher z-index:251672576, both of which are positive numbers when placed in a sal_Int32.

Likely the proper solution involves NOT letting the floating group shape go into the background? Why is it in the background anyway?
Comment 12 Justin L 2024-01-18 22:09:32 UTC
somewhere in between the 4.0.0 and 4.0.2 timeframe, the 30/couple object changed from being imported as an inline (as-character) thing to an in-the-background floating thing.
Comment 13 Justin L 2024-01-18 23:14:03 UTC
SimpleShape::createPictureObject looks like a good starting point to debug this.
Comment 14 Justin L 2024-04-19 22:41:57 UTC
This "hack a fix" patchset 1 works for this document, but I'm sure it will have bad side effects. I need to have it apply to a groupset only if not in header/footer (since in that case everything should be backgrounded).
Comment 16 Commit Notification 2024-04-20 17:08:15 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/00ef339bfc747897b8e4410fa0aa4397c4e45717

tdf#81956 vml import: put groupshape in foreground if positive z-index

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 17 Gabor Kelemen (allotropia) 2024-04-22 09:27:32 UTC
*** Bug 67759 has been marked as a duplicate of this bug. ***
Comment 18 Gabor Kelemen (allotropia) 2024-04-22 09:51:08 UTC
This still does not look exactly like in Word, but I think the similar bug 100037 covers the remaining issue, with Z-order of VML textbox (imported as TextFrame in Writer) and image.
Comment 19 Gabor Kelemen (allotropia) 2024-04-22 09:53:01 UTC
Created attachment 193798 [details]
Screenshot of the example file in Word 2016 and Writer master