Bug 52475 - FILEOPEN: RTF file shows wrong character background (highlight) color
Summary: FILEOPEN: RTF file shows wrong character background (highlight) color
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
3.5.4 release
Hardware: Other All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:3.7.0 target:3.6.3
Keywords: filter:rtf, regression
Depends on:
Blocks:
 
Reported: 2012-07-25 09:45 UTC by Martin
Modified: 2015-12-17 12:07 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
problem with this type of files (42.94 KB, application/rtf)
2012-07-25 09:45 UTC, Martin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin 2012-07-25 09:45:11 UTC
Created attachment 64649 [details]
problem with this type of files

LO 3.5.4. opening one RTF file more then 40 minuts and after open the file, the file is corupted. In file have to be highlight some word, but when I opened the file in LO 3.5, there are highlights all words. 
I find this problem also in LO 3.6.0.0 beta. Opening file is so faster, but file is stil corupted. 

In LO 3.3.1 was all OK, and file was opened OK.
Comment 1 Mike Kaganski 2012-09-15 08:49:19 UTC
Please note that this issue is mainly about "corruption", not long opening time. The open time has been largely addressed in 3.6, and is still worked upon in Bug 44736, while the problem with wrong character background color stays.

Apparently the RTF importer ignores \chcbpat0 control word. In the color table of this file, the color 0 is skipped (the \colortbl control word is immediately followed by semicolon); the RTF standard specifies this as "use the default color as color 0" (Word 2007: Rich Text Format (RTF) Specification, version 1.9.1 (http://www.microsoft.com/download/en/details.aspx?id=10725), page 23). But even if I manually define a value for color 0, LO still ignores it. The only way to change the character background (without exiting a group) is to use \chcbpatN, where N>0.
Comment 2 Mike Kaganski 2012-09-15 09:00:14 UTC
* Forgot to mention that the "default color" depends on the context: the default color for text is usually black; while the default for background is usually white. Generally I would expect the default to be the color of this class in the parent element (say, the background of paragraph) or the color of this element style (not the automatic style that has been created when the color has been applied in the previous step).
Comment 3 Roman Eisele 2012-09-26 13:27:41 UTC
(In reply to comment #1)
> Please note that this issue is mainly about "corruption", not long opening
> time. The open time has been largely addressed in 3.6, and is still worked
> upon in Bug 44736, while the problem with wrong character background color
> stays.

Therefore adapted Summary. Added keyword and whiteboard tag.
Comment 4 Roman Eisele 2012-09-26 13:35:03 UTC
@ Miklós:

This bug report about wrong character background = highlight color in a RTF file is interesting, because Mike Kaganski has already provided some thoughts about where exactly the bug is (RTF importer ignores \chcbpat0 control word). Maybe this helps to fix this?

Thank you very much!


Still reproducible with
* LibreOffice 3.6.2.1 and
* current master build (LOdev), pull time 2012-09-24
both on Mac OS X 10.6.8 (x86-64).
Comment 5 Miklos Vajna 2012-09-28 15:21:41 UTC
Mike,

Reproduced thanks. Here is a minimal testdoc to trigger the problem:

{\rtf1
{\colortbl;\red228\green228\blue228;}
before \chcbpat1 highlighted\chcbpat0  after
\par
}

According to the spec, "after" should not be highlighted, but in Writer, it is.

Roman,

As usual, thanks for the keywords.

Miklos
Comment 6 Not Assigned 2012-10-01 09:25:02 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=91f02521b827bf51f04befd45c51736fe4072fba

fdo#52475 fix import of RTF_CHCBPAT with value 0



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 7 Miklos Vajna 2012-10-01 09:27:05 UTC
Resolved in master, -3-6 cherry-pick request: https://gerrit.libreoffice.org/740
Comment 8 Not Assigned 2012-10-01 10:35:30 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "libreoffice-3-6":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=52b6ab689bbeb2611af84b694a98282e58426345&g=libreoffice-3-6

fdo#52475 fix import of RTF_CHCBPAT with value 0


It will be available in LibreOffice 3.6.3.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 9 Roman Eisele 2012-10-02 09:08:35 UTC
VERIFIED as FIXED with latest master build -- LOdev 3.7.0.0.alpha0+, build ID: b966a09, pull time: 2012-10-01 23:33:15, on Mac OS X 10.6.8 (Intel).

Now only short portions of the text show the grey text highlight color, as appropriate.


@ Miklós:
Thank you very much for fixing this!
Comment 10 Robinson Tryon (qubit) 2015-12-17 12:07:46 UTC Comment hidden (obsolete)