sc/qa/unit/uicalc/uicalc2.cxx    |   24 ++++++++++++++++++++++++
 sc/source/core/tool/refupdat.cxx |    2 --
 2 files changed, 24 insertions(+), 2 deletions(-)

New commits:
commit b88d11ba05085002cf847d4828ded52a3dfb3b09
Author:     Tünde Tóth <toth.tu...@nisz.hu>
AuthorDate: Wed Apr 26 15:31:46 2023 +0200
Commit:     László Németh <nem...@numbertext.org>
CommitDate: Thu Apr 27 18:58:32 2023 +0200

    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 <nem...@numbertext.org>
    Reviewed-by: László Németh <nem...@numbertext.org>

diff --git a/sc/qa/unit/uicalc/uicalc2.cxx b/sc/qa/unit/uicalc/uicalc2.cxx
index a09c9b8e20e9..69db567f305c 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 3fce7c714423..ef0902aab3f4 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 )

Reply via email to