sc/inc/rangenam.hxx | 2 +- sc/qa/unit/ucalc.cxx | 16 ++++++++-------- sc/qa/unit/ucalc_formula.cxx | 22 +++++++++++----------- sc/qa/unit/ucalc_pivottable.cxx | 2 +- sc/source/core/data/documen3.cxx | 4 ++-- sc/source/core/tool/rangenam.cxx | 4 ++-- sc/source/filter/orcus/interface.cxx | 2 +- sc/source/filter/xml/xmlimprt.cxx | 2 +- sc/source/ui/app/inputwin.cxx | 2 +- sc/source/ui/docshell/docfunc.cxx | 2 +- sc/source/ui/namedlg/namedefdlg.cxx | 2 +- sc/source/ui/namedlg/namedlg.cxx | 2 +- sc/source/ui/unoobj/nameuno.cxx | 4 ++-- sc/source/ui/view/viewfunc.cxx | 2 +- 14 files changed, 34 insertions(+), 34 deletions(-)
New commits: commit b3dc39b0d4bc1d2f906cd25c41636719dd838d2f Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sun Sep 13 21:14:58 2020 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Mon Sep 14 14:51:07 2020 +0200 both branches dereference ScDocument* arg Change-Id: I63a2b7908fe332c177ea0385c3ea9b9cd136f824 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102622 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sc/inc/rangenam.hxx b/sc/inc/rangenam.hxx index 36c31aea33ed..1a64db7bb9b6 100644 --- a/sc/inc/rangenam.hxx +++ b/sc/inc/rangenam.hxx @@ -83,7 +83,7 @@ private: void InitCode(); public: - SC_DLLPUBLIC ScRangeData( ScDocument* pDoc, + SC_DLLPUBLIC ScRangeData( ScDocument& rDoc, const OUString& rName, const OUString& rSymbol, const ScAddress& rAdr = ScAddress(), diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index d407efaff99a..d79146f92a86 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -1607,9 +1607,9 @@ void Test::testNamedRange() // Test using another-sheet-local name, scope Sheet1. ScRangeData* pLocal1 = new ScRangeData( *m_pDoc, "local1", ScAddress(0,0,0)); - ScRangeData* pLocal2 = new ScRangeData( m_pDoc, "local2", "$Sheet1.$A$1"); - ScRangeData* pLocal3 = new ScRangeData( m_pDoc, "local3", "Sheet1.$A$1"); - ScRangeData* pLocal4 = new ScRangeData( m_pDoc, "local4", "$A$1"); // implicit relative sheet reference + ScRangeData* pLocal2 = new ScRangeData( *m_pDoc, "local2", "$Sheet1.$A$1"); + ScRangeData* pLocal3 = new ScRangeData( *m_pDoc, "local3", "Sheet1.$A$1"); + ScRangeData* pLocal4 = new ScRangeData( *m_pDoc, "local4", "$A$1"); // implicit relative sheet reference std::unique_ptr<ScRangeName> pLocalRangeName1(new ScRangeName); pLocalRangeName1->insert(pLocal1); pLocalRangeName1->insert(pLocal2); @@ -3338,12 +3338,12 @@ void Test::testCopyPaste() //create some range names, local and global ScRangeData* pLocal1 = new ScRangeData( *m_pDoc, "local1", aAdr); ScRangeData* pLocal2 = new ScRangeData( *m_pDoc, "local2", aAdr); - ScRangeData* pLocal3 = new ScRangeData( m_pDoc, "local3", "$Sheet1.$A$1"); - ScRangeData* pLocal4 = new ScRangeData( m_pDoc, "local4", "Sheet1.$A$1"); - ScRangeData* pLocal5 = new ScRangeData( m_pDoc, "local5", "$A$1"); // implicit relative sheet reference + ScRangeData* pLocal3 = new ScRangeData( *m_pDoc, "local3", "$Sheet1.$A$1"); + ScRangeData* pLocal4 = new ScRangeData( *m_pDoc, "local4", "Sheet1.$A$1"); + ScRangeData* pLocal5 = new ScRangeData( *m_pDoc, "local5", "$A$1"); // implicit relative sheet reference ScRangeData* pGlobal = new ScRangeData( *m_pDoc, "global", aAdr); const OUString aGlobal2Symbol("$Sheet1.$A$1:$A$23"); - ScRangeData* pGlobal2 = new ScRangeData( m_pDoc, "global2", aGlobal2Symbol); + ScRangeData* pGlobal2 = new ScRangeData( *m_pDoc, "global2", aGlobal2Symbol); std::unique_ptr<ScRangeName> pGlobalRangeName(new ScRangeName()); pGlobalRangeName->insert(pGlobal); pGlobalRangeName->insert(pGlobal2); @@ -6673,7 +6673,7 @@ bool Test::insertRangeNames( for (; p != pEnd; ++p) { ScRangeData* pNew = new ScRangeData( - pDoc, + *pDoc, OUString::createFromAscii(p->mpName), OUString::createFromAscii(p->mpExpr), aA1, ScRangeData::Type::Name, diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index 93cec516acdd..13e6263e7da8 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -115,7 +115,7 @@ void Test::testFormulaCreateStringFromTokens() for (size_t i = 0; i < SAL_N_ELEMENTS(aNames); ++i) { ScRangeData* pName = new ScRangeData( - m_pDoc, OUString::createFromAscii(aNames[i].pName), OUString::createFromAscii(aNames[i].pExpr), + *m_pDoc, OUString::createFromAscii(aNames[i].pName), OUString::createFromAscii(aNames[i].pExpr), ScAddress(0,0,0), ScRangeData::Type::Name, formula::FormulaGrammar::GRAM_NATIVE); if (aNames[i].bGlobal) @@ -3304,7 +3304,7 @@ void Test::testFormulaRefUpdateName() ScRangeName* pGlobalNames = m_pDoc->GetRangeName(); CPPUNIT_ASSERT_MESSAGE("Failed to obtain global named expression object.", pGlobalNames); ScRangeData* pName = new ScRangeData( - m_pDoc, "ToLeft", "RC[-1]", ScAddress(2,1,0), + *m_pDoc, "ToLeft", "RC[-1]", ScAddress(2,1,0), ScRangeData::Type::Name, formula::FormulaGrammar::GRAM_NATIVE_XL_R1C1); bool bInserted = pGlobalNames->insert(pName); @@ -3347,7 +3347,7 @@ void Test::testFormulaRefUpdateName() // Insert a new named expression that references these values as absolute range. pName = new ScRangeData( - m_pDoc, "MyRange", "$B$10:$B$12", ScAddress(0,0,0), ScRangeData::Type::Name, formula::FormulaGrammar::GRAM_NATIVE); + *m_pDoc, "MyRange", "$B$10:$B$12", ScAddress(0,0,0), ScRangeData::Type::Name, formula::FormulaGrammar::GRAM_NATIVE); bInserted = pGlobalNames->insert(pName); CPPUNIT_ASSERT_MESSAGE("Failed to insert a new name.", bInserted); @@ -3404,7 +3404,7 @@ void Test::testFormulaRefUpdateName() pGlobalNames->clear(); pName = new ScRangeData( - m_pDoc, "MyRange", "$B$1:$C$6", ScAddress(0,0,0), ScRangeData::Type::Name, formula::FormulaGrammar::GRAM_NATIVE); + *m_pDoc, "MyRange", "$B$1:$C$6", ScAddress(0,0,0), ScRangeData::Type::Name, formula::FormulaGrammar::GRAM_NATIVE); bInserted = pGlobalNames->insert(pName); CPPUNIT_ASSERT_MESSAGE("Failed to insert a new name.", bInserted); pName->GetSymbol(aExpr); @@ -3871,7 +3871,7 @@ void Test::testFormulaRefUpdateNameCopySheet() m_pDoc->InsertTab(0, "Test2"); // Local name referencing sheet Test2. - bInserted = m_pDoc->GetRangeName(0)->insert( new ScRangeData( m_pDoc, "localname", "$Test2.$A$1")); + bInserted = m_pDoc->GetRangeName(0)->insert( new ScRangeData( *m_pDoc, "localname", "$Test2.$A$1")); CPPUNIT_ASSERT(bInserted); m_pDoc->SetString(ScAddress(0,0,0), "=SHEET()"); m_pDoc->SetString(ScAddress(1,0,0), "=localname"); @@ -6061,7 +6061,7 @@ void Test::testFunc_MATCH_INDIRECT() sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn on auto calculation. ScRangeName* pGlobalNames = m_pDoc->GetRangeName(); - ScRangeData* pRangeData = new ScRangeData( m_pDoc, "RoleAssignment", "$D$4:$D$13"); + ScRangeData* pRangeData = new ScRangeData( *m_pDoc, "RoleAssignment", "$D$4:$D$13"); pGlobalNames->insert(pRangeData); // D6: data to match, in 3rd row of named range. @@ -6614,7 +6614,7 @@ void Test::testExternalRangeName() rExtDoc.SetValue(0, 0, 0, 123.456); ScRangeName* pRangeName = rExtDoc.GetRangeName(); - ScRangeData* pRangeData = new ScRangeData(&rExtDoc, "ExternalName", + ScRangeData* pRangeData = new ScRangeData(rExtDoc, "ExternalName", "$Data1.$A$1"); pRangeName->insert(pRangeData); @@ -7116,7 +7116,7 @@ void Test::testFuncTableRef() // range definition to test later use of [#This Row] results in // proper rows. ScRangeData* pName = new ScRangeData( - m_pDoc, OUString::createFromAscii(aNames[i].pName), OUString::createFromAscii(aNames[i].pExpr), + *m_pDoc, OUString::createFromAscii(aNames[i].pName), OUString::createFromAscii(aNames[i].pExpr), ScAddress(2,4,0), ScRangeData::Type::Name, formula::FormulaGrammar::GRAM_NATIVE); bool bInserted = pGlobalNames->insert(pName); CPPUNIT_ASSERT_MESSAGE( @@ -7290,7 +7290,7 @@ void Test::testFuncTableRef() // range definition to test later use of [#This Row] results in // proper rows. ScRangeData* pName = new ScRangeData( - m_pDoc, OUString::createFromAscii(aHlNames[i].pName), OUString::createFromAscii(aHlNames[i].pExpr), + *m_pDoc, OUString::createFromAscii(aHlNames[i].pName), OUString::createFromAscii(aHlNames[i].pExpr), ScAddress(6,12,0), ScRangeData::Type::Name, formula::FormulaGrammar::GRAM_NATIVE); bool bInserted = pGlobalNames->insert(pName); CPPUNIT_ASSERT_MESSAGE( @@ -8673,9 +8673,9 @@ void Test::testIntersectionOpExcel() ScRangeName* pGlobalNames = m_pDoc->GetRangeName(); // Horizontal cell range covering C2. - pGlobalNames->insert( new ScRangeData( m_pDoc, "horz", "$B$2:$D$2")); + pGlobalNames->insert( new ScRangeData( *m_pDoc, "horz", "$B$2:$D$2")); // Vertical cell range covering C2. - pGlobalNames->insert( new ScRangeData( m_pDoc, "vert", "$C$1:$C$3")); + pGlobalNames->insert( new ScRangeData( *m_pDoc, "vert", "$C$1:$C$3")); // Data in C2. m_pDoc->SetValue(2,1,0, 1.0); diff --git a/sc/qa/unit/ucalc_pivottable.cxx b/sc/qa/unit/ucalc_pivottable.cxx index e8327f65c0f5..9649eeb7b598 100644 --- a/sc/qa/unit/ucalc_pivottable.cxx +++ b/sc/qa/unit/ucalc_pivottable.cxx @@ -689,7 +689,7 @@ void Test::testPivotTableNamedSource() ScRangeName* pNames = m_pDoc->GetRangeName(); CPPUNIT_ASSERT_MESSAGE("Failed to get global range name container.", pNames); ScRangeData* pName = new ScRangeData( - m_pDoc, aRangeName, aRangeStr); + *m_pDoc, aRangeName, aRangeStr); bool bSuccess = pNames->insert(pName); CPPUNIT_ASSERT_MESSAGE("Failed to insert a new name.", bSuccess); diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 033ebb326f6c..a3c412aff02a 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -221,7 +221,7 @@ bool ScDocument::InsertNewRangeName( const OUString& rName, const ScAddress& rPo if (!pGlobalNames) return false; - ScRangeData* pName = new ScRangeData(this, rName, rExpr, rPos, ScRangeData::Type::Name, GetGrammar()); + ScRangeData* pName = new ScRangeData(*this, rName, rExpr, rPos, ScRangeData::Type::Name, GetGrammar()); return pGlobalNames->insert(pName); } @@ -231,7 +231,7 @@ bool ScDocument::InsertNewRangeName( SCTAB nTab, const OUString& rName, const Sc if (!pLocalNames) return false; - ScRangeData* pName = new ScRangeData(this, rName, rExpr, rPos, ScRangeData::Type::Name, GetGrammar()); + ScRangeData* pName = new ScRangeData(*this, rName, rExpr, rPos, ScRangeData::Type::Name, GetGrammar()); return pLocalNames->insert(pName); } diff --git a/sc/source/core/tool/rangenam.cxx b/sc/source/core/tool/rangenam.cxx index 2d739cbab13f..38a14cb94880 100644 --- a/sc/source/core/tool/rangenam.cxx +++ b/sc/source/core/tool/rangenam.cxx @@ -44,7 +44,7 @@ using ::std::pair; // ScRangeData -ScRangeData::ScRangeData( ScDocument* pDok, +ScRangeData::ScRangeData( ScDocument& rDok, const OUString& rName, const OUString& rSymbol, const ScAddress& rAddress, @@ -54,7 +54,7 @@ ScRangeData::ScRangeData( ScDocument* pDok, aUpperName ( ScGlobal::getCharClassPtr()->uppercase( rName ) ), aPos ( rAddress ), eType ( nType ), - pDoc ( pDok ), + pDoc ( &rDok ), eTempGrammar( eGrammar ), nIndex ( 0 ), bModified ( false ) diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx index aa96eb21d405..95cec29ba5bc 100644 --- a/sc/source/filter/orcus/interface.cxx +++ b/sc/source/filter/orcus/interface.cxx @@ -248,7 +248,7 @@ void ScOrcusNamedExpression::commit() return; ScRangeData* pRange = new ScRangeData( - &mrDoc.getDoc(), maName, maExpr, maBasePos, ScRangeData::Type::Name, + mrDoc.getDoc(), maName, maExpr, maBasePos, ScRangeData::Type::Name, mrGlobalSettings.getCalcGrammar()); pNames->insert(pRange, false); diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx index 6cc383d23bd7..4270c73f7adc 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -1511,7 +1511,7 @@ public: ScXMLConverter::ConvertCellRangeAddress(aContent); ScRangeData* pData = new ScRangeData( - mpDoc, p->sName, aContent, aPos, nNewType, p->eGrammar); + *mpDoc, p->sName, aContent, aPos, nNewType, p->eGrammar); mrRangeName.insert(pData); } } diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index 82c8c0925a06..5397b09f6733 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -2466,7 +2466,7 @@ void ScPosWnd::DoEnter() ScRangeName aNewRanges( *pNames ); ScAddress aCursor( rViewData.GetCurX(), rViewData.GetCurY(), rViewData.GetTabNo() ); OUString aContent(aSelection.Format(rDoc, ScRefFlags::RANGE_ABS_3D, rDoc.GetAddressConvention())); - ScRangeData* pNew = new ScRangeData( &rDoc, aText, aContent, aCursor ); + ScRangeData* pNew = new ScRangeData( rDoc, aText, aContent, aCursor ); if ( aNewRanges.insert(pNew) ) { pDocShell->GetDocFunc().ModifyRangeNames( aNewRanges ); diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index d3f5dbe4b291..2d60e831cef8 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -5251,7 +5251,7 @@ void ScDocFunc::CreateOneName( ScRangeName& rList, if (bInsert) { - ScRangeData* pData = new ScRangeData( &rDoc, aName, aContent, + ScRangeData* pData = new ScRangeData( rDoc, aName, aContent, ScAddress( nPosX, nPosY, nTab)); if (!rList.insert(pData)) { diff --git a/sc/source/ui/namedlg/namedefdlg.cxx b/sc/source/ui/namedlg/namedefdlg.cxx index 0cd43c9b68c6..920f4d52ce11 100644 --- a/sc/source/ui/namedlg/namedefdlg.cxx +++ b/sc/source/ui/namedlg/namedefdlg.cxx @@ -206,7 +206,7 @@ void ScNameDefDlg::AddPushed() { ScRangeData::Type nType = ScRangeData::Type::Name; - ScRangeData* pNewEntry = new ScRangeData( &mrDoc, + ScRangeData* pNewEntry = new ScRangeData( mrDoc, aName, aExpression, maCursorPos, diff --git a/sc/source/ui/namedlg/namedlg.cxx b/sc/source/ui/namedlg/namedlg.cxx index ab459e1bc31d..2b237dedf16c 100644 --- a/sc/source/ui/namedlg/namedlg.cxx +++ b/sc/source/ui/namedlg/namedlg.cxx @@ -388,7 +388,7 @@ void ScNameDlg::NameModified() if ( m_xBtnPrintArea->get_active() ) nType |= ScRangeData::Type::PrintArea; if ( m_xBtnCriteria->get_active() ) nType |= ScRangeData::Type::Criteria; - ScRangeData* pNewEntry = new ScRangeData( mpDoc, aNewName, aExpr, + ScRangeData* pNewEntry = new ScRangeData( *mpDoc, aNewName, aExpr, maCursorPos, nType); pNewEntry->SetIndex( nIndex); pNewRangeName->insert(pNewEntry, false /*bReuseFreeIndex*/); diff --git a/sc/source/ui/unoobj/nameuno.cxx b/sc/source/ui/unoobj/nameuno.cxx index 4b30e29f1e34..a55d138687d3 100644 --- a/sc/source/ui/unoobj/nameuno.cxx +++ b/sc/source/ui/unoobj/nameuno.cxx @@ -193,7 +193,7 @@ void ScNamedRangeObj::Modify_Impl( const OUString* pNewName, const ScTokenArray* if (pNewTokens) pNew = new ScRangeData( &rDoc, aInsName, *pNewTokens, aPos, nType ); else - pNew = new ScRangeData( &rDoc, aInsName, aContent, aPos, nType, eGrammar ); + pNew = new ScRangeData( rDoc, aInsName, aContent, aPos, nType, eGrammar ); pNew->SetIndex( pOld->GetIndex() ); @@ -492,7 +492,7 @@ void SAL_CALL ScNamedRangesObj::addNewByName( const OUString& aName, { std::unique_ptr<ScRangeName> pNewRanges(new ScRangeName( *pNames )); // GRAM_API for API compatibility. - ScRangeData* pNew = new ScRangeData( &rDoc, aName, aContent, + ScRangeData* pNew = new ScRangeData( rDoc, aName, aContent, aPos, nNewType,formula::FormulaGrammar::GRAM_API ); if ( pNewRanges->insert(pNew) ) { diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 642d90f9c06f..091f23324220 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -2865,7 +2865,7 @@ bool ScViewFunc::InsertName( const OUString& rName, const OUString& rSymbol, ScRangeData::Type nType = ScRangeData::Type::Name; auto pNewEntry = std::make_unique<ScRangeData>( - &rDoc, rName, rSymbol, ScAddress( GetViewData().GetCurX(), + rDoc, rName, rSymbol, ScAddress( GetViewData().GetCurX(), GetViewData().GetCurY(), nTab), nType ); OUString aUpType = rType.toAsciiUpperCase(); if ( aUpType.indexOf( 'P' ) != -1 ) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits