sc/source/filter/excel/xipivot.cxx | 2 +- sc/source/ui/app/transobj.cxx | 19 ++++++++++++------- sc/source/ui/undo/undocell.cxx | 3 +-- sc/source/ui/view/viewfun2.cxx | 7 ++++--- sc/source/ui/view/viewfun4.cxx | 4 ++-- sc/source/ui/view/viewfunc.cxx | 5 ++++- 6 files changed, 24 insertions(+), 16 deletions(-)
New commits: commit 79f7c5d2f96a3182f856577c9a45a666e12ad91d Author: Kohei Yoshida <kohei.yosh...@gmail.com> Date: Thu Mar 21 23:36:50 2013 -0400 More on reducing use of ScDocument::PutCell(). Change-Id: I7a911f13cddea829884aa9558d3be6a5e281c144 diff --git a/sc/source/filter/excel/xipivot.cxx b/sc/source/filter/excel/xipivot.cxx index 646abc1..95a73b6 100644 --- a/sc/source/filter/excel/xipivot.cxx +++ b/sc/source/filter/excel/xipivot.cxx @@ -123,7 +123,7 @@ void XclImpPCItem::WriteToSource( const XclImpRoot& rRoot, const ScAddress& rScP XclTools::ErrorToEnum( fValue, EXC_BOOLERR_ERROR, nErrCode ) ); ScFormulaCell* pCell = new ScFormulaCell( &rDoc, rScPos, pScTokArr ); pCell->SetHybridDouble( fValue ); - rDoc.PutCell( rScPos, pCell ); + rDoc.SetFormulaCell(rScPos, pCell); } } diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx index b756000..bb67eef 100644 --- a/sc/source/ui/app/transobj.cxx +++ b/sc/source/ui/app/transobj.cxx @@ -61,6 +61,7 @@ #include "viewdata.hxx" #include "dociter.hxx" #include "cellsuno.hxx" +#include "stringutil.hxx" using namespace com::sun::star; @@ -799,19 +800,22 @@ void ScTransferObj::StripRefs( ScDocument* pDoc, ScBaseCell* pNew = 0; sal_uInt16 nErrCode = pFCell->GetErrCode(); + ScAddress aPos(nCol, nRow, nDestTab); if (nErrCode) { - pNew = new ScStringCell( ScGlobal::GetErrorString(nErrCode) ); if ( ((const SvxHorJustifyItem*) pDestDoc->GetAttr( nCol,nRow,nDestTab, ATTR_HOR_JUSTIFY))->GetValue() == SVX_HOR_JUSTIFY_STANDARD ) pDestDoc->ApplyAttr( nCol,nRow,nDestTab, SvxHorJustifyItem(SVX_HOR_JUSTIFY_RIGHT, ATTR_HOR_JUSTIFY) ); + + ScSetStringParam aParam; + aParam.setTextInput(); + pDestDoc->SetString(aPos, ScGlobal::GetErrorString(nErrCode)); } else if (pFCell->IsValue()) { - double fVal = pFCell->GetValue(); - pNew = new ScValueCell( fVal ); + pDestDoc->SetValue(aPos, pFCell->GetValue()); } else { @@ -823,12 +827,13 @@ void ScTransferObj::StripRefs( ScDocument* pDoc, pDestDoc->SetEditText(ScAddress(nCol,nRow,nDestTab), rEngine.CreateTextObject()); } else - pNew = new ScStringCell( aStr ); + { + ScSetStringParam aParam; + aParam.setTextInput(); + pDestDoc->SetString(aPos, aStr); + } } - if (pNew) - pDestDoc->PutCell(nCol, nRow, nDestTab, pNew); - // number formats sal_uLong nOldFormat = ((const SfxUInt32Item*) diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx index 868dff5..1f61639 100644 --- a/sc/source/ui/undo/undocell.cxx +++ b/sc/source/ui/undo/undocell.cxx @@ -706,8 +706,7 @@ void ScUndoThesaurus::DoChange( sal_Bool bUndo, const String& rStr, if (pCell->GetCellType() == CELLTYPE_EDIT ) { // A copy of pTObj will be stored in the cell. - ScEditCell* pNewCell = new ScEditCell(*pTObj, pDoc, NULL); - pDoc->PutCell( nCol, nRow, nTab, pNewCell ); + pDoc->SetEditText(ScAddress(nCol,nRow,nTab), *pTObj, pDoc->GetEditPool()); if ( !bUndo ) SetChangeTrack( pCell ); } diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index 04c21a2..6494cd2 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -808,12 +808,13 @@ void ScViewFunc::EnterBlock( const String& rString, const EditTextObject* pData if (aNewStr.GetChar(0) == '=') // Formula ? { // SetString not possible, because in Clipboard-Documents nothing will be compiled! - ScFormulaCell* pFCell = new ScFormulaCell( pDoc, aPos, aNewStr ); - pInsDoc->PutCell( nCol, nRow, nTab, pFCell ); + pInsDoc->SetFormulaCell(aPos, new ScFormulaCell(pDoc, aPos, aNewStr)); } else if ( pData ) + { // A copy of pData will be stored. - pInsDoc->PutCell(nCol, nRow, nTab, new ScEditCell(*pData, pDoc, NULL)); + pInsDoc->SetEditText(aPos, *pData, pDoc->GetEditPool()); + } else pInsDoc->SetString( nCol, nRow, nTab, aNewStr ); diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx index ea05778..944c508 100644 --- a/sc/source/ui/view/viewfun4.cxx +++ b/sc/source/ui/view/viewfun4.cxx @@ -259,8 +259,8 @@ void ScViewFunc::DoRefConversion( sal_Bool bRecord ) ScTokenArray* pArr = aComp.CompileString( aNew ); ScFormulaCell* pNewCell = new ScFormulaCell( pDoc, aPos, pArr,formula::FormulaGrammar::GRAM_DEFAULT, MM_NONE ); - pDoc->PutCell( aPos, pNewCell ); - bOk = sal_True; + pDoc->SetFormulaCell(aPos, pNewCell); + bOk = true; } } pCell = aIter.GetNext(); diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 6d376fb..8cea62d 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -705,7 +705,10 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, { ScMarkData::iterator itr = rMark.begin(), itrEnd = rMark.end(); for (; itr != itrEnd; ++itr) - pDoc->PutCell(nCol, nRow, *itr, new ScEditCell(rData, pDoc, NULL)); + { + ScAddress aPos(nCol, nRow, *itr); + pDoc->SetEditText(aPos, rData, pDoc->GetEditPool()); + } if ( bRecord ) { // because of ChangeTrack current first _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits