Download it now!
Bug 129841 - XTextTableCursor::setPropertyValue("BackColor", x) sets paragraph background color, not cell background
Summary: XTextTableCursor::setPropertyValue("BackColor", x) sets paragraph background ...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Mike Kaganski
URL:
Whiteboard: target:6.5.0 target:6.4.0.2
Keywords:
Depends on:
Blocks:
 
Reported: 2020-01-06 19:42 UTC by Mike Kaganski
Modified: 2020-01-08 10:47 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2020-01-06 19:42:09 UTC
In a text document insert a table; select several cells in it; run the following BASIC code:

> Sub ColorizeTable1
>   ThisComponent.getCurrentSelection().BackColor = &H00FF0000
> End Sub

Expected result is the cells having red background. Actual result is cells' paragraphs get red background, which makes cells have white spacing.

Compare to

> Sub ColorizeTable2
>   ThisComponent.getTextTables().getByIndex(0).getCellRangeByName("A1:A1").BackColor = &H00FF0000
> End Sub

which correctly does the job.

Both SwXTextTableCursor::setPropertyValue and SwXCellRange::setPropertyValue do the same thing: they check for FN_UNO_TABLE_CELL_BACKGROUND to apply the value to the cells [1]. For SwXCellRange, property name "BackColor" correctly maps to that value. But in case of SwXTextTableCursor, neither "BackColor", nor any other name maps to FN_UNO_TABLE_CELL_BACKGROUND, making it impossible to apply cell color using text table cursor.

The same for getPropertyValue.

Tested in Version: 6.4.0.1 (x64)
Build ID: 1b6477b31f0334bd8620a96f0aeeb449b587be9f
CPU threads: 12; OS: Windows 10.0 Build 18363; UI render: default; VCL: win; 
Locale: ru-RU (ru_RU); UI-Language: en-US
Calc: threaded

and in OpenOffice.org 2.2.0

but not in OpenOffice.org 1.0.3

Regression after https://git.libreoffice.org/core/+/eba784710e92597282a2284b56dce3a45ac38776

[1] https://opengrok.libreoffice.org/xref/core/sw/source/core/unocore/unotbl.cxx?r=24314773
Comment 1 Mike Kaganski 2020-01-06 22:30:53 UTC
https://gerrit.libreoffice.org/c/core/+/86315
Comment 2 Commit Notification 2020-01-07 05:02:39 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

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

tdf#129841: fix GetTextTableCursorPropertyMap cell background values

It will be available in 6.5.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 3 Commit Notification 2020-01-08 10:47:44 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-6-4":

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

tdf#129841: fix GetTextTableCursorPropertyMap cell background values

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