[Libreoffice-commits] core.git: sc/inc sc/qa sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Jul 27 07:26:16 UTC 2018


 sc/inc/dpobject.hxx                |    2 
 sc/qa/unit/ucalc_pivottable.cxx    |  145 ++++++++++++++-----------------------
 sc/source/core/data/dpobject.cxx   |    3 
 sc/source/filter/excel/xipivot.cxx |    2 
 sc/source/filter/xml/xmldpimp.cxx  |    6 -
 sc/source/ui/docshell/dbdocfun.cxx |    4 -
 sc/source/ui/undo/undodat.cxx      |    6 -
 7 files changed, 62 insertions(+), 106 deletions(-)

New commits:
commit 870c5443a5fb5e5981c1916cc2ff09dad984f225
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Jul 26 13:26:56 2018 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Jul 27 09:25:48 2018 +0200

    InsertNewTable always returns true
    
    Change-Id: I28b2cd46bf40011f5f813784bd5c182f18ee103f
    Reviewed-on: https://gerrit.libreoffice.org/58112
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx
index 9ea215f2f9eb..df422a461c97 100644
--- a/sc/inc/dpobject.hxx
+++ b/sc/inc/dpobject.hxx
@@ -392,7 +392,7 @@ public:
     OUString CreateNewName() const;
 
     void FreeTable(const ScDPObject* pDPObj);
-    SC_DLLPUBLIC bool InsertNewTable(ScDPObject* pDPObj);
+    SC_DLLPUBLIC void InsertNewTable(ScDPObject* pDPObj);
     SC_DLLPUBLIC bool HasTable(const ScDPObject* pDPObj) const;
 
     SC_DLLPUBLIC SheetCaches& GetSheetCaches();
diff --git a/sc/qa/unit/ucalc_pivottable.cxx b/sc/qa/unit/ucalc_pivottable.cxx
index 40c72e1b9bd3..01d922201fdf 100644
--- a/sc/qa/unit/ucalc_pivottable.cxx
+++ b/sc/qa/unit/ucalc_pivottable.cxx
@@ -222,8 +222,7 @@ void Test::testPivotTable()
         m_pDoc, ScRange(nCol1, nRow1, 0, nCol2, nRow2, 0), aFields, nFieldCount, false);
 
     ScDPCollection* pDPs = m_pDoc->GetDPCollection();
-    bool bSuccess = pDPs->InsertNewTable(pDPObj);
-    CPPUNIT_ASSERT_MESSAGE("failed to insert a new datapilot object into document", bSuccess);
+    pDPs->InsertNewTable(pDPObj);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one data pilot table.",
                            size_t(1), pDPs->GetCount());
     pDPObj->SetName(pDPs->CreateNewName());
@@ -248,7 +247,7 @@ void Test::testPivotTable()
             { "Total Result", "50", "57", "23", "130" }
         };
 
-        bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "DataPilot table output");
+        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "DataPilot table output");
         CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
     }
     CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be only one data cache.", size_t(1), pDPs->GetSheetCaches().size());
@@ -267,8 +266,7 @@ void Test::testPivotTable()
     // don't reload the cache which should force the copy to use the old data
     // from the cache.
     ScDPObject* pDPObj2 = new ScDPObject(*pDPObj);
-    bSuccess = pDPs->InsertNewTable(pDPObj2);
-    CPPUNIT_ASSERT_MESSAGE("failed to insert a new datapilot object into document", bSuccess);
+    pDPs->InsertNewTable(pDPObj2);
 
     aOutRange = pDPObj2->GetOutRange();
     pDPObj2->ClearTableData();
@@ -287,7 +285,7 @@ void Test::testPivotTable()
             { "Total Result", "50", "57", "23", "130" }
         };
 
-        bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "DataPilot table output (from old cache)");
+        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "DataPilot table output (from old cache)");
         CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
     }
 
@@ -324,7 +322,7 @@ void Test::testPivotTable()
             { "Total Result", "300", "700", "1100", "2100" }
         };
 
-        bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "DataPilot table output (refreshed)");
+        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "DataPilot table output (refreshed)");
         CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
     }
 
@@ -353,8 +351,7 @@ void Test::testPivotTable()
 
     pDPObj = createDPFromRange(
         m_pDoc, ScRange(nCol1, nRow1, 0, nCol2, nRow2, 0), aFields, nFieldCount, false);
-    bSuccess = pDPs->InsertNewTable(pDPObj);
-    CPPUNIT_ASSERT_MESSAGE("failed to insert a new datapilot object into document", bSuccess);
+    pDPs->InsertNewTable(pDPObj);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one data pilot table.",
                            size_t(1), pDPs->GetCount());
     pDPObj->SetName(pDPs->CreateNewName());
@@ -404,8 +401,7 @@ void Test::testPivotTableLabels()
         m_pDoc, ScRange(nCol1, nRow1, 0, nCol2, nRow2, 0), aFields, nFieldCount, false);
 
     ScDPCollection* pDPs = m_pDoc->GetDPCollection();
-    bool bSuccess = pDPs->InsertNewTable(pDPObj);
-    CPPUNIT_ASSERT_MESSAGE("failed to insert a new datapilot object into document", bSuccess);
+    pDPs->InsertNewTable(pDPObj);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one data pilot table.",
                            size_t(1), pDPs->GetCount());
     pDPObj->SetName(pDPs->CreateNewName());
@@ -420,7 +416,7 @@ void Test::testPivotTableLabels()
             { "Total Result", "30", "20", "45", "95" }
         };
 
-        bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "DataPilot table output");
+        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "DataPilot table output");
         CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
     }
 
@@ -460,8 +456,7 @@ void Test::testPivotTableDateLabels()
         m_pDoc, ScRange(nCol1, nRow1, 0, nCol2, nRow2, 0), aFields, nFieldCount, false);
 
     ScDPCollection* pDPs = m_pDoc->GetDPCollection();
-    bool bSuccess = pDPs->InsertNewTable(pDPObj);
-    CPPUNIT_ASSERT_MESSAGE("failed to insert a new datapilot object into document", bSuccess);
+    pDPs->InsertNewTable(pDPObj);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one data pilot table.",
                            size_t(1), pDPs->GetCount());
     pDPObj->SetName(pDPs->CreateNewName());
@@ -478,7 +473,7 @@ void Test::testPivotTableDateLabels()
             { "Total Result", "30", "20", "45", "95" }
         };
 
-        bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "DataPilot table output");
+        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "DataPilot table output");
         CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
     }
 
@@ -543,8 +538,7 @@ void Test::testPivotTableFilters()
         m_pDoc, ScRange(nCol1, nRow1, 0, nCol2, nRow2, 0), aFields, nFieldCount, true);
 
     ScDPCollection* pDPs = m_pDoc->GetDPCollection();
-    bool bSuccess = pDPs->InsertNewTable(pDPObj);
-    CPPUNIT_ASSERT_MESSAGE("failed to insert a new datapilot object into document", bSuccess);
+    pDPs->InsertNewTable(pDPObj);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one data pilot table.",
                            size_t(1), pDPs->GetCount());
     pDPObj->SetName(pDPs->CreateNewName());
@@ -561,7 +555,7 @@ void Test::testPivotTableFilters()
             { "Sum - Val2", "80" }
         };
 
-        bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "DataPilot table output (unfiltered)");
+        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "DataPilot table output (unfiltered)");
         CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
     }
 
@@ -595,7 +589,7 @@ void Test::testPivotTableFilters()
             { "Sum - Val2", "40" }
         };
 
-        bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "DataPilot table output (filtered by page)");
+        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "DataPilot table output (filtered by page)");
         CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
     }
 
@@ -624,7 +618,7 @@ void Test::testPivotTableFilters()
             { "Sum - Val2", "20" }
         };
 
-        bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "DataPilot table output (filtered by query)");
+        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "DataPilot table output (filtered by query)");
         CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
     }
 
@@ -647,7 +641,7 @@ void Test::testPivotTableFilters()
             { "Sum - Val2", "40" }
         };
 
-        bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "DataPilot table output (filtered by page)");
+        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "DataPilot table output (filtered by page)");
         CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
     }
 
@@ -703,8 +697,7 @@ void Test::testPivotTableNamedSource()
     CPPUNIT_ASSERT_MESSAGE("Failed to create a new pivot table object.", pDPObj);
 
     ScDPCollection* pDPs = m_pDoc->GetDPCollection();
-    bSuccess = pDPs->InsertNewTable(pDPObj);
-    CPPUNIT_ASSERT_MESSAGE("failed to insert a new pivot table object into document.", bSuccess);
+    pDPs->InsertNewTable(pDPObj);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one data pilot table.",
                            size_t(1), pDPs->GetCount());
     pDPObj->SetName(pDPs->CreateNewName());
@@ -979,9 +972,7 @@ void Test::testPivotTableDuplicateDataFields()
         m_pDoc, aDataRange, aFields, SAL_N_ELEMENTS(aFields), false);
 
     ScDPCollection* pDPs = m_pDoc->GetDPCollection();
-    bool bSuccess = pDPs->InsertNewTable(pDPObj);
-
-    CPPUNIT_ASSERT_MESSAGE("failed to insert a new pivot table object into document.", bSuccess);
+    pDPs->InsertNewTable(pDPObj);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one data pilot table.",
                            size_t(1), pDPs->GetCount());
     pDPObj->SetName(pDPs->CreateNewName());
@@ -999,7 +990,7 @@ void Test::testPivotTableDuplicateDataFields()
             { "Total Count - Value", nullptr, "10" },
         };
 
-        bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "DataPilot table output");
+        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "DataPilot table output");
         CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
     }
 
@@ -1023,7 +1014,7 @@ void Test::testPivotTableDuplicateDataFields()
             { "Total Result", "411", "10" }
         };
 
-        bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "DataPilot table output");
+        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "DataPilot table output");
         CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
     }
 
@@ -1072,9 +1063,7 @@ void Test::testPivotTableNormalGrouping()
         m_pDoc, aDataRange, aFields, SAL_N_ELEMENTS(aFields), false);
 
     ScDPCollection* pDPs = m_pDoc->GetDPCollection();
-    bool bSuccess = pDPs->InsertNewTable(pDPObj);
-
-    CPPUNIT_ASSERT_MESSAGE("failed to insert a new pivot table object into document.", bSuccess);
+    pDPs->InsertNewTable(pDPObj);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one data pilot table.",
                            size_t(1), pDPs->GetCount());
     pDPObj->SetName(pDPs->CreateNewName());
@@ -1094,7 +1083,7 @@ void Test::testPivotTableNormalGrouping()
             { "Total Result", "28" }
         };
 
-        bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Initial output without grouping");
+        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Initial output without grouping");
         CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
     }
 
@@ -1142,7 +1131,7 @@ void Test::testPivotTableNormalGrouping()
             { "Total Result", nullptr, "28" }
         };
 
-        bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "A, B, C grouped by Group1.");
+        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "A, B, C grouped by Group1.");
         CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
     }
 
@@ -1179,7 +1168,7 @@ void Test::testPivotTableNormalGrouping()
             { "Total Result", nullptr, "28" }
         };
 
-        bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "D, E, F grouped by Group2.");
+        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "D, E, F grouped by Group2.");
         CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
     }
 
@@ -1234,9 +1223,7 @@ void Test::testPivotTableNumberGrouping()
         m_pDoc, aDataRange, aFields, SAL_N_ELEMENTS(aFields), false);
 
     ScDPCollection* pDPs = m_pDoc->GetDPCollection();
-    bool bSuccess = pDPs->InsertNewTable(pDPObj);
-
-    CPPUNIT_ASSERT_MESSAGE("failed to insert a new pivot table object into document.", bSuccess);
+    pDPs->InsertNewTable(pDPObj);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one data pilot table.",
                            size_t(1), pDPs->GetCount());
     pDPObj->SetName(pDPs->CreateNewName());
@@ -1274,7 +1261,7 @@ void Test::testPivotTableNumberGrouping()
             { "Total Result", "1389" }
         };
 
-        bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Order grouped by numbers");
+        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Order grouped by numbers");
         CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
     }
 
@@ -1319,9 +1306,7 @@ void Test::testPivotTableDateGrouping()
         m_pDoc, aDataRange, aFields, SAL_N_ELEMENTS(aFields), false);
 
     ScDPCollection* pDPs = m_pDoc->GetDPCollection();
-    bool bSuccess = pDPs->InsertNewTable(pDPObj);
-
-    CPPUNIT_ASSERT_MESSAGE("failed to insert a new pivot table object into document.", bSuccess);
+    pDPs->InsertNewTable(pDPObj);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one data pilot table.",
                            size_t(1), pDPs->GetCount());
     pDPObj->SetName(pDPs->CreateNewName());
@@ -1391,7 +1376,7 @@ void Test::testPivotTableDateGrouping()
             { "Total Result", nullptr, nullptr, "36" },
         };
 
-        bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Years, quarters and months date groups.");
+        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Years, quarters and months date groups.");
         CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
     }
 
@@ -1419,7 +1404,7 @@ void Test::testPivotTableDateGrouping()
             { "Total Result", nullptr, nullptr, "10" },
         };
 
-        bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Year 2012 data now hidden");
+        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Year 2012 data now hidden");
         CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
     }
 
@@ -1448,7 +1433,7 @@ void Test::testPivotTableDateGrouping()
             { "Total Result", "36" }
         };
 
-        bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Remove all date grouping.");
+        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Remove all date grouping.");
         CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
     }
 
@@ -1492,9 +1477,7 @@ void Test::testPivotTableEmptyRows()
         m_pDoc, aDataRange, aFields, SAL_N_ELEMENTS(aFields), false);
 
     ScDPCollection* pDPs = m_pDoc->GetDPCollection();
-    bool bSuccess = pDPs->InsertNewTable(pDPObj);
-
-    CPPUNIT_ASSERT_MESSAGE("failed to insert a new pivot table object into document.", bSuccess);
+    pDPs->InsertNewTable(pDPObj);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one data pilot table.",
                            size_t(1), pDPs->GetCount());
     pDPObj->SetName(pDPs->CreateNewName());
@@ -1513,7 +1496,7 @@ void Test::testPivotTableEmptyRows()
             { "Total Result", "10" },
         };
 
-        bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Include empty rows");
+        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Include empty rows");
         CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
     }
 
@@ -1535,7 +1518,7 @@ void Test::testPivotTableEmptyRows()
             { "Total Result", "10" },
         };
 
-        bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Ignore empty rows");
+        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Ignore empty rows");
         CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
     }
 
@@ -1561,7 +1544,7 @@ void Test::testPivotTableEmptyRows()
             { "Total Result", "10" },
         };
 
-        bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Ignore empty rows");
+        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Ignore empty rows");
         CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
     }
 
@@ -1619,9 +1602,7 @@ void Test::testPivotTableTextNumber()
         m_pDoc, aDataRange, aFields, SAL_N_ELEMENTS(aFields), false);
 
     ScDPCollection* pDPs = m_pDoc->GetDPCollection();
-    bool bSuccess = pDPs->InsertNewTable(pDPObj);
-
-    CPPUNIT_ASSERT_MESSAGE("failed to insert a new pivot table object into document.", bSuccess);
+    pDPs->InsertNewTable(pDPObj);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one data pilot table.",
                            size_t(1), pDPs->GetCount());
     pDPObj->SetName(pDPs->CreateNewName());
@@ -1639,7 +1620,7 @@ void Test::testPivotTableTextNumber()
             { "Total Result", "10" },
         };
 
-        bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Text number field members");
+        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Text number field members");
         CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
     }
 
@@ -1664,7 +1645,7 @@ void Test::testPivotTableTextNumber()
             { "4", nullptr }
         };
 
-        bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Text number field members");
+        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Text number field members");
         CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
     }
 
@@ -1703,9 +1684,7 @@ void Test::testPivotTableCaseInsensitiveStrings()
         m_pDoc, aDataRange, aFields, SAL_N_ELEMENTS(aFields), false);
 
     ScDPCollection* pDPs = m_pDoc->GetDPCollection();
-    bool bSuccess = pDPs->InsertNewTable(pDPObj);
-
-    CPPUNIT_ASSERT_MESSAGE("failed to insert a new pivot table object into document.", bSuccess);
+    pDPs->InsertNewTable(pDPObj);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one data pilot table.",
                            size_t(1), pDPs->GetCount());
     pDPObj->SetName(pDPs->CreateNewName());
@@ -1720,7 +1699,7 @@ void Test::testPivotTableCaseInsensitiveStrings()
             { "Total Result", "3" },
         };
 
-        bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Case insensitive strings");
+        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Case insensitive strings");
         CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
     }
 
@@ -1794,9 +1773,7 @@ void Test::testPivotTableNumStability()
         m_pDoc, aDataRange, aFields, SAL_N_ELEMENTS(aFields), false);
 
     ScDPCollection* pDPs = m_pDoc->GetDPCollection();
-    bool bSuccess = pDPs->InsertNewTable(pDPObj);
-
-    CPPUNIT_ASSERT_MESSAGE("failed to insert a new pivot table object into document.", bSuccess);
+    pDPs->InsertNewTable(pDPObj);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one data pilot table.",
                            size_t(1), pDPs->GetCount());
     pDPObj->SetName(pDPs->CreateNewName());
@@ -1866,9 +1843,7 @@ void Test::testPivotTableFieldReference()
         m_pDoc, aDataRange, aFields, SAL_N_ELEMENTS(aFields), false);
 
     ScDPCollection* pDPs = m_pDoc->GetDPCollection();
-    bool bSuccess = pDPs->InsertNewTable(pDPObj);
-
-    CPPUNIT_ASSERT_MESSAGE("failed to insert a new pivot table object into document.", bSuccess);
+    pDPs->InsertNewTable(pDPObj);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one data pilot table.",
                            size_t(1), pDPs->GetCount());
     pDPObj->SetName(pDPs->CreateNewName());
@@ -1886,7 +1861,7 @@ void Test::testPivotTableFieldReference()
             { "Total Result", "15" },
         };
 
-        bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Field reference (none)");
+        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Field reference (none)");
         CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
     }
 
@@ -1913,7 +1888,7 @@ void Test::testPivotTableFieldReference()
             { "Total Result", nullptr },
         };
 
-        bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Field reference (difference from)");
+        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Field reference (difference from)");
         CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
     }
 
@@ -1933,7 +1908,7 @@ void Test::testPivotTableFieldReference()
             { "Total Result", nullptr },
         };
 
-        bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Field reference (% of)");
+        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Field reference (% of)");
         CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
     }
 
@@ -1953,7 +1928,7 @@ void Test::testPivotTableFieldReference()
             { "Total Result", nullptr },
         };
 
-        bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Field reference (% difference from)");
+        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Field reference (% difference from)");
         CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
     }
 
@@ -1973,7 +1948,7 @@ void Test::testPivotTableFieldReference()
             { "Total Result", nullptr },
         };
 
-        bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Field reference (Running total)");
+        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Field reference (Running total)");
         CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
     }
 
@@ -1993,7 +1968,7 @@ void Test::testPivotTableFieldReference()
             { "Total Result", "100.00%" },
         };
 
-        bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Field reference (% of column)");
+        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Field reference (% of column)");
         CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
     }
 
@@ -2107,9 +2082,7 @@ void Test::testFuncGETPIVOTDATA()
     }
 
     ScDPCollection* pDPs = m_pDoc->GetDPCollection();
-    bool bSuccess = pDPs->InsertNewTable(pDPObj);
-
-    CPPUNIT_ASSERT_MESSAGE("failed to insert a new pivot table object into document.", bSuccess);
+    pDPs->InsertNewTable(pDPObj);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one data pilot table.",
                            size_t(1), pDPs->GetCount());
     pDPObj->SetName(pDPs->CreateNewName());
@@ -2124,7 +2097,7 @@ void Test::testFuncGETPIVOTDATA()
             { "Total Result", "21" },
         };
 
-        bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Pivot table created for GETPIVOTDATA");
+        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Pivot table created for GETPIVOTDATA");
         CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
     }
 
@@ -2170,8 +2143,7 @@ void Test::testFuncGETPIVOTDATA()
         pDPObj = createDPFromRange(m_pDoc, aDataRange, aFields, SAL_N_ELEMENTS(aFields), false);
     }
 
-    bSuccess = pDPs->InsertNewTable(pDPObj);
-    CPPUNIT_ASSERT_MESSAGE("InsertNewTable failed", bSuccess);
+    pDPs->InsertNewTable(pDPObj);
     aOutRange = refresh(pDPObj);
 
     {
@@ -2186,7 +2158,7 @@ void Test::testFuncGETPIVOTDATA()
             { "Total Count - Value", nullptr,               "6"  },
         };
 
-        bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Pivot table refreshed");
+        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Pivot table refreshed");
         CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
     }
 
@@ -2266,9 +2238,7 @@ void Test::testFuncGETPIVOTDATALeafAccess()
     pDPObj = createDPFromRange(m_pDoc, aDataRange, aFields, SAL_N_ELEMENTS(aFields), false);
 
     ScDPCollection* pDPs = m_pDoc->GetDPCollection();
-    bool bSuccess = pDPs->InsertNewTable(pDPObj);
-
-    CPPUNIT_ASSERT_MESSAGE("failed to insert a new pivot table object into document.", bSuccess);
+    pDPs->InsertNewTable(pDPObj);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one data pilot table.",
                            size_t(1), pDPs->GetCount());
     pDPObj->SetName(pDPs->CreateNewName());
@@ -2285,7 +2255,7 @@ void Test::testFuncGETPIVOTDATALeafAccess()
             { "Total Result",  nullptr,         "10"          },
         };
 
-        bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Pivot table refreshed");
+        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "Pivot table refreshed");
         CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
     }
 
@@ -2363,8 +2333,7 @@ void Test::testPivotTableRepeatItemLabels()
         m_pDoc, ScRange(nCol1, nRow1, 0, nCol2, nRow2, 0), aFields, nFieldCount, false);
 
     ScDPCollection* pDPs = m_pDoc->GetDPCollection();
-    bool bSuccess = pDPs->InsertNewTable(pDPObj);
-    CPPUNIT_ASSERT_MESSAGE("failed to insert a new datapilot object into document", bSuccess);
+    pDPs->InsertNewTable(pDPObj);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one data pilot table.",
                            size_t(1), pDPs->GetCount());
     pDPObj->SetName(pDPs->CreateNewName());
@@ -2390,7 +2359,7 @@ void Test::testPivotTableRepeatItemLabels()
             { "Total Result", nullptr,         nullptr,      "220"         }
         };
 
-        bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "DataPilot table output");
+        bool bSuccess = checkDPTableOutput(m_pDoc, aOutRange, aOutputCheck, "DataPilot table output");
         CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess);
     }
 
@@ -2444,15 +2413,13 @@ void Test::testPivotTableDPCollection()
 
     // Add 2 DP objects
     ScDPObject* pDPObj = createDPFromRange(m_pDoc, aDataRange , aFields, nFieldCount, false);
-    bool bSuccess = pDPs->InsertNewTable(pDPObj);
-    CPPUNIT_ASSERT_MESSAGE("failed to insert a new DP object into document", bSuccess);
+    pDPs->InsertNewTable(pDPObj);
     pDPObj->SetName("DP1"); // set custom name
 
     CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one data pilot table.", size_t(1), pDPs->GetCount());
 
     ScDPObject* pDPObj2 = createDPFromRange(m_pDoc, aDataRange, aFields, nFieldCount, false);
-    bSuccess = pDPs->InsertNewTable(pDPObj2);
-    CPPUNIT_ASSERT_MESSAGE("failed to insert a new DP object into document", bSuccess);
+    pDPs->InsertNewTable(pDPObj2);
     pDPObj2->SetName("DP2"); // set custom name
 
     CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be two DP tables", size_t(2), pDPs->GetCount());
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index 7fa4b2ab1da9..6432ca91531e 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -3788,7 +3788,7 @@ void ScDPCollection::FreeTable(const ScDPObject* pDPObject)
     maTables.erase(std::remove_if(maTables.begin(), maTables.end(), funcRemoveCondition), maTables.end());
 }
 
-bool ScDPCollection::InsertNewTable(ScDPObject* pDPObj)
+void ScDPCollection::InsertNewTable(ScDPObject* pDPObj)
 {
     const ScRange& rOutRange = pDPObj->GetOutRange();
     const ScAddress& s = rOutRange.aStart;
@@ -3796,7 +3796,6 @@ bool ScDPCollection::InsertNewTable(ScDPObject* pDPObj)
     mpDoc->ApplyFlagsTab(s.Col(), s.Row(), e.Col(), e.Row(), s.Tab(), ScMF::DpTable);
 
     maTables.push_back(std::unique_ptr<ScDPObject>(pDPObj));
-    return true;
 }
 
 bool ScDPCollection::HasTable(const ScDPObject* pDPObj) const
diff --git a/sc/source/filter/excel/xipivot.cxx b/sc/source/filter/excel/xipivot.cxx
index 5a6e640d451c..b0452408054b 100644
--- a/sc/source/filter/excel/xipivot.cxx
+++ b/sc/source/filter/excel/xipivot.cxx
@@ -1485,7 +1485,7 @@ void XclImpPivotTable::Convert()
     pDPObj->SetOutRange( aOutRange );
     pDPObj->SetHeaderLayout( maPTViewEx9Info.mnGridLayout == 0 );
 
-    (void)GetDoc().GetDPCollection()->InsertNewTable(pDPObj);
+    GetDoc().GetDPCollection()->InsertNewTable(pDPObj);
     mpDPObj = pDPObj;
 
     ApplyFieldInfo();
diff --git a/sc/source/filter/xml/xmldpimp.cxx b/sc/source/filter/xml/xmldpimp.cxx
index 8d7c731d43e7..3c9a29439652 100644
--- a/sc/source/filter/xml/xmldpimp.cxx
+++ b/sc/source/filter/xml/xmldpimp.cxx
@@ -540,11 +540,7 @@ void SAL_CALL ScXMLDataPilotTableContext::endFastElement( sal_Int32 /*nElement*/
     if ( pDPCollection->GetByName(pDPObject->GetName()) )
         pDPObject->SetName( OUString() );     // ignore the invalid name, create a new name in AfterXMLLoading
 
-    if (!pDPCollection->InsertNewTable(pDPObject))
-    {
-        OSL_FAIL("cannot insert DPObject");
-        DELETEZ( pDPObject );
-    }
+    pDPCollection->InsertNewTable(pDPObject);
 
     SetButtons();
 }
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
index 9f9eccaef9e0..53a902288c3f 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -1457,9 +1457,7 @@ bool ScDBDocFunc::CreatePivotTable(const ScDPObject& rDPObj, bool bRecord, bool
         }
     }
 
-    if (!rDoc.GetDPCollection()->InsertNewTable(pDestObj.release()))
-        // Insertion into collection failed.
-        return false;
+    rDoc.GetDPCollection()->InsertNewTable(pDestObj.release());
 
     rDestObj.ReloadGroupTableData();
     rDestObj.SyncAllDimensionMembers();
diff --git a/sc/source/ui/undo/undodat.cxx b/sc/source/ui/undo/undodat.cxx
index 71f2b11bd7be..5c6c11acbdb8 100644
--- a/sc/source/ui/undo/undodat.cxx
+++ b/sc/source/ui/undo/undodat.cxx
@@ -1460,11 +1460,7 @@ void ScUndoDataPilot::Undo()
         //  re-insert deleted object
 
         ScDPObject* pDestObj = new ScDPObject(*xOldDPObject);
-        if ( !rDoc.GetDPCollection()->InsertNewTable(pDestObj) )
-        {
-            OSL_FAIL("cannot insert DPObject");
-            DELETEZ( pDestObj );
-        }
+        rDoc.GetDPCollection()->InsertNewTable(pDestObj);
     }
 
     if (xNewUndoDoc)


More information about the Libreoffice-commits mailing list