Bug 118983 - inserting columns or rows changes global named ranges on different sheets if expand references is on and insertion touches the edge (ignoring sheet)
Summary: inserting columns or rows changes global named ranges on different sheets if ...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
5.4.7.2 release
Hardware: All All
: medium normal
Assignee: Eike Rathke
URL:
Whiteboard: target:6.2.0 target:6.1.1 target:6.0.7
Keywords: bibisected, bisected, regression
Depends on:
Blocks:
 
Reported: 2018-07-29 08:18 UTC by Oliver Brinzing
Modified: 2018-08-22 07:34 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
namedranges_expand_ref_demo.ots (12.46 KB, application/vnd.oasis.opendocument.spreadsheet-template)
2018-07-29 08:18 UTC, Oliver Brinzing
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Oliver Brinzing 2018-07-29 08:18:47 UTC
Created attachment 143810 [details]
namedranges_expand_ref_demo.ots

inserting columns on a sheet will extend global named ranges defined 
on other sheets, if option:
LibreOffice Calc/General
[x] Expand references when new columns/rows are inserted

is enabled.

this does not happen with LO 4.4.7.2/AOO 4.1.5.

steps to reproduce:
- open attached spreadsheet
- check named range "TEST" - it will point to $Test.$A$3:$D$7
- select [InsertColumns with ExpandReferences enabled]
  (the macro will insert 3 columns at named range B_X and copy
   range B_CPY into the inserted ranges.)
- check namedrange "TEST" - it will now point to $Test.$A$3:$G$7

i would expect, that inserting columns on sheet "Demo" will not
change named ranges on other sheets.

steps to reproduce with ExpandReference disabled:
- open attached spreadsheet
- check named range "TEST" - it will point to $Test.$A$3:$D$7
- select [InsertColumns with ExpandReferences disabled]
- check namedrange "TEST" - it will still point to $Test.$A$3:$D$7
Comment 1 Oliver Brinzing 2018-07-29 08:51:21 UTC
just noticed:

to reproduce *without* macro:
- open attached spreadsheet
- *enable* option:
  LibreOffice Calc/General
  [x] Expand references when new columns/rows are inserted
- select column headers E:G
- context menu "Insert columns left"
- check namedrange "TEST" - it will now point to $Test.$A$3:$G$7

btw: "B_CPY" will expand cause the inserting position
is at the edge of the range. this is correct.
Comment 2 raal 2018-07-30 17:20:51 UTC
This seems to have begun at the below commit.
Adding Cc: to Eike Rathke ; Could you possibly take a look at this one?
Thanks

c2f1aa2930785d707d1cf9b72d6eec16215d5f3a is the first bad commit
commit c2f1aa2930785d707d1cf9b72d6eec16215d5f3a
Author: Jenkins Build User <tdf@pollux.tdf>
Date:   Sat Dec 9 14:27:17 2017 +0100

    source sha:02e69f0c3acec2c2e81692bc53c4356591a84ba5

author	Eike Rathke <erack@redhat.com>	2016-01-26 16:10:06 +0100
committer	Eike Rathke <erack@redhat.com>	2016-01-26 16:13:48 +0100
commit	02e69f0c3acec2c2e81692bc53c4356591a84ba5 (patch)
tree	0948a83669adf3cba101186fe7ca5d2758692b1d
parent	2a3a9dec50068321125e4a76de7042bf2d741bc7 (diff)
Resolves: tdf#93151 handle ExpandRefs and mnColDelta the same as mnRowDelta
Comment 3 Eike Rathke 2018-08-15 13:14:12 UTC
Investigating.
Comment 4 Eike Rathke 2018-08-17 10:03:17 UTC
So inserting rows at the end of such constellation was always similar wrong..
Comment 5 Commit Notification 2018-08-17 17:25:08 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

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

Resolves: tdf#118983 do not expand range if sheet references not affected

It will be available in 6.2.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 6 Eike Rathke 2018-08-17 17:27:13 UTC
Pending review
https://gerrit.libreoffice.org/59271 for 6-1
https://gerrit.libreoffice.org/59272 for 6-0
Comment 7 Oliver Brinzing 2018-08-18 15:18:07 UTC
just did a quick test with 

Version: 6.2.0.0.alpha0+ (x64)
Build ID: 991ff3d6205d8b594701c9df537cf8f0a629a92d
CPU threads: 4; OS: Windows 10.0; UI render: default; 
Locale: de-DE (de_DE); Calc: threaded

with "[x] Expand references when new columns/rows are inserted"
- inserting rows/columns above/left will expand the range
- inserting rows/columns below/right will not expand the range
- global named ranges defined on other sheets are not affected

so this bug seems to be fixed.
Comment 8 Aron Budea 2018-08-18 23:45:36 UTC
Let's mark as verified, thanks for the confirmation, and to Eike for the fix!
Comment 9 Commit Notification 2018-08-22 07:25:21 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-6-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=826b2d68ee3985144e68966dc29bb3433d22b4d5&h=libreoffice-6-1

Resolves: tdf#118983 do not expand range if sheet references not affected

It will be available in 6.1.1.

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 10 Commit Notification 2018-08-22 07:34:44 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-6-0":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=211e4a9e03ef5f1c7c26617859435285d2699339&h=libreoffice-6-0

Resolves: tdf#118983 do not expand range if sheet references not affected

It will be available in 6.0.7.

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.