Bug 149857 - Cell Styles pane is not visible/accessible/grayed-out when a sheet is protected
Summary: Cell Styles pane is not visible/accessible/grayed-out when a sheet is protected
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.4.0.0 beta1+
Hardware: All Linux (All)
: medium normal
Assignee: Heiko Tietze
URL:
Whiteboard:
Keywords: bibisected, bisected, regression
Depends on:
Blocks:
 
Reported: 2022-07-05 04:56 UTC by Kevin Suo
Modified: 2023-01-08 09:19 UTC (History)
8 users (show)

See Also:
Crash report or crash signature:


Attachments
Style Test.ods (12.57 KB, application/vnd.oasis.opendocument.spreadsheet)
2022-07-05 04:56 UTC, Kevin Suo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Suo 2022-07-05 04:56:20 UTC
Created attachment 181112 [details]
Style Test.ods

Steps to Reproduce:
1. Protect Sheet1.
2. Leave Sheet 2 unprotected, save and reopen.
3. Go to sheet 2, click one cell, try to visit the Cell Styles sidebar pane.

Or, open the attached test file and following step 3.

Current Result:
Cell Styles pane is grayed out.

Expected Result:
Cell Styles pane is not grayed out and I should be able to view or apply cell styles to cells in Sheet 2 since that sheet is not protected.

Version: 7.4.0.0.beta1+ / LibreOffice Community
Build ID: adab2c204f43e0e5b2eaf70a55bdb41ba260574f
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: zh-CN (zh_CN.UTF-8); UI: zh-CN
Calc: threaded

Ubuntu 22.04.

Also in current master.
Comment 1 Kevin Suo 2022-07-05 04:57:55 UTC
Bug does not exist in
Version: 7.3.4.2 / LibreOffice Community
Build ID: 30(Build:2)
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: zh-CN (zh_CN.UTF-8); UI: zh-CN
Ubuntu package version: 1:7.3.4-0ubuntu0.22.04.1
Calc: threaded

Thus this is a regression and need bibisection.
Comment 2 m_a_riosv 2022-07-05 16:57:11 UTC
Works for me
Version: 7.3.4.2 (x64) / LibreOffice Community
Build ID: 728fec16bd5f605073805c3c9e7c4212a0120dc5
CPU threads: 4; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: es-ES (es_ES); UI: en-US Calc: CL
Comment 3 Shinji Enoki 2022-09-07 21:23:05 UTC
Reproduced in 

Version: 7.4.0.3 / LibreOffice Community
Build ID: f85e47c08ddd19c015c0114a68350214f7066f5a
CPU threads: 8; OS: Linux 5.19; UI render: default; VCL: gtk3
Locale: ja-JP (ja_JP.UTF-8); UI: ja-JP
Calc: threaded

There was a report that encountered the same problem on Ask (Japanese)
https://ask.libreoffice.org/t/topic/81418/
Comment 4 raal 2022-09-08 15:22:42 UTC
This seems to have begun at the below commit.
Adding Cc: to Heiko Tietze ; Could you possibly take a look at this one?
Thanks
 0f09d5fafdb0d0a66b0137649c500445aa8d854c is the first bad commit
commit 0f09d5fafdb0d0a66b0137649c500445aa8d854c
Author: Jenkins Build User <tdf@pollux.tdf>
Date:   Wed Mar 16 19:43:12 2022 +0100

    source a3cb71ac80c0c2971e97c033d212cf4e464fa8f0

https://git.libreoffice.org/core/+/a3cb71ac80c0c2971e97c033d212cf4e464fa8f0
Comment 5 Kevin Suo 2022-09-08 16:26:22 UTC
(In reply to raal from comment #4)
I think disabling the cell styles was inspired that since the sheets are protected editing a style may force the cells within the protected sheets to be changed.

If we do not allow the styles (used by the protected sheets) to be modified, then we need to:
1. Detect which styles are used by the protected sheets.
2. Disable the modifying of such styles, but still allow to apply such styles to other cells outside the protected sheets.
3. Allow the modifying of other styles which are not used by any protected sheets.
Comment 6 Heiko Tietze 2022-09-09 12:12:19 UTC
"Regression" by design, see bug 143100.

(In reply to Kevin Suo from comment #5)
> 1. Detect which styles are used by the protected sheets.
> 2. Disable the modifying of such styles, but still allow to apply such
> styles to other cells outside the protected sheets.
> 3. Allow the modifying of other styles which are not used by any protected
> sheets.

For simplicity I think it's acceptable to disable the Cell Styles view for protected sheets. But switching to a normal, unprotected sheet should re-enable it, at least. Feel free to improve my patch - or to revert and implement some better solution.
Comment 7 George Tzan 2022-10-27 10:43:50 UTC
Problem exists in ver. 7.4.2.3.
In ver. 7.3.6.2 function as expected


A protected sheet can contain unprotected cells. It should be possible to apply style to those unprotected cells although sheet is protected.
Comment 8 Kevin Suo 2022-10-27 11:20:55 UTC
Set the version back to 7.4.0.0 beta1+, as this field should reflect the earliest version the bug appears.
Comment 9 Michel Rudelle 2022-11-07 14:30:16 UTC
(In reply to Heiko Tietze from comment #6)
> For simplicity I think it's acceptable to disable the Cell Styles view for
> protected sheets. But switching to a normal, unprotected sheet should
> re-enable it, at least. Feel free to improve my patch - or to revert and
> implement some better solution.

From my point of view, and for simplicity, it would be better to return to the operation prior to 7.4, while waiting to make a more suitable patch. 
When building complex workbooks, we need to be able to work on one sheet and apply existing cell styles or create new ones while keeping other sheets protected from inadvertent changes.
Comment 10 ocleyr2lalune@zaclys.net 2022-12-22 14:19:18 UTC
I reproduce in Version: 7.4.3.2 / LibreOffice Community
Build ID: 1048a8393ae2eeec98dff31b5c133c5f1d08b890
CPU threads: 4; OS: Linux 6.0; UI render: default; VCL: gtk3
Locale: fr-FR (fr_FR.UTF-8); UI: fr-FR
Calc: threaded

Protect cells, sheets, is different than protect styles.
I  understand that when you change a style in use in a protect sheet, this may be effect on the sheet, but this comportment not seems good.
If style in use in a protect sheet need editing, an alert may be use but I'm not sure that editing should be disabled.

Maybe it's a new option to have for the protect sheet diag ?
Comment 11 Heiko Tietze 2023-01-06 10:01:30 UTC
Enough people disagreeing with the modification (compared to one asking for it). Going to revert the patch.
Comment 12 Heiko Tietze 2023-01-08 09:19:50 UTC
Reverted the patch with https://gerrit.libreoffice.org/c/core/+/145118