summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-03-21 23:36:50 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-03-22 21:49:24 -0400
commit6cc6f68895b99dca9e9785b7cb77a853c0eb2178 (patch)
tree5b3b776a6c95d7f1e682b09a946ea36687d793b1 /sc
parent304fabda76364301956333120bf86b5a0ea9fe04 (diff)
More on reducing use of ScDocument::PutCell().
Change-Id: I7a911f13cddea829884aa9558d3be6a5e281c144
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/excel/xipivot.cxx2
-rw-r--r--sc/source/ui/app/transobj.cxx19
-rw-r--r--sc/source/ui/undo/undocell.cxx3
-rw-r--r--sc/source/ui/view/viewfun2.cxx7
-rw-r--r--sc/source/ui/view/viewfun4.cxx4
-rw-r--r--sc/source/ui/view/viewfunc.cxx5
6 files changed, 24 insertions, 16 deletions
diff --git a/sc/source/filter/excel/xipivot.cxx b/sc/source/filter/excel/xipivot.cxx
index 646abc13ee4c..95a73b6a081b 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 b75600098272..bb67eef8cc48 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 868dff59a373..1f6163978c7a 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 04c21a224bfa..6494cd2bc500 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 ea057782aa39..944c508de22c 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 6d376fb84610..8cea62d9fc57 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