[Libreoffice-commits] core.git: sc/source
Eike Rathke
erack at redhat.com
Wed Jun 21 17:43:53 UTC 2017
sc/source/core/tool/token.cxx | 59 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 59 insertions(+)
New commits:
commit 6580e171ad054dca38f55822e67a400191cecdf5
Author: Eike Rathke <erack at redhat.com>
Date: Wed Jun 21 19:42:36 2017 +0200
Resolves: tdf#108671 mark named expression single reference #REF! if deleted
Probably broken already since
commit f77c9d5b3cb65d9c2e2417f60bec1113feac50e1
Date: Mon Jul 29 14:47:07 2013 -0400
Change-Id: If90a959d000a1bf5ab0804deb22d5cfad413ea5e
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 1bc6c217077a..3cbbc966a3e9 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -3660,6 +3660,65 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceInName(
case svSingleRef:
{
ScSingleRefData& rRef = *p->GetSingleRef();
+ if (rCxt.mnRowDelta < 0)
+ {
+ // row(s) deleted.
+
+ if (rRef.IsRowRel())
+ // Don't modify relative references in names.
+ break;
+
+ ScAddress aAbs = rRef.toAbs(rPos);
+
+ if (aAbs.Col() < rCxt.maRange.aStart.Col() || rCxt.maRange.aEnd.Col() < aAbs.Col())
+ // column of the reference is not in the deleted column range.
+ break;
+
+ if (aAbs.Tab() > rCxt.maRange.aEnd.Tab() || aAbs.Tab() < rCxt.maRange.aStart.Tab())
+ // wrong tables
+ break;
+
+ const SCROW nDelStartRow = rCxt.maRange.aStart.Row() + rCxt.mnRowDelta;
+ const SCROW nDelEndRow = nDelStartRow - rCxt.mnRowDelta - 1;
+
+ if (nDelStartRow <= aAbs.Row() && aAbs.Row() <= nDelEndRow)
+ {
+ // This reference is deleted.
+ rRef.SetRowDeleted(true);
+ aRes.mbReferenceModified = true;
+ break;
+ }
+ }
+ else if (rCxt.mnColDelta < 0)
+ {
+ // column(s) deleted.
+
+ if (rRef.IsColRel())
+ // Don't modify relative references in names.
+ break;
+
+ ScAddress aAbs = rRef.toAbs(rPos);
+
+ if (aAbs.Row() < rCxt.maRange.aStart.Row() || rCxt.maRange.aEnd.Row() < aAbs.Row())
+ // row of the reference is not in the deleted row range.
+ break;
+
+ if (aAbs.Tab() > rCxt.maRange.aEnd.Tab() || aAbs.Tab() < rCxt.maRange.aStart.Tab())
+ // wrong tables
+ break;
+
+ const SCCOL nDelStartCol = rCxt.maRange.aStart.Col() + rCxt.mnColDelta;
+ const SCCOL nDelEndCol = nDelStartCol - rCxt.mnColDelta - 1;
+
+ if (nDelStartCol <= aAbs.Col() && aAbs.Col() <= nDelEndCol)
+ {
+ // This reference is deleted.
+ rRef.SetColDeleted(true);
+ aRes.mbReferenceModified = true;
+ break;
+ }
+ }
+
if (adjustSingleRefInName(rRef, rCxt, rPos, nullptr))
aRes.mbReferenceModified = true;
}
More information about the Libreoffice-commits
mailing list