summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2020-02-18 00:23:40 +0100
committerAdolfo Jayme Barrientos <fitojb@ubuntu.com>2020-02-19 11:11:29 +0100
commitbef90981e3f9f9dc3e4731c5bcbab315e52b9baf (patch)
treedc8857155653691bbe49f5155c99d6fcafb6d03e
parent27badf859389b20d03b96e7459a8110bc48224db (diff)
Resolves: tdf#130370 Do not increment sheet-local name on cut&paste / move
This is a combination of 2 commits. Resolves: tdf#130370 Increment sheet-local name only for moved cells Probably that piece of code is not needed at all anymore since moving entire sheets and their names is handled differently nowadays. Needs further investigation. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88898 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins (cherry picked from commit 180fef2a54207555c39fb63ead5e66ba3a71a0cf) Related: tdf#130370 Let cut&paste/move of a sheet-local name reference ... ... reference the original sheet-local name instead of a same name on the destination sheet. In bugdoc https://bugs.documentfoundation.org/attachment.cgi?id=102780 that is the case when cutting Sheet2.B3 and pasting somewhere on Sheet3. That yielded formula =value with result 3. (after the fix of commit 180fef2a54207555c39fb63ead5e66ba3a71a0cf, before it was #NAME?). Now it yields the expected formula =Sheet2.value with result 2. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88939 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins (cherry picked from commit 0c6bf98cd94307ef7b0896e6643be6161691f9c9) d92778ea41544583e885eaccfbf82c26762925a5 Change-Id: I2ac115c18354371d0abbfc6cc972d16edcb41021 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88946 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
-rw-r--r--sc/source/core/data/document10.cxx9
-rw-r--r--sc/source/core/tool/token.cxx6
2 files changed, 6 insertions, 9 deletions
diff --git a/sc/source/core/data/document10.cxx b/sc/source/core/data/document10.cxx
index 2cdc71b3374a..31d2cb7fed89 100644
--- a/sc/source/core/data/document10.cxx
+++ b/sc/source/core/data/document10.cxx
@@ -737,10 +737,13 @@ bool ScDocument::CopyAdjustRangeName( SCTAB& rSheet, sal_uInt16& rIndex, ScRange
ScDocument& rNewDoc, const ScAddress& rNewPos, const ScAddress& rOldPos, const bool bGlobalNamesToLocal,
const bool bUsedByFormula ) const
{
- const bool bSameDoc = (rNewDoc.GetPool() == const_cast<ScDocument*>(this)->GetPool());
- if (bSameDoc && ((rSheet < 0 && !bGlobalNamesToLocal) || (rSheet >= 0 && rSheet != rOldPos.Tab())))
+ ScDocument* pThis = const_cast<ScDocument*>(this);
+ const bool bSameDoc = (rNewDoc.GetPool() == pThis->GetPool());
+ if (bSameDoc && ((rSheet < 0 && !bGlobalNamesToLocal) || (rSheet >= 0
+ && (rSheet != rOldPos.Tab() || (IsClipboard() && pThis->IsCutMode())))))
// Same doc and global name, if not copied to local name, or
- // sheet-local name on other sheet stays the same.
+ // sheet-local name on other sheet stays the same. Sheet-local on
+ // same sheet also in a clipboard cut&paste / move operation.
return false;
// Ensure we don't fiddle with the references until exit.
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 0e5a09e4e7a0..0e8be4de4d2e 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -3379,12 +3379,6 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceOnMove(
SCTAB nOldTab = (*pp)->GetSheet();
if (isNameModified(rCxt.maUpdatedNames, nOldTab, **pp))
aRes.mbNameModified = true;
- if (rCxt.mnTabDelta &&
- rCxt.maRange.aStart.Tab() <= nOldTab && nOldTab <= rCxt.maRange.aEnd.Tab())
- {
- aRes.mbNameModified = true;
- (*pp)->SetSheet( nOldTab + rCxt.mnTabDelta);
- }
}
break;
case ocDBArea: