[Libreoffice-commits] core.git: sc/source

Eike Rathke (via logerrit) logerrit at kemper.freedesktop.org
Tue Feb 18 15:48:24 UTC 2020


 sc/source/core/data/document10.cxx |    9 ++++++---
 sc/source/core/tool/token.cxx      |    9 ---------
 2 files changed, 6 insertions(+), 12 deletions(-)

New commits:
commit 0c6bf98cd94307ef7b0896e6643be6161691f9c9
Author:     Eike Rathke <erack at redhat.com>
AuthorDate: Tue Feb 18 14:10:16 2020 +0100
Commit:     Eike Rathke <erack at redhat.com>
CommitDate: Tue Feb 18 16:47:45 2020 +0100

    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.
    
    Change-Id: Id92778ea41544583e885eaccfbf82c26762925a5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88939
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Jenkins

diff --git a/sc/source/core/data/document10.cxx b/sc/source/core/data/document10.cxx
index a6626867b14c..1afe7a378ac1 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 8f9e9a67b002..a1f6e58a628e 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -3389,15 +3389,6 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceOnMove(
                             SCTAB nOldTab = (*pp)->GetSheet();
                             if (isNameModified(rCxt.maUpdatedNames, nOldTab, **pp))
                                 aRes.mbNameModified = true;
-                            if (rCxt.mnTabDelta && aOldRange.In(rOldPos) &&
-                                    aOldRange.aStart.Tab() <= nOldTab && nOldTab <= aOldRange.aEnd.Tab())
-                            {
-                                /* TODO: this may not be needed at all anymore;
-                                 * investigate when we actually hit the
-                                 * condition. */
-                                aRes.mbNameModified = true;
-                                (*pp)->SetSheet( nOldTab + rCxt.mnTabDelta);
-                            }
                         }
                         break;
                     case ocDBArea:


More information about the Libreoffice-commits mailing list