summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-03-19 12:51:47 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-03-19 13:40:27 -0400
commit20c4921e901d84a7ef8835ee192e1a7a4b62ee61 (patch)
treec298901717bf1297e1d50c19f1e1347359105c89
parentd0314afa2fef363eba06e98c70ecdc83e690dcd0 (diff)
Remove use of ScBaseCell and its derivatives outside ScDocument.
This is still work in progress. Change-Id: Ifcdbefbdd307a2a8819b073d896e90a16980781e
-rw-r--r--sc/inc/column.hxx4
-rw-r--r--sc/inc/document.hxx15
-rw-r--r--sc/inc/table.hxx5
-rw-r--r--sc/source/core/data/column3.cxx4
-rw-r--r--sc/source/core/data/document.cxx17
-rw-r--r--sc/source/core/data/table2.cxx11
-rw-r--r--sc/source/core/data/table6.cxx6
-rw-r--r--sc/source/filter/excel/excimp8.cxx5
-rw-r--r--sc/source/filter/excel/impop.cxx6
-rw-r--r--sc/source/filter/excel/xicontent.cxx11
-rw-r--r--sc/source/filter/excel/xihelper.cxx44
-rw-r--r--sc/source/filter/inc/xicontent.hxx4
-rw-r--r--sc/source/filter/inc/xihelper.hxx10
-rw-r--r--sc/source/filter/oox/worksheethelper.cxx3
-rw-r--r--sc/source/filter/rtf/eeimpars.cxx14
-rw-r--r--sc/source/filter/xml/xmlcelli.cxx4
-rw-r--r--sc/source/ui/app/transobj.cxx10
-rw-r--r--sc/source/ui/docshell/impex.cxx4
-rw-r--r--sc/source/ui/undo/undoblk3.cxx7
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx2
-rw-r--r--sc/source/ui/view/viewfun4.cxx5
21 files changed, 127 insertions, 64 deletions
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 4776a70d63a2..d8e4a389a493 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -257,10 +257,12 @@ public:
bool HasEditCells(SCROW nStartRow, SCROW nEndRow, SCROW& rFirst) const;
- // TRUE = format for numbers is set
bool SetString(
SCROW nRow, SCTAB nTab, const String& rString, formula::FormulaGrammar::AddressConvention eConv,
ScSetStringParam* pParam = NULL );
+
+ void SetEditText( SCROW nRow, EditTextObject* pEditText );
+
void SetValue( SCROW nRow, const double& rVal);
void SetError( SCROW nRow, const sal_uInt16 nError);
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 98b21ebe3866..91e003e51e55 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -750,7 +750,18 @@ public:
SC_DLLPUBLIC bool SetString(
SCCOL nCol, SCROW nRow, SCTAB nTab, const rtl::OUString& rString,
ScSetStringParam* pParam = NULL );
- bool SetString( const ScAddress& rPos, const OUString& rString, ScSetStringParam* pParam = NULL );
+ SC_DLLPUBLIC bool SetString( const ScAddress& rPos, const OUString& rString, ScSetStringParam* pParam = NULL );
+
+ /**
+ * This method manages the lifecycle of the passed edit text object. When
+ * the text is successfully inserted, the cell takes over the ownership of
+ * the text object. If not, the text object gets deleted.
+ *
+ * <p>The caller must ensure that the passed edit text object <i>uses the
+ * SfxItemPool instance returned from ScDocument::GetEditPool()</i>.
+ * This is very important.</p>
+ */
+ SC_DLLPUBLIC void SetEditText( const ScAddress& rPos, EditTextObject* pEditText );
SC_DLLPUBLIC void SetValue( SCCOL nCol, SCROW nRow, SCTAB nTab, const double& rVal );
void SetError( SCCOL nCol, SCROW nRow, SCTAB nTab, const sal_uInt16 nError);
@@ -1875,6 +1886,8 @@ private: // CLOOK-Impl-methods
ScDocument* mpDoc;
};
+ bool TableExists( SCTAB nTab ) const;
+
void MergeNumberFormatter(ScDocument* pSrcDoc);
void ImplCreateOptions(); // Suggestion: switch to on-demand?
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 036dcca89420..990b0fc09003 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -299,9 +299,12 @@ public:
void PutCell( const ScAddress&, ScBaseCell* pCell );
void PutCell( SCCOL nCol, SCROW nRow, ScBaseCell* pCell );
void PutCell(SCCOL nCol, SCROW nRow, sal_uLong nFormatIndex, ScBaseCell* pCell);
- // TRUE = numberformat set
+
bool SetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString,
ScSetStringParam* pParam = NULL );
+
+ void SetEditText( SCCOL nCol, SCROW nRow, EditTextObject* pEditText );
+
void SetValue( SCCOL nCol, SCROW nRow, const double& rVal );
void SetError( SCCOL nCol, SCROW nRow, sal_uInt16 nError);
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index fb6c2122c41b..439783456d1c 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -1490,6 +1490,10 @@ bool ScColumn::SetString( SCROW nRow, SCTAB nTabP, const String& rString,
return bNumFmtSet;
}
+void ScColumn::SetEditText( SCROW nRow, EditTextObject* pEditText )
+{
+ Insert(nRow, new ScEditCell(pEditText, pDocument));
+}
void ScColumn::GetFilterEntries(SCROW nStartRow, SCROW nEndRow, std::vector<ScTypedStrData>& rStrings, bool& rHasDates)
{
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index f4ef72c3ed56..71f4a1f9fa64 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -22,6 +22,7 @@
#include <editeng/boxitem.hxx>
#include <editeng/frmdiritem.hxx>
+#include "editeng/editobj.hxx"
#include <svx/pageitem.hxx>
#include <editeng/editeng.hxx>
#include <svx/svditer.hxx>
@@ -2158,6 +2159,11 @@ ScDocument::NumFmtMergeHandler::~NumFmtMergeHandler()
mpDoc->pFormatExchangeList = NULL;
}
+bool ScDocument::TableExists( SCTAB nTab ) const
+{
+ return ValidTab(nTab) && static_cast<size_t>(nTab) < maTabs.size() && maTabs[nTab];
+}
+
void ScDocument::MergeNumberFormatter(ScDocument* pSrcDoc)
{
SvNumberFormatter* pThisFormatter = xPoolHelper->GetFormTable();
@@ -2962,6 +2968,17 @@ bool ScDocument::SetString(
return SetString(rPos.Col(), rPos.Row(), rPos.Tab(), rString, pParam);
}
+void ScDocument::SetEditText( const ScAddress& rPos, EditTextObject* pEditText )
+{
+ if (!TableExists(rPos.Tab()))
+ {
+ delete pEditText;
+ return;
+ }
+
+ maTabs[rPos.Tab()]->SetEditText(rPos.Col(), rPos.Row(), pEditText);
+}
+
void ScDocument::SetValue( SCCOL nCol, SCROW nRow, SCTAB nTab, const double& rVal )
{
if (ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()))
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index c0815c0f12aa..015fa678561b 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -19,6 +19,7 @@
#include "scitems.hxx"
#include <editeng/boxitem.hxx>
+#include "editeng/editobj.hxx"
#include <svl/poolcach.hxx>
#include <unotools/charclass.hxx>
#include <math.h>
@@ -1322,6 +1323,16 @@ bool ScTable::SetString( SCCOL nCol, SCROW nRow, SCTAB nTabP, const String& rStr
return false;
}
+void ScTable::SetEditText( SCCOL nCol, SCROW nRow, EditTextObject* pEditText )
+{
+ if (!ValidColRow(nCol, nRow))
+ {
+ delete pEditText;
+ return;
+ }
+
+ aCol[nCol].SetEditText(nRow, pEditText);
+}
void ScTable::SetValue( SCCOL nCol, SCROW nRow, const double& rVal )
{
diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx
index f4a5d25721df..640ed59e7cbd 100644
--- a/sc/source/core/data/table6.cxx
+++ b/sc/source/core/data/table6.cxx
@@ -222,7 +222,11 @@ bool ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, SCROW nRo
aCol[nCol].Insert( nRow, pFCell );
}
else if ( bMultiLine && aString.indexOf('\n') != -1 )
- PutCell( nCol, nRow, new ScEditCell( aString, pDocument ) );
+ {
+ ScFieldEditEngine& rEngine = pDocument->GetEditEngine();
+ rEngine.SetText(aString);
+ SetEditText(nCol, nRow, rEngine.CreateTextObject());
+ }
else
aCol[nCol].SetString(nRow, nTab, aString, pDocument->GetAddressConvention());
// pCell is invalid now (deleted)
diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx
index 52852475672d..68ceed5238aa 100644
--- a/sc/source/filter/excel/excimp8.cxx
+++ b/sc/source/filter/excel/excimp8.cxx
@@ -296,8 +296,9 @@ void ImportExcel8::Labelsst( void )
if( GetAddressConverter().ConvertAddress( aScPos, aXclPos, GetCurrScTab(), true ) )
{
GetXFRangeBuffer().SetXF( aScPos, nXF );
- if( ScBaseCell* pCell = GetSst().CreateCell( nSst, nXF ) )
- GetDoc().PutCell( aScPos.Col(), aScPos.Row(), aScPos.Tab(), pCell );
+ const XclImpString* pXclStr = GetSst().GetString(nSst);
+ if (pXclStr)
+ XclImpStringHelper::SetToDocument(GetDoc(), aScPos, *this, *pXclStr, nXF);
}
}
diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx
index 4125061928c7..662e426ee676 100644
--- a/sc/source/filter/excel/impop.cxx
+++ b/sc/source/filter/excel/impop.cxx
@@ -338,8 +338,7 @@ void ImportExcel::ReadLabel()
SetTextEncoding( eOldTextEnc );
GetXFRangeBuffer().SetXF( aScPos, nXFIdx );
- if( ScBaseCell* pCell = XclImpStringHelper::CreateCell( GetRoot(), aString, nXFIdx ) )
- GetDoc().PutCell( aScPos, pCell );
+ XclImpStringHelper::SetToDocument(GetDoc(), aScPos, GetRoot(), aString, nXFIdx);
}
}
@@ -902,8 +901,7 @@ void ImportExcel::Rstring( void )
aString.ReadFormats( maStrm );
GetXFRangeBuffer().SetXF( aScPos, nXFIdx );
- if( ScBaseCell* pCell = XclImpStringHelper::CreateCell( *this, aString, nXFIdx ) )
- GetDoc().PutCell( aScPos, pCell );
+ XclImpStringHelper::SetToDocument(GetDoc(), aScPos, *this, aString, nXFIdx);
}
}
diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx
index de6fd1370187..86ed9de2fa08 100644
--- a/sc/source/filter/excel/xicontent.cxx
+++ b/sc/source/filter/excel/xicontent.cxx
@@ -91,14 +91,6 @@ const XclImpString* XclImpSst::GetString( sal_uInt32 nSstIndex ) const
return (nSstIndex < maStrings.size()) ? &maStrings[ nSstIndex ] : 0;
}
-ScBaseCell* XclImpSst::CreateCell( sal_uInt32 nSstIndex, sal_uInt16 nXFIndex ) const
-{
- ScBaseCell* pCell = 0;
- if( const XclImpString* pString = GetString( nSstIndex ) )
- pCell = XclImpStringHelper::CreateCell( *this, *pString, nXFIndex );
- return pCell;
-}
-
// Hyperlinks =================================================================
namespace {
@@ -197,8 +189,7 @@ void lclInsertUrl( const XclImpRoot& rRoot, const String& rUrl, SCCOL nScCol, SC
}
// The cell will own the text object instance.
- ScEditCell* pCell = new ScEditCell(rEE.CreateTextObject(), &rDoc);
- rDoc.PutCell( aScPos, pCell );
+ rDoc.SetEditText(aScPos, rEE.CreateTextObject());
}
break;
diff --git a/sc/source/filter/excel/xihelper.cxx b/sc/source/filter/excel/xihelper.cxx
index ef840f9a476b..4f114a95fe7c 100644
--- a/sc/source/filter/excel/xihelper.cxx
+++ b/sc/source/filter/excel/xihelper.cxx
@@ -25,15 +25,14 @@
#include <editeng/eeitem.hxx>
#include <editeng/flditem.hxx>
#include "document.hxx"
-#include "cell.hxx"
#include "rangelst.hxx"
#include "editutil.hxx"
#include "attrib.hxx"
#include "xltracer.hxx"
#include "xistream.hxx"
#include "xistyle.hxx"
-
#include "excform.hxx"
+#include "stringutil.hxx"
// Excel->Calc cell address/range conversion ==================================
@@ -220,24 +219,39 @@ EditTextObject* XclImpStringHelper::CreateTextObject(
return lclCreateTextObject( rRoot, rString, EXC_FONTITEM_EDITENG, 0 );
}
-ScBaseCell* XclImpStringHelper::CreateCell(
- const XclImpRoot& rRoot, const XclImpString& rString, sal_uInt16 nXFIndex )
+void XclImpStringHelper::SetToDocument(
+ ScDocument& rDoc, const ScAddress& rPos, const XclImpRoot& rRoot,
+ const XclImpString& rString, sal_uInt16 nXFIndex )
{
- ScBaseCell* pCell = 0;
+ if (!rString.GetText().Len())
+ return;
- if( rString.GetText().Len() )
- {
- ::std::auto_ptr< EditTextObject > pTextObj( lclCreateTextObject( rRoot, rString, EXC_FONTITEM_EDITENG, nXFIndex ) );
- ScDocument& rDoc = rRoot.GetDoc();
+ ::std::auto_ptr< EditTextObject > pTextObj( lclCreateTextObject( rRoot, rString, EXC_FONTITEM_EDITENG, nXFIndex ) );
- if( pTextObj.get() )
- // ScEditCell will own the text object instance.
- pCell = new ScEditCell(pTextObj.release(), &rDoc);
+ if (pTextObj.get())
+ {
+ rDoc.SetEditText(rPos, pTextObj.release());
+ }
+ else
+ {
+ OUString aStr = rString.GetText();
+ if (aStr.indexOf('\n') != -1 || aStr.indexOf(CHAR_CR) != -1)
+ {
+ // Multiline content.
+ ScFieldEditEngine& rEngine = rDoc.GetEditEngine();
+ rEngine.SetText(aStr);
+ rDoc.SetEditText(rPos, rEngine.CreateTextObject());
+ }
else
- pCell = ScBaseCell::CreateTextCell( rString.GetText(), &rDoc );
+ {
+ // Normal text cell.
+ ScSetStringParam aParam;
+ aParam.mbDetectNumberFormat = false;
+ aParam.mbHandleApostrophe = false;
+ aParam.meSetTextNumFormat = ScSetStringParam::Always;
+ rDoc.SetString(rPos, aStr, &aParam);
+ }
}
-
- return pCell;
}
// Header/footer conversion ===================================================
diff --git a/sc/source/filter/inc/xicontent.hxx b/sc/source/filter/inc/xicontent.hxx
index f4128adbe46f..c5d7aae4a32e 100644
--- a/sc/source/filter/inc/xicontent.hxx
+++ b/sc/source/filter/inc/xicontent.hxx
@@ -64,10 +64,6 @@ public:
/** Returns a pointer to the string with the passed index. */
const XclImpString* GetString( sal_uInt32 nSstIndex ) const;
- /** Creates a new text cell or edit cell for a Calc document.
- @param nXFIndex Index to XF for first text portion (checks escapement). */
- ScBaseCell* CreateCell( sal_uInt32 nSstIndex, sal_uInt16 nXFIndex = 0 ) const;
-
private:
typedef ::std::vector< XclImpString > XclImpStringVec;
XclImpStringVec maStrings; /// List with all strings in the SST.
diff --git a/sc/source/filter/inc/xihelper.hxx b/sc/source/filter/inc/xihelper.hxx
index 8917a7dab5d7..84eb92445dd7 100644
--- a/sc/source/filter/inc/xihelper.hxx
+++ b/sc/source/filter/inc/xihelper.hxx
@@ -109,12 +109,10 @@ public:
const XclImpRoot& rRoot,
const XclImpString& rString );
- /** Creates a new text cell or edit cell for a Calc document.
- @param nXFIndex Index to XF for first text portion (for escapement). */
- static ScBaseCell* CreateCell(
- const XclImpRoot& rRoot,
- const XclImpString& rString,
- sal_uInt16 nXFIndex = 0 );
+ static void SetToDocument(
+ ScDocument& rDoc, const ScAddress& rPos, const XclImpRoot& rRoot,
+ const XclImpString& rString, sal_uInt16 nXFIndex = 0 );
+
private:
/** We don't want anybody to instantiate this class, since it is just a
collection of static methods. To enforce this, the default constructor
diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx
index 3f9305600d11..c83e3c0666a2 100644
--- a/sc/source/filter/oox/worksheethelper.cxx
+++ b/sc/source/filter/oox/worksheethelper.cxx
@@ -1572,10 +1572,9 @@ void WorksheetHelper::putRichString( const CellAddress& rAddress, const RichStri
ScEditEngineDefaulter& rEE = getEditEngine();
// The cell will own the text object instance returned from convert().
- ScBaseCell* pNewCell = new ScEditCell(rString.convert(rEE, pFirstPortionFont), &rDoc);
ScAddress aAddress;
ScUnoConversion::FillScAddress( aAddress, rAddress );
- rDoc.PutCell( aAddress, pNewCell );
+ rDoc.SetEditText(aAddress, rString.convert(rEE, pFirstPortionFont));
}
void WorksheetHelper::putFormulaTokens( const CellAddress& rAddress, const ApiTokenSequence& rTokens ) const
diff --git a/sc/source/filter/rtf/eeimpars.cxx b/sc/source/filter/rtf/eeimpars.cxx
index 5e3dd69c366c..23a4c3c9501a 100644
--- a/sc/source/filter/rtf/eeimpars.cxx
+++ b/sc/source/filter/rtf/eeimpars.cxx
@@ -47,7 +47,6 @@
#include "docpool.hxx"
#include "attrib.hxx"
#include "patattr.hxx"
-#include "cell.hxx"
#include "eeparser.hxx"
#include "drwlayer.hxx"
#include "rangenam.hxx"
@@ -386,19 +385,20 @@ void ScEEImport::WriteToDocument( bool bSizeColsRows, double nOutputFactor, SvNu
aStr.SearchAndReplaceAll( (sal_Unicode)'\n', (sal_Unicode)' ' );
if (bTextFormat)
- mpDoc->PutCell( nCol, nRow, nTab, new ScStringCell( aStr));
- else
{
- aParam.mbDetectNumberFormat = bConvertDate;
- mpDoc->SetString( nCol, nRow, nTab, aStr, &aParam );
+ aParam.mbDetectNumberFormat = false;
+ aParam.meSetTextNumFormat = ScSetStringParam::Always;
}
+ else
+ aParam.mbDetectNumberFormat = bConvertDate;
+
+ mpDoc->SetString(nCol, nRow, nTab, aStr, &aParam);
}
}
else
{
// The cell will own the text object instance.
- mpDoc->PutCell(
- nCol, nRow, nTab, new ScEditCell(mpEngine->CreateTextObject(pE->aSel), mpDoc));
+ mpDoc->SetEditText(ScAddress(nCol,nRow,nTab), mpEngine->CreateTextObject(pE->aSel));
}
if ( pE->maImageList.size() )
bHasGraphics |= GraphicSize( nCol, nRow, nTab, pE );
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 7126f144af28..19b9041530eb 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -1053,14 +1053,14 @@ void ScXMLTableRowCellContext::PutTextCell( const ScAddress& rCurrentPos,
// This edit engine uses the SfxItemPool instance returned
// from pDoc->GetEditPool() to create the text object, which
// is a prerequisite for using this constructor of ScEditCell.
- pNewCell = new ScEditCell(mpEditEngine->CreateTextObject(), pDoc);
+ pDoc->SetEditText(rCurrentPos, mpEditEngine->CreateTextObject());
}
}
else if ( nCurrentCol > 0 && pOUText && !pOUText->isEmpty() )
pNewCell = ScBaseCell::CreateTextCell( *pOUText, pDoc );
bDoIncrement = pNewCell != NULL;
- if ( bDoIncrement )
+ if (bDoIncrement && pNewCell)
pDoc->PutCell( rCurrentPos, pNewCell );
}
// #i56027# This is about setting simple text, not edit cells,
diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index 5325fac83632..b75600098272 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -817,11 +817,17 @@ void ScTransferObj::StripRefs( ScDocument* pDoc,
{
String aStr = pFCell->GetString();
if ( pFCell->IsMultilineResult() )
- pNew = new ScEditCell( aStr, pDestDoc );
+ {
+ ScFieldEditEngine& rEngine = pDestDoc->GetEditEngine();
+ rEngine.SetText(aStr);
+ pDestDoc->SetEditText(ScAddress(nCol,nRow,nDestTab), rEngine.CreateTextObject());
+ }
else
pNew = new ScStringCell( aStr );
}
- pDestDoc->PutCell( nCol,nRow,nDestTab, pNew );
+
+ if (pNew)
+ pDestDoc->PutCell(nCol, nRow, nDestTab, pNew);
// number formats
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 92a38de54a96..b94146c860f1 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -1204,7 +1204,9 @@ static bool lcl_PutString(
else
{
bMultiLine = true;
- pDoc->PutCell( nCol, nRow, nTab, new ScEditCell( rStr, pDoc ) );
+ ScFieldEditEngine& rEngine = pDoc->GetEditEngine();
+ rEngine.SetText(rStr);
+ pDoc->SetEditText(ScAddress(nCol,nRow,nTab), rEngine.CreateTextObject());
}
return bMultiLine;
}
diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx
index e3b3c6498a8b..fa3a56c71a1b 100644
--- a/sc/source/ui/undo/undoblk3.cxx
+++ b/sc/source/ui/undo/undoblk3.cxx
@@ -49,6 +49,7 @@
#include "postit.hxx"
#include "docuno.hxx"
#include "progress.hxx"
+#include "editutil.hxx"
// STATIC DATA ---------------------------------------------------------------
@@ -1023,7 +1024,11 @@ void ScUndoReplace::Undo()
{
// aUndoStr may contain line breaks
if ( aUndoStr.Search('\n') != STRING_NOTFOUND )
- pDoc->PutCell( aCursorPos, new ScEditCell( aUndoStr, pDoc ) );
+ {
+ ScFieldEditEngine& rEngine = pDoc->GetEditEngine();
+ rEngine.SetText(aUndoStr);
+ pDoc->SetEditText(aCursorPos, rEngine.CreateTextObject());
+ }
else
pDoc->SetString( aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab(), aUndoStr );
if (pViewShell)
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 90511ae45d18..cfd864a2acf7 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -2359,7 +2359,7 @@ void ScCellRangesBase::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pE
aEngine.QuickSetAttribs( aAttr, ESelection( 0, 0, 0, aStr.Len()));
// The cell will own the text object instance.
- pDoc->PutCell(aRanges[0]->aStart, new ScEditCell(aEngine.CreateTextObject(), pDoc));
+ pDoc->SetEditText(aRanges[0]->aStart, aEngine.CreateTextObject());
}
}
}
diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx
index 33ac57649055..ea057782aa39 100644
--- a/sc/source/ui/view/viewfun4.cxx
+++ b/sc/source/ui/view/viewfun4.cxx
@@ -414,9 +414,8 @@ void ScViewFunc::DoThesaurus( sal_Bool bRecord )
if (pCell && pTObject)
{
// The cell will own the text object instance.
- pDoc->PutCell(
- nCol, nRow, nTab,
- new ScEditCell(pThesaurusEngine->CreateTextObject(), pDoc));
+ pDoc->SetEditText(
+ ScAddress(nCol,nRow,nTab), pThesaurusEngine->CreateTextObject());
}
else
{