sc/inc/tokenarray.hxx | 2 +- sc/source/core/data/clipcontext.cxx | 2 +- sc/source/core/data/column.cxx | 2 +- sc/source/core/data/column3.cxx | 12 ++++++------ sc/source/core/data/conditio.cxx | 8 ++++---- sc/source/core/data/documen4.cxx | 2 +- sc/source/core/data/documentimport.cxx | 2 +- sc/source/core/data/formulacell.cxx | 16 ++++++++-------- sc/source/core/data/table2.cxx | 4 ++-- sc/source/core/data/table3.cxx | 2 +- sc/source/core/data/validat.cxx | 4 ++-- sc/source/core/tool/compiler.cxx | 16 ++++++++-------- sc/source/core/tool/consoli.cxx | 4 ++-- sc/source/core/tool/interpr1.cxx | 2 +- sc/source/core/tool/rangenam.cxx | 6 +++--- sc/source/core/tool/token.cxx | 4 ++-- sc/source/filter/excel/xechart.cxx | 2 +- sc/source/filter/excel/xeformula.cxx | 6 +++--- sc/source/filter/html/htmlimp.cxx | 2 +- sc/source/filter/inc/tokstack.hxx | 2 +- sc/source/filter/lotus/tool.cxx | 4 ++-- sc/source/filter/oox/condformatbuffer.cxx | 10 +++++----- sc/source/filter/oox/workbookhelper.cxx | 2 +- sc/source/filter/oox/worksheethelper.cxx | 2 +- sc/source/filter/xml/xmlcelli.cxx | 2 +- sc/source/filter/xml/xmlsubti.cxx | 2 +- sc/source/ui/docshell/docfunc.cxx | 2 +- sc/source/ui/docshell/externalrefmgr.cxx | 12 ++++++------ sc/source/ui/docshell/tablink.cxx | 2 +- sc/source/ui/formdlg/formula.cxx | 4 ++-- sc/source/ui/unoobj/cellsuno.cxx | 6 +++--- sc/source/ui/unoobj/chart2uno.cxx | 4 ++-- sc/source/ui/unoobj/fmtuno.cxx | 8 ++++---- sc/source/ui/unoobj/funcuno.cxx | 2 +- sc/source/ui/unoobj/nameuno.cxx | 2 +- sc/source/ui/unoobj/tokenuno.cxx | 2 +- sc/source/ui/vba/vbarange.cxx | 2 +- sc/source/ui/view/viewfun2.cxx | 2 +- 38 files changed, 85 insertions(+), 85 deletions(-)
New commits: commit f3af5f8e6897279dc8e4ad2695caf7f25937d608 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sun Sep 13 16:31:23 2020 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Sun Sep 13 22:11:52 2020 +0200 ScTokenArray ctor always dereferences its ScDocument* arg Change-Id: Ie65ca182fd00600670c1e916343fef511d6cdcc8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102588 Tested-by: Caolán McNamara <caol...@redhat.com> Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sc/inc/tokenarray.hxx b/sc/inc/tokenarray.hxx index fb8495fe7da1..3af5fbcb5ca1 100644 --- a/sc/inc/tokenarray.hxx +++ b/sc/inc/tokenarray.hxx @@ -62,7 +62,7 @@ class SAL_WARN_UNUSED SC_DLLPUBLIC ScTokenArray final : public formula::FormulaT void CheckForThreading( const formula::FormulaToken& r ); public: - ScTokenArray(const ScDocument* pDoc); + ScTokenArray(const ScDocument& rDoc); ScTokenArray(ScSheetLimits&); /** Assignment with incrementing references of FormulaToken entries (not copied!) */ diff --git a/sc/source/core/data/clipcontext.cxx b/sc/source/core/data/clipcontext.cxx index 1926d865669e..d2733fad4517 100644 --- a/sc/source/core/data/clipcontext.cxx +++ b/sc/source/core/data/clipcontext.cxx @@ -152,7 +152,7 @@ void CopyFromClipContext::setSingleCell( const ScAddress& rSrcPos, const ScColum aRef.InitAddress(rSrcPos); aRef.SetFlag3D(true); - ScTokenArray aArr(mpClipDoc); + ScTokenArray aArr(*mpClipDoc); aArr.AddSingleReference(aRef); rSrcCell.set(new ScFormulaCell(mpClipDoc, rSrcPos, aArr)); return; diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index fec0cb3de38e..31b1630e219f 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -1291,7 +1291,7 @@ class CopyAsLinkHandler aRef.InitAddress(ScAddress(mrSrcCol.GetCol(), nRow, mrSrcCol.GetTab())); // Absolute reference. aRef.SetFlag3D(true); - ScTokenArray aArr(mrDestCol.GetDoc()); + ScTokenArray aArr(*mrDestCol.GetDoc()); aArr.AddSingleReference(aRef); return new ScFormulaCell(mrDestCol.GetDoc(), ScAddress(mrDestCol.GetCol(), nRow, mrDestCol.GetTab()), aArr); } diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 43dc0c6b5338..cbd69dc2b5cd 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -1095,7 +1095,7 @@ class CopyCellsFromClipHandler aRef.InitAddress(aSrcPos); aRef.SetFlag3D(true); - ScTokenArray aArr(mrCxt.getDestDoc()); + ScTokenArray aArr(*mrCxt.getDestDoc()); aArr.AddSingleReference(aRef); mrDestCol.SetFormulaCell( @@ -1429,7 +1429,7 @@ void ScColumn::CopyFromClip( aRef.SetAbsRow(nDestRow - nDy); // Source row aDestPos.SetRow( nDestRow ); - ScTokenArray aArr(GetDoc()); + ScTokenArray aArr(*GetDoc()); aArr.AddSingleReference( aRef ); SetFormulaCell(nDestRow, new ScFormulaCell(pDocument, aDestPos, aArr)); } @@ -1585,7 +1585,7 @@ public: case sc::element_type_formula: { // Combination of value and at least one formula -> Create formula - ScTokenArray aArr(mrDestColumn.GetDoc()); + ScTokenArray aArr(*mrDestColumn.GetDoc()); // First row aArr.AddDouble(f); @@ -1643,7 +1643,7 @@ public: case sc::element_type_numeric: { // Source is formula, and dest is value. - ScTokenArray aArr(mrDestColumn.GetDoc()); + ScTokenArray aArr(*mrDestColumn.GetDoc()); // First row lcl_AddCode(aArr, p); @@ -1672,7 +1672,7 @@ public: case sc::element_type_formula: { // Both are formulas. - ScTokenArray aArr(mrDestColumn.GetDoc()); + ScTokenArray aArr(*mrDestColumn.GetDoc()); // First row lcl_AddCode(aArr, p); @@ -1752,7 +1752,7 @@ public: break; case sc::element_type_formula: { - ScTokenArray aArr(mrDestColumn.GetDoc()); + ScTokenArray aArr(*mrDestColumn.GetDoc()); // First row ScFormulaCell* pSrc = sc::formula_block::at(*aPos.first->data, aPos.second); diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index 12857f329295..975e232ca0dd 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -352,7 +352,7 @@ void ScConditionEntry::Compile( const OUString& rExpr1, const OUString& rExpr2, if ( mpDoc->IsImportingXML() && !bTextToReal ) { // temporary formula string as string tokens - pFormula1.reset( new ScTokenArray(mpDoc) ); + pFormula1.reset( new ScTokenArray(*mpDoc) ); pFormula1->AssignXMLString( rExpr1, rExprNmsp1 ); // bRelRef1 is set when the formula is compiled again (CompileXML) } @@ -371,7 +371,7 @@ void ScConditionEntry::Compile( const OUString& rExpr1, const OUString& rExpr2, if ( mpDoc->IsImportingXML() && !bTextToReal ) { // temporary formula string as string tokens - pFormula2.reset( new ScTokenArray(mpDoc) ); + pFormula2.reset( new ScTokenArray(*mpDoc) ); pFormula2->AssignXMLString( rExpr2, rExprNmsp2 ); // bRelRef2 is set when the formula is compiled again (CompileXML) } @@ -1289,7 +1289,7 @@ std::unique_ptr<ScTokenArray> ScConditionEntry::CreateFlatCopiedTokenArray( sal_ pRet.reset(new ScTokenArray( *pFormula1 )); else { - pRet.reset(new ScTokenArray(mpDoc)); + pRet.reset(new ScTokenArray(*mpDoc)); if (bIsStr1) { svl::SharedStringPool& rSPool = mpDoc->GetSharedStringPool(); @@ -1305,7 +1305,7 @@ std::unique_ptr<ScTokenArray> ScConditionEntry::CreateFlatCopiedTokenArray( sal_ pRet.reset(new ScTokenArray( *pFormula2 )); else { - pRet.reset(new ScTokenArray(mpDoc)); + pRet.reset(new ScTokenArray(*mpDoc)); if (bIsStr2) { svl::SharedStringPool& rSPool = mpDoc->GetSharedStringPool(); diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx index 570f90e24cdf..e3c8e55e0cd2 100644 --- a/sc/source/core/data/documen4.cxx +++ b/sc/source/core/data/documen4.cxx @@ -313,7 +313,7 @@ void ScDocument::InsertMatrixFormula(SCCOL nCol1, SCROW nRow1, aRefData.SetTabRel( true ); aRefData.SetAddress(GetSheetLimits(), aBasePos, aBasePos); - ScTokenArray aArr(this); // consists only of one single reference token. + ScTokenArray aArr(*this); // consists only of one single reference token. formula::FormulaToken* t = aArr.AddMatrixSingleReference(aRefData); for (const SCTAB& nTab : rMark) diff --git a/sc/source/core/data/documentimport.cxx b/sc/source/core/data/documentimport.cxx index ec528a502bfb..224dfeacae6f 100644 --- a/sc/source/core/data/documentimport.cxx +++ b/sc/source/core/data/documentimport.cxx @@ -410,7 +410,7 @@ void ScDocumentImport::setMatrixCells( aRefData.SetTabRel(true); aRefData.SetAddress(mpImpl->mrDoc.GetSheetLimits(), rBasePos, rBasePos); - ScTokenArray aArr(&mpImpl->mrDoc); // consists only of one single reference token. + ScTokenArray aArr(mpImpl->mrDoc); // consists only of one single reference token. formula::FormulaToken* t = aArr.AddMatrixSingleReference(aRefData); ScAddress aPos = rBasePos; diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 228150525db0..107d0569b03c 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -622,7 +622,7 @@ ScFormulaCell::ScFormulaCell( ScDocument* pDoc, const ScAddress& rPos ) : nSeenInIteration(0), nFormatType(SvNumFormatType::NUMBER), eTempGrammar(formula::FormulaGrammar::GRAM_DEFAULT), - pCode(new ScTokenArray(pDoc)), + pCode(new ScTokenArray(*pDoc)), pDocument(pDoc), pPrevious(nullptr), pNext(nullptr), @@ -665,7 +665,7 @@ ScFormulaCell::ScFormulaCell( ScDocument* pDoc, const ScAddress& rPos, Compile( rFormula, true, eGrammar ); // bNoListening, Insert does that if (!pCode) // We need to have a non-NULL token array instance at all times. - pCode = new ScTokenArray(pDoc); + pCode = new ScTokenArray(*pDoc); } ScFormulaCell::ScFormulaCell( @@ -790,7 +790,7 @@ ScFormulaCell::ScFormulaCell( nSeenInIteration(0), nFormatType(xGroup->mnFormatType), eTempGrammar( eGrammar), - pCode(xGroup->mpCode ? xGroup->mpCode.get() : new ScTokenArray(&rDoc)), + pCode(xGroup->mpCode ? xGroup->mpCode.get() : new ScTokenArray(rDoc)), pDocument( &rDoc ), pPrevious(nullptr), pNext(nullptr), @@ -1038,7 +1038,7 @@ OUString ScFormulaCell::GetFormula( sc::CompileFormulaContext& rCxt, const ScInt OUStringBuffer aBuf; if (pCode->GetCodeError() != FormulaError::NONE && !pCode->GetLen()) { - ScTokenArray aCode(&rCxt.getDoc()); + ScTokenArray aCode(rCxt.getDoc()); aCode.AddToken( FormulaErrorToken( pCode->GetCodeError())); ScCompiler aComp(rCxt, aPos, aCode, false, false, pContext); aComp.CreateStringFromTokenArray(aBuf); @@ -3247,7 +3247,7 @@ void setOldCodeToUndo( ScFormulaCell* pFCell = new ScFormulaCell( - pUndoDoc, aUndoPos, pOldCode ? *pOldCode : ScTokenArray(pUndoDoc), eTempGrammar, cMatrixFlag); + pUndoDoc, aUndoPos, pOldCode ? *pOldCode : ScTokenArray(*pUndoDoc), eTempGrammar, cMatrixFlag); pFCell->SetResultToken(nullptr); // to recognize it as changed later (Cut/Paste!) pUndoDoc->SetFormulaCell(aUndoPos, pFCell); @@ -3852,7 +3852,7 @@ void ScFormulaCell::UpdateTranspose( const ScRange& rSource, const ScAddress& rD if (pUndoDoc) { ScFormulaCell* pFCell = new ScFormulaCell( - pUndoDoc, aPos, pOld ? *pOld : ScTokenArray(pUndoDoc), eTempGrammar, cMatrixFlag); + pUndoDoc, aPos, pOld ? *pOld : ScTokenArray(*pUndoDoc), eTempGrammar, cMatrixFlag); pFCell->aResult.SetToken( nullptr); // to recognize it as changed later (Cut/Paste!) pUndoDoc->SetFormulaCell(aPos, pFCell); @@ -5064,7 +5064,7 @@ bool ScFormulaCell::InterpretFormulaGroupOpenCL(sc::FormulaLogger::GroupScope& a xGroup->mpCode = std::move(mxGroup->mpCode); // temporarily transfer } - ScTokenArray aCode(pDocument); + ScTokenArray aCode(*pDocument); ScGroupTokenConverter aConverter(aCode, *pDocument, *this, xGroup->mpTopCell->aPos); // TODO avoid this extra compilation ScCompiler aComp( pDocument, xGroup->mpTopCell->aPos, *pCode, formula::FormulaGrammar::GRAM_UNSPECIFIED, true, cMatrixFlag != ScMatrixMode::NONE ); @@ -5146,7 +5146,7 @@ bool ScFormulaCell::InterpretInvariantFormulaGroup() // An invariant group should only have absolute row references, and no // external references are allowed. - ScTokenArray aCode(pDocument); + ScTokenArray aCode(*pDocument); FormulaTokenArrayPlainIterator aIter(*pCode); for (const formula::FormulaToken* p = aIter.First(); p; p = aIter.Next()) { diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index c1018405b101..e625fb037feb 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -813,7 +813,7 @@ class TransClipHandler aRef.InitAddress(aSrcPos); // Absolute reference. aRef.SetFlag3D(true); - ScTokenArray aArr(&mrClipTab.GetDoc()); + ScTokenArray aArr(mrClipTab.GetDoc()); aArr.AddSingleReference(aRef); return new ScFormulaCell(&mrClipTab.GetDoc(), rDestPos, aArr); } @@ -912,7 +912,7 @@ void ScTable::TransposeClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScSingleRefData aRef; aRef.InitAddress(ScAddress(nCol,nRow,nTab)); aRef.SetFlag3D(true); - ScTokenArray aArr(pDestDoc); + ScTokenArray aArr(*pDestDoc); aArr.AddSingleReference( aRef ); pTransClip->SetFormulaCell( diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index d30499f305e1..7a34da65b1ca 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -2164,7 +2164,7 @@ bool ScTable::DoSubTotals( ScSubTotalParam& rParam ) aRef.Ref2.SetAbsCol(nResCols[nResult]); aRef.Ref2.SetAbsRow(rRowEntry.nFuncEnd); - ScTokenArray aArr(pDocument); + ScTokenArray aArr(*pDocument); aArr.AddOpCode( ocSubTotal ); aArr.AddOpCode( ocOpen ); aArr.AddDouble( static_cast<double>(pResFunc[nResult]) ); diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx index e121dbb6e489..31ed337047e9 100644 --- a/sc/source/core/data/validat.cxx +++ b/sc/source/core/data/validat.cxx @@ -783,7 +783,7 @@ bool ScValidationData::GetSelectionFromFormula( { for( nCol = 0; nCol < nCols ; nCol++ ) { - ScTokenArray aCondTokArr(pDocument); + ScTokenArray aCondTokArr(*pDocument); std::unique_ptr<ScTypedStrData> pEntry; OUString aValStr; ScMatrixValue nMatVal = pValues->Get( nCol, nRow); @@ -938,7 +938,7 @@ bool ScValidationData::IsListValid( ScRefCellValue& rCell, const ScAddress& rPos if( !bIsValid ) { // create a formula containing a single string or number - ScTokenArray aCondTokArr(GetDocument()); + ScTokenArray aCondTokArr(*GetDocument()); double fValue; OUString aStr(pString); if (GetDocument()->GetFormatTable()->IsNumberFormat(aStr, nFormat, fValue)) diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index d0df03f30485..aad726849ad4 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -4502,7 +4502,7 @@ std::unique_ptr<ScTokenArray> ScCompiler::CompileString( const OUString& rFormul if( meGrammar == FormulaGrammar::GRAM_EXTERNAL ) SetGrammar( FormulaGrammar::GRAM_PODF ); - ScTokenArray aArr(pDoc); + ScTokenArray aArr(*pDoc); pArr = &aArr; maArrIterator = FormulaTokenArrayPlainIterator(*pArr); aFormula = comphelper::string::strip(rFormula, ' '); @@ -4822,7 +4822,7 @@ std::unique_ptr<ScTokenArray> ScCompiler::CompileString( const OUString& rFormul table::CellAddress aReferencePos; ScUnoConversion::FillApiAddress( aReferencePos, aPos ); uno::Sequence< sheet::FormulaToken > aTokenSeq = xParser->parseFormula( rFormula, aReferencePos ); - ScTokenArray aTokenArray(pDoc); + ScTokenArray aTokenArray(*pDoc); if( ScTokenConversion::ConvertToTokenArray( *pDoc, aTokenArray, aTokenSeq ) ) { // remember pArr, in case a subsequent CompileTokenArray() is executed. @@ -4871,7 +4871,7 @@ bool ScCompiler::HandleRange() bool bAddPair = !(bBorder1 && bBorder2); if ( bAddPair ) { - pNew = new ScTokenArray(pDoc); + pNew = new ScTokenArray(*pDoc); pNew->AddOpCode( ocClose ); PushTokenArray( pNew, true ); } @@ -4894,7 +4894,7 @@ bool ScCompiler::HandleRange() maArrIterator.Reset(); if ( bAddPair ) { - pNew = new ScTokenArray(pDoc); + pNew = new ScTokenArray(*pDoc); pNew->AddOpCode( ocOpen ); PushTokenArray( pNew, true ); } @@ -4905,7 +4905,7 @@ bool ScCompiler::HandleRange() { // No ScRangeData for an already compiled token can happen in BIFF .xls // import if the original range is not present in the document. - pNew = new ScTokenArray(pDoc); + pNew = new ScTokenArray(*pDoc); pNew->Add( new FormulaErrorToken( FormulaError::NoName)); PushTokenArray( pNew, true ); return GetToken(); @@ -5532,7 +5532,7 @@ bool ScCompiler::HandleColRowName() SetError(FormulaError::NoRef); else if (mbJumpCommandReorder) { - ScTokenArray* pNew = new ScTokenArray(pDoc); + ScTokenArray* pNew = new ScTokenArray(*pDoc); if ( bSingle ) { ScSingleRefData aRefData; @@ -5588,7 +5588,7 @@ bool ScCompiler::HandleDbData() pDBData->GetArea(aRange); aRange.aEnd.SetTab(aRange.aStart.Tab()); aRefData.SetRange(pDoc->GetSheetLimits(), aRange, aPos); - ScTokenArray* pNew = new ScTokenArray(pDoc); + ScTokenArray* pNew = new ScTokenArray(*pDoc); pNew->AddDoubleReference( aRefData ); PushTokenArray( pNew, true ); return GetToken(); @@ -5789,7 +5789,7 @@ bool ScCompiler::HandleTableRef() } } while (eState != sStop); } - ScTokenArray* pNew = new ScTokenArray(pDoc); + ScTokenArray* pNew = new ScTokenArray(*pDoc); if (nError == FormulaError::NONE || nError == FormulaError::NoValue) { bool bCol2Rel = false; diff --git a/sc/source/core/tool/consoli.cxx b/sc/source/core/tool/consoli.cxx index 725baa1ca802..a2955029e72e 100644 --- a/sc/source/core/tool/consoli.cxx +++ b/sc/source/core/tool/consoli.cxx @@ -477,7 +477,7 @@ void ScConsData::OutputToDocument( ScDocument* pDestDoc, SCCOL nCol, SCROW nRow, aSRef.SetAddress(pDestDoc->GetSheetLimits(), ScAddress(aRef.nCol,aRef.nRow,aRef.nTab), ScAddress()); - ScTokenArray aRefArr(pDestDoc); + ScTokenArray aRefArr(*pDestDoc); aRefArr.AddSingleReference(aSRef); aRefArr.AddOpCode(ocStop); ScAddress aDest( sal::static_int_cast<SCCOL>(nCol+nArrX), @@ -496,7 +496,7 @@ void ScConsData::OutputToDocument( ScDocument* pDestDoc, SCCOL nCol, SCROW nRow, aRange.aEnd.SetRow(nRow+nArrY+nNeeded-1); aCRef.SetRange(pDestDoc->GetSheetLimits(), aRange, aDest); - ScTokenArray aArr(pDestDoc); + ScTokenArray aArr(*pDestDoc); aArr.AddOpCode(eOpCode); // selected function aArr.AddOpCode(ocOpen); aArr.AddDoubleReference(aCRef); diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 121f17757b45..3601881e3404 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -2469,7 +2469,7 @@ void ScInterpreter::ScCellExternal() else if ( aInfoType == "ADDRESS" ) { // ODF 1.2 says we need to always display address using the ODF A1 grammar. - ScTokenArray aArray(&mrDoc); + ScTokenArray aArray(mrDoc); aArray.AddExternalSingleReference(nFileId, svl::SharedString( aTabName), aRef); // string not interned ScCompiler aComp(&mrDoc, aPos, aArray, formula::FormulaGrammar::GRAM_ODFF_A1); OUString aStr; diff --git a/sc/source/core/tool/rangenam.cxx b/sc/source/core/tool/rangenam.cxx index 615daddf3568..44a2bcff7be7 100644 --- a/sc/source/core/tool/rangenam.cxx +++ b/sc/source/core/tool/rangenam.cxx @@ -74,7 +74,7 @@ ScRangeData::ScRangeData( ScDocument* pDok, // Copy ctor default-constructs pCode if it was NULL, so it's initialized here, too, // to ensure same behavior if unnecessary copying is left out. - pCode.reset( new ScTokenArray(pDoc) ); + pCode.reset( new ScTokenArray(*pDoc) ); pCode->SetFromRangeName(true); } } @@ -103,7 +103,7 @@ ScRangeData::ScRangeData( ScDocument* pDok, const ScAddress& rTarget ) : aName ( rName ), aUpperName ( ScGlobal::getCharClassPtr()->uppercase( rName ) ), - pCode ( new ScTokenArray(pDok) ), + pCode ( new ScTokenArray(*pDok) ), aPos ( rTarget ), eType ( Type::Name ), pDoc ( pDok ), @@ -125,7 +125,7 @@ ScRangeData::ScRangeData( ScDocument* pDok, ScRangeData::ScRangeData(const ScRangeData& rScRangeData, ScDocument* pDocument, const ScAddress* pPos) : aName (rScRangeData.aName), aUpperName (rScRangeData.aUpperName), - pCode (rScRangeData.pCode ? rScRangeData.pCode->Clone().release() : new ScTokenArray(pDocument)), // make real copy (not copy-ctor) + pCode (rScRangeData.pCode ? rScRangeData.pCode->Clone().release() : new ScTokenArray(*pDocument)), // make real copy (not copy-ctor) aPos (pPos ? *pPos : rScRangeData.aPos), eType (rScRangeData.eType), pDoc (pDocument ? pDocument : rScRangeData.pDoc), diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index 329c8e3b53d9..0502c748bbbe 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -1862,9 +1862,9 @@ bool ScTokenArray::IsValidReference( ScRange& rRange, const ScAddress& rPos ) co return ImplGetReference(rRange, rPos, true); } -ScTokenArray::ScTokenArray(const ScDocument* pDoc) : +ScTokenArray::ScTokenArray(const ScDocument& rDoc) : FormulaTokenArray(), - mxSheetLimits(&pDoc->GetSheetLimits()), + mxSheetLimits(&rDoc.GetSheetLimits()), mnHashValue(0) { ResetVectorState(); diff --git a/sc/source/filter/excel/xechart.cxx b/sc/source/filter/excel/xechart.cxx index 8c25aa3d13d2..7d6ba12e0154 100644 --- a/sc/source/filter/excel/xechart.cxx +++ b/sc/source/filter/excel/xechart.cxx @@ -896,7 +896,7 @@ sal_uInt16 XclExpChSourceLink::ConvertDataSequence( Reference< XDataSequence > c if( !pArray ) return nDefCount; - ScTokenArray aArray(&GetRoot().GetDoc()); + ScTokenArray aArray(GetRoot().GetDoc()); sal_uInt32 nValueCount = 0; FormulaTokenArrayPlainIterator aIter(*pArray); for( const FormulaToken* pToken = aIter.First(); pToken; pToken = aIter.Next() ) diff --git a/sc/source/filter/excel/xeformula.cxx b/sc/source/filter/excel/xeformula.cxx index 07089c681f81..c1c2d1b1c943 100644 --- a/sc/source/filter/excel/xeformula.cxx +++ b/sc/source/filter/excel/xeformula.cxx @@ -2643,14 +2643,14 @@ XclTokenArrayRef XclExpFormulaCompiler::CreateFormula( XclTokenArrayRef XclExpFormulaCompiler::CreateFormula( XclFormulaType eType, const ScAddress& rScPos ) { - ScTokenArray aScTokArr(&GetRoot().GetDoc()); + ScTokenArray aScTokArr(GetRoot().GetDoc()); lclPutCellToTokenArray( aScTokArr, rScPos, GetCurrScTab(), mxImpl->Is3DRefOnly( eType ) ); return mxImpl->CreateFormula( eType, aScTokArr ); } XclTokenArrayRef XclExpFormulaCompiler::CreateFormula( XclFormulaType eType, const ScRange& rScRange ) { - ScTokenArray aScTokArr(&GetRoot().GetDoc()); + ScTokenArray aScTokArr(GetRoot().GetDoc()); lclPutRangeToTokenArray( aScTokArr, rScRange, GetCurrScTab(), mxImpl->Is3DRefOnly( eType ) ); return mxImpl->CreateFormula( eType, aScTokArr ); } @@ -2661,7 +2661,7 @@ XclTokenArrayRef XclExpFormulaCompiler::CreateFormula( XclFormulaType eType, con if( nCount == 0 ) return XclTokenArrayRef(); - ScTokenArray aScTokArr(&GetRoot().GetDoc()); + ScTokenArray aScTokArr(GetRoot().GetDoc()); SCTAB nCurrScTab = GetCurrScTab(); bool b3DRefOnly = mxImpl->Is3DRefOnly( eType ); for( size_t nIdx = 0; nIdx < nCount; ++nIdx ) diff --git a/sc/source/filter/html/htmlimp.cxx b/sc/source/filter/html/htmlimp.cxx index 1b0bd9af2612..40c0babd73eb 100644 --- a/sc/source/filter/html/htmlimp.cxx +++ b/sc/source/filter/html/htmlimp.cxx @@ -104,7 +104,7 @@ void ScHTMLImport::InsertRangeName( ScDocument* pDoc, const OUString& rName, con aRefData.InitRange( rRange ); aRefData.Ref1.SetFlag3D( true ); aRefData.Ref2.SetFlag3D( aRefData.Ref2.Tab() != aRefData.Ref1.Tab() ); - ScTokenArray aTokArray(pDoc); + ScTokenArray aTokArray(*pDoc); aTokArray.AddDoubleReference( aRefData ); ScRangeData* pRangeData = new ScRangeData( pDoc, rName, aTokArray ); pDoc->GetRangeName()->insert( pRangeData ); diff --git a/sc/source/filter/inc/tokstack.hxx b/sc/source/filter/inc/tokstack.hxx index 26283660b04d..74b916ddf4d5 100644 --- a/sc/source/filter/inc/tokstack.hxx +++ b/sc/source/filter/inc/tokstack.hxx @@ -410,7 +410,7 @@ inline TokenId TokenPool::Store() inline std::unique_ptr<ScTokenArray> TokenPool::GetTokenArray( const ScDocument *pDoc, const TokenId& rId ) { - std::unique_ptr<ScTokenArray> pScToken( new ScTokenArray(pDoc) ); + std::unique_ptr<ScTokenArray> pScToken( new ScTokenArray(*pDoc) ); if( rId ) {//...only if rId > 0! diff --git a/sc/source/filter/lotus/tool.cxx b/sc/source/filter/lotus/tool.cxx index 423c246b6e12..891eaaa556e0 100644 --- a/sc/source/filter/lotus/tool.cxx +++ b/sc/source/filter/lotus/tool.cxx @@ -404,7 +404,7 @@ void LotusRangeList::Append( const ScDocument* pDoc, std::unique_ptr<LotusRange> auto pLRTmp = pLR.get(); maRanges.push_back(std::move(pLR)); - ScTokenArray aTokArray(pDoc); + ScTokenArray aTokArray(*pDoc); ScSingleRefData* pSingRef = &aComplRef.Ref1; @@ -427,7 +427,7 @@ void LotusRangeList::Append( const ScDocument* pDoc, std::unique_ptr<LotusRange> } RangeNameBufferWK3::RangeNameBufferWK3(const ScDocument* pDoc) - : pScTokenArray( new ScTokenArray(pDoc) ) + : pScTokenArray( new ScTokenArray(*pDoc) ) { nIntCount = 1; } diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx index cca1064223d6..3b67674e254a 100644 --- a/sc/source/filter/oox/condformatbuffer.cxx +++ b/sc/source/filter/oox/condformatbuffer.cxx @@ -853,7 +853,7 @@ void CondFormatRule::finalizeImport() eOperator == ScConditionMode::ContainsText || eOperator == ScConditionMode::NotContainsText ) { ScDocument& rDoc = getScDocument(); - ScTokenArray aTokenArray(&rDoc); + ScTokenArray aTokenArray(rDoc); svl::SharedStringPool& rSPool = rDoc.GetSharedStringPool(); aTokenArray.AddString(rSPool.intern(maModel.maText)); OUString aStyleName = getStyles().createDxfStyle( maModel.mnDxfId ); @@ -866,12 +866,12 @@ void CondFormatRule::finalizeImport() std::unique_ptr<ScTokenArray> pTokenArray2; if( maModel.maFormulas.size() >= 2) { - pTokenArray2.reset(new ScTokenArray(&rDoc)); + pTokenArray2.reset(new ScTokenArray(rDoc)); ScTokenConversion::ConvertToTokenArray(rDoc, *pTokenArray2, maModel.maFormulas[1]); rDoc.CheckLinkFormulaNeedingCheck(*pTokenArray2); } - ScTokenArray aTokenArray(&rDoc); + ScTokenArray aTokenArray(rDoc); OUString aStyleName = getStyles().createDxfStyle( maModel.mnDxfId ); ScTokenConversion::ConvertToTokenArray( rDoc, aTokenArray, maModel.maFormulas[ 0 ] ); rDoc.CheckLinkFormulaNeedingCheck( aTokenArray); @@ -883,7 +883,7 @@ void CondFormatRule::finalizeImport() eOperator == ScConditionMode::TopPercent || eOperator == ScConditionMode::BottomPercent ) { ScDocument& rDoc = getScDocument(); - ScTokenArray aTokenArray(&rDoc); + ScTokenArray aTokenArray(rDoc); aTokenArray.AddDouble( maModel.mnRank ); OUString aStyleName = getStyles().createDxfStyle( maModel.mnDxfId ); ScCondFormatEntry* pNewEntry = new ScCondFormatEntry( eOperator, &aTokenArray, nullptr, &rDoc, aPos, aStyleName ); @@ -894,7 +894,7 @@ void CondFormatRule::finalizeImport() { ScDocument& rDoc = getScDocument(); // actually that is still unsupported - ScTokenArray aTokenArrayDev(&rDoc); + ScTokenArray aTokenArrayDev(rDoc); aTokenArrayDev.AddDouble( maModel.mnStdDev ); OUString aStyleName = getStyles().createDxfStyle( maModel.mnDxfId ); ScCondFormatEntry* pNewEntry = new ScCondFormatEntry( eOperator, &aTokenArrayDev, nullptr, &rDoc, aPos, aStyleName ); diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx index 9c604ca83a19..0a415346b64d 100644 --- a/sc/source/filter/oox/workbookhelper.cxx +++ b/sc/source/filter/oox/workbookhelper.cxx @@ -359,7 +359,7 @@ ScRangeData* lcl_addNewByNameAndTokens( ScDocument& rDoc, ScRangeName* pNames, c if ( nUnoType & NamedRangeFlag::PRINT_AREA ) nNewType |= ScRangeData::Type::PrintArea; if ( nUnoType & NamedRangeFlag::COLUMN_HEADER ) nNewType |= ScRangeData::Type::ColHeader; if ( nUnoType & NamedRangeFlag::ROW_HEADER ) nNewType |= ScRangeData::Type::RowHeader; - ScTokenArray aTokenArray(&rDoc); + ScTokenArray aTokenArray(rDoc); (void)ScTokenConversion::ConvertToTokenArray( rDoc, aTokenArray, rTokens ); ScRangeData* pNew = new ScRangeData( &rDoc, rName, aTokenArray, ScAddress(), nNewType ); pNew->GuessPosition(); diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx index 2616ca4ef973..a04ee80646fb 100644 --- a/sc/source/filter/oox/worksheethelper.cxx +++ b/sc/source/filter/oox/worksheethelper.cxx @@ -1548,7 +1548,7 @@ void WorksheetHelper::putRichString( const ScAddress& rAddress, const RichString void WorksheetHelper::putFormulaTokens( const ScAddress& rAddress, const ApiTokenSequence& rTokens ) { ScDocumentImport& rDoc = getDocImport(); - std::unique_ptr<ScTokenArray> pTokenArray(new ScTokenArray(&rDoc.getDoc())); + std::unique_ptr<ScTokenArray> pTokenArray(new ScTokenArray(rDoc.getDoc())); ScTokenConversion::ConvertToTokenArray(rDoc.getDoc(), *pTokenArray, rTokens); rDoc.setFormulaCell(rAddress, std::move(pTokenArray)); } diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index 7d5d6894f8b8..c5a2b79d938e 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -1361,7 +1361,7 @@ void ScXMLTableRowCellContext::PutFormulaCell( const ScAddress& rCellPos ) return; // temporary formula string as string tokens - std::unique_ptr<ScTokenArray> pCode(new ScTokenArray(pDoc)); + std::unique_ptr<ScTokenArray> pCode(new ScTokenArray(*pDoc)); // Check the special case of a single error constant without leading // '=' and create an error formula cell without tokens. diff --git a/sc/source/filter/xml/xmlsubti.cxx b/sc/source/filter/xml/xmlsubti.cxx index fa47ef2ce29b..a83ef254ac8d 100644 --- a/sc/source/filter/xml/xmlsubti.cxx +++ b/sc/source/filter/xml/xmlsubti.cxx @@ -270,7 +270,7 @@ void ScMyTables::AddMatrixRange( maMatrixRangeList.push_back(aScRange); ScDocumentImport& rDoc = rImport.GetDoc(); - ScTokenArray aCode(&rDoc.getDoc()); + ScTokenArray aCode(rDoc.getDoc()); aCode.AssignXMLString( rFormula, ((eGrammar == formula::FormulaGrammar::GRAM_EXTERNAL) ? rFormulaNmsp : OUString())); rDoc.setMatrixCells(aScRange, aCode, eGrammar); diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 58252c418227..d3f5dbe4b291 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -4358,7 +4358,7 @@ bool ScDocFunc::EnterMatrix( const ScRange& rRange, const ScMarkData* pTabMark, } else if ( rDoc.IsImportingXML() ) { - ScTokenArray aCode(&rDoc); + ScTokenArray aCode(rDoc); aCode.AssignXMLString( rString, ((eGrammar == formula::FormulaGrammar::GRAM_EXTERNAL) ? rFormulaNmsp : OUString())); rDoc.InsertMatrixFormula( nStartCol, nStartRow, nEndCol, nEndRow, diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx index 305035304257..f1d8be08bd02 100644 --- a/sc/source/ui/docshell/externalrefmgr.cxx +++ b/sc/source/ui/docshell/externalrefmgr.cxx @@ -687,7 +687,7 @@ ScExternalRefCache::TokenArrayRef ScExternalRefCache::getCellRangeData( ScMatrixToken aToken(xMat); if (!pArray) - pArray = std::make_shared<ScTokenArray>(mxFakeDoc.get()); + pArray = std::make_shared<ScTokenArray>(*mxFakeDoc); pArray->AddToken(aToken); bFirstTab = false; @@ -1536,7 +1536,7 @@ static std::unique_ptr<ScTokenArray> convertToTokenArray( std::unique_ptr<ScRange> pUsedRange; - unique_ptr<ScTokenArray> pArray(new ScTokenArray(pSrcDoc)); + unique_ptr<ScTokenArray> pArray(new ScTokenArray(*pSrcDoc)); bool bFirstTab = true; vector<ScExternalRefCache::SingleRangeData>::iterator itrCache = rCacheData.begin(), itrCacheEnd = rCacheData.end(); @@ -1618,7 +1618,7 @@ static std::unique_ptr<ScTokenArray> lcl_fillEmptyMatrix(const ScDocument* pDoc, ScMatrixRef xMat = new ScMatrix(nC, nR); ScMatrixToken aToken(xMat); - unique_ptr<ScTokenArray> pArray(new ScTokenArray(pDoc)); + unique_ptr<ScTokenArray> pArray(new ScTokenArray(*pDoc)); pArray->AddToken(aToken); return pArray; } @@ -2004,7 +2004,7 @@ ScExternalRefCache::TokenArrayRef ScExternalRefManager::getDoubleRefTokens( if (!pSrcDoc) { // Source document is not reachable. Throw a reference error. - pArray = std::make_shared<ScTokenArray>(maRefCache.getFakeDoc()); + pArray = std::make_shared<ScTokenArray>(*maRefCache.getFakeDoc()); pArray->AddToken(FormulaErrorToken(FormulaError::NoRef)); return pArray; } @@ -2248,7 +2248,7 @@ ScExternalRefCache::TokenArrayRef ScExternalRefManager::getDoubleRefTokensFromSr if (!pSrcDoc->GetTable(rTabName, nTab1)) { // specified table name doesn't exist in the source document. - pArray = std::make_shared<ScTokenArray>(pSrcDoc); + pArray = std::make_shared<ScTokenArray>(*pSrcDoc); pArray->AddToken(FormulaErrorToken(FormulaError::NoRef)); return pArray; } @@ -2296,7 +2296,7 @@ ScExternalRefCache::TokenArrayRef ScExternalRefManager::getRangeNameTokensFromSr // register the source document with the link manager if it's a new // source. - ScExternalRefCache::TokenArrayRef pNew = std::make_shared<ScTokenArray>(pSrcDoc); + ScExternalRefCache::TokenArrayRef pNew = std::make_shared<ScTokenArray>(*pSrcDoc); ScTokenArray aCode(*pRangeData->GetCode()); FormulaTokenArrayPlainIterator aIter(aCode); diff --git a/sc/source/ui/docshell/tablink.cxx b/sc/source/ui/docshell/tablink.cxx index 51d0095161e0..087119c653df 100644 --- a/sc/source/ui/docshell/tablink.cxx +++ b/sc/source/ui/docshell/tablink.cxx @@ -317,7 +317,7 @@ bool ScTableLink::Refresh(const OUString& rNewFile, const OUString& rNewFilter, size_t nRanges = aErrorCells.size(); if ( nRanges ) // found any? { - ScTokenArray aTokenArr(&rDoc); + ScTokenArray aTokenArr(rDoc); aTokenArr.AddOpCode( ocNotAvail ); aTokenArr.AddOpCode( ocOpen ); aTokenArr.AddOpCode( ocClose ); diff --git a/sc/source/ui/formdlg/formula.cxx b/sc/source/ui/formdlg/formula.cxx index 28fb1250a034..b57f5531d7ea 100644 --- a/sc/source/ui/formdlg/formula.cxx +++ b/sc/source/ui/formdlg/formula.cxx @@ -440,7 +440,7 @@ void ScFormulaDlg::SetReference( const ScRange& rRef, ScDocument& rRefDoc ) // We can't use ScRange::Format here because in R1C1 mode we need // to display the reference position relative to the cursor // position. - ScTokenArray aArray(&rRefDoc); + ScTokenArray aArray(rRefDoc); ScComplexRefData aRefData; aRefData.InitRangeRel(&rRefDoc, rRef, m_CursorPos); if ((eRangeFlags & eColFlags) == eColFlags) @@ -685,7 +685,7 @@ table::CellAddress ScFormulaDlg::getReferencePosition() const ::std::unique_ptr<formula::FormulaTokenArray> ScFormulaDlg::convertToTokenArray(const uno::Sequence< sheet::FormulaToken >& _aTokenList) { - ::std::unique_ptr<formula::FormulaTokenArray> pArray(new ScTokenArray(m_pDoc)); + ::std::unique_ptr<formula::FormulaTokenArray> pArray(new ScTokenArray(*m_pDoc)); pArray->Fill(_aTokenList, m_pDoc->GetSharedStringPool(), m_pDoc->GetExternalRefManager()); return pArray; } diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 10a510920c86..e1d90d36a14e 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -1191,7 +1191,7 @@ static bool lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange, uno::Sequence< sheet::FormulaToken > aTokens; if ( rElement >>= aTokens ) { - ScTokenArray aTokenArray(&rDoc); + ScTokenArray aTokenArray(rDoc); ScTokenConversion::ConvertToTokenArray( rDoc, aTokenArray, aTokens ); rDoc.SetFormula(aPos, aTokenArray); } @@ -4951,7 +4951,7 @@ void SAL_CALL ScCellRangeObj::setArrayTokens( const uno::Sequence<sheet::Formula } ScDocument& rDoc = pDocSh->GetDocument(); - ScTokenArray aTokenArray(&rDoc); + ScTokenArray aTokenArray(rDoc); (void)ScTokenConversion::ConvertToTokenArray( rDoc, aTokenArray, rTokens ); // Actually GRAM_API is a don't-care here because of the token @@ -6351,7 +6351,7 @@ void SAL_CALL ScCellObj::setTokens( const uno::Sequence<sheet::FormulaToken>& rT if ( pDocSh ) { ScDocument& rDoc = pDocSh->GetDocument(); - ScTokenArray aTokenArray(&rDoc); + ScTokenArray aTokenArray(rDoc); (void)ScTokenConversion::ConvertToTokenArray( rDoc, aTokenArray, rTokens ); ScFormulaCell* pNewCell = new ScFormulaCell(&rDoc, aCellPos, aTokenArray); diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx index 0d271511c7d7..f98c2c27d3a2 100644 --- a/sc/source/ui/unoobj/chart2uno.cxx +++ b/sc/source/ui/unoobj/chart2uno.cxx @@ -2029,7 +2029,7 @@ sal_Bool SAL_CALL ScChart2DataProvider::createDataSequenceByFormulaTokensPossibl if (!aTokens.hasElements()) return false; - ScTokenArray aCode(m_pDocument); + ScTokenArray aCode(*m_pDocument); if (!ScTokenConversion::ConvertToTokenArray(*m_pDocument, aCode, aTokens)) return false; @@ -2087,7 +2087,7 @@ ScChart2DataProvider::createDataSequenceByFormulaTokens( if (!aTokens.hasElements()) return xResult; - ScTokenArray aCode(m_pDocument); + ScTokenArray aCode(*m_pDocument); if (!ScTokenConversion::ConvertToTokenArray(*m_pDocument, aCode, aTokens)) return xResult; diff --git a/sc/source/ui/unoobj/fmtuno.cxx b/sc/source/ui/unoobj/fmtuno.cxx index 3f5112d8fec3..c6a84e98cb9c 100644 --- a/sc/source/ui/unoobj/fmtuno.cxx +++ b/sc/source/ui/unoobj/fmtuno.cxx @@ -215,14 +215,14 @@ void ScTableConditionalFormat::FillFormat( ScConditionalFormat& rFormat, if ( aData.maTokens1.hasElements() ) { - ScTokenArray aTokenArray(pDoc); + ScTokenArray aTokenArray(*pDoc); if ( ScTokenConversion::ConvertToTokenArray(*pDoc, aTokenArray, aData.maTokens1) ) pCoreEntry->SetFormula1(aTokenArray); } if ( aData.maTokens2.hasElements() ) { - ScTokenArray aTokenArray(pDoc); + ScTokenArray aTokenArray(*pDoc); if ( ScTokenConversion::ConvertToTokenArray(*pDoc, aTokenArray, aData.maTokens2) ) pCoreEntry->SetFormula2(aTokenArray); } @@ -601,14 +601,14 @@ ScValidationData* ScTableValidationObj::CreateValidationData( ScDocument* pDoc, if ( aTokens1.hasElements() ) { - ScTokenArray aTokenArray(pDoc); + ScTokenArray aTokenArray(*pDoc); if ( ScTokenConversion::ConvertToTokenArray(*pDoc, aTokenArray, aTokens1) ) pRet->SetFormula1(aTokenArray); } if ( aTokens2.hasElements() ) { - ScTokenArray aTokenArray(pDoc); + ScTokenArray aTokenArray(*pDoc); if ( ScTokenConversion::ConvertToTokenArray(*pDoc, aTokenArray, aTokens2) ) pRet->SetFormula2(aTokenArray); } diff --git a/sc/source/ui/unoobj/funcuno.cxx b/sc/source/ui/unoobj/funcuno.cxx index 2a72d61bd1cf..963afdb560a6 100644 --- a/sc/source/ui/unoobj/funcuno.cxx +++ b/sc/source/ui/unoobj/funcuno.cxx @@ -471,7 +471,7 @@ uno::Any SAL_CALL ScFunctionAccess::callFunction( const OUString& aName, // find function - ScTokenArray aTokenArr(pDoc); + ScTokenArray aTokenArr(*pDoc); if ( !lcl_AddFunctionToken( aTokenArr, aName,aCompiler ) ) { // function not found diff --git a/sc/source/ui/unoobj/nameuno.cxx b/sc/source/ui/unoobj/nameuno.cxx index f13ea65d5ed8..4b30e29f1e34 100644 --- a/sc/source/ui/unoobj/nameuno.cxx +++ b/sc/source/ui/unoobj/nameuno.cxx @@ -331,7 +331,7 @@ void SAL_CALL ScNamedRangeObj::setTokens( const uno::Sequence<sheet::FormulaToke SolarMutexGuard aGuard; if( pDocShell ) { - ScTokenArray aTokenArray(&pDocShell->GetDocument()); + ScTokenArray aTokenArray(pDocShell->GetDocument()); (void)ScTokenConversion::ConvertToTokenArray( pDocShell->GetDocument(), aTokenArray, rTokens ); // GRAM_API for API compatibility. Modify_Impl( nullptr, &aTokenArray, nullptr, nullptr, nullptr, formula::FormulaGrammar::GRAM_API ); diff --git a/sc/source/ui/unoobj/tokenuno.cxx b/sc/source/ui/unoobj/tokenuno.cxx index cc5b6c84d702..713d924e28c7 100644 --- a/sc/source/ui/unoobj/tokenuno.cxx +++ b/sc/source/ui/unoobj/tokenuno.cxx @@ -154,7 +154,7 @@ OUString SAL_CALL ScFormulaParserObj::printFormula( if (mpDocShell) { ScDocument& rDoc = mpDocShell->GetDocument(); - ScTokenArray aCode(&rDoc); + ScTokenArray aCode(rDoc); (void)ScTokenConversion::ConvertToTokenArray( rDoc, aCode, aTokens ); ScAddress aRefPos( ScAddress::UNINITIALIZED ); ScUnoConversion::FillScAddress( aRefPos, rReferencePos ); diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx index 6610d0fc1b5c..93c3404b87b3 100644 --- a/sc/source/ui/vba/vbarange.cxx +++ b/sc/source/ui/vba/vbarange.cxx @@ -2002,7 +2002,7 @@ ScVbaRange::setFormulaArray(const uno::Any& rFormula) OUString sFormula; rFormula >>= sFormula; uno::Sequence<sheet::FormulaToken> aTokens = xParser->parseFormula( sFormula, aAddress ); - ScTokenArray aTokenArray(&getScDocument()); + ScTokenArray aTokenArray(getScDocument()); (void)ScTokenConversion::ConvertToTokenArray( getScDocument(), aTokenArray, aTokens ); getScDocShell()->GetDocFunc().EnterMatrix( getScRangeList()[0], nullptr, &aTokenArray, OUString(), true, true, EMPTY_OUSTRING, formula::FormulaGrammar::GRAM_API ); diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index 179bd852e96a..b21b3dbe1d43 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -810,7 +810,7 @@ OUString ScViewFunc::GetAutoSumFormula( const ScRangeList& rRangeList, bool bSub { ScViewData& rViewData = GetViewData(); ScDocument* pDoc = rViewData.GetDocument(); - std::unique_ptr<ScTokenArray> pArray(new ScTokenArray(pDoc)); + std::unique_ptr<ScTokenArray> pArray(new ScTokenArray(*pDoc)); pArray->AddOpCode(bSubTotal ? ocSubTotal : eCode); pArray->AddOpCode(ocOpen); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits