Issue 128566 - cell displacement problem
Summary: cell displacement problem
Status: RESOLVED FIXED
Alias: None
Product: Calc
Classification: Application
Component: code (show other issues)
Version: 4.1.14
Hardware: All All
: P5 (lowest) Normal (vote)
Target Milestone: 4.1.15
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2023-03-14 15:21 UTC by Olivier Deloris (olivier76000)
Modified: 2023-04-11 09:14 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---
mseidel: 4.1.15_release_blocker?


Attachments
Example of bug (11.87 KB, application/vnd.oasis.opendocument.spreadsheet)
2023-03-14 15:21 UTC, Olivier Deloris (olivier76000)
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description Olivier Deloris (olivier76000) 2023-03-14 15:21:08 UTC
Created attachment 87176 [details]
Example of bug

Good morning,
I allow myself to write to report what I think is a bug on OpenOffice Calc V4.1.14 observed on March 14, 2023.

(sorry, I don't know which item to choose in the "component" section)

I believe there is an issue regarding "moving cell(s)" and dynamic tracking of related formulas.

On the simple example attached, we can notice that the sum in B1 is no longer exact if:
 - we move B1
 - we move the group A1:A10

Works well with V4.1.13

Best regards,
Olivier D
Comment 1 damjan 2023-03-14 15:29:26 UTC
Please provide more info.

By "move", do you mean cut and paste?

Where do you move B1?

Where do you move A1:A10?
Comment 2 Czesław Wolański 2023-03-14 16:16:24 UTC
Example

Cell A1 with value 1
Cell B1 with formula =A1

Select A1 and drag it somewhere e.g. to A4

Result: 
- in 4.1.13 cell B1 show 1  (formula changed to =A4)
- in 4.1.14 cell B1 shows 0 (formula =A1)

I presume a similar problem was raised on the English forum.
topic "OpenOffice 4.1.14: Drag & Drop fails to preserve formulas"

https://forum.openoffice.org/en/forum/viewtopic.php?p=535842&sid=4997e66fa1c6787808007a6b09285670#p535842
Comment 3 Olivier Deloris (olivier76000) 2023-03-14 16:27:04 UTC
(In reply to damjan from comment #1)
> Please provide more info.
> 
> By "move", do you mean cut and paste?
>   -(ctrl Maj and move) or (multiple selection cells)  

> Where do you move B1?
    - B5, for example 
> 
> Where do you move A1:A10?
    - D1:D10 for example
Comment 4 Olivier Deloris (olivier76000) 2023-03-14 16:28:53 UTC
(In reply to Czesław Wolański from comment #2)
> Example
> 
> Cell A1 with value 1
> Cell B1 with formula =A1
> 
> Select A1 and drag it somewhere e.g. to A4
> 
> Result: 
> - in 4.1.13 cell B1 show 1  (formula changed to =A4)
> - in 4.1.14 cell B1 shows 0 (formula =A1)
> 
> I presume a similar problem was raised on the English forum.
> topic "OpenOffice 4.1.14: Drag & Drop fails to preserve formulas"
> 
> https://forum.openoffice.org/en/forum/viewtopic.
> php?p=535842&sid=4997e66fa1c6787808007a6b09285670#p535842

Hello,
yes, it's exactly this problem

Olivier D
Comment 5 damjan 2023-03-14 16:34:34 UTC
Confirming and marking as a regression.

This could be a result of the fix for bug 118023, where cutting and pasting between different documents updates cell references on the wrong document. I never tested drag-moving when fixing that bug. Maybe drag-moving cells supplies different document references, so references do not get updated even though they should be, resulting in this bug?
Comment 6 damjan 2023-04-10 07:30:13 UTC
I think we have to allow:

pCBFCP->pClipDoc->GetClipParam().getSourceDocID() == 0
instead of only:
pCBFCP->pClipDoc->GetClipParam().getSourceDocID() == GetDocumentID()

presumably because when you drag cells, the clipboard source document isn't set.

With that change, dragged cells do preserve formulas, while bug 112023 does not recur.

Issue is thus fixed with commit 3accd9b1ca87d0b4656a691efa455d8f0a24bdc9. Resolving fixed.
Comment 7 damjan 2023-04-10 07:52:44 UTC
Cherry-picked for AOO41X with:
https://github.com/apache/openoffice/commit/90c740b5bc3772cd09423718c8d572588e4187c2
Comment 8 damjan 2023-04-10 07:54:38 UTC
Cherry-picked for AOO42X with:
https://github.com/apache/openoffice/commit/da1c051b9b2cdc4ed9487c3658fa0f9c052ccabb