summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2020-02-18 00:23:40 +0100
committerXisco Faulí <xiscofauli@libreoffice.org>2020-03-11 15:14:43 +0100
commit461824307d2ee701f3026f75a9ee5a7865cd6e7a (patch)
tree2882268b58b2c1315f41cb614606ea9872617ca8 /sc
parent35584bd345feb5869676b3eebf1586b248d35c3f (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> (cherry picked from commit bef90981e3f9f9dc3e4731c5bcbab315e52b9baf) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88955 Tested-by: Xisco Faulí <xiscofauli@libreoffice.org> Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc')
-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 877809901297..3fe63c768dac 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 ccdec841233d..164e3f922273 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -3375,12 +3375,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: