Bug 106242 - FORMATTING: Conditional formatting wrongly copied (on 1st sheet only)
Summary: FORMATTING: Conditional formatting wrongly copied (on 1st sheet only)
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
5.3.0.0.alpha0+
Hardware: All All
: medium normal
Assignee: Markus Mohrhard
URL:
Whiteboard: target:5.4.0
Keywords: bibisected, bisected, regression
: 106230 106334 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-02-28 21:30 UTC by Stefan_Lange_KA@T-Online.de
Modified: 2017-03-27 18:57 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
zip-File with 2 spreadsheets to reproduce resp. demonstrate the error (227.58 KB, application/x-zip-compressed)
2017-02-28 21:30 UTC, Stefan_Lange_KA@T-Online.de
Details
zip-file with 4 spreadsheets to demonstrate the test results (421.21 KB, application/x-zip-compressed)
2017-03-18 14:55 UTC, Stefan_Lange_KA@T-Online.de
Details
zip-file with 4 screenshots (892.53 KB, application/x-zip-compressed)
2017-03-19 10:13 UTC, Stefan_Lange_KA@T-Online.de
Details
zip-file with 2 spreadsheets and 2 screenshots to demonstrate the test (93.88 KB, application/x-zip-compressed)
2017-03-27 18:57 UTC, Stefan_Lange_KA@T-Online.de
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan_Lange_KA@T-Online.de 2017-02-28 21:30:28 UTC
Created attachment 131545 [details]
zip-File with 2 spreadsheets to reproduce resp. demonstrate the error

There is a problem with conditional formatting at copy + paste of more than one cell on the first or unique sheet of a spreadsheet document:

When a complete row should be copied to an other row and the first cell of the row to copy is with conditional formatting (= difference to bug 106230), the conditional formatting of the first cell is copied to all other cells of the target row. When there were yet other conditional formattings in the row to copy, they are lost. This is visible via Conditional formatting -> Manage.
See attached file "altix_Nummern_klein_V3_Row copied.ods": row 133 sheet "Altix I bis III" and especially cell C133!

Reproduce the error:
1. open the file "altix_Nummern_klein_V3.ods" from the attached zip-File
2. go to the first sheet ("Altix IV und V") 
3. insert a row before e.g. row 133
4. copy row 132 and paste it to row 133

Actual result:
- Color of cell C133 is Magenta
- some other cells in row 133 are missformatted (alignment and/or color Magenta)
- Conditional formatting -> Manage: for all cells xxx133 exists the same format condition as for A133

Expected result:
- Row 133 should look like row 132
- Conditional formatting -> Manage: condional formatting should exist only for A133, A134;A5:A132, C133 and C134;C5:C132 (for C133 same expression as for C134;C5:C132)

Problem was reproduced with with LO 5.3.0 (release), LO 5.3.1 rc1,
Version: 5.4.0.0.alpha0+
Build-ID: 08750abc64a7ad82cac96adeb7a0bcdce7ac704d
CPU-Threads: 2; BS-Version: Windows 6.2; UI-Render: Standard; 
TinderBox: Win-x86@62-merge-TDF, Branch:MASTER, Time: 2017-02-28_00:02:28
Gebietsschema: de-DE (de_DE); Calc: group

and also with LO 5.2.5 (release) and LO 5.2.6.1 (rc1).

The bug is similar to Bug 106230 - maybe a duplicate. But because the problem of Bug 106230 is not reproducible with LO 5.2.5 and LO 5.2.6.1, I am not sure.
Comment 1 Xisco Faulí 2017-03-02 11:43:33 UTC
Regression introduced by:

author	Markus Mohrhard <markus.mohrhard@googlemail.com>	2016-09-24 23:01:16 (GMT)
committer	Markus Mohrhard <markus.mohrhard@googlemail.com>	2016-09-25 23:05:48 (GMT)
commit 8a11d34c7e08218b5ff9da4870c460297f312332 (patch)
tree 1aa048423a4773426fee571f050b02be55c58019
parent cda8ce18310c2c32166e03acd5e2a852b960a892 (diff)
tdf#91312, don't forget to delete the old cond format indices

Adding Cc: to Markus Mohrhard
Comment 2 Xisco Faulí 2017-03-02 11:47:59 UTC
*** Bug 106230 has been marked as a duplicate of this bug. ***
Comment 3 Stefan_Lange_KA@T-Online.de 2017-03-02 13:15:31 UTC
I haven't seen until now that as version should be entered the earliest affected version. I had entered always this version where I have seen a problem the first time.

I think that 5.3.0.0.alpha0+ as earliest affected version is not correct for this bug, because I can reproduce the error also with 5.2.5 (release), 5.2.6.1 (rc1) and - seen today - also 5.2.6.2 (rc2).

I have tested once again the duplicate (?) Bug 106230: This bug doesn't occur in versions 5.2.5, 5.2.6.1 and 5.2.6.2.
Comment 4 Markus Mohrhard 2017-03-16 20:16:29 UTC
Once again more fun with the CopyOneCellFromClip specialization. This time it is about the handling of 1RxNC ranges in the clipboard and 1RxMC ranges in the target.

I think I have a solution but need to implement some tests to make sure that this case is handled correctly. The handling of 1RxNC source ranges requires also some additional testing.
Comment 5 Markus Mohrhard 2017-03-16 21:03:22 UTC
Fixed it and a few related cases. Including some test cases for the special cases.
Comment 6 Commit Notification 2017-03-17 02:33:02 UTC
Markus Mohrhard committed a patch related to this issue.
It has been pushed to "master":

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

CopyOneCellFromClip also copies one row ranges, tdf#106242

It will be available in 5.4.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 Commit Notification 2017-03-17 02:33:07 UTC
Markus Mohrhard committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=36d7e21c00d59eead018ad8ef339847a782b9734

add test for tdf#106242

It will be available in 5.4.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 8 Commit Notification 2017-03-17 02:33:12 UTC
Markus Mohrhard committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=1bffa5e110772a7d6183ac64e56c23f2c3019f93

add more conditional format one cell to range tests, related tdf#106242

It will be available in 5.4.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 9 Stefan_Lange_KA@T-Online.de 2017-03-18 14:55:20 UTC
Created attachment 131987 [details]
zip-file with 4 spreadsheets to demonstrate the test results

Test with 
Version: 5.4.0.0.alpha0+
Build ID: f2efe33f71a8c092a19e3a27a85ac9057ebdca64
CPU threads: 2; OS: Windows 6.19; UI render: default; 
TinderBox: Win-x86@42, Branch:master, Time: 2017-03-18_00:11:52
Locale: de-DE (de_DE); Calc: group

I have tested as described in the bug description of this bug with file "altix_Nummern_klein_V3.ods" and as described in the description of the duplicate Bug 106230 with the file "altix_Nummern_klein_V2.ods".

Result:
The conditional formatting is now correctly copied also on the first sheet. This can be checked by Format - Conditional Formatting - Manage, see files "altix_Nummern_klein_V3_Row copied_new_test.ods" and "altix_Nummern_klein_V2_Rows_copied_new_test.ods" in the attached zip-file "Cond_Format_Files_new_test.zip"!

Problem:
Except the cells in the first column A the copied conditional formatting doesn't work immediately after the paste, but only after the file is saved, closed and reopened. It affects the cells C133 in "altix_Nummern_klein_V3_Row copied_new_test.ods" and B21 and D21 in "altix_Nummern_klein_V2_Rows_copied_new_test.ods".
I don't know if this behavior is related to the patch or if it is a separate Bug (to report or already reported). 
Addition: When the conditional formatting is "condensed" (edited) by Format - Conditional Formatting - Manage, the conditional formatting in the copied cells works immediately after the OK of the Manage Dialog without save the document.
Comment 10 Stefan_Lange_KA@T-Online.de 2017-03-19 10:13:21 UTC
Created attachment 132006 [details]
zip-file with 4 screenshots

To show the problem noted in Comment 9 I have repeated the test and I have made screenshots after the paste and after the files were saved, closed and reopened:
- "V3_after_paste.JPG" and "V3_after_reopen.JPG": Screenshots from test with "altix_Nummern_klein_V3.ods"
- "V2_after_paste.JPG" and "V2_after_reopen.JPG": Screenshots from test with "altix_Nummern_klein_V2.ods"

Test was repeated with
Version: 5.4.0.0.alpha0+
Build ID: 96a9b38db5fd9c21bffe4274fa7d5083d4bc2ee9
CPU threads: 2; OS: Windows 6.19; UI render: default; 
TinderBox: Win-x86@42, Branch:master, Time: 2017-03-18_23:07:25
Locale: de-DE (de_DE); Calc: group
Comment 11 Markus Mohrhard 2017-03-25 00:36:26 UTC
*** Bug 106334 has been marked as a duplicate of this bug. ***
Comment 12 Stefan_Lange_KA@T-Online.de 2017-03-27 18:57:41 UTC
Created attachment 132198 [details]
zip-file with 2 spreadsheets and 2 screenshots to demonstrate the test

I have made an additional test related to the problem described in Comment 9 (on the 1st sheet of a spreadsheet copied cells with conditional formatting are displayed correctly formatted only in the 1st column) and I have found, that the problem only exists, when a single row is copied.

I have created the attached simple spreadsheet "Test_Cond_Format.ods" with 2 sheets and conditional formatting in Columns A, C, E and G on both sheets.
Then I have copied on both sheets
- a single row to a single row
- a single row to more than one row
- more than one row to more than one row

on sheet "Tabelle2":
--------------------
- row 6 to row 9, row 3 to row 11
- rows 1 ... 7 to rows 14 ... 20, rows 1 ..2 to rows 22 ... 23
Result: All copied cells are displayed correctly formatted after Copy+Paste!
see screenshot "Screenshot_Tabelle2_after_Copy+Paste.PNG"

on sheet "Tabelle1":
--------------------
source = single row
- row 2 to row 9, row 5 to row 11, row 6 to row 15
- row 1 to rows 30 ... 31
Result: Only cells in the first column A are displayed correctly formatted in the copied rows.
source = more than 1 row
- rows 1 ... 7 to rows 17 ... 23
- rows 1 ... 2 to rows 26 ... 27 
Result: Copied cells are displayed correctly formatted after Copy+Paste!
for both see screenshot "Screenshot_Tabelle1_after_Copy+Paste.PNG"

After the spreadsheet is saved, closed and reopened, all copied cells on sheet "Tabelle1" are displayed correctly formatted, see attached file "Test_Cond_Format_Test_LO_5.4.0+.ods"!