sc/qa/unit/ucalc_formula.cxx | 4 ++-- sc/source/core/tool/refdata.cxx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
New commits: commit 104596d005b32bd2bba15554e8c9ae740327aa46 Author: Eike Rathke <er...@redhat.com> AuthorDate: Mon Jun 6 14:34:34 2022 +0200 Commit: Eike Rathke <er...@redhat.com> CommitDate: Mon Jun 6 16:55:21 2022 +0200 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 <er...@redhat.com> Tested-by: Jenkins diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index 6bad4a40127c..e1df10374d43 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -7415,8 +7415,8 @@ void TestFormula::testFuncRangeOp() // have to be adapted. aPos.IncRow(); m_pDoc->SetString( aPos, "=SUM(B1:Sheet2.B2:Sheet3.B3)"); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "SUM(#REF!.B2:#REF!.B3)", "Wrong formula."); - CPPUNIT_ASSERT_EQUAL( OUString("#REF!"), m_pDoc->GetString(aPos)); + ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "SUM(b1:sheet2.b2:Sheet3.B3)", "Wrong formula."); + CPPUNIT_ASSERT_EQUAL( OUString("#NAME?"), m_pDoc->GetString(aPos)); aPos.IncRow(); m_pDoc->SetString( aPos, "=SUM(Sheet1.B1:Sheet3.B2:Sheet2.B3)"); diff --git a/sc/source/core/tool/refdata.cxx b/sc/source/core/tool/refdata.cxx index ec18dc06f598..8bd55dfc92ec 100644 --- a/sc/source/core/tool/refdata.cxx +++ b/sc/source/core/tool/refdata.cxx @@ -129,7 +129,7 @@ bool ScSingleRefData::IsDeleted() const bool ScSingleRefData::Valid(const ScDocument& rDoc) const { - return ColValid(rDoc) && RowValid(rDoc) && TabValid(); + return !IsDeleted() && ColValid(rDoc) && RowValid(rDoc) && TabValid(); } bool ScSingleRefData::ColValid(const ScDocument& rDoc) const