Bug 147868 - "[+] Add New sheet" button should be disabled when "Spreadsheet structure" is protected
Summary: "[+] Add New sheet" button should be disabled when "Spreadsheet structure" is...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.1.5.2 release
Hardware: All All
: medium enhancement
Assignee: Hossein
URL:
Whiteboard: target:7.5.0 target:7.4.0.2
Keywords:
Depends on:
Blocks: Calc-UX
  Show dependency treegraph
 
Reported: 2022-03-09 11:03 UTC by Dmitry INEC
Modified: 2022-12-13 07:43 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Main menu, in Russian (6.90 KB, image/png)
2022-03-28 09:38 UTC, Dmitry INEC
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry INEC 2022-03-09 11:03:35 UTC
Found in 7.1.5, confirmed in 7.3.1.3 - probably all Calc versions having that button

1. Open any workbook
2. Go main menu Tools / Protect sheet structure and check it.
(i am speaking of Russian i18n, so the your menu item names may be slightly different)
3. Go main menu Sheet / Insert new Sheet  -  you would see that the menu items are disabled, OK
4. look down to the sheets tabs, left of them there is [+] button to add new sheet. It is NOT disabled. But clicking on it gives no error - but just a do-nothing. Really confusing!!!


Minimal fix - make the button disabled when "sheet structure protection" is on.

Better fix - make button LOOK disabled, but when user hover or click it - show the actionable hint/message, why this button can not work now, and what to do to re-enable it. 
Same to be with items like main menu Sheet / Insert new Sheet - while looking disabled that should obtain an actionable hint or error message, so user would now how to re-enable them without googling.
Comment 1 Roman Kuznetsov 2022-03-27 17:51:13 UTC
confirm in

Version: 7.4.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 51fb84829afbc1c0957fd1a489085613ad199f1a
CPU threads: 4; OS: Windows 6.1 Service Pack 1 Build 7601; UI render: Skia/Raster; VCL: win
Locale: ru-RU (ru_RU); UI: en-US
Calc: CL Jumbo

but I think it's an enhancement

menu Tools / Protect Spreadsheet structure is a right name in EN UI

Heiko, could it be easyhackable?
Comment 2 Heiko Tietze 2022-03-28 07:01:38 UTC Comment hidden (obsolete)
Comment 3 Roman Kuznetsov 2022-03-28 08:17:17 UTC Comment hidden (obsolete)
Comment 4 Heiko Tietze 2022-03-28 09:01:11 UTC
In svtools/source/control/tabbar.cxx the button m_xAddButton could be set_sensitive() according IsDocEditable() in TabBar::ImplEnableControls() but svtools has no knowledge about ScDocument. The alternative is to come from the other side and send some message to the control in ScTabViewShell::GetStateTable() for FID_INS_TABLE.

Maybe Hossein has an idea how to solve this.
Comment 5 Dmitry INEC 2022-03-28 09:25:05 UTC
But the tabs themselves certainly DO know about the document, otherwise they won't know the count of the sheets, their name, and if renaming a sheet is allowed.

There already is some way for that window footer decoration to communicate with the document object, hopefully it can be found and reused
Comment 6 Dmitry INEC 2022-03-28 09:38:26 UTC
Created attachment 179160 [details]
Main menu, in Russian

> menu Tools / Protect Spreadsheet structure is a right name in EN UI
> He blocks not only one sheet, but all sheets

Hmm... but look at the menu screenshot.

The first item talks about "document", but next two talk about "sheet" (in singular, not in plural)

Does it look like mistranslation? Should there be another ticket on i18n then?
Comment 7 Roman Kuznetsov 2022-04-01 17:41:12 UTC
(In reply to Dmitry INEC from comment #6)
> Created attachment 179160 [details]
> Main menu, in Russian

> Hmm... but look at the menu screenshot.
> 
> The first item talks about "document", but next two talk about "sheet" (in
> singular, not in plural)
> 
> Does it look like mistranslation? Should there be another ticket on i18n
> then?

Yes, please file another ticket about translation
Comment 8 Dmitry INEC 2022-04-04 09:24:43 UTC
> Yes, please file another ticket about translation

#148353
Comment 9 Commit Notification 2022-07-24 13:54:34 UTC
Hossein committed a patch related to this issue.
It has been pushed to "master":

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

tdf#147868 Disable add sheet when structure is protected

It will be available in 7.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 10 Commit Notification 2022-07-25 08:35:59 UTC
Hossein committed a patch related to this issue.
It has been pushed to "libreoffice-7-4":

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

tdf#147868 Disable add sheet when structure is protected

It will be available in 7.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.
Comment 11 Stéphane Guillou (stragu) 2022-12-13 07:43:30 UTC
Fix verified in:

Version: 7.5.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: ad085990b8073a122ac5222e5220f8f1d6826dcf
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded