tdf#152577 sc DBData: fix regression of database ranges
Regression from commit 0c0444c44107f1a18f23dd0833d462d8dbf56569
"tdf#126926 sc DBData: delete the database range".
Change-Id: I04923decdc768770f98763e60cd295400d15c769
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151065
Tested-by: Jenkins
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
diff --git a/sc/qa/unit/uicalc/uicalc2.cxx b/sc/qa/unit/uicalc/uicalc2.cxx
index a09c9b8..69db567 100644
--- a/sc/qa/unit/uicalc/uicalc2.cxx
+++ b/sc/qa/unit/uicalc/uicalc2.cxx
@@ -1395,6 +1395,30 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testAutoSum)
CPPUNIT_ASSERT_EQUAL(OUString("=SUM(B207:D207)"), pDoc->GetFormula(4, 206, 0));
}
CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf152577)
{
createScDoc();
ScDocument* pDoc = getScDoc();
insertStringToCell("A1", u"1");
insertStringToCell("A2", u"2");
insertStringToCell("B1", u"3");
insertStringToCell("B2", u"4");
ScDBData* pDBData = new ScDBData("testDB", 0, 0, 0, 1, 1);
bool bInserted
= pDoc->GetDBCollection()->getNamedDBs().insert(std::unique_ptr<ScDBData>(pDBData));
CPPUNIT_ASSERT(bInserted);
insertNewSheet(*pDoc);
uno::Sequence<beans::PropertyValue> aArgs(
comphelper::InitPropertySequence({ { "Index", uno::Any(sal_uInt16(2)) } }));
dispatchCommand(mxComponent, ".uno:Remove", aArgs);
ScDBCollection* pDBs = pDoc->GetDBCollection();
CPPUNIT_ASSERT(!pDBs->empty());
}
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/tool/refupdat.cxx b/sc/source/core/tool/refupdat.cxx
index 3fce7c7..ef0902a 100644
--- a/sc/source/core/tool/refupdat.cxx
+++ b/sc/source/core/tool/refupdat.cxx
@@ -291,8 +291,6 @@ ScRefUpdateRes ScRefUpdate::Update( const ScDocument* pDoc, UpdateRefMode eUpdat
eRet = UR_INVALID;
theTab2 = theTab1;
}
else if (bCut2 && theTab2 == 0)
eRet = UR_INVALID;
else if ( bCut1 || bCut2 )
eRet = UR_UPDATED;
if ( bExp )