Bug 160072 - Inconsistent handling of objects on Calc sheets with select all (Delete, clear contents, copy-paste)
Summary: Inconsistent handling of objects on Calc sheets with select all (Delete, clea...
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.5.5.2 release
Hardware: All All
: medium minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: needsUXEval
Depends on:
Blocks:
 
Reported: 2024-03-06 18:29 UTC by jollytall
Modified: 2024-03-08 19:36 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jollytall 2024-03-06 18:29:21 UTC
It is not clear how and when objects (like charts, formula objects) are linked to the actual sheet they appear on.
One would expect that either an object is "part" of the sheet, or it should be totally independent. In the current implementation it is mixed.
When on a sheet everything is selected (e.g. clicking on the rectangle next to A1, or Ctrl-A) then objects are included in the selection. So, when the selection is pasted on another sheet, the objects go with it.
Similarly, when the full selection is cut into the clipboard (Ctrl-X) then all cells AND the objects are removed.
However, when all is selected and deleted (either with Del, or with right-mouse Delete...) then the objects remain on the - otherwise empty - sheet.
It has a strange side-effect, that if a sheet is Ctrl-A, Ctrl-C and another sheet is also Ctrl-A, Ctrl-V then the objects on the target sheet remain there. So, when e.g. a sheet with fresh data or changed formulas are copied again and again onto the same other sheet, on top of each others many copies of the object might appear.
It seems that Ctrl-A, right-mouse Clear Contents... might have a solution to the problem, because there objects can be checked or unchecked for deletion.
I would recommend to always do the same for copy, cut, delete and overwrite-with-paste. Either the objects need to be copied/deleted separately (manually), or they are always moved with the sheet and no multiple copies can appear.
Comment 1 Stéphane Guillou (stragu) 2024-03-07 05:10:27 UTC
Thanks for splitting this from bug 159800, jollytall.

My first reaction was:

Ctrl + A -> Delete is different to Ctrl + A -> Ctrl + X. This feels inconsistent (also with the Writer behaviour), but I some users' workflows might rely on a way to modify all cells without affecting objects...

However, as you noticed, we've got two ways to remove things in Calc (whereas Writer does not seem to make the distinction):
- Delete: directly removes cell contents
- Backspace (same as "Clear Contents" in context menu): offers a dialog. The default removes text, date & time, comments, numbers, formulas - which matches what Delete does. But one can pick and choose what gets deleted, and can delete absolutely everything with one tick of a box. Options are remembered, so it's then easy to Backspace + Enter.

(In reply to jollytall from comment #0)
> It has a strange side-effect, that if a sheet is Ctrl-A, Ctrl-C and another
> sheet is also Ctrl-A, Ctrl-V then the objects on the target sheet remain
> there.
It think this has to be the case, as the objects are two separate elements, with different names assigned to them, as can be seen in the navigator. One can't expect LO to replace an object just because it is of same type and is anchored to the same cell. And a single cell can have as many objects anchored to it as we desire.
Paste Special gives a large number of options to decide exactly what is pasted.
It's different for cell contents, as it is straight-forward to understand the model of pasting cell contents over others at the same coordinates.

So leaning towards "resolved - not a bug", but set back to "unconfirmed" if you still think something needs changing. Copying the UX/Design team in just in case.
Comment 2 jollytall 2024-03-07 08:59:03 UTC
Thanks,

As I look more and more into it, it gets even more confusing. Cells can have a lot of elements attached to and they are handled all differently with Del, Cut, Paste and Fill

What     Cut              Del           Clear          Paste             Fill
                                        (default)      (onto it)
------------------------------------------------------------------------------------------

Cell     Removed          Removed       Removed        Overwritten       Smart overwritten
(text or number)                                       (even if source empty)
Format   Removed          Left          Left           Overwritten       Overwritten
Formula  Removed          Removed       Removed        Overwritten       Smart overwritten
Comments Removed          Removed       Removed        OW only if        Not touched        
                                                       source has comment
                                                       otherwise leave
                                                       even when cell changes
Objects  Removed          Left          Left           Left and copied   Left
                                                       on top of it

As it can be seen, there are no two identical rows. This to me is still considered inconsistent.
Del and the default value of Clear is the same, while it would be logic that the two work differently (at least when the default is used). It worth mentioning that "Delete" and "Clear" are used somewhat synonyms. The pop-up menu that can be activated through right-mouse and "CLEAR Contents..." has a title "DELETE Contents". Also, although it is true that "options are remembered" as you say, it is only true until the program is closed. It is not stored neither as a program setting (as e.g. Paste Special options are stored), nor as a file related setting (like e.g. the last active sheet/cell).

Whatever the best approach is, I think it should be consistent. As an easy recommendation I would say that there should be a clear definition what are core elements of a cell and what are not. Core elements should always go with the cell, when a cell is deleted, copied, pasted, filled, etc., while non-core elements should not be touched unless they are selected specially.
In this approach my personal approach would be that value, formula, format and also comment(!) should definitely be linked to a cell. Objects are a bit more tricky, but I would also include those and so those would also be deleted with Del, but also with Paste if the object is linked to the target cell (for this it would be good to see somehow what cell is an object linked to). However if the developers think different elements to be "core" to a cell, it would be fine, as long as it is consistent.

A bit more complicated solution would be to have a "Select Special..." like "Paste Special..." and "Clear Contents..."  and thus the user could decide what to pick-up for Delete, Cut and Paste.

Also on the target of a paste I would differentiate if a target cell is selected or not. If on the target sheet the target area (a part of the sheet or even Ctrl-A) is selected then it should be cleared (again clear all elements that are considered core to the cell - with or without the objects as discussed above) and then paste should take place. If the target area is not selected (paste is done relative to the active target cell), then only those cells should be overwritten where the source has a cell with at least one core element (but then again All core elements of the target cell should go, before the paste). This way it could not happen that a cell is changed totally (value, formula, format), but the old comment stays.

And last, - it might be another improvement request, if you agree, but I do not want to spam the database, - it would be nice to have in the Options - Load/Save a setting set what to save in the document and what to save with the system. As said above, Clear Content options are not saved at all, while Paste Special options are saved with the main Calc, so when in one document once I do a Paste Spacial with Transpose, then a week later in a totally different project it is still there.
Comment 3 jollytall 2024-03-07 09:01:24 UTC
The table fell apart. Try again.

What     Cut          Del         Clear          Paste             Fill
                                 (default)      (onto it)
------------------------------------------------------------------------------------------

Cell     Removed      Removed     Removed        Overwritten       Smart overwritten
(text or number)                            (even if source empty)
Format   Removed      Left        Left           Overwritten       Overwritten
Formula  Removed      Removed     Removed        Overwritten       Smart overwritten
Comments Removed      Removed     Removed        OW only if        Not touched        
                                              source has comment
                                               otherwise leave
                                             even when cell changes
Objects  Removed      Left        Left           Left and copied   Left
                                                  on top of it
Comment 4 Heiko Tietze 2024-03-07 10:36:08 UTC
You stumble over the fact that copy/paste of a range does not include the associated chart while selecting all does. And you describe the issue as "it's not clear how and when objects are linked", probably with the idea to show an anchor like known from Writer. We do exactly this but only if the object is anchored to cell and not to page (and you need to show the anchor but this option is on by default). But even then you don't get the chart copied in case of the selection. And I don't think it should be done - and it is a slightly different topic - but up for discussion.
Comment 5 jollytall 2024-03-07 11:03:57 UTC
Well, not exactly.
An object might be anchored to the sheet, and still it IS copied when a RANGE is selected (not all sheet), but only if it is selected in a way that the full object is within the range. You do not need to select the object separately, it goes with the cells if all cells under the object is copied.
It leads a bit farther, but when an object is selected then normally it is marked with orange dots. Still if I copy cells under it in a way that not all the object is in it (i.e. the object is not selected, not copied) OR I copy cells under it in a way that the whole object is in it (i.e. the object is selected and copied), there is no difference in marking. It cannot be seen that the object is selected or not. It would probably be a good step to mark the object (with the orange dots or with the animated dashes like the cells) if it is selected and copied.

Btw. In the meantime I checked what Excel does. If I copy a sheet with an object on it, the object is copied to a new sheet, while the objects on the target sheet is not deleted. So, it can be copied over and over again many times (just like us). However the chart data is still linked to the source sheet and it is not moved with the object. So I think Calc is better.
Also, I tried what Delete and Cut does there. Delete works the same way as in Calc (i.e. leaves the object on the sheet), but Cut is different. There Cut removes the object as well, BUT ONLY when the cut data is Pasted somewhere. You cannot do what in Calc is possible, to Cut and then Escape, so to easily remove a sheet or a part of it with the objects on it, with a simple click. So, again, I think Calc is better.
Comment 6 Heiko Tietze 2024-03-08 10:55:13 UTC
(In reply to jollytall from comment #5)
> An object might be anchored to the sheet, and still it IS copied when a
> RANGE is selected (not all sheet), but only if it is selected in a way that
> the full object is within the range.
Do you think we should remove the unexpected feature to copy an object just because it's inconsistent?

> However the chart data is still linked to the source sheet and it is not moved
> with the object. So I think Calc is better.
Which could be seen as an inconsistency too. If you copy just the chart from Sheet A to B the absolute data range $Sheet1.$A$1:$A$3 remains and you get the data from sheet A. If you copy data+chart to C the range will be adjusted, although it is defined as absolute.

IMO: touching any of this will make many users unhappy.
Comment 7 jollytall 2024-03-08 19:36:48 UTC
I never had a problem with the object being copied, and I did not comment on it. I do not think we should make users unhappy.
I had two issues:
- The original was that if an object is considered part of a sheet or attached to some cells, then it should be treated consistently, i.e. if I select it, it should also be deleted with Del. I do not see why Cut should be different than Del.
- In your quoted sentence I just replied to your comment that selecting cells does not select the object, while actually selecting enough cells, selects the object as well. My issue here was again not the fact that it can be copied, but that it cannot be deleted the same way. That led me to the thought that it would be logic to see when the object is selected and when it is not.

Thinking more on it, this highlights why the current working is inconsistent. Imagine that a selection is always clearly visible (orange dots or animated dashes), what probably would be good anyway.
What would we see now when Ctrl-A? This is one step and should only have one result, either or:
Option 1. If the object is marked selected (so it should be selected!) then why it is not deleted when I press Del?
Option 2. If the object is not marked selected (so it surely is not selected) then why is it Cut, Copied, when I press Ctrl-X or Ctrl-C?

I still think that there should be one answer. I personally do not have a preference, whether Option 1 or 2 is better, but I think it should be marked on the object. If it were marked then the user could also easily add the object to the selection (in case of Option 2) with a Ctrl-Click or similarly could remove it (Option 1) before Del, Ctrl-X, Ctrl-C.