summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2018-09-21 16:07:42 +0200
committerLuboš Luňák <l.lunak@collabora.com>2018-10-10 13:01:05 +0200
commitb1721b04d8a921a69230927cd7995d8c5d8f5fe2 (patch)
tree1bfb15e5746e3a9f5e8735e1ee36a15353dd156a /sc
parent18ff25ff596552ee2755b41af11c9e1ec95fd2e7 (diff)
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@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/formulacell.cxx9
-rw-r--r--sc/source/core/data/grouptokenconverter.cxx4
2 files changed, 8 insertions, 5 deletions
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;