diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-11-10 10:22:39 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-11-10 10:31:36 +0100 |
commit | de29ac09535d814e4be7e1bf0f10beb9f0f847e3 (patch) | |
tree | 139f75d657cb825622e812254b8b7df4e509140b /sc/qa | |
parent | 60c40af090e420a8619b5236bde1ff4ef79100c6 (diff) |
loplugin:nullptr (automatic rewrite)
Change-Id: I765d2a600f9c57da50c85354688e3ae796750d94
Diffstat (limited to 'sc/qa')
-rw-r--r-- | sc/qa/extras/htmlexporttest.cxx | 2 | ||||
-rw-r--r-- | sc/qa/extras/macros-test.cxx | 2 | ||||
-rw-r--r-- | sc/qa/extras/sccondformats.cxx | 12 | ||||
-rw-r--r-- | sc/qa/unit/copy_paste_test.cxx | 6 | ||||
-rw-r--r-- | sc/qa/unit/helper/csv_handler.hxx | 2 | ||||
-rw-r--r-- | sc/qa/unit/helper/qahelper.cxx | 16 | ||||
-rw-r--r-- | sc/qa/unit/helper/qahelper.hxx | 6 | ||||
-rw-r--r-- | sc/qa/unit/rangelst_test.cxx | 2 | ||||
-rw-r--r-- | sc/qa/unit/subsequent_export-test.cxx | 14 | ||||
-rw-r--r-- | sc/qa/unit/subsequent_filters-test.cxx | 26 | ||||
-rw-r--r-- | sc/qa/unit/test_ScChartListenerCollection.cxx | 10 | ||||
-rw-r--r-- | sc/qa/unit/ucalc.cxx | 156 | ||||
-rw-r--r-- | sc/qa/unit/ucalc_formula.cxx | 56 | ||||
-rw-r--r-- | sc/qa/unit/ucalc_pivottable.cxx | 196 | ||||
-rw-r--r-- | sc/qa/unit/ucalc_sharedformula.cxx | 4 | ||||
-rw-r--r-- | sc/qa/unit/ucalc_sort.cxx | 54 |
16 files changed, 282 insertions, 282 deletions
diff --git a/sc/qa/extras/htmlexporttest.cxx b/sc/qa/extras/htmlexporttest.cxx index 1151070b0e29..58936c878e4d 100644 --- a/sc/qa/extras/htmlexporttest.cxx +++ b/sc/qa/extras/htmlexporttest.cxx @@ -74,7 +74,7 @@ public: void testHtmlSkipImage() { // need a temp dir, because there's an image exported too - TempFile aTempDir(0, true); + TempFile aTempDir(nullptr, true); OUString const url(aTempDir.GetURL()); TempFile aTempFile(&url, false); diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx index bfd0bf33917c..70b70095715f 100644 --- a/sc/qa/extras/macros-test.cxx +++ b/sc/qa/extras/macros-test.cxx @@ -84,7 +84,7 @@ void ScMacrosTest::testMSP() CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell); ScDocShell* xDocSh = dynamic_cast<ScDocShell*>(pFoundShell); - CPPUNIT_ASSERT(xDocSh != NULL); + CPPUNIT_ASSERT(xDocSh != nullptr); SfxObjectShell::CallXScript( xComponent, diff --git a/sc/qa/extras/sccondformats.cxx b/sc/qa/extras/sccondformats.cxx index 85a9d592bba0..02ebd5146b4e 100644 --- a/sc/qa/extras/sccondformats.cxx +++ b/sc/qa/extras/sccondformats.cxx @@ -134,18 +134,18 @@ void ScConditionalFormatTest::testUndoAnchor() CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell); ScDocShell* xDocSh = dynamic_cast<ScDocShell*>(pFoundShell); - CPPUNIT_ASSERT(xDocSh != NULL); + CPPUNIT_ASSERT(xDocSh != nullptr); // Check whether graphic imported well ScDocument& rDoc = xDocSh->GetDocument(); ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer(); - CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pDrawLayer != NULL ); + CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pDrawLayer != nullptr ); const SdrPage *pPage = pDrawLayer->GetPage(0); - CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pPage != NULL ); + CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pPage != nullptr ); SdrGrafObj* pObject = dynamic_cast<SdrGrafObj*>(pPage->GetObj(0)); - CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pObject != NULL ); + CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pObject != nullptr ); CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pObject->IsLinkedGraphic() ); const GraphicObject& rGraphicObj = pObject->GetGraphicObject(true); @@ -155,11 +155,11 @@ void ScConditionalFormatTest::testUndoAnchor() // Get the document controller ScTabViewShell* pViewShell = xDocSh->GetBestViewShell(false); - CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pViewShell != NULL ); + CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pViewShell != nullptr ); // Get the draw view of the document ScDrawView* pDrawView = pViewShell->GetViewData().GetScDrawView(); - CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pDrawView != NULL ); + CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pDrawView != nullptr ); // Select graphic object pDrawView->MarkNextObj(); diff --git a/sc/qa/unit/copy_paste_test.cxx b/sc/qa/unit/copy_paste_test.cxx index 195e3ce585dd..a2f305cbb9a0 100644 --- a/sc/qa/unit/copy_paste_test.cxx +++ b/sc/qa/unit/copy_paste_test.cxx @@ -73,7 +73,7 @@ void ScCopyPasteTest::testCopyPasteXLS() // Get the document controller ScTabViewShell* pViewShell = xDocSh->GetBestViewShell(false); - CPPUNIT_ASSERT(pViewShell != NULL); + CPPUNIT_ASSERT(pViewShell != nullptr); // 2. Highlight B2:C5 ScRange aSrcRange; @@ -109,11 +109,11 @@ void ScCopyPasteTest::testCopyPasteXLS() CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell); xDocSh = dynamic_cast<ScDocShell*>(pFoundShell); - CPPUNIT_ASSERT(xDocSh != NULL); + CPPUNIT_ASSERT(xDocSh != nullptr); // Get the document controller pViewShell = xDocSh->GetBestViewShell(false); - CPPUNIT_ASSERT(pViewShell != NULL); + CPPUNIT_ASSERT(pViewShell != nullptr); // 6. Paste pViewShell->GetViewData().GetView()->PasteFromClip(InsertDeleteFlags::ALL, &aClipDoc); diff --git a/sc/qa/unit/helper/csv_handler.hxx b/sc/qa/unit/helper/csv_handler.hxx index 59f21370c959..115b6bc11e12 100644 --- a/sc/qa/unit/helper/csv_handler.hxx +++ b/sc/qa/unit/helper/csv_handler.hxx @@ -131,7 +131,7 @@ public: } else { - char* pRemainingChars = NULL; + char* pRemainingChars = nullptr; std::string aStr(p, n); double nValue = strtod(&aStr[0], &pRemainingChars); if (*pRemainingChars) diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index 2ac7ee8cf33b..c8b73c890281 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -184,7 +184,7 @@ void testFormats(ScBootstrapFixture* pTest, ScDocument* pDoc, sal_Int32 nFormat) //formatting for B5: # ??/100 gets lost during import //test Sheet2 - const ScPatternAttr* pPattern = NULL; + const ScPatternAttr* pPattern = nullptr; pPattern = pDoc->GetPattern(0,0,1); vcl::Font aFont; pPattern->GetFont(aFont,SC_AUTOCOL_RAW); @@ -296,40 +296,40 @@ const SdrOle2Obj* getSingleChartObject(ScDocument& rDoc, sal_uInt16 nPage) if (!pDrawLayer) { cout << "Failed to retrieve the drawing layer object." << endl; - return NULL; + return nullptr; } const SdrPage* pPage = pDrawLayer->GetPage(nPage); if (!pPage) { cout << "Failed to retrieve the page object." << endl; - return NULL; + return nullptr; } if (pPage->GetObjCount() != 1) { cout << "This page should contain one drawing object." << endl; - return NULL; + return nullptr; } const SdrObject* pObj = pPage->GetObj(0); if (!pObj) { cout << "Failed to retrieve the drawing object." << endl; - return NULL; + return nullptr; } if (pObj->GetObjIdentifier() != OBJ_OLE2) { cout << "This is not an OLE2 object." << endl; - return NULL; + return nullptr; } const SdrOle2Obj& rOleObj = static_cast<const SdrOle2Obj&>(*pObj); if (!rOleObj.IsChart()) { cout << "This should be a chart object." << endl; - return NULL; + return nullptr; } return &rOleObj; @@ -415,7 +415,7 @@ ScTokenArray* getTokens(ScDocument& rDoc, const ScAddress& rPos) { OUString aStr = rPos.Format(SCA_VALID); cerr << aStr << " is not a formula cell." << endl; - return NULL; + return nullptr; } return pCell->GetCode(); diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx index e7a6d5f75040..2a33b6562819 100644 --- a/sc/qa/unit/helper/qahelper.hxx +++ b/sc/qa/unit/helper/qahelper.hxx @@ -133,7 +133,7 @@ SCQAHELPER_DLLPUBLIC bool checkFormulaPositions( ScDocument& rDoc, SCTAB nTab, SCCOL nCol, const SCROW* pRows, size_t nRowCount); SCQAHELPER_DLLPUBLIC ScTokenArray* compileFormula( - ScDocument* pDoc, const OUString& rFormula, const ScAddress* pPos = NULL, + ScDocument* pDoc, const OUString& rFormula, const ScAddress* pPos = nullptr, formula::FormulaGrammar::Grammar eGram = formula::FormulaGrammar::GRAM_NATIVE ); template<size_t _Size> @@ -206,12 +206,12 @@ protected: ScDocShellRef load( bool bReadWrite, const OUString& rURL, const OUString& rFilter, const OUString &rUserData, const OUString& rTypeName, SfxFilterFlags nFilterFlags, SotClipboardFormatId nClipboardID, - sal_uIntPtr nFilterVersion = SOFFICE_FILEFORMAT_CURRENT, const OUString* pPassword = NULL ); + sal_uIntPtr nFilterVersion = SOFFICE_FILEFORMAT_CURRENT, const OUString* pPassword = nullptr ); ScDocShellRef load( const OUString& rURL, const OUString& rFilter, const OUString &rUserData, const OUString& rTypeName, SfxFilterFlags nFilterFlags, SotClipboardFormatId nClipboardID, - sal_uIntPtr nFilterVersion = SOFFICE_FILEFORMAT_CURRENT, const OUString* pPassword = NULL ); + sal_uIntPtr nFilterVersion = SOFFICE_FILEFORMAT_CURRENT, const OUString* pPassword = nullptr ); ScDocShellRef loadDoc(const OUString& rFileName, sal_Int32 nFormat, bool bReadWrite = false ); diff --git a/sc/qa/unit/rangelst_test.cxx b/sc/qa/unit/rangelst_test.cxx index b22ca7cf0f35..7b13b0d09af4 100644 --- a/sc/qa/unit/rangelst_test.cxx +++ b/sc/qa/unit/rangelst_test.cxx @@ -19,7 +19,7 @@ class Test : public test::BootstrapFixture { public: Test() - : m_pDoc(NULL) + : m_pDoc(nullptr) { } diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 3fe86d995ca0..0a16302312f7 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -1378,8 +1378,8 @@ void ScExportTest::testExcelCellBorders( sal_uLong nFormatType ) for (size_t i = 0; i < SAL_N_ELEMENTS(aChecks); ++i) { - const editeng::SvxBorderLine* pLine = NULL; - rDoc.GetBorderLines(2, aChecks[i].mnRow, 0, NULL, &pLine, NULL, NULL); + const editeng::SvxBorderLine* pLine = nullptr; + rDoc.GetBorderLines(2, aChecks[i].mnRow, 0, nullptr, &pLine, nullptr, nullptr); CPPUNIT_ASSERT(pLine); CPPUNIT_ASSERT_EQUAL(toBorderName(aChecks[i].mnStyle), toBorderName(pLine->GetBorderLineStyle())); if (aChecks[i].mnWidth >= 0) @@ -1392,8 +1392,8 @@ void ScExportTest::testExcelCellBorders( sal_uLong nFormatType ) ScDocument& rDoc = xNewDocSh->GetDocument(); for (size_t i = 0; i < SAL_N_ELEMENTS(aChecks); ++i) { - const editeng::SvxBorderLine* pLine = NULL; - rDoc.GetBorderLines(2, aChecks[i].mnRow, 0, NULL, &pLine, NULL, NULL); + const editeng::SvxBorderLine* pLine = nullptr; + rDoc.GetBorderLines(2, aChecks[i].mnRow, 0, nullptr, &pLine, nullptr, nullptr); CPPUNIT_ASSERT(pLine); CPPUNIT_ASSERT_EQUAL(toBorderName(aChecks[i].mnStyle), toBorderName(pLine->GetBorderLineStyle())); if (aChecks[i].mnWidth >= 0) @@ -2479,11 +2479,11 @@ void ScExportTest::testLinkedGraphicRT() // Check whether graphic imported well after export ScDocument& rDoc = xDocSh->GetDocument(); ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer(); - CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pDrawLayer != NULL ); + CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pDrawLayer != nullptr ); const SdrPage *pPage = pDrawLayer->GetPage(0); - CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pPage != NULL ); + CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pPage != nullptr ); SdrGrafObj* pObject = dynamic_cast<SdrGrafObj*>(pPage->GetObj(0)); - CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pObject != NULL ); + CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pObject != nullptr ); CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pObject->IsLinkedGraphic() ); const GraphicObject& rGraphicObj = pObject->GetGraphicObject(true); diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index b4c0451ef358..cdb0aedf1dc7 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -878,10 +878,10 @@ void ScFiltersTest::testBorderODS() CPPUNIT_ASSERT_MESSAGE("Failed to load border.*", xDocSh.Is()); ScDocument& rDoc = xDocSh->GetDocument(); - const editeng::SvxBorderLine* pLeft = NULL; - const editeng::SvxBorderLine* pTop = NULL; - const editeng::SvxBorderLine* pRight = NULL; - const editeng::SvxBorderLine* pBottom = NULL; + const editeng::SvxBorderLine* pLeft = nullptr; + const editeng::SvxBorderLine* pTop = nullptr; + const editeng::SvxBorderLine* pRight = nullptr; + const editeng::SvxBorderLine* pBottom = nullptr; rDoc.GetBorderLines( 0, 1, 0, &pLeft, &pTop, &pRight, &pBottom ); CPPUNIT_ASSERT(!pLeft); @@ -974,17 +974,17 @@ void ScFiltersTest::testBordersOoo33() CPPUNIT_ASSERT_MESSAGE("Failed to load borders_ooo33.*", xDocSh.Is()); ScDocument& rDoc = xDocSh->GetDocument(); - const editeng::SvxBorderLine* pLeft = NULL; - const editeng::SvxBorderLine* pTop = NULL; - const editeng::SvxBorderLine* pRight = NULL; - const editeng::SvxBorderLine* pBottom = NULL; + const editeng::SvxBorderLine* pLeft = nullptr; + const editeng::SvxBorderLine* pTop = nullptr; + const editeng::SvxBorderLine* pRight = nullptr; + const editeng::SvxBorderLine* pBottom = nullptr; sal_Int16 temp = 0; for(sal_Int16 i = 0; i<6; ++i) { for(sal_Int32 j = 0; j<22; ++j) { rDoc.GetBorderLines( i, j, 0, &pLeft, &pTop, &pRight, &pBottom ); - if(pLeft!=NULL && pTop!=NULL && pRight!=NULL && pBottom!=NULL) + if(pLeft!=nullptr && pTop!=nullptr && pRight!=nullptr && pBottom!=nullptr) { CPPUNIT_ASSERT_EQUAL(borders[temp].column, i); CPPUNIT_ASSERT_EQUAL(borders[temp].row, j); @@ -2119,7 +2119,7 @@ void ScFiltersTest::testRichTextContentODS() CPPUNIT_ASSERT_MESSAGE("Unexpected text.", aParaText.startsWith("Sheet name is ")); CPPUNIT_ASSERT_MESSAGE("Sheet name field item not found.", pEditText->HasField(text::textfield::Type::TABLE)); CPPUNIT_ASSERT_EQUAL(OUString("Sheet name is Test."), ScEditUtil::GetString(*pEditText, &rDoc)); - CPPUNIT_ASSERT_EQUAL(OUString("Sheet name is ?."), ScEditUtil::GetString(*pEditText, NULL)); + CPPUNIT_ASSERT_EQUAL(OUString("Sheet name is ?."), ScEditUtil::GetString(*pEditText, nullptr)); // Cell with URL field item. aPos.IncRow(); @@ -2131,7 +2131,7 @@ void ScFiltersTest::testRichTextContentODS() CPPUNIT_ASSERT_MESSAGE("Unexpected text.", aParaText.startsWith("URL: ")); CPPUNIT_ASSERT_MESSAGE("URL field item not found.", pEditText->HasField(text::textfield::Type::URL)); CPPUNIT_ASSERT_EQUAL(OUString("URL: http://libreoffice.org"), ScEditUtil::GetString(*pEditText, &rDoc)); - CPPUNIT_ASSERT_EQUAL(OUString("URL: http://libreoffice.org"), ScEditUtil::GetString(*pEditText, NULL)); + CPPUNIT_ASSERT_EQUAL(OUString("URL: http://libreoffice.org"), ScEditUtil::GetString(*pEditText, nullptr)); // Cell with Date field item. aPos.IncRow(); @@ -2143,7 +2143,7 @@ void ScFiltersTest::testRichTextContentODS() CPPUNIT_ASSERT_MESSAGE("Unexpected text.", aParaText.startsWith("Date: ")); CPPUNIT_ASSERT_MESSAGE("Date field item not found.", pEditText->HasField(text::textfield::Type::DATE)); CPPUNIT_ASSERT_MESSAGE("Date field not resolved with rDoc.", ScEditUtil::GetString(*pEditText, &rDoc).indexOf("/20") > 0); - CPPUNIT_ASSERT_MESSAGE("Date field not resolved with NULL.", ScEditUtil::GetString(*pEditText, NULL).indexOf("/20") > 0); + CPPUNIT_ASSERT_MESSAGE("Date field not resolved with NULL.", ScEditUtil::GetString(*pEditText, nullptr).indexOf("/20") > 0); // Cell with DocInfo title field item. aPos.IncRow(); @@ -2155,7 +2155,7 @@ void ScFiltersTest::testRichTextContentODS() CPPUNIT_ASSERT_MESSAGE("Unexpected text.", aParaText.startsWith("Title: ")); CPPUNIT_ASSERT_MESSAGE("DocInfo title field item not found.", pEditText->HasField(text::textfield::Type::DOCINFO_TITLE)); CPPUNIT_ASSERT_EQUAL(OUString("Title: Test Document"), ScEditUtil::GetString(*pEditText, &rDoc)); - CPPUNIT_ASSERT_EQUAL(OUString("Title: ?"), ScEditUtil::GetString(*pEditText, NULL)); + CPPUNIT_ASSERT_EQUAL(OUString("Title: ?"), ScEditUtil::GetString(*pEditText, nullptr)); // Cell with sentence with both bold and italic sequences. aPos.IncRow(); diff --git a/sc/qa/unit/test_ScChartListenerCollection.cxx b/sc/qa/unit/test_ScChartListenerCollection.cxx index fccf3f0ddc62..82aa66a5d705 100644 --- a/sc/qa/unit/test_ScChartListenerCollection.cxx +++ b/sc/qa/unit/test_ScChartListenerCollection.cxx @@ -56,7 +56,7 @@ struct MockedHiddenRangeListener : public ScChartHiddenRangeListener { void ChartListenerCollectionTest::ListenerGetsNotifiedWhenItsRangeIsSetDirty() { MockedHiddenRangeListener listener; - ScChartListenerCollection sut(NULL); + ScChartListenerCollection sut(nullptr); sut.StartListeningHiddenRange(RANGE_1, &listener); sut.SetRangeDirty(RANGE_INTERSECTING_1_AND_2); @@ -66,7 +66,7 @@ void ChartListenerCollectionTest::ListenerGetsNotifiedWhenItsRangeIsSetDirty() { void ChartListenerCollectionTest::ListenerGetsNotifiedTwiceWhenRegisteredTwoTimes() { MockedHiddenRangeListener listener; - ScChartListenerCollection sut(NULL); + ScChartListenerCollection sut(nullptr); sut.StartListeningHiddenRange(RANGE_1, &listener); sut.StartListeningHiddenRange(RANGE_2, &listener); @@ -77,7 +77,7 @@ void ChartListenerCollectionTest::ListenerGetsNotifiedTwiceWhenRegisteredTwoTime void ChartListenerCollectionTest::ListenerDoesNotGetNotifiedWhenListeningStops() { MockedHiddenRangeListener listener; - ScChartListenerCollection sut(NULL); + ScChartListenerCollection sut(nullptr); sut.StartListeningHiddenRange(RANGE_1, &listener); sut.EndListeningHiddenRange(&listener); @@ -89,7 +89,7 @@ void ChartListenerCollectionTest::ListenerDoesNotGetNotifiedWhenListeningStops() void ChartListenerCollectionTest::ListenerStopsListeningForAllRanges() { MockedHiddenRangeListener listener; - ScChartListenerCollection sut(NULL); + ScChartListenerCollection sut(nullptr); sut.StartListeningHiddenRange(RANGE_1, &listener); sut.StartListeningHiddenRange(RANGE_2, &listener); @@ -103,7 +103,7 @@ void ChartListenerCollectionTest::ListenersStopListeningIdependently() { MockedHiddenRangeListener listener1; MockedHiddenRangeListener listener2; - ScChartListenerCollection sut(NULL); + ScChartListenerCollection sut(nullptr); sut.StartListeningHiddenRange(RANGE_1, &listener1); sut.StartListeningHiddenRange(RANGE_2, &listener2); diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 356222868e4d..81bc4152b9dc 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -142,7 +142,7 @@ public: Test::Test() : m_pImpl(new TestImpl), - m_pDoc(0) + m_pDoc(nullptr) { } @@ -1093,7 +1093,7 @@ void Test::testHorizontalIterator() // Raw data - 'hole' data const char* aData[][2] = { { "A", "B" }, - { "C", 0 }, + { "C", nullptr }, { "D", "E" }, }; @@ -1115,15 +1115,15 @@ void Test::testHorizontalIterator() { // Very holy data const char* aData[][2] = { - { 0, "A" }, - { 0, 0 }, - { 0, "1" }, - { "B", 0 }, + { nullptr, "A" }, + { nullptr, nullptr }, + { nullptr, "1" }, + { "B", nullptr }, { "C", "2" }, { "D", "3" }, - { "E", 0 }, - { 0, "G" }, - { 0, 0 }, + { "E", nullptr }, + { nullptr, "G" }, + { nullptr, nullptr }, }; HoriIterCheck aChecks[] = { @@ -1148,13 +1148,13 @@ void Test::testHorizontalIterator() { // Degenerate case const char* aData[][2] = { - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, + { nullptr, nullptr }, + { nullptr, nullptr }, + { nullptr, nullptr }, }; bool bRes = checkHorizontalIterator( - m_pDoc, aData, SAL_N_ELEMENTS(aData), NULL, 0); + m_pDoc, aData, SAL_N_ELEMENTS(aData), nullptr, 0); if (!bRes) CPPUNIT_FAIL("Failed on test degenerate."); @@ -1163,9 +1163,9 @@ void Test::testHorizontalIterator() { // Data at end const char* aData[][2] = { - { 0, 0 }, - { 0, 0 }, - { 0, "A" }, + { nullptr, nullptr }, + { nullptr, nullptr }, + { nullptr, "A" }, }; HoriIterCheck aChecks[] = { @@ -1182,11 +1182,11 @@ void Test::testHorizontalIterator() { // Data in middle const char* aData[][2] = { - { 0, 0 }, - { 0, 0 }, - { 0, "A" }, - { 0, "1" }, - { 0, 0 }, + { nullptr, nullptr }, + { nullptr, nullptr }, + { nullptr, "A" }, + { nullptr, "1" }, + { nullptr, nullptr }, }; HoriIterCheck aChecks[] = { @@ -1300,21 +1300,21 @@ formula::FormulaToken* getSingleRefToken(ScDocument& rDoc, const ScAddress& rPos if (!pFC) { cerr << "Formula cell expected, but not found." << endl; - return NULL; + return nullptr; } ScTokenArray* pTokens = pFC->GetCode(); if (!pTokens) { cerr << "Token array is not present." << endl; - return NULL; + return nullptr; } formula::FormulaToken* pToken = pTokens->First(); if (!pToken || pToken->GetType() != formula::svSingleRef) { cerr << "Not a single reference token." << endl; - return NULL; + return nullptr; } return pToken; @@ -1732,7 +1732,7 @@ void Test::testNamedRange() CPPUNIT_ASSERT_MESSAGE("wrong range name is retrieved with the copied instance.", aName.equalsAscii(aNames[i].mpName)); } - m_pDoc->SetRangeName(NULL); // Delete the names. + m_pDoc->SetRangeName(nullptr); // Delete the names. m_pDoc->DeleteTab(0); } @@ -2236,7 +2236,7 @@ void Test::testDataArea() CPPUNIT_ASSERT_MESSAGE("Sheet is expected to be empty.", m_pDoc->IsBlockEmpty(0, 0, 0, 100, 100)); // Now, set borders in some cells.... - ::editeng::SvxBorderLine aLine(NULL, 50, table::BorderLineStyle::SOLID); + ::editeng::SvxBorderLine aLine(nullptr, 50, table::BorderLineStyle::SOLID); SvxBoxItem aBorderItem(ATTR_BORDER); aBorderItem.SetLine(&aLine, SvxBoxItemLine::LEFT); aBorderItem.SetLine(&aLine, SvxBoxItemLine::RIGHT); @@ -2349,7 +2349,7 @@ void Test::testFunctionLists() "DSUM", "DVAR", "DVARP", - 0 + nullptr }; const char* aDateTime[] = { @@ -2382,7 +2382,7 @@ void Test::testFunctionLists() "WORKDAY.INTL", "YEAR", "YEARS", - 0 + nullptr }; const char* aFinancial[] = { @@ -2412,7 +2412,7 @@ void Test::testFunctionLists() "SLN", "SYD", "VDB", - 0 + nullptr }; const char* aInformation[] = { @@ -2435,7 +2435,7 @@ void Test::testFunctionLists() "N", "NA", "TYPE", - 0 + nullptr }; const char* aLogical[] = { @@ -2448,7 +2448,7 @@ void Test::testFunctionLists() "OR", "TRUE", "XOR", - 0 + nullptr }; const char* aMathematical[] = { @@ -2522,7 +2522,7 @@ void Test::testFunctionLists() "TAN", "TANH", "TRUNC", - 0 + nullptr }; const char* aArray[] = { @@ -2540,7 +2540,7 @@ void Test::testFunctionLists() "SUMXMY2", "TRANSPOSE", "TREND", - 0 + nullptr }; const char* aStatistical[] = { @@ -2685,7 +2685,7 @@ void Test::testFunctionLists() "WEIBULL.DIST", "Z.TEST", "ZTEST", - 0 + nullptr }; const char* aSpreadsheet[] = { @@ -2711,7 +2711,7 @@ void Test::testFunctionLists() "SHEETS", "STYLE", "VLOOKUP", - 0 + nullptr }; const char* aText[] = { @@ -2756,7 +2756,7 @@ void Test::testFunctionLists() "UPPER", "VALUE", "WEBSERVICE", - 0 + nullptr }; struct { @@ -2772,8 +2772,8 @@ void Test::testFunctionLists() { "Statistical", aStatistical }, { "Spreadsheet", aSpreadsheet }, { "Text", aText }, - { "Add-in", 0 }, - { 0, 0 } + { "Add-in", nullptr }, + { nullptr, nullptr } }; ScFunctionMgr* pFuncMgr = ScGlobal::GetStarCalcFunctionMgr(); @@ -2801,9 +2801,9 @@ void Test::testGraphicsInGroup() m_pDoc->InitDrawLayer(); ScDrawLayer *pDrawLayer = m_pDoc->GetDrawLayer(); - CPPUNIT_ASSERT_MESSAGE("must have a draw layer", pDrawLayer != NULL); + CPPUNIT_ASSERT_MESSAGE("must have a draw layer", pDrawLayer != nullptr); SdrPage* pPage = pDrawLayer->GetPage(0); - CPPUNIT_ASSERT_MESSAGE("must have a draw page", pPage != NULL); + CPPUNIT_ASSERT_MESSAGE("must have a draw page", pPage != nullptr); { //Add a square @@ -3119,7 +3119,7 @@ void Test::testAutofilter() const char* aData[][3] = { { "C1", "C2", "C3" }, { "0", "1", "A" }, - { "1", "2", 0 }, + { "1", "2", nullptr }, { "1", "2", "B" }, { "0", "2", "B" } }; @@ -3260,7 +3260,7 @@ void Test::testCopyPaste() std::unique_ptr<ScUndoPaste> pUndo(createUndoPaste(getDocShell(), aRange, pUndoDoc)); ScMarkData aMark; aMark.SetMarkArea(aRange); - m_pDoc->CopyFromClip(aRange, aMark, InsertDeleteFlags::ALL, NULL, &aClipDoc); + m_pDoc->CopyFromClip(aRange, aMark, InsertDeleteFlags::ALL, nullptr, &aClipDoc); //check values after copying OUString aString; @@ -3279,7 +3279,7 @@ void Test::testCopyPaste() CPPUNIT_ASSERT_MESSAGE("local range name 1 should be valid", bIsValidRef); CPPUNIT_ASSERT_MESSAGE("local range 1 should still point to Sheet1.A1",aRangeLocal1 == ScRange(0,0,0,0,0,0)); pLocal2 = m_pDoc->GetRangeName(1)->findByUpperName(OUString("LOCAL2")); - CPPUNIT_ASSERT_MESSAGE("local2 should not be copied", pLocal2 == NULL); + CPPUNIT_ASSERT_MESSAGE("local2 should not be copied", pLocal2 == nullptr); // check notes after copying CPPUNIT_ASSERT_MESSAGE("There should be a note on Sheet2.A2", m_pDoc->HasNote(ScAddress(0, 1, 1))); @@ -3343,7 +3343,7 @@ void Test::testCopyPasteAsLink() ScMarkData aMark; aMark.SetMarkArea(aRange); // Paste range as link. - m_pDoc->CopyFromClip(aRange, aMark, InsertDeleteFlags::CONTENTS, NULL, &aClipDoc, true, true); + m_pDoc->CopyFromClip(aRange, aMark, InsertDeleteFlags::CONTENTS, nullptr, &aClipDoc, true, true); // Check pasted content to make sure they reference the correct cells. ScFormulaCell* pFC = m_pDoc->GetFormulaCell(ScAddress(1,1,1)); @@ -3400,7 +3400,7 @@ void Test::testCopyPasteTranspose() ScRange aDestRange = ScRange(3,1,1,3,3,1);//target: Sheet2.D2:D4 ScMarkData aMark; aMark.SetMarkArea(aDestRange); - m_pDoc->CopyFromClip(aDestRange, aMark, InsertDeleteFlags::ALL, NULL, pTransposedClip); + m_pDoc->CopyFromClip(aDestRange, aMark, InsertDeleteFlags::ALL, nullptr, pTransposedClip); //check cell content after transposed copy/paste OUString aString = m_pDoc->GetString(3, 3, 1); @@ -3687,7 +3687,7 @@ void Test::testCopyPasteSkipEmpty2() ScRange aDestRange(0,2,0,2,2,0); ScMarkData aMark; aMark.SetMarkArea(aDestRange); - m_pDoc->CopyFromClip(aDestRange, aMark, InsertDeleteFlags::ALL, NULL, &aClipDoc, false, false, true, true); + m_pDoc->CopyFromClip(aDestRange, aMark, InsertDeleteFlags::ALL, nullptr, &aClipDoc, false, false, true, true); CPPUNIT_ASSERT_EQUAL(OUString("A"), m_pDoc->GetString(ScAddress(0,2,0))); CPPUNIT_ASSERT_MESSAGE("B3 should be empty.", m_pDoc->GetCellType(ScAddress(1,2,0)) == CELLTYPE_NONE); @@ -3801,7 +3801,7 @@ void Test::testCutPasteRefUndo() if (!checkFormula(*pUndoDoc, ScAddress(0,1,0), "B2")) CPPUNIT_FAIL("A2 in the undo document should be referencing B2."); - ScUndoPaste aUndo(&getDocShell(), ScRange(ScAddress(2,1,0)), aMark, pUndoDoc, NULL, InsertDeleteFlags::CONTENTS, NULL, false, NULL); + ScUndoPaste aUndo(&getDocShell(), ScRange(ScAddress(2,1,0)), aMark, pUndoDoc, nullptr, InsertDeleteFlags::CONTENTS, nullptr, false, nullptr); aUndo.Undo(); // Now A2 should be referencing B2 once again. @@ -3990,7 +3990,7 @@ void Test::testCopyPasteRelativeFormula() InsertDeleteFlags nFlags = InsertDeleteFlags::ALL; ScRange aDestRange(1,0,0,1,1,0); aMark.SetMarkArea(aDestRange); - m_pDoc->CopyFromClip(aDestRange, aMark, nFlags, NULL, &aClipDoc); + m_pDoc->CopyFromClip(aDestRange, aMark, nFlags, nullptr, &aClipDoc); // B2 references A2, so the value should be 1. CPPUNIT_ASSERT_EQUAL(1.0, m_pDoc->GetValue(ScAddress(1,1,0))); @@ -4016,7 +4016,7 @@ void Test::testCopyPasteRelativeFormula() // Paste to A3. aDestRange = ScRange(0,2,0,0,2,0); aMark.SetMarkArea(aDestRange); - m_pDoc->CopyFromClip(aDestRange, aMark, nFlags, NULL, &aClipDoc); + m_pDoc->CopyFromClip(aDestRange, aMark, nFlags, nullptr, &aClipDoc); pFC = m_pDoc->GetFormulaCell(ScAddress(0,2,0)); CPPUNIT_ASSERT(pFC); @@ -4073,7 +4073,7 @@ void Test::testCopyPasteRepeatOneFormula() InsertDeleteFlags nFlags = InsertDeleteFlags::CONTENTS; ScRange aDestRange(2,1,0,2,9,0); aMark.SetMarkArea(aDestRange); - m_pDoc->CopyFromClip(aDestRange, aMark, nFlags, NULL, &aClipDoc); + m_pDoc->CopyFromClip(aDestRange, aMark, nFlags, nullptr, &aClipDoc); // Make sure C1:C10 are grouped. const ScFormulaCell* pFC = m_pDoc->GetFormulaCell(aPos); @@ -4509,7 +4509,7 @@ void Test::testAutoFill() ScMarkData aMarkData; aMarkData.SelectTable(0, true); - m_pDoc->Fill( 0, 0, 0, 0, NULL, aMarkData, 5); + m_pDoc->Fill( 0, 0, 0, 0, nullptr, aMarkData, 5); for (SCROW i = 0; i< 6; ++i) ASSERT_DOUBLES_EQUAL(static_cast<double>(i+1.0), m_pDoc->GetValue(0, i, 0)); @@ -4519,14 +4519,14 @@ void Test::testAutoFill() m_pDoc->SetValue(0,2,0,10); m_pDoc->SetRowHidden(1, 2, 0, true); - m_pDoc->Fill( 0, 0, 0, 0, NULL, aMarkData, 8); + m_pDoc->Fill( 0, 0, 0, 0, nullptr, aMarkData, 8); ASSERT_DOUBLES_EQUAL(10.0, m_pDoc->GetValue(0,1,0)); ASSERT_DOUBLES_EQUAL(10.0, m_pDoc->GetValue(0,2,0)); for (SCROW i = 3; i< 8; ++i) ASSERT_DOUBLES_EQUAL(static_cast<double>(i-1.0), m_pDoc->GetValue(0, i, 0)); - m_pDoc->Fill( 0, 0, 0, 8, NULL, aMarkData, 5, FILL_TO_RIGHT ); + m_pDoc->Fill( 0, 0, 0, 8, nullptr, aMarkData, 5, FILL_TO_RIGHT ); for (SCCOL i = 0; i < 5; ++i) { for(SCROW j = 0; j < 8; ++j) @@ -4551,7 +4551,7 @@ void Test::testAutoFill() // test auto fill user data lists m_pDoc->SetString( 0, 100, 0, "January" ); - m_pDoc->Fill( 0, 100, 0, 100, NULL, aMarkData, 2, FILL_TO_BOTTOM, FILL_AUTO ); + m_pDoc->Fill( 0, 100, 0, 100, nullptr, aMarkData, 2, FILL_TO_BOTTOM, FILL_AUTO ); OUString aTestValue = m_pDoc->GetString( 0, 101, 0 ); CPPUNIT_ASSERT_EQUAL( aTestValue, OUString("February") ); aTestValue = m_pDoc->GetString( 0, 102, 0 ); @@ -4559,7 +4559,7 @@ void Test::testAutoFill() // test that two same user data list entries will not result in incremental fill m_pDoc->SetString( 0, 101, 0, "January" ); - m_pDoc->Fill( 0, 100, 0, 101, NULL, aMarkData, 2, FILL_TO_BOTTOM, FILL_AUTO ); + m_pDoc->Fill( 0, 100, 0, 101, nullptr, aMarkData, 2, FILL_TO_BOTTOM, FILL_AUTO ); for ( SCROW i = 102; i <= 103; ++i ) { aTestValue = m_pDoc->GetString( 0, i, 0 ); @@ -4607,7 +4607,7 @@ void Test::testAutoFill() m_pDoc->SetString(100, 110, 0, "=A111"); - m_pDoc->Fill(100, 110, 100, 110, NULL, aMarkData, 10, FILL_TO_TOP, FILL_AUTO); + m_pDoc->Fill(100, 110, 100, 110, nullptr, aMarkData, 10, FILL_TO_TOP, FILL_AUTO); for(SCROW nRow = 110; nRow >= 100; --nRow) { OUString aExpected = "=A" + OUString::number(nRow +1); @@ -4629,7 +4629,7 @@ void Test::testAutoFillSimple() ScMarkData aMarkData; aMarkData.SelectTable(0, true); - m_pDoc->Fill( 0, 0, 0, 1, NULL, aMarkData, 6, FILL_TO_BOTTOM, FILL_AUTO); + m_pDoc->Fill( 0, 0, 0, 1, nullptr, aMarkData, 6, FILL_TO_BOTTOM, FILL_AUTO); for(SCROW nRow = 0; nRow < 8; ++nRow) { @@ -4697,7 +4697,7 @@ void Test::testCopyPasteFormulasExternalDoc() SfxMedium* pMed = new SfxMedium(aExtDocName, STREAM_STD_READWRITE); xExtDocSh->DoInitNew(pMed); CPPUNIT_ASSERT_MESSAGE("external document instance not loaded.", - findLoadedDocShellByName(aExtDocName) != NULL); + findLoadedDocShellByName(aExtDocName) != nullptr); ScDocument& rExtDoc = xExtDocSh->GetDocument(); rExtDoc.InsertTab(0, aExtSh1Name); @@ -4724,7 +4724,7 @@ void Test::testCopyPasteFormulasExternalDoc() aRange = ScRange(1,1,1,1,6,1); ScMarkData aMarkData2; aMarkData2.SetMarkArea(aRange); - rExtDoc.CopyFromClip(aRange, aMarkData2, nFlags, NULL, pClipDoc); + rExtDoc.CopyFromClip(aRange, aMarkData2, nFlags, nullptr, pClipDoc); OUString aFormula; rExtDoc.GetFormula(1,1,1, aFormula); @@ -4749,12 +4749,12 @@ void Test::testCopyPasteFormulasExternalDoc() void Test::testFindAreaPosVertical() { const char* aData[][3] = { - { 0, "1", "1" }, - { "1", 0, "1" }, + { nullptr, "1", "1" }, + { "1", nullptr, "1" }, { "1", "1", "1" }, - { 0, "1", "1" }, + { nullptr, "1", "1" }, { "1", "1", "1" }, - { "1", 0, "1" }, + { "1", nullptr, "1" }, { "1", "1", "1" }, }; @@ -4939,7 +4939,7 @@ void Test::testNoteBasic() bool bInsertRow = m_pDoc->InsertRow(0, 0, MAXCOL, 0, 1, 1); CPPUNIT_ASSERT_MESSAGE("failed to insert row", bInsertRow ); - CPPUNIT_ASSERT_MESSAGE("note hasn't moved", m_pDoc->GetNote(aAddr) == NULL); + CPPUNIT_ASSERT_MESSAGE("note hasn't moved", m_pDoc->GetNote(aAddr) == nullptr); aAddr.IncRow(); // cell C4 CPPUNIT_ASSERT_MESSAGE("note not there", m_pDoc->GetNote(aAddr) == pNote); @@ -4947,13 +4947,13 @@ void Test::testNoteBasic() bool bInsertCol = m_pDoc->InsertCol(0, 0, MAXROW, 0, 1, 1); CPPUNIT_ASSERT_MESSAGE("failed to insert column", bInsertCol ); - CPPUNIT_ASSERT_MESSAGE("note hasn't moved", m_pDoc->GetNote(aAddr) == NULL); + CPPUNIT_ASSERT_MESSAGE("note hasn't moved", m_pDoc->GetNote(aAddr) == nullptr); aAddr.IncCol(); // cell D4 CPPUNIT_ASSERT_MESSAGE("note not there", m_pDoc->GetNote(aAddr) == pNote); // Insert a new sheet to shift the current sheet to the right. m_pDoc->InsertTab(0, "Table2"); - CPPUNIT_ASSERT_MESSAGE("note hasn't moved", m_pDoc->GetNote(aAddr) == NULL); + CPPUNIT_ASSERT_MESSAGE("note hasn't moved", m_pDoc->GetNote(aAddr) == nullptr); aAddr.IncTab(); // Move to the next sheet. CPPUNIT_ASSERT_MESSAGE("note not there", m_pDoc->GetNote(aAddr) == pNote); @@ -5224,7 +5224,7 @@ void Test::testNoteCopyPaste() // Paste to B6:B8 but only cell notes. ScRange aDestRange(1,5,0,1,7,0); - m_pDoc->CopyFromClip(aDestRange, aMark, InsertDeleteFlags::NOTE, NULL, &aClipDoc); + m_pDoc->CopyFromClip(aDestRange, aMark, InsertDeleteFlags::NOTE, nullptr, &aClipDoc); // Make sure the notes are there. pNote = m_pDoc->GetNote(ScAddress(1,5,0)); @@ -5349,9 +5349,9 @@ void Test::testAnchoredRotatedShape() m_pDoc->InitDrawLayer(); ScDrawLayer *pDrawLayer = m_pDoc->GetDrawLayer(); - CPPUNIT_ASSERT_MESSAGE("must have a draw layer", pDrawLayer != NULL); + CPPUNIT_ASSERT_MESSAGE("must have a draw layer", pDrawLayer != nullptr); SdrPage* pPage = pDrawLayer->GetPage(0); - CPPUNIT_ASSERT_MESSAGE("must have a draw page", pPage != NULL); + CPPUNIT_ASSERT_MESSAGE("must have a draw page", pPage != nullptr); m_pDoc->SetRowHeightRange( 0, MAXROW, 0, sc::HMMToTwips( 1000 ) ); const long TOLERANCE = 30; //30 hmm for ( SCCOL nCol = 0; nCol < MAXCOL; ++nCol ) @@ -5513,7 +5513,7 @@ bool checkEditTextIterator(sc::EditTextIterator& rIter, const char** pChecks) { if (!pText) // No more edit cells. The check string array should end too. - return p == NULL; + return p == nullptr; if (!p) // More edit cell, but no more check string. Bad. @@ -5542,7 +5542,7 @@ void Test::testEditTextIterator() { // First, try with an empty sheet. sc::EditTextIterator aIter(*m_pDoc,0); - const char* pChecks[] = { NULL }; + const char* pChecks[] = { nullptr }; CPPUNIT_ASSERT_MESSAGE("Wrong iterator behavior.", checkEditTextIterator(aIter, pChecks)); } @@ -5553,7 +5553,7 @@ void Test::testEditTextIterator() rEditEngine.SetText("A2"); m_pDoc->SetEditText(ScAddress(0,1,0), rEditEngine.CreateTextObject()); sc::EditTextIterator aIter(*m_pDoc,0); - const char* pChecks[] = { "A2", NULL }; + const char* pChecks[] = { "A2", nullptr }; CPPUNIT_ASSERT_MESSAGE("Wrong iterator behavior.", checkEditTextIterator(aIter, pChecks)); } @@ -5566,7 +5566,7 @@ void Test::testEditTextIterator() rEditEngine.SetText("A7"); m_pDoc->SetEditText(ScAddress(0,6,0), rEditEngine.CreateTextObject()); sc::EditTextIterator aIter(*m_pDoc,0); - const char* pChecks[] = { "A2", "A5", "A6", "A7", NULL }; + const char* pChecks[] = { "A2", "A5", "A6", "A7", nullptr }; CPPUNIT_ASSERT_MESSAGE("Wrong iterator behavior.", checkEditTextIterator(aIter, pChecks)); } @@ -5579,7 +5579,7 @@ void Test::testEditTextIterator() rEditEngine.SetText("C4"); m_pDoc->SetEditText(ScAddress(2,3,0), rEditEngine.CreateTextObject()); sc::EditTextIterator aIter(*m_pDoc,0); - const char* pChecks[] = { "A2", "A5", "A6", "A7", "C1", "C3", "C4", NULL }; + const char* pChecks[] = { "A2", "A5", "A6", "A7", "C1", "C3", "C4", nullptr }; CPPUNIT_ASSERT_MESSAGE("Wrong iterator behavior.", checkEditTextIterator(aIter, pChecks)); } @@ -5589,7 +5589,7 @@ void Test::testEditTextIterator() m_pDoc->SetValue(ScAddress(1,3,0), 1.2); m_pDoc->SetString(ScAddress(2,4,0), "Simple string"); sc::EditTextIterator aIter(*m_pDoc,0); - const char* pChecks[] = { "A2", "A5", "A6", "A7", "C1", "C3", "C4", NULL }; + const char* pChecks[] = { "A2", "A5", "A6", "A7", "C1", "C3", "C4", nullptr }; CPPUNIT_ASSERT_MESSAGE("Wrong iterator behavior.", checkEditTextIterator(aIter, pChecks)); } @@ -6775,7 +6775,7 @@ ScDocShell* Test::findLoadedDocShellByName(const OUString& rName) } pShell = static_cast<ScDocShell*>(SfxObjectShell::GetNext(*pShell, checkSfxObjectShell<ScDocShell>, false)); } - return NULL; + return nullptr; } bool Test::insertRangeNames( @@ -6844,7 +6844,7 @@ void Test::pasteFromClip(ScDocument* pDestDoc, const ScRange& rDestRange, ScDocu { ScMarkData aMark; aMark.SetMarkArea(rDestRange); - pDestDoc->CopyFromClip(rDestRange, aMark, InsertDeleteFlags::ALL, NULL, pClipDoc); + pDestDoc->CopyFromClip(rDestRange, aMark, InsertDeleteFlags::ALL, nullptr, pClipDoc); } ScUndoPaste* Test::createUndoPaste(ScDocShell& rDocSh, const ScRange& rRange, ScDocument* pUndoDoc) @@ -6855,7 +6855,7 @@ ScUndoPaste* Test::createUndoPaste(ScDocShell& rDocSh, const ScRange& rRange, Sc ScRefUndoData* pRefUndoData = new ScRefUndoData(&rDoc); return new ScUndoPaste( - &rDocSh, rRange, aMarkData, pUndoDoc, NULL, InsertDeleteFlags::ALL, pRefUndoData, false); + &rDocSh, rRange, aMarkData, pUndoDoc, nullptr, InsertDeleteFlags::ALL, pRefUndoData, false); } void Test::setExpandRefs(bool bExpand) diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index b97dabb75084..7a0158e7b6b0 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -926,7 +926,7 @@ void Test::testFormulaCompiler() { std::unique_ptr<ScTokenArray> pArray; { - pArray.reset(compileFormula(m_pDoc, OUString::createFromAscii(aTests[i].pInput), NULL, aTests[i].eInputGram)); + pArray.reset(compileFormula(m_pDoc, OUString::createFromAscii(aTests[i].pInput), nullptr, aTests[i].eInputGram)); CPPUNIT_ASSERT_MESSAGE("Token array shouldn't be NULL!", pArray.get()); } @@ -3184,11 +3184,11 @@ void Test::testFuncCOUNTBLANK() m_pDoc->InsertTab(0, "Formula"); const char* aData[][4] = { - { "1", 0, "=B1", "=\"\"" }, - { "2", 0, "=B2", "=\"\"" }, - { "A", 0, "=B3", "=\"\"" }, - { "B", 0, "=B4", "=D3" }, - { 0, 0, "=B5", "=D4" }, + { "1", nullptr, "=B1", "=\"\"" }, + { "2", nullptr, "=B2", "=\"\"" }, + { "A", nullptr, "=B3", "=\"\"" }, + { "B", nullptr, "=B4", "=D3" }, + { nullptr, nullptr, "=B5", "=D4" }, { "=COUNTBLANK(A1:A5)", "=COUNTBLANK(B1:B5)", "=COUNTBLANK(C1:C5)", "=COUNTBLANK(D1:D5)" } }; @@ -3208,7 +3208,7 @@ void Test::testFuncCOUNTBLANK() const char* aData2[][2] = { { "1", "=COUNTBLANK(A1)" }, { "A", "=COUNTBLANK(A2)" }, - { 0, "=COUNTBLANK(A3)" }, + { nullptr, "=COUNTBLANK(A3)" }, { "=\"\"", "=COUNTBLANK(A4)" }, { "=A4" , "=COUNTBLANK(A5)" }, }; @@ -4010,7 +4010,7 @@ void Test::testFuncLOOKUP() { "=CONCATENATE(\"A\")", "1" }, { "=CONCATENATE(\"B\")", "2" }, { "=CONCATENATE(\"C\")", "3" }, - { 0, 0 } // terminator + { nullptr, nullptr } // terminator }; // Insert raw data into A1:B3. @@ -4024,7 +4024,7 @@ void Test::testFuncLOOKUP() { "A", "=LOOKUP(RC[-1];R1C1:R3C1;R1C2:R3C2)" }, { "B", "=LOOKUP(RC[-1];R1C1:R3C1;R1C2:R3C2)" }, { "C", "=LOOKUP(RC[-1];R1C1:R3C1;R1C2:R3C2)" }, - { 0, 0 } // terminator + { nullptr, nullptr } // terminator }; // Insert check formulas into A5:B7. @@ -4075,7 +4075,7 @@ void Test::testFuncVLOOKUP() { "D", "13" }, { "E", "14" }, { "F", "15" }, - { 0, 0 } // terminator + { nullptr, nullptr } // terminator }; // Insert raw data into A1:B14. @@ -4091,7 +4091,7 @@ void Test::testFuncVLOOKUP() struct { const char* pLookup; const char* pFormula; const char* pRes; } aChecks[] = { - { "Lookup", "Formula", 0 }, + { "Lookup", "Formula", nullptr }, { "12", "=VLOOKUP(D2;A2:B14;2;1)", "3" }, { "29", "=VLOOKUP(D3;A2:B14;2;1)", "4" }, { "31", "=VLOOKUP(D4;A2:B14;2;1)", "5" }, @@ -4828,8 +4828,8 @@ void Test::testFormulaDepTracking3() const char* pData[][4] = { { "1", "2", "=SUM(A1:B1)", "=SUM(C1:C3)" }, - { "3", "4", "=SUM(A2:B2)", 0 }, - { "5", "6", "=SUM(A3:B3)", 0 }, + { "3", "4", "=SUM(A2:B2)", nullptr }, + { "5", "6", "=SUM(A3:B3)", nullptr }, }; insertRangeData(m_pDoc, ScAddress(0,0,0), pData, SAL_N_ELEMENTS(pData)); @@ -4910,7 +4910,7 @@ void Test::testFormulaDepTrackingDeleteCol() const char* aData[][3] = { { "2", "=A1", "=B1" }, // not grouped - { 0, 0, 0 }, // empty row to separate the formula groups. + { nullptr, nullptr, nullptr }, // empty row to separate the formula groups. { "3", "=A3", "=B3" }, // grouped { "4", "=A4", "=B4" }, // grouped }; @@ -4948,7 +4948,7 @@ void Test::testFormulaDepTrackingDeleteCol() // Expected output table content. 0 = empty cell const char* aOutputCheck[][2] = { { "#REF!", "#REF!" }, - { 0, 0 }, + { nullptr, nullptr }, { "#REF!", "#REF!" }, { "#REF!", "#REF!" }, }; @@ -4967,7 +4967,7 @@ void Test::testFormulaDepTrackingDeleteCol() // Expected output table content. 0 = empty cell const char* aOutputCheck[][3] = { { "2", "2", "2" }, - { 0, 0, 0 }, + { nullptr, nullptr, nullptr }, { "3", "3", "3" }, { "4", "4", "4" }, }; @@ -4983,7 +4983,7 @@ void Test::testFormulaDepTrackingDeleteCol() // Expected output table content. 0 = empty cell const char* aOutputCheck[][2] = { { "#REF!", "#REF!" }, - { 0, 0 }, + { nullptr, nullptr }, { "#REF!", "#REF!" }, { "#REF!", "#REF!" }, }; @@ -5003,7 +5003,7 @@ void Test::testFormulaDepTrackingDeleteCol() // Expected output table content. 0 = empty cell const char* aOutputCheck[][3] = { { "22", "22", "22" }, - { 0, 0, 0 }, + { nullptr, nullptr, nullptr }, { "23", "23", "23" }, { "24", "24", "24" }, }; @@ -5054,7 +5054,7 @@ void Test::testExternalRef() SfxMedium* pMed = new SfxMedium(aExtDocName, STREAM_STD_READWRITE); xExtDocSh->DoInitNew(pMed); CPPUNIT_ASSERT_MESSAGE("external document instance not loaded.", - findLoadedDocShellByName(aExtDocName) != NULL); + findLoadedDocShellByName(aExtDocName) != nullptr); // Populate the external source document. ScDocument& rExtDoc = xExtDocSh->GetDocument(); @@ -5190,7 +5190,7 @@ void Test::testExternalRef() // have been cached. ScExternalRefCache::TableTypeRef pCacheTab = pRefMgr->getCacheTable( nFileId, aExtSh1Name, false); - CPPUNIT_ASSERT_MESSAGE("Cache table for sheet 1 should exist.", pCacheTab.get() != NULL); + CPPUNIT_ASSERT_MESSAGE("Cache table for sheet 1 should exist.", pCacheTab.get() != nullptr); ScRange aCachedRange = getCachedRange(pCacheTab); CPPUNIT_ASSERT_MESSAGE("Unexpected cached data range.", aCachedRange.aStart.Col() == 0 && aCachedRange.aEnd.Col() == 1 && @@ -5198,11 +5198,11 @@ void Test::testExternalRef() // Sheet2 is not referenced at all; the cache table shouldn't even exist. pCacheTab = pRefMgr->getCacheTable(nFileId, aExtSh2Name, false); - CPPUNIT_ASSERT_MESSAGE("Cache table for sheet 2 should *not* exist.", pCacheTab.get() == NULL); + CPPUNIT_ASSERT_MESSAGE("Cache table for sheet 2 should *not* exist.", pCacheTab.get() == nullptr); // Sheet3's row 5 is not referenced; it should not be cached. pCacheTab = pRefMgr->getCacheTable(nFileId, aExtSh3Name, false); - CPPUNIT_ASSERT_MESSAGE("Cache table for sheet 3 should exist.", pCacheTab.get() != NULL); + CPPUNIT_ASSERT_MESSAGE("Cache table for sheet 3 should exist.", pCacheTab.get() != nullptr); aCachedRange = getCachedRange(pCacheTab); CPPUNIT_ASSERT_MESSAGE("Unexpected cached data range.", aCachedRange.aStart.Col() == 0 && aCachedRange.aEnd.Col() == 1 && @@ -5211,7 +5211,7 @@ void Test::testExternalRef() // Unload the external document shell. xExtDocSh->DoClose(); CPPUNIT_ASSERT_MESSAGE("external document instance should have been unloaded.", - findLoadedDocShellByName(aExtDocName) == NULL); + findLoadedDocShellByName(aExtDocName) == nullptr); m_pDoc->DeleteTab(0); } @@ -5224,7 +5224,7 @@ void Test::testExternalRangeName() SfxMedium* pMed = new SfxMedium(aExtDocName, STREAM_STD_READWRITE); xExtDocSh->DoInitNew(pMed); CPPUNIT_ASSERT_MESSAGE("external document instance not loaded.", - findLoadedDocShellByName(aExtDocName) != NULL); + findLoadedDocShellByName(aExtDocName) != nullptr); ScDocument& rExtDoc = xExtDocSh->GetDocument(); rExtDoc.InsertTab(0, aExtSh1Name); @@ -5243,7 +5243,7 @@ void Test::testExternalRangeName() xExtDocSh->DoClose(); CPPUNIT_ASSERT_MESSAGE("external document instance should have been unloaded.", - findLoadedDocShellByName(aExtDocName) == NULL); + findLoadedDocShellByName(aExtDocName) == nullptr); m_pDoc->DeleteTab(0); } @@ -5319,7 +5319,7 @@ void Test::testExternalRefFunctions() SfxMedium* pMed = new SfxMedium(aExtDocName, STREAM_STD_READWRITE); xExtDocSh->DoInitNew(pMed); CPPUNIT_ASSERT_MESSAGE("external document instance not loaded.", - findLoadedDocShellByName(aExtDocName) != NULL); + findLoadedDocShellByName(aExtDocName) != nullptr); ScExternalRefManager* pRefMgr = m_pDoc->GetExternalRefManager(); CPPUNIT_ASSERT_MESSAGE("external reference manager doesn't exist.", pRefMgr); @@ -5374,7 +5374,7 @@ void Test::testExternalRefFunctions() // Unload the external document shell. xExtDocSh->DoClose(); CPPUNIT_ASSERT_MESSAGE("external document instance should have been unloaded.", - findLoadedDocShellByName(aExtDocName) == NULL); + findLoadedDocShellByName(aExtDocName) == nullptr); m_pDoc->DeleteTab(0); } @@ -5519,7 +5519,7 @@ void Test::testFuncFORMULA() // Data in B1:D3 const char* aData[][3] = { { "=A1", "=FORMULA(B1)", "=FORMULA(B1:B3)" }, - { 0, "=FORMULA(B2)", "=FORMULA(B1:B3)" }, + { nullptr, "=FORMULA(B2)", "=FORMULA(B1:B3)" }, { "=A3", "=FORMULA(B3)", "=FORMULA(B1:B3)" }, }; diff --git a/sc/qa/unit/ucalc_pivottable.cxx b/sc/qa/unit/ucalc_pivottable.cxx index 53d1019d0edb..619af2b0b91e 100644 --- a/sc/qa/unit/ucalc_pivottable.cxx +++ b/sc/qa/unit/ucalc_pivottable.cxx @@ -116,7 +116,7 @@ ScDPObject* createDPFromSourceDesc( eFunc = static_cast<sheet::GeneralFunction>(aFields[i].eFunc); pDim->SetFunction(eFunc); - pDim->SetReferenceValue(NULL); + pDim->SetReferenceValue(nullptr); } else { @@ -232,14 +232,14 @@ void Test::testPivotTable() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][5] = { - { "Sum - Score", "Group", 0, 0, 0 }, + { "Sum - Score", "Group", nullptr, nullptr, nullptr }, { "Name", "A", "B", "C", "Total Result" }, - { "Andy", "30", 0, 0, "30" }, - { "Bruce", "20", 0, 0, "20" }, - { "Charlie", 0, "45", 0, "45" }, - { "David", 0, "12", 0, "12" }, - { "Edward", 0, 0, "8", "8" }, - { "Frank", 0, 0, "15", "15" }, + { "Andy", "30", nullptr, nullptr, "30" }, + { "Bruce", "20", nullptr, nullptr, "20" }, + { "Charlie", nullptr, "45", nullptr, "45" }, + { "David", nullptr, "12", nullptr, "12" }, + { "Edward", nullptr, nullptr, "8", "8" }, + { "Frank", nullptr, nullptr, "15", "15" }, { "Total Result", "50", "57", "23", "130" } }; @@ -270,14 +270,14 @@ void Test::testPivotTable() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][5] = { - { "Sum - Score", "Group", 0, 0, 0 }, + { "Sum - Score", "Group", nullptr, nullptr, nullptr }, { "Name", "A", "B", "C", "Total Result" }, - { "Andy", "30", 0, 0, "30" }, - { "Bruce", "20", 0, 0, "20" }, - { "Charlie", 0, "45", 0, "45" }, - { "David", 0, "12", 0, "12" }, - { "Edward", 0, 0, "8", "8" }, - { "Frank", 0, 0, "15", "15" }, + { "Andy", "30", nullptr, nullptr, "30" }, + { "Bruce", "20", nullptr, nullptr, "20" }, + { "Charlie", nullptr, "45", nullptr, "45" }, + { "David", nullptr, "12", nullptr, "12" }, + { "Edward", nullptr, nullptr, "8", "8" }, + { "Frank", nullptr, nullptr, "15", "15" }, { "Total Result", "50", "57", "23", "130" } }; @@ -307,14 +307,14 @@ void Test::testPivotTable() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][5] = { - { "Sum - Score", "Group", 0, 0, 0 }, + { "Sum - Score", "Group", nullptr, nullptr, nullptr }, { "Name", "A", "B", "C", "Total Result" }, - { "Andy", "100", 0, 0, "100" }, - { "Bruce", "200", 0, 0, "200" }, - { "Charlie", 0, "300", 0, "300" }, - { "David", 0, "400", 0, "400" }, - { "Edward", 0, 0, "500", "500" }, - { "Frank", 0, 0, "600", "600" }, + { "Andy", "100", nullptr, nullptr, "100" }, + { "Bruce", "200", nullptr, nullptr, "200" }, + { "Charlie", nullptr, "300", nullptr, "300" }, + { "David", nullptr, "400", nullptr, "400" }, + { "Edward", nullptr, nullptr, "500", "500" }, + { "Frank", nullptr, nullptr, "600", "600" }, { "Total Result", "300", "700", "1100", "2100" } }; @@ -408,7 +408,7 @@ void Test::testPivotTableLabels() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][5] = { - { "Sum - 1.2.3", "Version", 0, 0, 0 }, + { "Sum - 1.2.3", "Version", nullptr, nullptr, nullptr }, { "Software", "3.3.0", "3.3.1", "3.4.0", "Total Result" }, { "LibreOffice", "30", "20", "45", "95" }, { "Total Result", "30", "20", "45", "95" } @@ -464,11 +464,11 @@ void Test::testPivotTableDateLabels() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][5] = { - { "Sum - Value", "Date", 0, 0, 0 }, + { "Sum - Value", "Date", nullptr, nullptr, nullptr }, { "Name", "2011-01-01", "2011-01-02", "2011-01-03", "Total Result" }, - { "Xavior", 0, 0, "45", "45" }, - { "Yodel", 0, "20", 0, "20" }, - { "Zena", "30", 0, 0, "30" }, + { "Xavior", nullptr, nullptr, "45", "45" }, + { "Yodel", nullptr, "20", nullptr, "20" }, + { "Zena", "30", nullptr, nullptr, "30" }, { "Total Result", "30", "20", "45", "95" } }; @@ -547,10 +547,10 @@ void Test::testPivotTableFilters() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][2] = { - { "Filter", 0 }, + { "Filter", nullptr }, { "Group2", "- all -" }, - { 0, 0 }, - { "Data", 0 }, + { nullptr, nullptr }, + { "Data", nullptr }, { "Sum - Val1", "8" }, { "Sum - Val2", "80" } }; @@ -581,10 +581,10 @@ void Test::testPivotTableFilters() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][2] = { - { "Filter", 0 }, + { "Filter", nullptr }, { "Group2", "A" }, - { 0, 0 }, - { "Data", 0 }, + { nullptr, nullptr }, + { "Data", nullptr }, { "Sum - Val1", "4" }, { "Sum - Val2", "40" } }; @@ -610,10 +610,10 @@ void Test::testPivotTableFilters() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][2] = { - { "Filter", 0 }, + { "Filter", nullptr }, { "Group2", "A" }, - { 0, 0 }, - { "Data", 0 }, + { nullptr, nullptr }, + { "Data", nullptr }, { "Sum - Val1", "2" }, { "Sum - Val2", "20" } }; @@ -627,16 +627,16 @@ void Test::testPivotTableFilters() // Set the current page of 'Group2' back to '- all -'. The query filter // should still be in effect. - pPageDim->SetCurrentPage(NULL); // Remove the page. + pPageDim->SetCurrentPage(nullptr); // Remove the page. pDPObj->SetSaveData(aSaveData); aOutRange = refresh(pDPObj); { // Expected output table content. 0 = empty cell const char* aOutputCheck[][2] = { - { "Filter", 0 }, + { "Filter", nullptr }, { "Group2", "- all -" }, - { 0, 0 }, - { "Data", 0 }, + { nullptr, nullptr }, + { "Data", nullptr }, { "Sum - Val1", "4" }, { "Sum - Val2", "40" } }; @@ -707,14 +707,14 @@ void Test::testPivotTableNamedSource() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][5] = { - { "Sum - Score", "Group", 0, 0, 0 }, + { "Sum - Score", "Group", nullptr, nullptr, nullptr }, { "Name", "A", "B", "C", "Total Result" }, - { "Andy", "30", 0, 0, "30" }, - { "Bruce", "20", 0, 0, "20" }, - { "Charlie", 0, "45", 0, "45" }, - { "David", 0, "12", 0, "12" }, - { "Edward", 0, 0, "8", "8" }, - { "Frank", 0, 0, "15", "15" }, + { "Andy", "30", nullptr, nullptr, "30" }, + { "Bruce", "20", nullptr, nullptr, "20" }, + { "Charlie", nullptr, "45", nullptr, "45" }, + { "David", nullptr, "12", nullptr, "12" }, + { "Edward", nullptr, nullptr, "8", "8" }, + { "Frank", nullptr, nullptr, "15", "15" }, { "Total Result", "50", "57", "23", "130" } }; @@ -984,13 +984,13 @@ void Test::testPivotTableDuplicateDataFields() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][3] = { - { "Name", "Data", 0 }, + { "Name", "Data", nullptr }, { "A", "Sum - Value", "144" }, - { 0, "Count - Value", "5" }, + { nullptr, "Count - Value", "5" }, { "B", "Sum - Value", "267" }, - { 0, "Count - Value", "5" }, - { "Total Sum - Value", 0, "411" }, - { "Total Count - Value", 0, "10" }, + { nullptr, "Count - Value", "5" }, + { "Total Sum - Value", nullptr, "411" }, + { "Total Count - Value", nullptr, "10" }, }; bSuccess = checkDPTableOutput<3>(m_pDoc, aOutRange, aOutputCheck, "DataPilot table output"); @@ -1010,7 +1010,7 @@ void Test::testPivotTableDuplicateDataFields() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][3] = { - { 0, "Data", 0 }, + { nullptr, "Data", nullptr }, { "Name", "Sum - Value", "Count - Value" }, { "A", "144", "5" }, { "B", "267", "5" }, @@ -1100,7 +1100,7 @@ void Test::testPivotTableNormalGrouping() OUString aGroupPrefix("Group"); OUString aBaseDimName("Name"); OUString aGroupDimName = - pDimData->CreateGroupDimName(aBaseDimName, *pDPObj, false, NULL); + pDimData->CreateGroupDimName(aBaseDimName, *pDPObj, false, nullptr); { // Group A, B and C together. @@ -1131,9 +1131,9 @@ void Test::testPivotTableNormalGrouping() { "F", "F", "6" }, { "G", "G", "7" }, { "Group1", "A", "1" }, - { 0, "B", "2" }, - { 0, "C", "3" }, - { "Total Result", 0, "28" } + { nullptr, "B", "2" }, + { nullptr, "C", "3" }, + { "Total Result", nullptr, "28" } }; bSuccess = checkDPTableOutput<3>(m_pDoc, aOutRange, aOutputCheck, "A, B, C grouped by Group1."); @@ -1165,12 +1165,12 @@ void Test::testPivotTableNormalGrouping() { "Name2", "Name", "Sum - Value" }, { "G", "G", "7" }, { "Group1", "A", "1" }, - { 0, "B", "2" }, - { 0, "C", "3" }, + { nullptr, "B", "2" }, + { nullptr, "C", "3" }, { "Group2", "D", "4" }, - { 0, "E", "5" }, - { 0, "F", "6" }, - { "Total Result", 0, "28" } + { nullptr, "E", "5" }, + { nullptr, "F", "6" }, + { "Total Result", nullptr, "28" } }; bSuccess = checkDPTableOutput<3>(m_pDoc, aOutRange, aOutputCheck, "D, E, F grouped by Group2."); @@ -1343,7 +1343,7 @@ void Test::testPivotTableDateGrouping() // Add quarter dimension. This will be an additional dimension. OUString aGroupDimName = pDimData->CreateDateGroupDimName( - sheet::DataPilotFieldGroupBy::QUARTERS, *pDPObj, true, NULL); + sheet::DataPilotFieldGroupBy::QUARTERS, *pDPObj, true, nullptr); ScDPSaveGroupDimension aGroupDim(aBaseDimName, aGroupDimName); aGroupDim.SetDateInfo(aInfo, sheet::DataPilotFieldGroupBy::QUARTERS); pDimData->AddGroupDimension(aGroupDim); @@ -1358,7 +1358,7 @@ void Test::testPivotTableDateGrouping() // Add year dimension. This is a new dimension also. OUString aGroupDimName = pDimData->CreateDateGroupDimName( - sheet::DataPilotFieldGroupBy::YEARS, *pDPObj, true, NULL); + sheet::DataPilotFieldGroupBy::YEARS, *pDPObj, true, nullptr); ScDPSaveGroupDimension aGroupDim(aBaseDimName, aGroupDimName); aGroupDim.SetDateInfo(aInfo, sheet::DataPilotFieldGroupBy::YEARS); pDimData->AddGroupDimension(aGroupDim); @@ -1376,13 +1376,13 @@ void Test::testPivotTableDateGrouping() const char* aOutputCheck[][4] = { { "Years", "Quarters", "Date", "Sum - Value" }, { "2011", "Q1", "Jan", "1" }, - { 0, 0, "Mar", "2" }, - { 0, "Q3", "Sep", "7" }, + { nullptr, nullptr, "Mar", "2" }, + { nullptr, "Q3", "Sep", "7" }, { "2012", "Q1", "Jan", "3" }, - { 0, 0, "Feb", "9" }, - { 0, 0, "Mar", "6" }, - { 0, "Q4", "Dec", "8" }, - { "Total Result", 0, 0, "36" }, + { nullptr, nullptr, "Feb", "9" }, + { nullptr, nullptr, "Mar", "6" }, + { nullptr, "Q4", "Dec", "8" }, + { "Total Result", nullptr, nullptr, "36" }, }; bSuccess = checkDPTableOutput<4>(m_pDoc, aOutRange, aOutputCheck, "Years, quarters and months date groups."); @@ -1408,9 +1408,9 @@ void Test::testPivotTableDateGrouping() const char* aOutputCheck[][4] = { { "Years", "Quarters", "Date", "Sum - Value" }, { "2011", "Q1", "Jan", "1" }, - { 0, 0, "Mar", "2" }, - { 0, "Q3", "Sep", "7" }, - { "Total Result", 0, 0, "10" }, + { nullptr, nullptr, "Mar", "2" }, + { nullptr, "Q3", "Sep", "7" }, + { "Total Result", nullptr, nullptr, "10" }, }; bSuccess = checkDPTableOutput<4>(m_pDoc, aOutRange, aOutputCheck, "Year 2012 data now hidden"); @@ -1503,7 +1503,7 @@ void Test::testPivotTableEmptyRows() { "B", "2" }, { "C", "3" }, { "D", "4" }, - { "(empty)", 0 }, + { "(empty)", nullptr }, { "Total Result", "10" }, }; @@ -1654,9 +1654,9 @@ void Test::testPivotTableTextNumber() // Expected output table content. 0 = empty cell const char* aOutputCheck[][2] = { { "Name", "0004" }, - { 0, 0 }, - { "Sum - Value", 0 }, - { "4", 0 } + { nullptr, nullptr }, + { "Sum - Value", nullptr }, + { "4", nullptr } }; bSuccess = checkDPTableOutput<2>(m_pDoc, aOutRange, aOutputCheck, "Text number field members"); @@ -1901,11 +1901,11 @@ void Test::testPivotTableFieldReference() // Expected output table content. 0 = empty cell const char* aOutputCheck[][2] = { { "Name", "Sum - Value" }, - { "A", 0 }, + { "A", nullptr }, { "B", "1" }, { "C", "3" }, { "D", "7" }, - { "Total Result", 0 }, + { "Total Result", nullptr }, }; bSuccess = checkDPTableOutput<2>(m_pDoc, aOutRange, aOutputCheck, "Field reference (difference from)"); @@ -1925,7 +1925,7 @@ void Test::testPivotTableFieldReference() { "B", "200.00%" }, { "C", "400.00%" }, { "D", "800.00%" }, - { "Total Result", 0 }, + { "Total Result", nullptr }, }; bSuccess = checkDPTableOutput<2>(m_pDoc, aOutRange, aOutputCheck, "Field reference (% of)"); @@ -1941,11 +1941,11 @@ void Test::testPivotTableFieldReference() // Expected output table content. 0 = empty cell const char* aOutputCheck[][2] = { { "Name", "Sum - Value" }, - { "A", 0 }, + { "A", nullptr }, { "B", "100.00%" }, { "C", "300.00%" }, { "D", "700.00%" }, - { "Total Result", 0 }, + { "Total Result", nullptr }, }; bSuccess = checkDPTableOutput<2>(m_pDoc, aOutRange, aOutputCheck, "Field reference (% difference from)"); @@ -1965,7 +1965,7 @@ void Test::testPivotTableFieldReference() { "B", "3" }, { "C", "7" }, { "D", "15" }, - { "Total Result", 0 }, + { "Total Result", nullptr }, }; bSuccess = checkDPTableOutput<2>(m_pDoc, aOutRange, aOutputCheck, "Field reference (Running total)"); @@ -2089,7 +2089,7 @@ void Test::testFuncGETPIVOTDATA() ScRange aDataRange = insertRangeData(m_pDoc, aPos, aData, SAL_N_ELEMENTS(aData)); CPPUNIT_ASSERT_MESSAGE("failed to insert range data at correct position", aDataRange.aStart == aPos); - ScDPObject* pDPObj = NULL; + ScDPObject* pDPObj = nullptr; { // Dimension definition @@ -2172,13 +2172,13 @@ void Test::testFuncGETPIVOTDATA() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][3] = { - { "Name", "Data", 0 }, + { "Name", "Data", nullptr }, { "A", "Sum - Value", "6" }, - { 0, "Count - Value", "3" }, + { nullptr, "Count - Value", "3" }, { "B", "Sum - Value", "15" }, - { 0, "Count - Value", "3" }, - { "Total Sum - Value", 0, "21" }, - { "Total Count - Value", 0, "6" }, + { nullptr, "Count - Value", "3" }, + { "Total Sum - Value", nullptr, "21" }, + { "Total Count - Value", nullptr, "6" }, }; bSuccess = checkDPTableOutput<3>(m_pDoc, aOutRange, aOutputCheck, "Pivot table refreshed"); @@ -2248,7 +2248,7 @@ void Test::testFuncGETPIVOTDATALeafAccess() ScRange aDataRange = insertRangeData(m_pDoc, aPos, aData, SAL_N_ELEMENTS(aData)); CPPUNIT_ASSERT_MESSAGE("failed to insert range data at correct position", aDataRange.aStart == aPos); - ScDPObject* pDPObj = NULL; + ScDPObject* pDPObj = nullptr; // Dimension definition DPFieldDef aFields[] = { @@ -2274,10 +2274,10 @@ void Test::testFuncGETPIVOTDATALeafAccess() const char* aOutputCheck[][3] = { { "Type", "Member", "Sum - Value" }, { "A", "Anna", "1" }, - { 0, "Cecilia", "3" }, + { nullptr, "Cecilia", "3" }, { "B", "Brittany", "2" }, - { 0, "Donna", "4" }, - { "Total Result", 0, "10" }, + { nullptr, "Donna", "4" }, + { "Total Result", nullptr, "10" }, }; bSuccess = checkDPTableOutput<3>(m_pDoc, aOutRange, aOutputCheck, "Pivot table refreshed"); @@ -2376,14 +2376,14 @@ void Test::testPivotTableRepeatItemLabels() const char* aOutputCheck[][4] = { { "Name", "Country", "Year", "Sum - Score" }, { "Andy", "US", "1999", "30" }, - { "Andy", 0, "2002", "20" }, - { "Andy", 0, "2010", "45" }, + { "Andy", nullptr, "2002", "20" }, + { "Andy", nullptr, "2010", "45" }, { "David", "GB", "1998", "12" }, { "Edward", "NO", "2000", "8" }, { "Frank", "FR", "2007", "45" }, - { "Frank", 0, "2008", "45" }, - { "Frank", 0, "2009", "15" }, - { "Total Result", 0, 0, "220" } + { "Frank", nullptr, "2008", "45" }, + { "Frank", nullptr, "2009", "15" }, + { "Total Result", nullptr, nullptr, "220" } }; bSuccess = checkDPTableOutput<4>(m_pDoc, aOutRange, aOutputCheck, "DataPilot table output"); diff --git a/sc/qa/unit/ucalc_sharedformula.cxx b/sc/qa/unit/ucalc_sharedformula.cxx index 8d70e4defd2d..656bce67b436 100644 --- a/sc/qa/unit/ucalc_sharedformula.cxx +++ b/sc/qa/unit/ucalc_sharedformula.cxx @@ -613,7 +613,7 @@ void Test::testSharedFormulasRefUpdateRangeDeleteRow() const char* aData[][3] = { { "1", "2", "=SUM(A1:B1)" }, { "3", "4", "=SUM(A2:B2)" }, - { 0, 0, 0 }, + { nullptr, nullptr, nullptr }, { "5", "6", "=SUM(A4:B4)" }, { "7", "8", "=SUM(A5:B5)" } }; @@ -1712,7 +1712,7 @@ void Test::testSharedFormulaUnshareAreaListeners() { "=SUM(B1:B2)", "1" }, { "=SUM(B2:B3)", "2" }, { "=SUM(B3:B4)", "4" }, - { 0, "8" } + { nullptr, "8" } }; insertRangeData(m_pDoc, ScAddress(0,0,0), pData, SAL_N_ELEMENTS(pData)); diff --git a/sc/qa/unit/ucalc_sort.cxx b/sc/qa/unit/ucalc_sort.cxx index 8e183fff2f20..bb8151d24d07 100644 --- a/sc/qa/unit/ucalc_sort.cxx +++ b/sc/qa/unit/ucalc_sort.cxx @@ -61,7 +61,7 @@ void Test::testSort() aSortData.maKeyState[0].nField = 1; aSortData.maKeyState[0].bAscending = true; - m_pDoc->Sort(0, aSortData, false, true, NULL, NULL); + m_pDoc->Sort(0, aSortData, false, true, nullptr, nullptr); double nVal = m_pDoc->GetValue(1,0,0); ASSERT_DOUBLES_EQUAL(nVal, 1.0); @@ -75,8 +75,8 @@ void Test::testSort() // 0 = empty cell const char* aData[][1] = { { "Title" }, - { 0 }, - { 0 }, + { nullptr }, + { nullptr }, { "12" }, { "b" }, { "1" }, @@ -94,7 +94,7 @@ void Test::testSort() aSortData.nRow2 = aDataRange.aEnd.Row(); aSortData.bHasHeader = true; aSortData.maKeyState[0].nField = 0; - m_pDoc->Sort(0, aSortData, false, true, NULL, NULL); + m_pDoc->Sort(0, aSortData, false, true, nullptr, nullptr); // Title should stay at the top, numbers should be sorted numerically, // numbers always come before strings, and empty cells always occur at the @@ -411,7 +411,7 @@ void Test::testSortWithFormulaRefs() aSortData.maKeyState[0].bDoSort = true; aSortData.maKeyState[0].nField = 0; - m_pDoc->Sort(0, aSortData, false, true, NULL, NULL); + m_pDoc->Sort(0, aSortData, false, true, nullptr, nullptr); for (size_t i = 0; i < SAL_N_ELEMENTS(aResults); ++i) { @@ -446,7 +446,7 @@ void Test::testSortWithStrings() aParam.maKeyState[0].bAscending = true; aParam.maKeyState[0].nField = 1; - m_pDoc->Sort(0, aParam, false, true, NULL, NULL); + m_pDoc->Sort(0, aParam, false, true, nullptr, nullptr); CPPUNIT_ASSERT_EQUAL(OUString("Header"), m_pDoc->GetString(ScAddress(1,1,0))); CPPUNIT_ASSERT_EQUAL(OUString("Val1"), m_pDoc->GetString(ScAddress(1,2,0))); @@ -454,7 +454,7 @@ void Test::testSortWithStrings() aParam.maKeyState[0].bAscending = false; - m_pDoc->Sort(0, aParam, false, true, NULL, NULL); + m_pDoc->Sort(0, aParam, false, true, nullptr, nullptr); CPPUNIT_ASSERT_EQUAL(OUString("Header"), m_pDoc->GetString(ScAddress(1,1,0))); CPPUNIT_ASSERT_EQUAL(OUString("Val2"), m_pDoc->GetString(ScAddress(1,2,0))); @@ -499,7 +499,7 @@ void Test::testSortInFormulaGroup() aSortData.maKeyState[0].nField = 0; aSortData.maKeyState[0].bAscending = true; - m_pDoc->Sort(0, aSortData, false, true, NULL, NULL); + m_pDoc->Sort(0, aSortData, false, true, nullptr, nullptr); static struct { SCCOL nCol; @@ -543,7 +543,7 @@ void Test::testSortWithCellFormats() return false; } - const SfxPoolItem* pItem = NULL; + const SfxPoolItem* pItem = nullptr; if (!pPat->GetItemSet().HasItem(ATTR_FONT_WEIGHT, &pItem)) { cerr << "Pattern does not have a font weight item, but it should." << endl; @@ -569,7 +569,7 @@ void Test::testSortWithCellFormats() return false; } - const SfxPoolItem* pItem = NULL; + const SfxPoolItem* pItem = nullptr; if (!pPat->GetItemSet().HasItem(ATTR_FONT_POSTURE, &pItem)) { cerr << "Pattern does not have a font posture item, but it should." << endl; @@ -595,7 +595,7 @@ void Test::testSortWithCellFormats() return false; } - const SfxPoolItem* pItem = NULL; + const SfxPoolItem* pItem = nullptr; if (pPat->GetItemSet().HasItem(ATTR_FONT_WEIGHT, &pItem)) { // Check if the font weight is applied. @@ -864,7 +864,7 @@ void Test::testSortRefUpdate2() { "2", "=RC[-1]" }, { "6", "=RC[-1]" }, { "4", "=RC[-1]" }, - { 0, 0 } // terminator + { nullptr, nullptr } // terminator }; for (SCROW i = 0; aData[i][0]; ++i) @@ -951,7 +951,7 @@ void Test::testSortRefUpdate3() "2", "=A4+10", "=A2+A4", - 0 // terminator + nullptr // terminator }; for (SCROW i = 0; pData[i]; ++i) @@ -1491,8 +1491,8 @@ void Test::testSortBroadcaster() { const char* aData[][7] = { - { "1", 0, 0, "=B1", "=$B$1", "=SUM(A1:B1)", "=SUM($A$1:$B$1)" }, - { "2", "8", 0, "=B2", "=$B$2", "=SUM(A2:B2)", "=SUM($A$2:$B$2)" }, + { "1", nullptr, nullptr, "=B1", "=$B$1", "=SUM(A1:B1)", "=SUM($A$1:$B$1)" }, + { "2", "8", nullptr, "=B2", "=$B$2", "=SUM(A2:B2)", "=SUM($A$2:$B$2)" }, }; ScAddress aPos(0,0,0); @@ -1502,8 +1502,8 @@ void Test::testSortBroadcaster() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][7] = { - { "1", 0, 0, "0", "0", "1", "1" }, - { "2", "8", 0, "8", "8", "10", "10" }, + { "1", nullptr, nullptr, "0", "0", "1", "1" }, + { "2", "8", nullptr, "8", "8", "10", "10" }, }; bool bSuccess = checkOutput<7>(m_pDoc, aDataRange, aOutputCheck, "Initial value"); @@ -1533,8 +1533,8 @@ void Test::testSortBroadcaster() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][7] = { - { "2", "8", 0, "8", "8", "10", "10" }, - { "1", 0, 0, "0", "0", "1", "1" }, + { "2", "8", nullptr, "8", "8", "10", "10" }, + { "1", nullptr, nullptr, "0", "0", "1", "1" }, }; bool bSuccess = checkOutput<7>(m_pDoc, aDataRange, aOutputCheck, "Sorted without reference update"); @@ -1587,8 +1587,8 @@ void Test::testSortBroadcaster() { const char* aData[][2] = { { "1", "2" }, - { 0, "8" }, - { 0, 0 }, + { nullptr, "8" }, + { nullptr, nullptr }, { "=A6", "=B6" }, { "=$A$6", "=$B$6" }, { "=SUM(A5:A6)", "=SUM(B5:B6)" }, @@ -1603,8 +1603,8 @@ void Test::testSortBroadcaster() // Expected output table content. 0 = empty cell const char* aOutputCheck[][2] = { { "1", "2" }, - { 0, "8" }, - { 0, 0 }, + { nullptr, "8" }, + { nullptr, nullptr }, { "0", "8" }, { "0", "8" }, { "1", "10" }, @@ -1639,8 +1639,8 @@ void Test::testSortBroadcaster() // Expected output table content. 0 = empty cell const char* aOutputCheck[][2] = { { "2", "1" }, - { "8", 0 }, - { 0, 0 }, + { "8", nullptr }, + { nullptr, nullptr }, { "8", "0" }, { "8", "0" }, { "10", "1" }, @@ -1707,7 +1707,7 @@ void Test::testSortOutOfPlaceResult() "2", "9", "-2", - 0 // terminator + nullptr // terminator }; // source data in A1:A6. @@ -1781,7 +1781,7 @@ void Test::testSortPartialFormulaGroup() { "8", "=RC[-1]" }, { "47", "=RC[-1]" }, { "28", "=RC[-1]" }, - { 0, 0 } // terminator + { nullptr, nullptr } // terminator }; // A1:B6. |