Bug 74322 - moving named range does not move name reference
Summary: moving named range does not move name reference
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.2.0.4 release
Hardware: Other Windows (All)
: medium normal
Assignee: Kohei Yoshida
URL:
Whiteboard: target:4.3.0 target:4.2.4
Keywords: regression
Depends on:
Blocks:
 
Reported: 2014-02-01 14:14 UTC by Michel Belanger
Modified: 2014-05-04 09:09 UTC (History)
1 user (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 Michel Belanger 2014-02-01 14:14:08 UTC
In Calc, moving named range on sheet level does not update the name reference to the new location in a Cut+Paste.

To reproduce, open a new sheet. Click any cell, name it using the Manage Names, from the menu Insert/Names/Define. Close the Manage Names window.

Click the named cell, do a Cut+Paste. The Cell name did not follow.

Rational: The use of named cell in formula make equation very easy to read. At time it is normal to rearrange the cells and move things around. However if moving a cell does not move its reference makes Named Cells difficult to maintain.
Comment 1 m_a_riosv 2014-02-01 22:32:46 UTC
Hi @Michel, thanks for reporting.

Reproducible with:
Win7x64Ultimate
Version: 4.2.0.4 Build ID: 05dceb5d363845f2cf968344d7adab8dcfb2ba71

This is a regression from
Version: 4.1.6.0.0+ Build ID: 2d0b2cb6b7ca48663d09118acfb01a1dd194a1e

I think it is a MAB.
Comment 2 Markus Mohrhard 2014-02-08 22:05:01 UTC
The problem is not limited to named ranges, it also affects normal formula cells.

I think we miss a call to ScDocument::UpdateReference but need to check that this does not break the new shared formulas.
Comment 3 Kohei Yoshida 2014-02-25 18:06:54 UTC
This is related to Bug 75386 which I'm looking into.  I'll keep this one.
Comment 4 Commit Notification 2014-03-26 02:39:06 UTC
Kohei Yoshida committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=3edc49d11765372fa54c52b71b49bf52675f4dda

fdo#74322: Write unit test for this first.



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 5 Commit Notification 2014-03-26 02:39:19 UTC
Kohei Yoshida committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=003a27a14d5cf65fe0b528b6d6015e37a64dbb8e

fdo#74322: Handle moving of named ranges correctly.



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 6 Kohei Yoshida 2014-03-26 02:41:41 UTC
4.2 backport request: https://gerrit.libreoffice.org/8756
Comment 7 Commit Notification 2014-03-26 10:02:14 UTC
Kohei Yoshida committed a patch related to this issue.
It has been pushed to "libreoffice-4-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=0568f9f55b0054629e86561e96e78ecf13a8df5f&h=libreoffice-4-2

fdo#74322: Handle moving of named ranges correctly.


It will be available in LibreOffice 4.2.4.

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 8 m_a_riosv 2014-04-20 00:45:54 UTC
Thanks Kohei,
cut & paste or move works with:
Win7x64 Ultimated
Version: 4.2.4.1 Build ID: d4c441391e20647b3d2e8dde4d20aa868e77e515
Version: 4.2.5.0.0+ Build ID: cc45204a7a286cef32fc7faf266dc2da235c1ae2
   TinderBox: Win-x86@42, Branch:libreoffice-4-2, Time: 2014-04-17_02:46:49

although undo needs two steps to do it, one for name range and a second for the cell's content.

But doesn't work for me with:
Win7x64 Ultimate
Version: 4.3.0.0.alpha0+ Build ID: 0ce6d9bcea7c37a7cb2c42e8393e2e20780bd171
   TinderBox: Win-x86@39, Branch:master, Time: 2014-04-17_00:11:33

Steps:
- new spreadsheet
- enter 1 in B3
- give a name to B3 in the address box.
- Cut & copy or move B3, the range name remains related to B3.
- Also two steps here for undo.

Please can you review, before reopen.

Maybe a new bug for two steps for undo?.
Comment 9 Kohei Yoshida 2014-04-24 13:30:38 UTC
(In reply to comment #8)

> Steps:
> - new spreadsheet
> - enter 1 in B3
> - give a name to B3 in the address box.
> - Cut & copy or move B3, the range name remains related to B3.
> - Also two steps here for undo.

It's likely unrelated to my change since I didn't touch that part.  So, it's a pre-existing condition.

> Maybe a new bug for two steps for undo?.

Yes.  Filing a new bug for this would be appropriate in my opinion.

Thanks!
Comment 10 m_a_riosv 2014-04-24 23:17:28 UTC
(In reply to comment #9)
> (In reply to comment #8)

> It's likely unrelated to my change since I didn't touch that part.  So, it's
> a pre-existing condition.

?
 
> > Maybe a new bug for two steps for undo?.
> Yes.  Filing a new bug for this would be appropriate in my opinion.
> Thanks!

My misinterpretation, it's fine, one to undo paste and another to undo cut. Drag&drop works with only one undo.
Comment 11 Kohei Yoshida 2014-04-29 13:26:18 UTC
I'll reopen this to handle the remaining issue mentioned in Comment 8.  Looks like the relocation only happens with range references.
Comment 12 Kohei Yoshida 2014-04-29 15:18:27 UTC
(In reply to comment #11)
> I'll reopen this to handle the remaining issue mentioned in Comment 8. 
> Looks like the relocation only happens with range references.

Actually no, the reference update happens only when the moved block is more than just a single cell.  And this doesn't just affect named ranges, but it affects normal references as well.
Comment 13 Kohei Yoshida 2014-04-29 15:25:07 UTC
And the good news is that this appears to be a master only problem.  4.2 doesn't exhibit it.
Comment 14 Commit Notification 2014-04-29 15:43:28 UTC
Kohei Yoshida committed a patch related to this issue.
It has been pushed to "master":

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

fdo#74322: Additional test for the followup issue.



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 15 Commit Notification 2014-04-29 15:43:40 UTC
Kohei Yoshida committed a patch related to this issue.
It has been pushed to "master":

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

fdo#74322: Let's not handle cut mode here.



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 16 Kohei Yoshida 2014-04-29 15:44:09 UTC
It should be good now on the master branch.
Comment 17 m_a_riosv 2014-05-04 02:23:04 UTC
Thanks Kohei,
Verified with:
Win7x64
Version: 4.3.0.0.alpha1+ Build ID: 20778b037c688759a4dc46acb8aeb66c9d1290cc
   TinderBox: Win-x86@39, Branch:master, Time: 2014-05-03_23:16:12