Bug 117957

Summary: [WMF] FILEOPEN SELECTPALETTE is not implemented (7-color palette WMF opens black instead in color)
Product: LibreOffice Reporter: a246246_246-kde
Component: DrawAssignee: Bartosz <gang65>
Status: CLOSED FIXED    
Severity: normal CC: gang65, ilmari.lauhakangas, xiscofauli
Priority: medium    
Version: Inherited From OOo   
Hardware: x86-64 (AMD64)   
OS: All   
Whiteboard: target:7.2.0 target:7.1.4
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 103859    
Attachments: WMF shown in incorrect color.
EMF file opened with MS Word for Mac
WMF file exported to PNG by MS Paint
WMF sample reduced to a single ellipse with pen and brush from pallete of 2 colors
Screenshot of the reduced sample in MS Paint
Reduced sample in LO 72.master from May 11, 2021
WMF sample with mixed palette and regular color usage
Screenshot for mixed palette and regular colors
Comparison LibreOffice 7.1 (KO), LibreOffice 7.2 master (OK) and MSO 2010

Description a246246_246-kde 2018-06-01 13:06:11 UTC
Description:
I got some WMF files from http://www.newviewgraphics.com/dna/dna.zip and got attached file B_DNA.wmf.
This file and other ones are not shown correctly, that means it looks different on mspaint.exe on Windows. On mspaint, I see many ellipses drawn in 4 colors, gray, yellow, blue and red, however in LibreOffice 6.0.4.2 on Windows 7 (x64), they are all in black.

Steps to Reproduce:
1. Open attached file B_DNA.wmf with LibreOffice Draw.
2. Open the same file with mspaint.exe.
3. Compare.

Actual Results:  
Ellipses are drawn in black.

Expected Results:
Ellipses are drawn in color.


Reproducible: Always


User Profile Reset: No



Additional Info:


User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0
Comment 1 a246246_246-kde 2018-06-01 13:07:33 UTC
Created attachment 142476 [details]
WMF shown in incorrect color.
Comment 2 a246246_246-kde 2018-06-01 13:09:48 UTC
I also send this file to Inkscape project because it looks it has the same bug.
https://bugs.launchpad.net/inkscape/+bug/1774430
Comment 3 Xavier Van Wijmeersch 2018-06-01 18:53:20 UTC
Those images are to small to give a correct colorpalet

Gimp reject the image as to small 1x1 px. not loading
Geegie same thing not loading the image
Draw give a black image because there is no color info in these small images
That is what i think, maybe i am wrong, hope so
Comment 4 a246246_246-kde 2018-06-02 02:50:58 UTC
Please check my analyze for this image on the Inkscape forum above.
I see it has 7-color palette.
Comment 5 a246246_246-kde 2018-06-02 03:25:51 UTC
BoundingBox is defined at META_PLACEABLE Record (in WMF spec 2.3.2.3.) 
I see 0xce 0xfe 0xc2 0xf4 0x31 0x01 0x27 0x00, that means left: -305, top: -2878, right: 305, bottom 39, when interpreted as 16-bit signed integer.
Comment 6 Buovjaga 2018-06-21 18:03:13 UTC
Setting to NEW

Already in
Win 10
LibreOffice 3.3.0 
OOO330m19 (Build:6)
tag libreoffice-3.3.0.4
Comment 7 QA Administrators 2019-06-22 02:49:55 UTC Comment hidden (obsolete)
Comment 8 Timur 2020-11-10 08:06:25 UTC
Repro 7.1+.
Comment 9 Bartosz 2021-03-18 14:40:44 UTC
Created attachment 170553 [details]
EMF file opened with MS Word for Mac

It seems that for Microsoft Word for Mac, EMF file is also not displayed correctly.
Comment 10 Bartosz 2021-03-18 22:57:37 UTC
Created attachment 170561 [details]
WMF file exported to PNG by MS Paint
Comment 11 Bartosz 2021-03-19 08:03:32 UTC
The root cause of this issue is missing META_SELECTPALETTE implementation in WMF import. Together with META_CREATEPALETTE it should change the colour properly.
Comment 12 Valek Filippov 2021-05-13 15:16:14 UTC
Created attachment 171963 [details]
WMF sample reduced to a single ellipse with pen and brush from pallete of 2 colors

As per Bartosz request
Comment 13 Valek Filippov 2021-05-13 15:16:42 UTC
Created attachment 171964 [details]
Screenshot of the reduced sample in MS Paint
Comment 14 Valek Filippov 2021-05-13 15:17:10 UTC
Created attachment 171965 [details]
Reduced sample in LO 72.master from May 11, 2021
Comment 15 Valek Filippov 2021-05-13 16:15:09 UTC
Created attachment 171967 [details]
WMF sample with mixed palette and regular color usage
Comment 16 Valek Filippov 2021-05-13 16:17:13 UTC
Created attachment 171968 [details]
Screenshot for mixed palette and regular colors
Comment 17 Commit Notification 2021-05-15 14:53:29 UTC
Bartosz Kosiorek committed a patch related to this issue.
It has been pushed to "master":

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

tdf#117957 WMF Add support for selecting colors from palette

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-05-15 16:16:15 UTC
Bartosz Kosiorek committed a patch related to this issue.
It has been pushed to "libreoffice-7-1":

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

tdf#117957 WMF Add support for selecting colors from palette

It will be available in 7.1.4.

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 Xisco FaulĂ­ 2021-05-17 15:19:55 UTC
Created attachment 172092 [details]
Comparison LibreOffice 7.1 (KO), LibreOffice 7.2 master (OK) and  MSO 2010
Comment 20 Xisco FaulĂ­ 2021-05-17 15:20:43 UTC
Verified in

Version: 7.2.0.0.alpha1+ / LibreOffice Community
Build ID: c781776f3c79bbe3175b1452d26c79ebb931a500
CPU threads: 4; OS: Linux 5.7; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded

@Bartosz, thanks for fixing this issue. Should it be closed as RESOLVED FIXED ?
Comment 21 Commit Notification 2021-05-27 11:10:24 UTC
Bartosz Kosiorek committed a patch related to this issue.
It has been pushed to "master":

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

tdf#117957 WMF Fix failing tests on arm64

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 22 Commit Notification 2021-05-28 07:33:57 UTC
Bartosz Kosiorek committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/9864fbc9d5f532d9aa4742968886b3f94bc44dbc

tdf#117957 WMF Replace ellipses with rects to fix tests on arm64

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 23 Commit Notification 2021-05-28 09:20:18 UTC
Bartosz Kosiorek committed a patch related to this issue.
It has been pushed to "libreoffice-7-1":

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

tdf#117957 WMF Replace ellipses with rects to fix tests on arm64

It will be available in 7.1.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 24 Commit Notification 2021-05-28 09:22:47 UTC
Bartosz Kosiorek committed a patch related to this issue.
It has been pushed to "libreoffice-7-1-4":

https://git.libreoffice.org/core/commit/676ba2babff95da3ac41205bc96d1bf252496d6f

tdf#117957 WMF Replace ellipses with rects to fix tests on arm64

It will be available in 7.1.4.

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.