Bug 43535 - EDITING: Can't delete unprotected rows in protected document
Summary: EDITING: Can't delete unprotected rows in protected document
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: Other All
: medium enhancement
Assignee: Kohei Yoshida
URL:
Whiteboard: BSA target:5.4.0
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-05 08:53 UTC by Mark C
Modified: 2022-01-28 10:23 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Sample0.ods (8.58 KB, application/vnd.oasis.opendocument.spreadsheet)
2011-12-05 23:04 UTC, Rainer Bielefeld Retired
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mark C 2011-12-05 08:53:24 UTC
Problem description: I can't delete rows that are unprotected in a document with protection turned on

Steps to reproduce:
1. New Spreadsheet
2. Select a number of rows via the row header and unprotect
3. Set sheet protection on the sheet
4. Attempt to delete rows using the row header

Current behavior: I get a 'Protected cells can not be modified' warning

Expected behavior: I should be able to delete the rows since they aren't protected.

Platform (if different from the browser): 
              
Browser: Opera/9.80 (Windows NT 5.1; U; en) Presto/2.9.168 Version/11.52
Comment 1 Rainer Bielefeld Retired 2011-12-05 22:52:07 UTC
I am pretty sure that this is a user error. You can not do changes that would touch position of protected contents, so in my "Sample0.ods" you only can delete rows/columns below/behind the protected cell.

Help and documentation seem to be a little vague concerning these facts, in the Calc Manual under "Cell protection" I read "Use the Cell Protection options to protect cells against certain types of editing"

@Mark C
Please attach a sample document!
Comment 2 Rainer Bielefeld Retired 2011-12-05 23:04:21 UTC
Created attachment 54132 [details]
Sample0.ods

See comment 1!
Comment 3 Mark C 2011-12-06 05:47:03 UTC
I understand what you're saying, but this is different from the behaviour of MS Excel and breaks compatibility with it. Corel's Quattro Pro does have the same behaviour though ;-) interestingly enough.
Your attachment is exactly what I produce as well.

Mark
Comment 4 Mark C 2011-12-06 05:54:37 UTC
MS Office 2010 has more fine-grained control over protection. You can set various levels, including the ability to delete rows, but this affects the whole sheet, whether or not there are protected cells.
Comment 5 Rainer Bielefeld Retired 2011-12-06 11:00:27 UTC
Gnumeric ignores my sheet protection :-(

So at least we should have selectors. Not only  "Protected", but
- Protect Cell(s) contents
- Protect Cell contents' position in the sheet.

For my needs that would be useful. But we additionally have to keep in mind compatibility to other programs and ODF and and...

@David:
Can you help with ODF knowledge or should this be handled by Spreadsheet team?
Comment 6 Joel Madero 2014-07-13 01:33:31 UTC Comment hidden (obsolete)
Comment 7 Mark C 2014-07-13 11:23:46 UTC
This problem is still present on 4.2.5.2 running under Arch Linux.
Comment 8 Kohei Yoshida 2017-05-15 23:39:16 UTC
I'll piggyback on this one.

I'm currently working on adding four new sheet protection options for Calc.  They conditionally support:

* insert columns.
* insert rows.
* delete columns.
* delete rows.

over unprotected cells on a protected sheet, provided that the sheet protection options specifically enable one or more of these options.
Comment 9 Kohei Yoshida 2017-05-17 00:33:45 UTC
The new change will add ods import and export as well.  The xls and xlsx import and export should already be working even without my change.
Comment 10 Commit Notification 2017-05-17 03:19:41 UTC
Kohei Yoshida committed a patch related to this issue.
It has been pushed to "master":

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

tdf#43535: support additional sheet protection options.

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 11 Commit Notification 2017-05-17 03:20:16 UTC
Kohei Yoshida committed a patch related to this issue.
It has been pushed to "master":

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

tdf#43535: add unit test for this.

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 12 Timur 2017-05-17 18:00:36 UTC Comment hidden (obsolete)
Comment 13 Timur 2017-05-17 18:05:23 UTC
What Mark noticed corresponds with unselected "delete rows/columns" now.

Looks like Fixed for Delete. I can't confirm for Insert, there are Insert.. available on all rows even protected. Is it OK? On a second thought, probably yes if given that right.
@Kohei: please add to https://wiki.documentfoundation.org/ReleaseNotes/5.4#Calc but with those details.
Comment 14 Kohei Yoshida 2017-05-17 19:51:29 UTC
(In reply to Timur from comment #13)
> What Mark noticed corresponds with unselected "delete rows/columns" now.
> 
> Looks like Fixed for Delete. I can't confirm for Insert, there are Insert..
> available on all rows even protected. Is it OK?

Yes, if the insert rows option is checked in the dialog, you should be able to insert rows even over the protected region.  I took that behavior from how Excel handles it.
Comment 15 Kohei Yoshida 2017-05-18 02:10:49 UTC
Just added an entry for this enhancement on the release notes page.  I'll mark this as finished.
Comment 16 pierre-yves samyn 2017-05-18 06:12:43 UTC
Hi

(In reply to Kohei Yoshida from comment #15)
> I'll mark this as finished.

Thanks for these new options. Can I ask if access to these options via the API is possible, see Bug 55969

Best regards
Pierre-Yves
Comment 17 Kohei Yoshida 2017-05-18 12:49:07 UTC
(In reply to pierre-yves samyn from comment #16)
> Hi
> 
> (In reply to Kohei Yoshida from comment #15)
> > I'll mark this as finished.
> 
> Thanks for these new options. Can I ask if access to these options via the
> API is possible, see Bug 55969

I have no idea. But since I didn't do anything special to handle the API, it's most likely a "no".  That would be another enhancement that needs to be worked on separately, I'm afraid.
Comment 18 Gauthier 2020-04-13 23:51:44 UTC
Great work! I looked at your patch, sadly I don't understanding it as my programming skills are very limited, to say the list.

Do you know if there is any plans / possibilites to add the following options to select from from when protecting a sheet to allow users to:

- allow to format columns:
   (allowing to hide / unhide columns)
   (allowing to resize columns)

- allow to format rows:
   (allowing to add / unhide rows)
   (allowing to resize rows)

These would be very useful to have and have been in MS Excel since at least Excel 2010.