Kaydet (Commit) b1721b04 authored tarafından Luboš Luňák's avatar Luboš Luňák

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: 's avatarLuboš Luňák <l.lunak@collabora.com>
üst 18ff25ff
......@@ -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;
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment