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

New commits:
commit 94ca402cd1fe2fd9776d08448f7216b7f638e69a
Author:     Tünde Tóth <toth.tu...@nisz.hu>
AuthorDate: Tue Jul 18 15:20:47 2023 +0200
Commit:     László Németh <nem...@numbertext.org>
CommitDate: Tue Jul 25 15:04:01 2023 +0200

    tdf#156174 sc DBData: fix regression of database ranges
    
    Regression from commit 0c0444c44107f1a18f23dd0833d462d8dbf56569
    "tdf#126926 sc DBData: delete the database range".
    
    Change-Id: If6cccc41af42a44cadbb8485bfa5b9a8eca5a757
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154582
    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 44ebf12935bc..4e154f8bbb83 100644
--- a/sc/qa/unit/uicalc/uicalc2.cxx
+++ b/sc/qa/unit/uicalc/uicalc2.cxx
@@ -1446,6 +1446,32 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf155796)
     CPPUNIT_ASSERT_EQUAL(OUString("Sheet1.A1:Sheet1.A3"), aMarkedAreaString);
 }
 
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf156174)
+{
+    createScDoc();
+    ScDocument* pDoc = getScDoc();
+
+    insertNewSheet(*pDoc);
+
+    insertStringToCell("A1", u"1");
+    insertStringToCell("A2", u"2");
+    insertStringToCell("B1", u"3");
+    insertStringToCell("B2", u"4");
+
+    ScDBData* pDBData = new ScDBData("testDB", 1, 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(3)) 
} }));
+    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 ef0902aab3f4..e05a14d0137f 100644
--- a/sc/source/core/tool/refupdat.cxx
+++ b/sc/source/core/tool/refupdat.cxx
@@ -286,12 +286,7 @@ ScRefUpdateRes ScRefUpdate::Update( const ScDocument* 
pDoc, UpdateRefMode eUpdat
             bool bExp = (bExpand && IsExpand( theTab1, theTab2, nTab1, nDz ));
             bCut1 = lcl_MoveStart( theTab1, nTab1, nDz, nMaxTab );
             bCut2 = lcl_MoveEnd( theTab2, nTab1, nDz, nMaxTab );
-            if ( theTab2 < theTab1 )
-            {
-                eRet = UR_INVALID;
-                theTab2 = theTab1;
-            }
-            else if ( bCut1 || bCut2 )
+            if ( bCut1 || bCut2 )
                 eRet = UR_UPDATED;
             if ( bExp )
             {

Reply via email to