Bug 86253

Summary: Copying & paste special / Paintbrush of conditional formatting applies to wrong cell range
Product: LibreOffice Reporter: Kevin Suo <suokunlong>
Component: SpreadsheetAssignee: Markus Mohrhard <markus.mohrhard>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: medium CC: batavist, lazylogic
Version: 4.3.3.2 releaseKeywords: regression
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
See Also: https://bugs.freedesktop.org/show_bug.cgi?id=82503
Whiteboard: bibisectRequest target:4.4.0.0.beta2 target:4.3.6
i915 platform: i915 features:
Attachments: test ods file with conditional formatting for A1:C6

Description Kevin Suo 2014-11-13 14:27:14 UTC
Created attachment 109414 [details]
test ods file with conditional formatting for A1:C6

Steps to reproduce:

1. Download and save the attached test ods file. This file contains conditional formatting in cells A1:A6. You can observe the conditions by going to "Format - Conditional Formatting - Manage".

2. Open the saved file, then either:
 * Copy A1, then paste special only "formatting" to C1; or
 * Select A1, click the paintbrush, then apply to C1.

--> Conditional formatting is correctly applied to C1. A new formatting condition is created with the range "C1". This is expected.

3. But, if you do the following:
 * Copy A1, then paste special only "formatting" to C1:C17; or
 * Select A1, click the paintbrush, then apply to C1:C17.

--> Cell formatting for C1:C17 is changed. But, if you go to "Format - Conditional Formatting - Manage", you will see that a new formatting condition is created with the range "C1:C6", rather than "C1:C17". This is wrong behavior.

4. Further, if you save the file modified by step 3, then reopen, you see that cell formatting for C7:C17 are lost. (Of course this is because of the wrong behavior as discussed above in step 3.)

Version: 4.4.0.0.alpha2+
Build ID: c1358e5dc875bb923f4b5472ba615ebd19f0d057
Fedora 20 X64.

Also reproducible with
4.3.4.1
Build ID: bc356b2f991740509f321d70e4512a6a54c5f243 
xubuntu 14.04 64bit

I see that the main codes for conditional formatting is at:
http://cgit.freedesktop.org/libreoffice/core/tree/sc/source/core/data/conditio.cxx
and the recent changes to this file is:
http://cgit.freedesktop.org/libreoffice/core/log/sc/source/core/data/conditio.cxx

Not much changes to this source file, so it may be easier to find the bad commit.

(This bug was first reported at the Chinese LibreOffice discussion forum and was confirmed:
http://www.libreofficechina.org/thread-774-1-1.html
Comment 1 jmxhyz 2014-11-14 11:34:23 UTC
Also reproducible with
 4.3.3.2
Build ID: 9bb7eadab57b6755b1265afa86e04bf45fbfc644
xubuntu 14.04 64bit
Comment 2 Kevin Suo 2014-11-14 13:39:22 UTC
Set version to 4.3.3.2 according to comment 1.
Also jmxhyz pointed out in the chinese forum that it works OK in version 4.2.6.2, so it's a regression.
Comment 3 Markus Mohrhard 2014-11-29 19:48:55 UTC
*** Bug 85701 has been marked as a duplicate of this bug. ***
Comment 4 Markus Mohrhard 2014-11-29 20:13:56 UTC
Ok. I have a fix for this. Another case where our performance improvement for single cell copy&paste has introduced a conditional format regression.
Comment 5 Commit Notification 2014-11-30 00:14:48 UTC
Markus Mohrhard committed a patch related to this issue.
It has been pushed to "libreoffice-4-4":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=e429686c7797ce6e219dd8cd2dbbb1b59f8909da&h=libreoffice-4-4

we need to copy the condition format cell for cell, fdo#86253

It will be available in 4.4.0.0.beta2.

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 6 Markus Mohrhard 2014-11-30 00:24:41 UTC
review request for 4-3 in gerrit. Patch is also in master but the server reboot dropped the notification
Comment 7 Commit Notification 2014-12-01 09:24:51 UTC
Markus Mohrhard committed a patch related to this issue.
It has been pushed to "libreoffice-4-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=e6b9f1c7364bca5a63d4185b7c4ff10e8feecd2c&h=libreoffice-4-3

we need to copy the condition format cell for cell, fdo#86253

It will be available in 4.3.6.

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 8 Markus Mohrhard 2014-12-04 00:32:11 UTC
*** Bug 84927 has been marked as a duplicate of this bug. ***

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.