[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sc/source
Eike Rathke
erack at redhat.com
Sun Jul 2 02:57:05 UTC 2017
sc/source/core/tool/token.cxx | 59 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 59 insertions(+)
New commits:
commit 777103737f9b20f680d9c9f3d0610e91383f7499
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
(cherry picked from commit 6580e171ad054dca38f55822e67a400191cecdf5)
Reviewed-on: https://gerrit.libreoffice.org/39072
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index bf25d135f728..584502f17c1f 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -3640,6 +3640,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