diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-11-04 22:24:39 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-11-06 20:40:21 -0500 |
commit | a09f7fddb4e847b35e6d47a45403c649152dd671 (patch) | |
tree | 4d411affe2ec89e289fbefacf8db00ee2572a8ee /sc/source | |
parent | df8257faf64b01f3de26277742195693ddfe29fc (diff) |
Modify ScFormulaCell's ctor to take a const reference to ScTokenArray.
Instead of a pointer to ScTokenArray, and then clone its instance. If
the token array gets cloned in ctor, take a const reference.
Change-Id: I280fd7eb9eaea9905dbf954a1ace904ab0814dfe
Diffstat (limited to 'sc/source')
25 files changed, 82 insertions, 54 deletions
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 512ccc54e175..12fc80af485f 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -1643,7 +1643,7 @@ class CopyAsLinkHandler ScTokenArray aArr; aArr.AddSingleReference(aRef); - return new ScFormulaCell(&mrDestCol.GetDoc(), ScAddress(mrDestCol.GetCol(), nRow, mrDestCol.GetTab()), &aArr); + return new ScFormulaCell(&mrDestCol.GetDoc(), ScAddress(mrDestCol.GetCol(), nRow, mrDestCol.GetTab()), aArr); } void createRefBlock(const sc::CellStoreType::value_type& aNode, size_t nOffset, size_t nDataSize) diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 61f5326e6d45..a40093546169 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -700,7 +700,7 @@ class CopyCellsFromClipHandler aArr.AddSingleReference(aRef); mrDestCol.SetFormulaCell( - maDestBlockPos, nDestRow, new ScFormulaCell(&mrDestCol.GetDoc(), aDestPos, &aArr)); + maDestBlockPos, nDestRow, new ScFormulaCell(&mrDestCol.GetDoc(), aDestPos, aArr)); } void duplicateNotes(SCROW nStartRow, size_t nDataSize, bool bCloneCaption ) @@ -968,7 +968,7 @@ void ScColumn::CopyFromClip( ScTokenArray aArr; aArr.AddSingleReference( aRef ); - SetFormulaCell(nDestRow, new ScFormulaCell(pDocument, aDestPos, &aArr)); + SetFormulaCell(nDestRow, new ScFormulaCell(pDocument, aDestPos, aArr)); } return; @@ -1117,7 +1117,7 @@ public: miNewCellsPos = maNewCells.set( miNewCellsPos, nRow-mnRowOffset, new ScFormulaCell( - &mrDestColumn.GetDoc(), ScAddress(mrDestColumn.GetCol(), nRow, mrDestColumn.GetTab()), &aArr)); + &mrDestColumn.GetDoc(), ScAddress(mrDestColumn.GetCol(), nRow, mrDestColumn.GetTab()), aArr)); } break; case sc::element_type_string: @@ -1174,7 +1174,7 @@ public: miNewCellsPos = maNewCells.set( miNewCellsPos, nRow-mnRowOffset, new ScFormulaCell( - &mrDestColumn.GetDoc(), ScAddress(mrDestColumn.GetCol(), nRow, mrDestColumn.GetTab()), &aArr)); + &mrDestColumn.GetDoc(), ScAddress(mrDestColumn.GetCol(), nRow, mrDestColumn.GetTab()), aArr)); } break; case sc::element_type_formula: @@ -1203,7 +1203,7 @@ public: miNewCellsPos = maNewCells.set( miNewCellsPos, nRow-mnRowOffset, new ScFormulaCell( - &mrDestColumn.GetDoc(), ScAddress(mrDestColumn.GetCol(), nRow, mrDestColumn.GetTab()), &aArr)); + &mrDestColumn.GetDoc(), ScAddress(mrDestColumn.GetCol(), nRow, mrDestColumn.GetTab()), aArr)); } break; case sc::element_type_string: @@ -1282,7 +1282,7 @@ public: miNewCellsPos = maNewCells.set( miNewCellsPos, nDestRow-mnRowOffset, new ScFormulaCell( - &mrDestColumn.GetDoc(), ScAddress(mrDestColumn.GetCol(), nDestRow, mrDestColumn.GetTab()), &aArr)); + &mrDestColumn.GetDoc(), ScAddress(mrDestColumn.GetCol(), nDestRow, mrDestColumn.GetTab()), aArr)); } break; default: @@ -1709,7 +1709,7 @@ void ScColumn::SetFormula( SCROW nRow, const ScTokenArray& rArray, formula::Form ScAddress aPos(nCol, nRow, nTab); sc::CellStoreType::iterator it = GetPositionToInsert(nRow); - ScFormulaCell* pCell = new ScFormulaCell(pDocument, aPos, &rArray, eGram); + ScFormulaCell* pCell = new ScFormulaCell(pDocument, aPos, rArray, eGram); sal_uInt32 nCellFormat = GetNumberFormat(nRow); if( (nCellFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0) pCell->SetNeedNumberFormat(true); diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index c0d6f0d1c0fc..cd1d2dfef97a 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -414,13 +414,13 @@ void ScConditionEntry::MakeCells( const ScAddress& rPos ) // Formelzel { if ( pFormula1 && !pFCell1 && !bRelRef1 ) { - pFCell1 = new ScFormulaCell( mpDoc, rPos, pFormula1 ); + pFCell1 = new ScFormulaCell(mpDoc, rPos, *pFormula1); pFCell1->StartListeningTo( mpDoc ); } if ( pFormula2 && !pFCell2 && !bRelRef2 ) { - pFCell2 = new ScFormulaCell( mpDoc, rPos, pFormula2 ); + pFCell2 = new ScFormulaCell(mpDoc, rPos, *pFormula2); pFCell2->StartListeningTo( mpDoc ); } } @@ -630,7 +630,7 @@ void ScConditionEntry::Interpret( const ScAddress& rPos ) ScFormulaCell* pEff1 = pFCell1; if ( bRelRef1 ) { - pTemp1 = new ScFormulaCell( mpDoc, rPos, pFormula1 ); // ohne Listening + pTemp1 = pFormula1 ? new ScFormulaCell(mpDoc, rPos, *pFormula1) : new ScFormulaCell(mpDoc, rPos); pEff1 = pTemp1; } if ( pEff1 ) @@ -660,7 +660,7 @@ void ScConditionEntry::Interpret( const ScAddress& rPos ) ScFormulaCell* pEff2 = pFCell2; //@ 1!=2 if ( bRelRef2 ) { - pTemp2 = new ScFormulaCell( mpDoc, rPos, pFormula2 ); // ohne Listening + pTemp2 = pFormula2 ? new ScFormulaCell(mpDoc, rPos, *pFormula2) : new ScFormulaCell(mpDoc, rPos); pEff2 = pTemp2; } if ( pEff2 ) diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx index 65005bd73957..0aa6383f1211 100644 --- a/sc/source/core/data/documen4.cxx +++ b/sc/source/core/data/documen4.cxx @@ -272,7 +272,7 @@ void ScDocument::InsertMatrixFormula(SCCOL nCol1, SCROW nRow1, ScFormulaCell* pCell; ScAddress aPos( nCol1, nRow1, nTab1 ); if (pArr) - pCell = new ScFormulaCell( this, aPos, pArr, eGram, MM_FORMULA ); + pCell = new ScFormulaCell(this, aPos, *pArr, eGram, MM_FORMULA); else pCell = new ScFormulaCell( this, aPos, rFormula, eGram, MM_FORMULA ); pCell->SetMatColsRows( nCol2 - nCol1 + 1, nRow2 - nRow1 + 1, bDirtyFlag ); @@ -336,7 +336,7 @@ void ScDocument::InsertMatrixFormula(SCCOL nCol1, SCROW nRow1, aRefData.SetAddress(aBasePos, aPos); t->GetSingleRef() = aRefData; boost::scoped_ptr<ScTokenArray> pTokArr(aArr.Clone()); - pCell = new ScFormulaCell( this, aPos, pTokArr.get(), eGram, MM_REFERENCE ); + pCell = new ScFormulaCell(this, aPos, *pTokArr, eGram, MM_REFERENCE); pTab->SetFormulaCell(nCol, nRow, pCell); } } diff --git a/sc/source/core/data/documentimport.cxx b/sc/source/core/data/documentimport.cxx index a5fa5218c74a..93b43b04e7d7 100644 --- a/sc/source/core/data/documentimport.cxx +++ b/sc/source/core/data/documentimport.cxx @@ -216,7 +216,7 @@ void ScDocumentImport::setFormulaCell(const ScAddress& rPos, const ScTokenArray& sc::CellStoreType& rCells = pTab->aCol[rPos.Col()].maCells; pBlockPos->miCellPos = - rCells.set(pBlockPos->miCellPos, rPos.Row(), new ScFormulaCell(&mpImpl->mrDoc, rPos, &rArray)); + rCells.set(pBlockPos->miCellPos, rPos.Row(), new ScFormulaCell(&mpImpl->mrDoc, rPos, rArray)); } void ScDocumentImport::setFormulaCell(const ScAddress& rPos, ScFormulaCell* pCell) @@ -254,7 +254,7 @@ void ScDocumentImport::setMatrixCells( sc::CellStoreType& rCells = pTab->aCol[rBasePos.Col()].maCells; // Set the master cell. - ScFormulaCell* pCell = new ScFormulaCell(&mpImpl->mrDoc, rBasePos, &rArray, eGram, MM_FORMULA); + ScFormulaCell* pCell = new ScFormulaCell(&mpImpl->mrDoc, rBasePos, rArray, eGram, MM_FORMULA); pBlockPos->miCellPos = rCells.set(pBlockPos->miCellPos, rBasePos.Row(), pCell); @@ -283,7 +283,7 @@ void ScDocumentImport::setMatrixCells( aRefData.SetAddress(rBasePos, aPos); t->GetSingleRef() = aRefData; boost::scoped_ptr<ScTokenArray> pTokArr(aArr.Clone()); - pCell = new ScFormulaCell(&mpImpl->mrDoc, aPos, pTokArr.get(), eGram, MM_REFERENCE); + pCell = new ScFormulaCell(&mpImpl->mrDoc, aPos, *pTokArr, eGram, MM_REFERENCE); pBlockPos->miCellPos = rCells.set(pBlockPos->miCellPos, aPos.Row(), pCell); } @@ -303,7 +303,7 @@ void ScDocumentImport::setMatrixCells( aRefData.SetAddress(rBasePos, aPos); t->GetSingleRef() = aRefData; boost::scoped_ptr<ScTokenArray> pTokArr(aArr.Clone()); - pCell = new ScFormulaCell(&mpImpl->mrDoc, aPos, pTokArr.get(), eGram, MM_REFERENCE); + pCell = new ScFormulaCell(&mpImpl->mrDoc, aPos, *pTokArr, eGram, MM_REFERENCE); pBlockPos->miCellPos = rColCells.set(pBlockPos->miCellPos, aPos.Row(), pCell); } diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 4f27592b51e6..15c3b98a5147 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -429,6 +429,31 @@ void ScFormulaCellGroup::compileCode( // ============================================================================ +ScFormulaCell::ScFormulaCell( ScDocument* pDoc, const ScAddress& rPos ) : + eTempGrammar(formula::FormulaGrammar::GRAM_DEFAULT), + pCode(new ScTokenArray), + pDocument(pDoc), + pPrevious(0), + pNext(0), + pPreviousTrack(0), + pNextTrack(0), + nSeenInIteration(0), + cMatrixFlag(MM_NONE), + nFormatType(NUMBERFORMAT_NUMBER), + bDirty(false), + bChanged(false), + bRunning(false), + bCompile(false), + bSubTotal(false), + bIsIterCell(false), + bInChangeTrack(false), + bTableOpDirty(false), + bNeedListening(false), + mbNeedsNumberFormat(false), + aPos(rPos) +{ +} + ScFormulaCell::ScFormulaCell( ScDocument* pDoc, const ScAddress& rPos, const OUString& rFormula, const FormulaGrammar::Grammar eGrammar, @@ -461,22 +486,20 @@ ScFormulaCell::ScFormulaCell( ScDocument* pDoc, const ScAddress& rPos, pCode = new ScTokenArray; } -// Used by import filters - -ScFormulaCell::ScFormulaCell( ScDocument* pDoc, const ScAddress& rPos, - const ScTokenArray* pArr, - const FormulaGrammar::Grammar eGrammar, sal_uInt8 cInd ) : +ScFormulaCell::ScFormulaCell( + ScDocument* pDoc, const ScAddress& rPos, const ScTokenArray& rArray, + const FormulaGrammar::Grammar eGrammar, sal_uInt8 cMatInd ) : eTempGrammar( eGrammar), - pCode( pArr ? new ScTokenArray( *pArr ) : new ScTokenArray ), + pCode(new ScTokenArray(rArray)), pDocument( pDoc ), pPrevious(0), pNext(0), pPreviousTrack(0), pNextTrack(0), nSeenInIteration(0), - cMatrixFlag ( cInd ), + cMatrixFlag ( cMatInd ), nFormatType ( NUMBERFORMAT_NUMBER ), - bDirty( NULL != pArr ), // -> Because of the use of the Auto Pilot Function was: cInd != 0 + bDirty( true ), bChanged( false ), bRunning( false ), bCompile( false ), @@ -2319,7 +2342,10 @@ void setOldCodeToUndo( if (pUndoDoc->GetCellType(aUndoPos) == CELLTYPE_FORMULA) return; - ScFormulaCell* pFCell = new ScFormulaCell(pUndoDoc, aUndoPos, pOldCode, eTempGrammar, cMatrixFlag); + ScFormulaCell* pFCell = + new ScFormulaCell( + pUndoDoc, aUndoPos, pOldCode ? *pOldCode : ScTokenArray(), eTempGrammar, cMatrixFlag); + pFCell->SetResultToken(NULL); // to recognize it as changed later (Cut/Paste!) pUndoDoc->SetFormulaCell(aUndoPos, pFCell); } @@ -2919,8 +2945,9 @@ void ScFormulaCell::UpdateTranspose( const ScRange& rSource, const ScAddress& rD { if (pUndoDoc) { - ScFormulaCell* pFCell = new ScFormulaCell( pUndoDoc, aPos, pOld, - eTempGrammar, cMatrixFlag); + ScFormulaCell* pFCell = new ScFormulaCell( + pUndoDoc, aPos, pOld ? *pOld : ScTokenArray(), eTempGrammar, cMatrixFlag); + pFCell->aResult.SetToken( NULL); // to recognize it as changed later (Cut/Paste!) pUndoDoc->SetFormulaCell(aPos, pFCell); } diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index c94d66a87c88..b44122ef5e80 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -751,7 +751,7 @@ class TransClipHandler ScTokenArray aArr; aArr.AddSingleReference(aRef); - return new ScFormulaCell(&mrClipTab.GetDoc(), rDestPos, &aArr); + return new ScFormulaCell(&mrClipTab.GetDoc(), rDestPos, aArr); } void setLink(size_t nRow) @@ -853,7 +853,7 @@ void ScTable::TransposeClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, pTransClip->SetFormulaCell( static_cast<SCCOL>(nRow-nRow1), static_cast<SCROW>(nCol-nCol1), - new ScFormulaCell(pDestDoc, aDestPos, &aArr)); + new ScFormulaCell(pDestDoc, aDestPos, aArr)); } } else diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index a79add4ae65d..99d1c8eb6f44 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -1056,7 +1056,7 @@ bool ScTable::DoSubTotals( ScSubTotalParam& rParam ) aArr.AddOpCode( ocClose ); aArr.AddOpCode( ocStop ); ScFormulaCell* pCell = new ScFormulaCell( - pDocument, ScAddress(nResCols[nResult], iEntry->nDestRow, nTab), &aArr); + pDocument, ScAddress(nResCols[nResult], iEntry->nDestRow, nTab), aArr); SetFormulaCell(nResCols[nResult], iEntry->nDestRow, pCell); diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx index 5a1264995508..0adc60a40eb2 100644 --- a/sc/source/core/data/validat.cxx +++ b/sc/source/core/data/validat.cxx @@ -632,8 +632,8 @@ bool ScValidationData::GetSelectionFromFormula( if( NULL == pDocument ) return false; - ScFormulaCell aValidationSrc( pDocument, rPos, &rTokArr, - formula::FormulaGrammar::GRAM_DEFAULT, MM_FORMULA); + ScFormulaCell aValidationSrc( + pDocument, rPos, rTokArr, formula::FormulaGrammar::GRAM_DEFAULT, MM_FORMULA); // Make sure the formula gets interpreted and a result is delivered, // regardless of the AutoCalc setting. diff --git a/sc/source/core/tool/consoli.cxx b/sc/source/core/tool/consoli.cxx index 25492bb3e304..3dbe8f923fc1 100644 --- a/sc/source/core/tool/consoli.cxx +++ b/sc/source/core/tool/consoli.cxx @@ -735,7 +735,7 @@ void ScConsData::OutputToDocument( ScDocument* pDestDoc, SCCOL nCol, SCROW nRow, aRefArr.AddOpCode(ocStop); ScAddress aDest( sal::static_int_cast<SCCOL>(nCol+nArrX), sal::static_int_cast<SCROW>(nRow+nArrY+nPos), nTab ); - ScFormulaCell* pCell = new ScFormulaCell( pDestDoc, aDest, &aRefArr ); + ScFormulaCell* pCell = new ScFormulaCell(pDestDoc, aDest, aRefArr); pDestDoc->SetFormulaCell(aDest, pCell); } } @@ -755,7 +755,7 @@ void ScConsData::OutputToDocument( ScDocument* pDestDoc, SCCOL nCol, SCROW nRow, aArr.AddDoubleReference(aCRef); aArr.AddOpCode(ocClose); aArr.AddOpCode(ocStop); - ScFormulaCell* pCell = new ScFormulaCell( pDestDoc, aDest, &aArr ); + ScFormulaCell* pCell = new ScFormulaCell(pDestDoc, aDest, aArr); pDestDoc->SetFormulaCell(aDest, pCell); } } diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx index 74b0ea07dde7..e2e24702b715 100644 --- a/sc/source/filter/excel/excform.cxx +++ b/sc/source/filter/excel/excform.cxx @@ -174,7 +174,7 @@ void ImportExcel::Formula( if (pResult) { - pCell = new ScFormulaCell(&rDoc.getDoc(), aScPos, pResult); + pCell = new ScFormulaCell(&rDoc.getDoc(), aScPos, *pResult); rDoc.getDoc().EnsureTable(aScPos.Tab()); rDoc.setFormulaCell(aScPos, pCell); SetLastFormula(aScPos.Col(), aScPos.Row(), fCurVal, nXF, pCell); diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx index b86ea72d1153..8db86c3280eb 100644 --- a/sc/source/filter/excel/impop.cxx +++ b/sc/source/filter/excel/impop.cxx @@ -390,7 +390,7 @@ void ImportExcel::ReadBoolErr() double fValue; const ScTokenArray* pScTokArr = ErrorToFormula( nType, nValue, fValue ); - ScFormulaCell* pCell = new ScFormulaCell( pD, aScPos, pScTokArr ); + ScFormulaCell* pCell = pScTokArr ? new ScFormulaCell(pD, aScPos, *pScTokArr) : new ScFormulaCell(pD, aScPos); pCell->SetHybridDouble( fValue ); GetDoc().SetFormulaCell(aScPos, pCell); } diff --git a/sc/source/filter/excel/xipivot.cxx b/sc/source/filter/excel/xipivot.cxx index 99ceb86009f2..30af343dc070 100644 --- a/sc/source/filter/excel/xipivot.cxx +++ b/sc/source/filter/excel/xipivot.cxx @@ -121,7 +121,7 @@ void XclImpPCItem::WriteToSource( XclImpRoot& rRoot, const ScAddress& rScPos ) c sal_uInt8 nErrCode = static_cast< sal_uInt8 >( *pnError ); const ScTokenArray* pScTokArr = rRoot.GetOldFmlaConverter().GetBoolErr( XclTools::ErrorToEnum( fValue, EXC_BOOLERR_ERROR, nErrCode ) ); - ScFormulaCell* pCell = new ScFormulaCell(&rDoc.getDoc(), rScPos, pScTokArr); + ScFormulaCell* pCell = pScTokArr ? new ScFormulaCell(&rDoc.getDoc(), rScPos, *pScTokArr) : new ScFormulaCell(&rDoc.getDoc(), rScPos); pCell->SetHybridDouble( fValue ); rDoc.setFormulaCell(rScPos, pCell); } diff --git a/sc/source/filter/lotus/lotimpop.cxx b/sc/source/filter/lotus/lotimpop.cxx index ad273603fe9b..f8fc773b151f 100644 --- a/sc/source/filter/lotus/lotimpop.cxx +++ b/sc/source/filter/lotus/lotimpop.cxx @@ -290,7 +290,7 @@ ScFormulaCell *ImportLotus::Formulacell( sal_uInt16 n ) aConv.SetWK3(); aConv.Convert( pErg, nRest ); - ScFormulaCell* pCell = new ScFormulaCell( pD, aAddr, pErg ); + ScFormulaCell* pCell = pErg ? new ScFormulaCell(pD, aAddr, *pErg) : new ScFormulaCell(pD, aAddr); pCell->AddRecalcMode( RECALCMODE_ONLOAD_ONCE ); pD->EnsureTable(aAddr.Tab()); pD->SetFormulaCell(aAddr, pCell); diff --git a/sc/source/filter/lotus/op.cxx b/sc/source/filter/lotus/op.cxx index 9e777a7e6109..c42211d89278 100644 --- a/sc/source/filter/lotus/op.cxx +++ b/sc/source/filter/lotus/op.cxx @@ -169,7 +169,7 @@ void OP_Formula( SvStream& r, sal_uInt16 /*n*/ ) if (ValidColRow( static_cast<SCCOL>(nCol), nRow)) { - ScFormulaCell* pCell = new ScFormulaCell( pLotusRoot->pDoc, aAddress, pErg ); + ScFormulaCell* pCell = new ScFormulaCell(pLotusRoot->pDoc, aAddress, *pErg); pCell->AddRecalcMode( RECALCMODE_ONLOAD_ONCE ); pDoc->EnsureTable(nTab); pDoc->SetFormulaCell(ScAddress(nCol,nRow,nTab), pCell); @@ -413,7 +413,7 @@ void OP_Formula123( SvStream& r, sal_uInt16 n ) if (ValidColRow( static_cast<SCCOL>(nCol), nRow) && nTab <= pDoc->GetMaxTableNumber()) { - ScFormulaCell* pCell = new ScFormulaCell( pLotusRoot->pDoc, aAddress, pErg ); + ScFormulaCell* pCell = new ScFormulaCell(pLotusRoot->pDoc, aAddress, *pErg); pCell->AddRecalcMode( RECALCMODE_ONLOAD_ONCE ); pDoc->EnsureTable(nTab); pDoc->SetFormulaCell(ScAddress(nCol,nRow,nTab), pCell); diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx index cf5b73eec4e7..3dde87b8824b 100644 --- a/sc/source/filter/oox/formulabuffer.cxx +++ b/sc/source/filter/oox/formulabuffer.cxx @@ -173,7 +173,7 @@ void FormulaBuffer::applySharedFormulas( sal_Int32 nTab ) ScAddress aPos; ScUnoConversion::FillScAddress(aPos, rAddr); - ScFormulaCell* pCell = new ScFormulaCell(&rDoc.getDoc(), aPos, pArray); + ScFormulaCell* pCell = new ScFormulaCell(&rDoc.getDoc(), aPos, *pArray); rDoc.setFormulaCell(aPos, pCell); if (it->maCellValue.isEmpty()) { diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx index 1372d7753b43..df8c9928a61f 100644 --- a/sc/source/filter/orcus/interface.cxx +++ b/sc/source/filter/orcus/interface.cxx @@ -358,7 +358,7 @@ void ScOrcusSheet::set_shared_formula( maFormulaGroups.set(sindex, pArray); - ScFormulaCell* pCell = new ScFormulaCell(&mrDoc.getDoc(), aPos, pArray); + ScFormulaCell* pCell = new ScFormulaCell(&mrDoc.getDoc(), aPos, *pArray); mrDoc.setFormulaCell(aPos, pCell); cellInserted(); @@ -381,7 +381,7 @@ void ScOrcusSheet::set_shared_formula(os::row_t row, os::col_t col, size_t sinde if (!pArray) return; - ScFormulaCell* pCell = new ScFormulaCell(&mrDoc.getDoc(), aPos, pArray); + ScFormulaCell* pCell = new ScFormulaCell(&mrDoc.getDoc(), aPos, *pArray); mrDoc.setFormulaCell(aPos, pCell); cellInserted(); diff --git a/sc/source/filter/qpro/qpro.cxx b/sc/source/filter/qpro/qpro.cxx index bff702ba6ae6..77dc5dca39fc 100644 --- a/sc/source/filter/qpro/qpro.cxx +++ b/sc/source/filter/qpro/qpro.cxx @@ -110,7 +110,7 @@ FltError ScQProReader::readSheet( SCTAB nTab, ScDocument* pDoc, ScQProStyle *pSt eRet = eERR_FORMAT; else { - ScFormulaCell *pFormula = new ScFormulaCell( pDoc, aAddr, pArray ); + ScFormulaCell* pFormula = new ScFormulaCell(pDoc, aAddr, *pArray); nStyle = nStyle >> 3; pFormula->AddRecalcMode( RECALCMODE_ONLOAD_ONCE ); pStyle->SetFormat( pDoc, nCol, nRow, nTab, nStyle ); diff --git a/sc/source/filter/xcl97/XclImpChangeTrack.cxx b/sc/source/filter/xcl97/XclImpChangeTrack.cxx index a2f1ddec57c4..489286105068 100644 --- a/sc/source/filter/xcl97/XclImpChangeTrack.cxx +++ b/sc/source/filter/xcl97/XclImpChangeTrack.cxx @@ -272,7 +272,7 @@ void XclImpChangeTrack::ReadCell( if( pStrm->IsValid() && pTokenArray ) { rCell.meType = CELLTYPE_FORMULA; - rCell.mpFormula = new ScFormulaCell(GetDocPtr(), rPosition, pTokenArray); + rCell.mpFormula = new ScFormulaCell(GetDocPtr(), rPosition, *pTokenArray); } delete pTokenArray; } diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index a3f3a0f058a5..39fe09357d10 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -1366,7 +1366,7 @@ void ScXMLTableRowCellContext::PutFormulaCell( const ScAddress& rCellPos ) pCode->AddStringXML( aFormulaNmsp ); rDoc.getDoc().IncXMLImportedFormulaCount( aText.getLength() ); - ScFormulaCell* pNewCell = new ScFormulaCell(pDoc, rCellPos, pCode.get(), eGrammar, MM_NONE); + ScFormulaCell* pNewCell = new ScFormulaCell(pDoc, rCellPos, *pCode, eGrammar, MM_NONE); SetFormulaCell(pNewCell); rDoc.setFormulaCell(rCellPos, pNewCell); pNewCell->SetNeedNumberFormat( true ); diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index 025737f86fef..e9c050b79fc5 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -1842,7 +1842,7 @@ bool ScImportExport::Sylk2Doc( SvStream& rStrm ) else { ScFormulaCell* pFCell = new ScFormulaCell( - pDoc, aPos, pCode, eGrammar, MM_NONE); + pDoc, aPos, *pCode, eGrammar, MM_NONE); pDoc->SetFormulaCell(aPos, pFCell); } delete pCode; // ctor/InsertMatrixFormula did copy TokenArray diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index f128f6646a50..8da119885af9 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -6661,7 +6661,7 @@ void SAL_CALL ScCellObj::setTokens( const uno::Sequence<sheet::FormulaToken>& rT ScTokenArray aTokenArray; (void)ScTokenConversion::ConvertToTokenArray( *pDoc, aTokenArray, rTokens ); - ScFormulaCell* pNewCell = new ScFormulaCell( pDoc, aCellPos, &aTokenArray ); + ScFormulaCell* pNewCell = new ScFormulaCell(pDoc, aCellPos, aTokenArray); (void)pDocSh->GetDocFunc().SetFormulaCell(aCellPos, pNewCell, false); } } diff --git a/sc/source/ui/unoobj/funcuno.cxx b/sc/source/ui/unoobj/funcuno.cxx index 7bf321ad77ac..174b6a6731e2 100644 --- a/sc/source/ui/unoobj/funcuno.cxx +++ b/sc/source/ui/unoobj/funcuno.cxx @@ -643,8 +643,9 @@ uno::Any SAL_CALL ScFunctionAccess::callFunction( const OUString& aName, ScAddress aFormulaPos( 0, 0, nTempSheet ); // GRAM_PODF_A1 doesn't really matter for the token array but fits with // other API compatibility grammars. - ScFormulaCell* pFormula = new ScFormulaCell( pDoc, aFormulaPos, - &aTokenArr, formula::FormulaGrammar::GRAM_PODF_A1, (sal_uInt8)(mbArray ? MM_FORMULA : MM_NONE) ); + ScFormulaCell* pFormula = new ScFormulaCell( + pDoc, aFormulaPos, aTokenArr, formula::FormulaGrammar::GRAM_PODF_A1, + (sal_uInt8)(mbArray ? MM_FORMULA : MM_NONE) ); pFormula = pDoc->SetFormulaCell(aFormulaPos, pFormula); // call GetMatrix before GetErrCode because GetMatrix always recalculates diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx index e924b34b0203..91584fd1f50c 100644 --- a/sc/source/ui/view/viewfun4.cxx +++ b/sc/source/ui/view/viewfun4.cxx @@ -261,7 +261,7 @@ void ScViewFunc::DoRefConversion( sal_Bool bRecord ) boost::scoped_ptr<ScTokenArray> pArr(aComp.CompileString(aNew)); ScFormulaCell* pNewCell = new ScFormulaCell( - pDoc, aPos, pArr.get(), formula::FormulaGrammar::GRAM_DEFAULT, MM_NONE); + pDoc, aPos, *pArr, formula::FormulaGrammar::GRAM_DEFAULT, MM_NONE); pDoc->SetFormulaCell(aPos, pNewCell); bOk = true; diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index cff2302479e7..089024a8d50d 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -508,7 +508,7 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, } } - ScFormulaCell aCell( pDoc, aPos, pArr,formula::FormulaGrammar::GRAM_DEFAULT, MM_NONE ); + ScFormulaCell aCell(pDoc, aPos, *pArr, formula::FormulaGrammar::GRAM_DEFAULT, MM_NONE); delete pArr; SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); |