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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Oct 10 11:01:31 UTC 2018


 sc/source/core/data/formulacell.cxx         |    9 ++++++---
 sc/source/core/data/grouptokenconverter.cxx |    4 ++--
 2 files changed, 8 insertions(+), 5 deletions(-)

New commits:
commit b1721b04d8a921a69230927cd7995d8c5d8f5fe2
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Fri Sep 21 16:07:42 2018 +0200
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Wed Oct 10 13:01:05 2018 +0200

    fix detection of self-references
    
    If the reference points to another sheet, it obviously cannot be
    a self-reference.
    
    Change-Id: I3290660e6ed679c84036ab4e65a55bdb369a64e9
    Reviewed-on: https://gerrit.libreoffice.org/61188
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>

diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 84d0ba952cda..2de9f39afac9 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -4251,7 +4251,7 @@ struct ScDependantsCalculator
 
     bool isSelfReferenceRelative(const ScAddress& rRefPos, SCROW nRelRow)
     {
-        if (rRefPos.Col() != mrPos.Col())
+        if (rRefPos.Col() != mrPos.Col() || rRefPos.Tab() != mrPos.Tab())
             return false;
 
         SCROW nEndRow = mrPos.Row() + mnLen - 1;
@@ -4281,7 +4281,7 @@ struct ScDependantsCalculator
 
     bool isSelfReferenceAbsolute(const ScAddress& rRefPos)
     {
-        if (rRefPos.Col() != mrPos.Col())
+        if (rRefPos.Col() != mrPos.Col() || rRefPos.Tab() != mrPos.Tab())
             return false;
 
         SCROW nEndRow = mrPos.Row() + mnLen - 1;
@@ -4300,8 +4300,11 @@ struct ScDependantsCalculator
     //        isSelfReference[Absolute|Relative]() on both the start and end of the double ref
     bool isDoubleRefSpanGroupRange(const ScRange& rAbs, bool bIsRef1RowRel, bool bIsRef2RowRel)
     {
-        if (rAbs.aStart.Col() > mrPos.Col() || rAbs.aEnd.Col() < mrPos.Col())
+        if (rAbs.aStart.Col() > mrPos.Col() || rAbs.aEnd.Col() < mrPos.Col()
+            || rAbs.aStart.Tab() > mrPos.Tab() || rAbs.aEnd.Tab() < mrPos.Tab())
+        {
             return false;
+        }
 
         SCROW nStartRow    = mrPos.Row();
         SCROW nEndRow      = nStartRow + mnLen - 1;
diff --git a/sc/source/core/data/grouptokenconverter.cxx b/sc/source/core/data/grouptokenconverter.cxx
index ec96c60827cf..a0df06a90f33 100644
--- a/sc/source/core/data/grouptokenconverter.cxx
+++ b/sc/source/core/data/grouptokenconverter.cxx
@@ -20,7 +20,7 @@ using namespace formula;
 
 bool ScGroupTokenConverter::isSelfReferenceRelative(const ScAddress& rRefPos, SCROW nRelRow)
 {
-    if (rRefPos.Col() != mrPos.Col())
+    if (rRefPos.Col() != mrPos.Col() || rRefPos.Tab() != mrPos.Tab())
         return false;
 
     SCROW nLen = mrCell.GetCellGroup()->mnLength;
@@ -46,7 +46,7 @@ bool ScGroupTokenConverter::isSelfReferenceRelative(const ScAddress& rRefPos, SC
 
 bool ScGroupTokenConverter::isSelfReferenceAbsolute(const ScAddress& rRefPos)
 {
-    if (rRefPos.Col() != mrPos.Col())
+    if (rRefPos.Col() != mrPos.Col() || rRefPos.Tab() != mrPos.Tab())
         return false;
 
     SCROW nLen = mrCell.GetCellGroup()->mnLength;


More information about the Libreoffice-commits mailing list