Resolves: tdf#148163 Preserve names of bad cell reference input again
commitea91f8f9b1bccce73a22af8b4c1626ccb834b9d1
authorEike Rathke <erack@redhat.com>
Mon, 6 Jun 2022 12:34:34 +0000 (6 14:34 +0200)
committerXisco Fauli <xiscofauli@libreoffice.org>
Tue, 7 Jun 2022 17:22:35 +0000 (7 19:22 +0200)
tree8dec1fe49d81fa24cc0b411f4d051a809b0258eb
parentb545b6b2bf7e56047211ea4ec974054a522cc2e9
Resolves: tdf#148163 Preserve names of bad cell reference input again

A regression of

    commit e247262327d04ad9933f4af354050f4420c6e303
    CommitDate: Tue Jul 30 23:49:55 2013 -0400

        More on avoiding direct access to data members.

that changed, for example, invalid sheet references

-                aRef.nTab = MAXTAB+3;
+                aRef.SetTabDeleted(true);

The then following

    commit 8a19af57bbcc57a02a7d87c6408d1e3212a6deba
    CommitDate: Tue Jul 30 23:50:03 2013 -0400

        Now nobody accesses reference members directly. Make them private.

changed ScSingleRefData::Valid()

-    return  nCol >= 0 && nCol <= MAXCOL &&
-            nRow >= 0 && nRow <= MAXROW &&
-            nTab >= 0 && nTab <= MAXTAB;
+    return ColValid() && RowValid() && TabValid();

without taking the deleted flags into account, where previous to
commit e247262327d04ad9933f4af354050f4420c6e303 nTab > MAXTAB
fulfilled the condition of not valid.

This makes it necessary to adjust the
TestFormula::testFuncRangeOp() test case that relied on the broken
behaviour.

Change-Id: I42e769ca0d56a2eb786bb6f65917f0c15d082763
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135453
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
(cherry picked from commit 104596d005b32bd2bba15554e8c9ae740327aa46)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135379
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
sc/qa/unit/ucalc_formula.cxx
sc/source/core/tool/refdata.cxx