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

Eike Rathke erack at redhat.com
Fri Apr 1 11:25:03 UTC 2016


 sc/source/core/data/formulacell.cxx |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 8dc3b88b567d5fc4a75453654da860c47ae16403
Author: Eike Rathke <erack at redhat.com>
Date:   Fri Apr 1 13:16:41 2016 +0200

    copy used names to other doc, not only referencing sheet; tdf#56518
    
    Change-Id: I434663a2ffe9b0565cabcf210c643ec57c7ba07b

diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index ac877f8..725ad88 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -453,7 +453,7 @@ MightReferenceSheet mightRangeNameReferenceSheet( ScRangeData* pData, SCTAB nRef
  */
 bool findRangeNamesReferencingSheet( sc::UpdatedRangeNames& rIndexes, const FormulaToken* pToken,
         const ScDocument* pDoc, SCTAB nGlobalRefTab, SCTAB nLocalRefTab,
-        SCTAB nOldTokenTab, SCTAB nOldTokenTabReplacement, int nRecursion)
+        SCTAB nOldTokenTab, SCTAB nOldTokenTabReplacement, bool bSameDoc, int nRecursion)
 {
     const sal_uInt16 nTokenIndex = pToken->GetIndex();
     SCTAB nTokenTab = pToken->GetSheet();
@@ -489,7 +489,7 @@ bool findRangeNamesReferencingSheet( sc::UpdatedRangeNames& rIndexes, const Form
     if (!pCode)
         return false;
 
-    bool bRef = false;
+    bool bRef = !bSameDoc;  // include every name used when copying to other doc
     if (nRecursion < 126)   // whatever.. 42*3
     {
         for (const FormulaToken* p = pCode->First(); p; p = pCode->Next())
@@ -497,7 +497,7 @@ bool findRangeNamesReferencingSheet( sc::UpdatedRangeNames& rIndexes, const Form
             if (p->GetOpCode() == ocName)
             {
                 bRef |= findRangeNamesReferencingSheet( rIndexes, p, pDoc, nGlobalRefTab, nLocalRefTab,
-                        nOldTokenTab, nOldTokenTabReplacement, nRecursion+1);
+                        nOldTokenTab, nOldTokenTabReplacement, bSameDoc, nRecursion+1);
             }
         }
     }
@@ -712,7 +712,7 @@ void adjustRangeName(formula::FormulaToken* pToken, ScDocument& rNewDoc, const S
             const SCTAB nOldTokenTabReplacement = nOldTab;
             sc::UpdatedRangeNames aReferencingNames;
             findRangeNamesReferencingSheet( aReferencingNames, pToken, pOldDoc,
-                    nGlobalRefTab, nLocalRefTab, nOldTokenTab, nOldTokenTabReplacement, 0);
+                    nGlobalRefTab, nLocalRefTab, nOldTokenTab, nOldTokenTabReplacement, bSameDoc, 0);
             if (bEarlyBailOut && aReferencingNames.isEmpty(-1) && aReferencingNames.isEmpty(nOldTokenTabReplacement))
                 return;
 


More information about the Libreoffice-commits mailing list