Bug 114799 - DOCX import: fix missing background color of numbering set by shadowing
Summary: DOCX import: fix missing background color of numbering set by shadowing
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
5.2 all versions
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:7.0.0 target:7.2.0
Keywords: filter:docx
Depends on:
Blocks: DOCX-Lists-Direct-Formatting
  Show dependency treegraph
 
Reported: 2018-01-02 12:52 UTC by Gabor Kelemen (allotropia)
Modified: 2021-03-13 11:01 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments
Example file made with Word 2013 (12.81 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2018-01-02 12:52 UTC, Gabor Kelemen (allotropia)
Details
Similar example in ODT (9.78 KB, application/vnd.oasis.opendocument.text)
2018-01-02 12:53 UTC, Gabor Kelemen (allotropia)
Details
The two files opened in LO 6 master (105.27 KB, image/png)
2018-01-02 12:53 UTC, Gabor Kelemen (allotropia)
Details
The two files in LO after recoloring the numbered paragraphs to red (110.18 KB, image/png)
2018-01-02 12:54 UTC, Gabor Kelemen (allotropia)
Details
Example file saved by LO7 and opened in Word and Writer (121.03 KB, image/png)
2020-04-21 14:12 UTC, NISZ LibreOffice Team
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gabor Kelemen (allotropia) 2018-01-02 12:52:40 UTC
Created attachment 138799 [details]
Example file made with Word 2013

1, Create a simple docx file containing some numbering, add a highlight color to these paragraphs. The numbering gets the same color.
2, Open the file in Writer, try to add a different highlight color to the already colored paragraphs. 
3, The paragraphs text is recolored, but the numbers keep their original color.
4, Saving the file with a different name and reloading it gets the numbers recolored too.

If I start with an odt in LO, the recoloring happens instantly, without saving and reloading.
Comment 1 Gabor Kelemen (allotropia) 2018-01-02 12:53:07 UTC
Created attachment 138800 [details]
Similar example in ODT
Comment 2 Gabor Kelemen (allotropia) 2018-01-02 12:53:47 UTC
Created attachment 138801 [details]
The two files opened in LO 6 master
Comment 3 Gabor Kelemen (allotropia) 2018-01-02 12:54:24 UTC
Created attachment 138802 [details]
The two files in LO after recoloring the numbered paragraphs to red
Comment 4 Gabor Kelemen (allotropia) 2018-01-10 10:40:39 UTC
Just found out this is a dupe :)

*** This bug has been marked as a duplicate of bug 106991 ***
Comment 5 Tamás Zolnai 2018-01-10 13:43:47 UTC
I reopen this bug, see this comment for explanation:
https://bugs.documentfoundation.org/show_bug.cgi?id=106991#c12
Comment 6 Xisco Faulí 2019-03-20 16:31:25 UTC
Also reproduced in

Version: 5.2.0.0.alpha0+
Build ID: 3ca42d8d51174010d5e8a32b96e9b4c0b3730a53
Threads 4; Ver: 4.15; Render: default;
Comment 7 László Németh 2019-05-23 11:55:08 UTC
The recent master has a different, not so serious, but still annoying problem: sometimes the numbering gets the highlighting, sometimes not (ie. it gets the background color of the page).

Changing the highlighting the attached test file removes the highlighting of the numbering, but saving it gives it back.
Comment 8 NISZ LibreOffice Team 2020-04-21 14:12:44 UTC
Created attachment 159787 [details]
Example file saved by LO7 and opened in Word and Writer

Rechecking in current master:

Version: 7.0.0.0.alpha0+ (x64)Build ID: 8c8b3a4f83f67882b284ddc3b3fe10d3fe6dedf4CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: GL; VCL: win; Locale: hu-HU (hu_HU); UI-Language: en-USCalc: CL

Highlight of the numbering is seemingly replaced when the numbered paragraphs get another highlight color/no highlight, but after saving to docx we get different results:
- In Word the original highlight is retained for the numbering
- In Writer no highlight is displayed for the numbering
Comment 9 László Németh 2020-04-30 07:42:17 UTC
tdf#114799 DOCX import: fix missing numbering highlight

opening a DOCX with shadowing (w:shd) instead of highlight
(w:highlight), for example, a DOCX saved in LibreOffice.

This reverts also commit aa02ed306f7c633bbffede16e44e8e736977ace4
(tdf#106991: Highlighting remains after select no fill).
Comment 10 Commit Notification 2020-04-30 07:42:30 UTC
László Németh committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/315d56582f8a56d8f2d3ea6cda63ea4832249608

tdf#114799 DOCX import: fix missing numbering highlight

It will be available in 7.0.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 László Németh 2020-04-30 07:51:52 UTC
Note: after fixing Bug 127606 (DOCX lists: fix unchangeable formatting) and Bug 132351 (DOCX export: fix character formatting of numbering), the remaining problem became the missing background color of numbering after a LO round-trip, caused by w:highlight->w:shd conversion, i.e. missing support of painting shadowing on numbering. The bug description was modified according to this.
Comment 12 BogdanB 2020-05-10 12:58:52 UTC
works as expected

Tested on

Version: 7.0.0.0.alpha1
Build ID: 6a03b2a54143a9bc0c6d4c7f1...
CPU threads: 4; OS: Linux 5.4; UI render: default; VCL: gtk3; 
Locale: ro-RO (ro_RO.UTF-8); UI: en-US
Calc: threaded
Comment 13 Justin L 2021-02-18 13:39:30 UTC
(In reply to BogdanB from comment #12)
> works as expected

I disagree. The round-tripped file might match what LO sees, but not what Word sees. In Word, the numbering has no background colour for two out of the three example documents connected to this bug report.

[My comments below assume 7.0's new default setting to export background as w:shd instead of w:highlight.]

attachment 138799 [details] from comment 0 DOES have character w:highlighting on the number in Word. This seems to be the document that was "fixed" by Laszlo.

A DOCX round-trip of attachment 138800 [details] from comment 1 does NOT have character highlighting on the number in Word. However, LO does highlight it after Laszlo's fix.

The unit test from the fix in comment 10 does NOT have character highlighting on the number in Word on either the original or on the round-tripped file. So it is  a little strange to find the unit test asserting a yellow colour for the number when in Word the yellow is never there.

The problem here is that RES_CHRATR_BACKGROUND can have two different meanings at export time depending on a user setting. A w:shd never impacts the numbering colour. Bug 135774 deals with this further.
Comment 14 BogdanB 2021-02-18 19:00:17 UTC
I checked only the condition from 3. "The paragraphs text is recolored, but the numbers keep their original color." -> this bug solved this problem, but indeed, in Word the number are with one color and the text with other color. In LibreOffice now number and text are toghether.

Version: 7.1.0.3 / LibreOffice Community
Build ID: f6099ecf3d29644b5008cc8f48f42f4a40986e4c
CPU threads: 4; OS: Linux 5.8; UI render: default; VCL: gtk3
Locale: de-DE (ro_RO.UTF-8); UI: en-US
Calc: threaded
Comment 15 Commit Notification 2021-02-23 05:14:33 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/873df086db969cadc66087a5abdb1ff33f2c99f1

tdf#135774, tdf#114799 Char highlight: apply to numbering

It will be available in 7.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 16 Justin L 2021-02-23 05:52:49 UTC
(In reply to Commit Notification from comment #15)
> tdf#135774, tdf#114799 Char highlight: apply to numbering

Just to clarify the intent of this patch:
While this issue discusses CHANGING the background colour, László's patch only tested round-tripping the file. So my patch also only deals with round-tripping files.

Dealing with the user CHANGING the background colour introduces a lot more complexity that needs to be dealt with separately. (Specifically, it introduces a w:highlight of none, which either needs to be removed, or else needs to be recognized and not duplicated by converting the background to a (second) highlight entry.)

I've started work on that with:
-http://gerrit.libreoffice.org/c/core/+/111295 tdf#114799 Char highlight: don't convert imported shading
-http://gerrit.libreoffice.org/c/core/+/111297 tdf#114799 Char highlight: skip convert if highlight exists
Comment 17 Commit Notification 2021-03-01 10:04:06 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/3ab99045e22f82ad8b5d9c862860e4a8a93a52d6

tdf#114799 Char highlight: don't convert imported shading

It will be available in 7.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 18 Commit Notification 2021-03-03 12:39:47 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/01a640ce6f2072e72bcea86695a7ab7cc96a13b6

tdf#114799 Char highlight: skip convert if highlight exists

It will be available in 7.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 19 Commit Notification 2021-03-13 11:01:40 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

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

tdf#135774 Char highlight: partial revert tdf#114799

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