Bug 156815 - Renaming a sheet should update ranges in solver models
Summary: Renaming a sheet should update ranges in solver models
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.6.0.2 rc
Hardware: All All
: medium normal
Assignee: Rafael Lima
URL:
Whiteboard: target:24.2.0
Keywords:
Depends on:
Blocks: Solver
  Show dependency treegraph
 
Reported: 2023-08-18 17:50 UTC by Rafael Lima
Modified: 2023-10-12 00:36 UTC (History)
0 users

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 Rafael Lima 2023-08-18 17:50:11 UTC
In solver models that reference cells from other sheets, renaming the referenced sheet should update the cell address in the original model.

Steps to reproduce
1) Create a Calc file with 2 sheets "Sheet1" and "Sheet2"
2) In "Sheet1" go to Tools - Solver and set the target cell to some cell in "Sheet2"
3) Notice that the address will be something like $Sheet2.$E$20 (i.e. starting with "Sheet2" to indicate that the cell is in another sheet; close the Solver dialog
4) Now rename "Sheet2" to some other name, f.i. "NewName"
5) Go back to "Sheet1" (where the model was created) open the Solver dialog and notice that the target cell is still $Sheet2.$E$20

Expected result
The target should have been updated to $NewName.$E$20

This problem happens since LO 7.6+
Comment 1 Rafael Lima 2023-08-18 17:52:13 UTC
I would like to fix this issue, but I don't know how to listen to sheet rename events and respond to them.

Can anyone provide a code pointer or a patch that implemented a similar functionality?
Comment 2 Rafael Lima 2023-09-12 23:27:38 UTC
Here's the proposed patch to fix this issue:

https://gerrit.libreoffice.org/c/core/+/156872
Comment 3 Commit Notification 2023-10-10 22:06:09 UTC
Rafael Lima committed a patch related to this issue.
It has been pushed to "master":

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

tdf#156815 Reset solver settings when a sheet is renamed

It will be available in 24.2.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.