[Libreoffice-commits] core.git: 4 commits - sc/inc sc/source

Kohei Yoshida kohei.yoshida at gmail.com
Tue Feb 12 09:31:34 PST 2013


 sc/inc/cell.hxx                                   |   68 ++++++++++++---
 sc/source/core/data/cell2.cxx                     |   97 ++++++++++++----------
 sc/source/core/data/column2.cxx                   |    8 -
 sc/source/core/data/documen8.cxx                  |   18 +---
 sc/source/core/data/table4.cxx                    |    7 +
 sc/source/filter/excel/xicontent.cxx              |    6 -
 sc/source/filter/excel/xihelper.cxx               |    4 
 sc/source/filter/oox/richstring.cxx               |    4 
 sc/source/filter/oox/worksheethelper.cxx          |    4 
 sc/source/filter/rtf/eeimpars.cxx                 |   11 +-
 sc/source/filter/xml/XMLTrackedChangesContext.cxx |    3 
 sc/source/filter/xml/xmlcelli.cxx                 |    6 -
 sc/source/ui/docshell/docfunc.cxx                 |    6 -
 sc/source/ui/inc/viewfunc.hxx                     |    7 +
 sc/source/ui/undo/undoblk3.cxx                    |   14 ++-
 sc/source/ui/undo/undocell.cxx                    |   13 +-
 sc/source/ui/unoobj/cellsuno.cxx                  |    7 +
 sc/source/ui/view/cellsh3.cxx                     |    2 
 sc/source/ui/view/spelleng.cxx                    |    6 -
 sc/source/ui/view/viewfun2.cxx                    |    5 -
 sc/source/ui/view/viewfun4.cxx                    |   20 ++--
 sc/source/ui/view/viewfunc.cxx                    |   11 +-
 22 files changed, 206 insertions(+), 121 deletions(-)

New commits:
commit f1eba4c718934e50af478fc3018d404de8d2e780
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Tue Feb 12 12:25:01 2013 -0500

    Add prefix 'm' for ScEditCell's data members.
    
    Since I'm modifying the header....
    
    Change-Id: I7cb44335a46dbc185e1a717304c221e5bb6fcb3c

diff --git a/sc/inc/cell.hxx b/sc/inc/cell.hxx
index 7d0b798..c84e985 100644
--- a/sc/inc/cell.hxx
+++ b/sc/inc/cell.hxx
@@ -215,10 +215,9 @@ private:
 
 class SC_DLLPUBLIC ScEditCell : public ScBaseCell
 {
-private:
-    EditTextObject*     pData;
-    mutable rtl::OUString* pString;        // for faster access to formulas
-    ScDocument*         pDoc;           // for EditEngine access with Pool
+    EditTextObject* mpData;
+    mutable OUString* mpString;        // for faster access to formulas
+    ScDocument* mpDoc;           // for EditEngine access with Pool
 
     void            SetTextObject( const EditTextObject* pObject,
                                     const SfxItemPool* pFromPool );
@@ -242,7 +241,7 @@ public:
      * instance returned from ScDocument::GetEditPool()</i>.  This is
      * important.</p>
      */
-    ScEditCell(EditTextObject* pObject, ScDocument* pDocP);
+    ScEditCell(EditTextObject* pObject, ScDocument* pDoc);
 
     /**
      * Constructor.  The caller is responsible for deleting the text object
@@ -250,17 +249,18 @@ public:
      * stores it instead of the original.
      *
      * @param rObject text object to clone from.
-     * @param pDocP pointer to the document instance.
+     * @param pDoc pointer to the document instance.
      * @param pFromPool pointer to SfxItemPool instance that the new text
      *                  object that is to be stored in the cell instance
      *                  should use.  If it's NULL, it uses the default pool
      *                  for edit cells from the document instance (one
      *                  returned from GetEditPool()).
      */
-    ScEditCell(const EditTextObject& rObject, ScDocument* pDocP, const SfxItemPool* pFromPool);
+    ScEditCell(const EditTextObject& rObject, ScDocument* pDoc, const SfxItemPool* pFromPool);
     ScEditCell(const ScEditCell& rCell, ScDocument& rDoc, const ScAddress& rDestPos);
-                    // for line breaks
-                    ScEditCell( const rtl::OUString& rString, ScDocument* );
+
+    // for line breaks
+    ScEditCell(const OUString& rString, ScDocument* pDoc);
 
     /**
      * Remove the text data as well as string cache.
@@ -288,7 +288,7 @@ public:
      */
     void SetData(EditTextObject* pObject);
 
-    rtl::OUString   GetString() const;
+    OUString GetString() const;
 
     const EditTextObject* GetData() const;
 
diff --git a/sc/source/core/data/cell2.cxx b/sc/source/core/data/cell2.cxx
index 58a7595..ac0f73d 100644
--- a/sc/source/core/data/cell2.cxx
+++ b/sc/source/core/data/cell2.cxx
@@ -52,44 +52,45 @@ IMPL_FIXEDMEMPOOL_NEWDEL( ScEditCell )
 
 // ============================================================================
 
-ScEditCell::ScEditCell(EditTextObject* pObject, ScDocument* pDocP) :
+ScEditCell::ScEditCell(EditTextObject* pObject, ScDocument* pDoc) :
     ScBaseCell(CELLTYPE_EDIT),
-    pData(pObject), pString(NULL), pDoc(pDocP) {}
+    mpData(pObject), mpString(NULL), mpDoc(pDoc) {}
 
 ScEditCell::ScEditCell(
-    const EditTextObject& rObject, ScDocument* pDocP, const SfxItemPool* pFromPool) :
+    const EditTextObject& rObject, ScDocument* pDoc, const SfxItemPool* pFromPool) :
     ScBaseCell(CELLTYPE_EDIT),
-    pString(NULL),
-    pDoc(pDocP)
+    mpString(NULL),
+    mpDoc(pDoc)
 {
     SetTextObject(&rObject, pFromPool);
 }
 
 ScEditCell::ScEditCell(const ScEditCell& rCell, ScDocument& rDoc, const ScAddress& rDestPos) :
-    ScBaseCell(rCell), pString(NULL), pDoc(&rDoc)
+    ScBaseCell(rCell), mpString(NULL), mpDoc(&rDoc)
 {
-    SetTextObject( rCell.pData, rCell.pDoc->GetEditPool() );
+    SetTextObject( rCell.mpData, rCell.mpDoc->GetEditPool() );
     UpdateFields(rDestPos.Tab());
 }
 
-ScEditCell::ScEditCell( const rtl::OUString& rString, ScDocument* pDocP )  :
-        ScBaseCell( CELLTYPE_EDIT ),
-        pString( NULL ),
-        pDoc( pDocP )
+ScEditCell::ScEditCell(const OUString& rString, ScDocument* pDoc)  :
+    ScBaseCell(CELLTYPE_EDIT),
+    mpData(NULL),
+    mpString(NULL),
+    mpDoc(pDoc)
 {
     OSL_ENSURE( rString.indexOf('\n') != -1 ||
                 rString.indexOf(CHAR_CR) != -1,
                 "EditCell mit einfachem Text !?!?" );
 
-    EditEngine& rEngine = pDoc->GetEditEngine();
+    EditEngine& rEngine = mpDoc->GetEditEngine();
     rEngine.SetText( rString );
-    pData = rEngine.CreateTextObject();
+    mpData = rEngine.CreateTextObject();
 }
 
 ScEditCell::~ScEditCell()
 {
-    delete pData;
-    delete pString;
+    delete mpData;
+    delete mpString;
 
 #if OSL_DEBUG_LEVEL > 0
     eCellType = CELLTYPE_DESTROYED;
@@ -98,10 +99,10 @@ ScEditCell::~ScEditCell()
 
 void ScEditCell::ClearData()
 {
-    delete pString;
-    pString = NULL;
-    delete pData;
-    pData = NULL;
+    delete mpString;
+    mpString = NULL;
+    delete mpData;
+    mpData = NULL;
 }
 
 void ScEditCell::SetData(const EditTextObject& rObject, const SfxItemPool* pFromPool)
@@ -113,32 +114,32 @@ void ScEditCell::SetData(const EditTextObject& rObject, const SfxItemPool* pFrom
 void ScEditCell::SetData(EditTextObject* pObject)
 {
     ClearData();
-    pData = pObject;
+    mpData = pObject;
 }
 
-rtl::OUString ScEditCell::GetString() const
+OUString ScEditCell::GetString() const
 {
-    if ( pString )
-        return *pString;
+    if (mpString)
+        return *mpString;
 
-    if ( pData )
+    if (mpData)
     {
         // Also Text from URL fields, Doc-Engine is a ScFieldEditEngine
-        EditEngine& rEngine = pDoc->GetEditEngine();
-        rEngine.SetText( *pData );
+        EditEngine& rEngine = mpDoc->GetEditEngine();
+        rEngine.SetText(*mpData);
         rtl::OUString sRet = ScEditUtil::GetMultilineString(rEngine); // string with line separators between paragraphs
         // cache short strings for formulas
         if ( sRet.getLength() < 256 )
-            pString = new rtl::OUString(sRet);   //! non-const
+            mpString = new rtl::OUString(sRet);   //! non-const
         return sRet;
     }
 
-    return rtl::OUString();
+    return OUString();
 }
 
 const EditTextObject* ScEditCell::GetData() const
 {
-    return pData;
+    return mpData;
 }
 
 void ScEditCell::RemoveCharAttribs( const ScPatternAttr& rAttr )
@@ -159,13 +160,13 @@ void ScEditCell::RemoveCharAttribs( const ScPatternAttr& rAttr )
     for (sal_uInt16 i = 0; i < nMapCount; ++i)
     {
         if ( rSet.GetItemState(AttrTypeMap[i].nAttrType, false, &pItem) == SFX_ITEM_SET )
-            pData->RemoveCharAttribs(AttrTypeMap[i].nCharType);
+            mpData->RemoveCharAttribs(AttrTypeMap[i].nCharType);
     }
 }
 
 void ScEditCell::UpdateFields(SCTAB nTab)
 {
-    editeng::FieldUpdater aUpdater = pData->GetFieldUpdater();
+    editeng::FieldUpdater aUpdater = mpData->GetFieldUpdater();
     aUpdater.updateTableFields(nTab);
 }
 
@@ -174,13 +175,13 @@ void ScEditCell::SetTextObject( const EditTextObject* pObject,
 {
     if ( pObject )
     {
-        if ( pFromPool && pDoc->GetEditPool() == pFromPool )
-            pData = pObject->Clone();
+        if ( pFromPool && mpDoc->GetEditPool() == pFromPool )
+            mpData = pObject->Clone();
         else
         {   //! another "spool"
             // Sadly there is no other way to change the Pool than to
             // "spool" the Object through a corresponding Engine
-            EditEngine& rEngine = pDoc->GetEditEngine();
+            EditEngine& rEngine = mpDoc->GetEditEngine();
             if ( pObject->HasOnlineSpellErrors() )
             {
                 sal_uLong nControl = rEngine.GetControlWord();
@@ -189,19 +190,19 @@ void ScEditCell::SetTextObject( const EditTextObject* pObject,
                 if ( bNewControl )
                     rEngine.SetControlWord( nControl | nSpellControl );
                 rEngine.SetText( *pObject );
-                pData = rEngine.CreateTextObject();
+                mpData = rEngine.CreateTextObject();
                 if ( bNewControl )
                     rEngine.SetControlWord( nControl );
             }
             else
             {
                 rEngine.SetText( *pObject );
-                pData = rEngine.CreateTextObject();
+                mpData = rEngine.CreateTextObject();
             }
         }
     }
     else
-        pData = NULL;
+        mpData = NULL;
 }
 
 ScEditDataArray::ScEditDataArray()
commit 1ed3387aad80b740b90b28eab2c60816b89e2222
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Tue Feb 12 12:10:26 2013 -0500

    Made similar change to SetData() of ScEditCell.
    
    Change-Id: Ie1475eb19a4ad41e5eac1ca00419a1af5c207b12

diff --git a/sc/inc/cell.hxx b/sc/inc/cell.hxx
index a6d1480..7d0b798 100644
--- a/sc/inc/cell.hxx
+++ b/sc/inc/cell.hxx
@@ -262,8 +262,32 @@ public:
                     // for line breaks
                     ScEditCell( const rtl::OUString& rString, ScDocument* );
 
-    void            SetData( const EditTextObject* pObject,
-                            const SfxItemPool* pFromPool /* = NULL */ );
+    /**
+     * Remove the text data as well as string cache.
+     */
+    void ClearData();
+
+    /**
+     * Set new text data.  This method clones the passed text data and stores
+     * the clone; the caller is responsible for deleting the text data
+     * instance after the call.
+     *
+     * @param rObject text object to clone from.
+     * @param pFromPool pointer to SfxItemPool instance that the new text
+     *                  object that is to be stored in the cell instance
+     *                  should use.  If it's NULL, it uses the default pool
+     *                  for edit cells from the document instance (one
+     *                  returned from GetEditPool()).
+     */
+    void SetData(const EditTextObject& rObject, const SfxItemPool* pFromPool);
+
+    /**
+     * Set new text data. The passed text data instance will be owned by the
+     * cell.  The caller must ensure that the text data uses the SfxItemPool
+     * instance returned from ScDocument::GetEditPool().
+     */
+    void SetData(EditTextObject* pObject);
+
     rtl::OUString   GetString() const;
 
     const EditTextObject* GetData() const;
diff --git a/sc/source/core/data/cell2.cxx b/sc/source/core/data/cell2.cxx
index 849fd69..58a7595 100644
--- a/sc/source/core/data/cell2.cxx
+++ b/sc/source/core/data/cell2.cxx
@@ -96,16 +96,24 @@ ScEditCell::~ScEditCell()
 #endif
 }
 
-void ScEditCell::SetData( const EditTextObject* pObject,
-            const SfxItemPool* pFromPool )
+void ScEditCell::ClearData()
 {
-    if ( pString )
-    {
-        delete pString;
-        pString = NULL;
-    }
+    delete pString;
+    pString = NULL;
     delete pData;
-    SetTextObject( pObject, pFromPool );
+    pData = NULL;
+}
+
+void ScEditCell::SetData(const EditTextObject& rObject, const SfxItemPool* pFromPool)
+{
+    ClearData();
+    SetTextObject(&rObject, pFromPool);
+}
+
+void ScEditCell::SetData(EditTextObject* pObject)
+{
+    ClearData();
+    pData = pObject;
 }
 
 rtl::OUString ScEditCell::GetString() const
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 21f7784..d2a5ee7 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -908,9 +908,7 @@ void ScColumn::RemoveAutoSpellObj()
             ScEditAttrTester aTester( pEngine );
             if ( aTester.NeedsObject() )                    // only remove spelling errors
             {
-                EditTextObject* pNewData = pEngine->CreateTextObject(); // without BIGOBJ
-                pOldCell->SetData( pNewData, pEngine->GetEditTextObjectPool() );
-                delete pNewData;
+                pOldCell->SetData(pEngine->CreateTextObject());
             }
             else                                            // create a string
             {
@@ -975,9 +973,7 @@ void ScColumn::RemoveEditAttribs( SCROW nStartRow, SCROW nEndRow )
                 sal_uInt32 nWantBig = bSpellErrors ? EE_CNTRL_ALLOWBIGOBJS : 0;
                 if ( ( nCtrl & EE_CNTRL_ALLOWBIGOBJS ) != nWantBig )
                     pEngine->SetControlWord( (nCtrl & ~EE_CNTRL_ALLOWBIGOBJS) | nWantBig );
-                EditTextObject* pNewData = pEngine->CreateTextObject();
-                pOldCell->SetData( pNewData, pEngine->GetEditTextObjectPool() );
-                delete pNewData;
+                pOldCell->SetData(pEngine->CreateTextObject());
             }
             else                                            // create String
             {
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index 2c9d628..46d160d 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -741,15 +741,12 @@ bool ScDocument::OnlineSpellInRange( const ScRange& rSpellRange, ScAddress& rSpe
 
                 if ( bNeedEdit )
                 {
-                    SAL_WNODEPRECATED_DECLARATIONS_PUSH
-                    std::auto_ptr<EditTextObject> pNewData(pEngine->CreateTextObject());
-                    SAL_WNODEPRECATED_DECLARATIONS_POP
                     if ( eType == CELLTYPE_EDIT )
-                        // SetData will create a clone of pNewData and stores the clone.
-                        static_cast<ScEditCell*>(pCell)->SetData(pNewData.get(), pEngine->GetEditTextObjectPool());
+                        // The cell will take ownership of pNewData.
+                        static_cast<ScEditCell*>(pCell)->SetData(pEngine->CreateTextObject());
                     else
                         // The cell will take ownership of pNewData.
-                        PutCell(nCol, nRow, nTab, new ScEditCell(pNewData.release(), this));
+                        PutCell(nCol, nRow, nTab, new ScEditCell(pEngine->CreateTextObject(), this));
                 }
                 else                    // einfacher String
                     PutCell( nCol, nRow, nTab, new ScStringCell( pEngine->GetText() ) );
diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx
index 5157efd..969beb7 100644
--- a/sc/source/ui/undo/undoblk3.cxx
+++ b/sc/source/ui/undo/undoblk3.cxx
@@ -444,9 +444,19 @@ void ScUndoSelectionAttr::ChangeEditData( const bool bUndo )
 
         ScEditCell* pEditCell = static_cast<ScEditCell*>(pCell);
         if (bUndo)
-            pEditCell->SetData(pItem->GetOldData(), NULL);
+        {
+            if (pItem->GetOldData())
+                pEditCell->SetData(*pItem->GetOldData(), NULL);
+            else
+                pEditCell->ClearData();
+        }
         else
-            pEditCell->SetData(pItem->GetNewData(), NULL);
+        {
+            if (pItem->GetNewData())
+                pEditCell->SetData(*pItem->GetNewData(), NULL);
+            else
+                pEditCell->ClearData();
+        }
     }
 }
 
diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx
index b1f7c98..3b935e7 100644
--- a/sc/source/ui/undo/undocell.cxx
+++ b/sc/source/ui/undo/undocell.cxx
@@ -103,8 +103,8 @@ void ScUndoCursorAttr::DoChange( const ScPatternAttr* pWhichPattern, const share
 
     ScBaseCell* pCell;
     pDoc->GetCell(nCol, nRow, nTab, pCell);
-    if (pCell && pCell->GetCellType() == CELLTYPE_EDIT && pEditData.get())
-        static_cast<ScEditCell*>(pCell)->SetData(pEditData.get(), NULL);
+    if (pCell && pCell->GetCellType() == CELLTYPE_EDIT && pEditData)
+        static_cast<ScEditCell*>(pCell)->SetData(*pEditData, NULL);
 
     ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
     if (pViewShell)
diff --git a/sc/source/ui/view/spelleng.cxx b/sc/source/ui/view/spelleng.cxx
index 6cb0cc5..fffda6e 100644
--- a/sc/source/ui/view/spelleng.cxx
+++ b/sc/source/ui/view/spelleng.cxx
@@ -42,6 +42,8 @@
 #include "globstr.hrc"
 #include "markdata.hxx"
 
+#include <boost/scoped_ptr.hpp>
+
 using namespace ::com::sun::star;
 
 ScConversionEngineBase::ScConversionEngineBase(
@@ -118,8 +120,8 @@ bool ScConversionEngineBase::FindNextConversionCell()
                     if( pCell )
                     {
                         ScEditCell* pEditCell = static_cast< ScEditCell* >( pCell );
-                        ::std::auto_ptr< EditTextObject > pEditObj( CreateTextObject() );
-                        pEditCell->SetData( pEditObj.get(), GetEditTextObjectPool() );
+                        boost::scoped_ptr<EditTextObject> pEditObj(CreateTextObject());
+                        pEditCell->SetData(*pEditObj, GetEditTextObjectPool());
                     }
                 }
                 else
commit 0585322e70d3c0f1d26d6bd9c04a388a1ff55abf
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Tue Feb 12 11:23:26 2013 -0500

    Go through all ScEditCell instantiations and fix memory leaks.
    
    Changed the signature of the constructor (one that clones the text object)
    to take a reference instead of a pointer, to smoke out the callers that
    use this constructor.  Went through all its callers and made changes to
    either 1) pass ownership to the cell instance (if the text object uses
    the SfxItemPool instance returned from ScDocument::GetEditPool()), or 2)
    pass as const reference to make it clear that the instance will get cloned.
    
    Change-Id: I669e066d4739536bf8d3b356186503dcdfa303b0

diff --git a/sc/inc/cell.hxx b/sc/inc/cell.hxx
index a66d779..a6d1480 100644
--- a/sc/inc/cell.hxx
+++ b/sc/inc/cell.hxx
@@ -244,8 +244,20 @@ public:
      */
     ScEditCell(EditTextObject* pObject, ScDocument* pDocP);
 
-                    ScEditCell( const EditTextObject* pObject, ScDocument*,
-                                const SfxItemPool* pFromPool /* = NULL */ );
+    /**
+     * Constructor.  The caller is responsible for deleting the text object
+     * instance passed on to this constructor, since it creates a clone and
+     * stores it instead of the original.
+     *
+     * @param rObject text object to clone from.
+     * @param pDocP pointer to the document instance.
+     * @param pFromPool pointer to SfxItemPool instance that the new text
+     *                  object that is to be stored in the cell instance
+     *                  should use.  If it's NULL, it uses the default pool
+     *                  for edit cells from the document instance (one
+     *                  returned from GetEditPool()).
+     */
+    ScEditCell(const EditTextObject& rObject, ScDocument* pDocP, const SfxItemPool* pFromPool);
     ScEditCell(const ScEditCell& rCell, ScDocument& rDoc, const ScAddress& rDestPos);
                     // for line breaks
                     ScEditCell( const rtl::OUString& rString, ScDocument* );
diff --git a/sc/source/core/data/cell2.cxx b/sc/source/core/data/cell2.cxx
index 004b553..849fd69 100644
--- a/sc/source/core/data/cell2.cxx
+++ b/sc/source/core/data/cell2.cxx
@@ -56,13 +56,13 @@ ScEditCell::ScEditCell(EditTextObject* pObject, ScDocument* pDocP) :
     ScBaseCell(CELLTYPE_EDIT),
     pData(pObject), pString(NULL), pDoc(pDocP) {}
 
-ScEditCell::ScEditCell( const EditTextObject* pObject, ScDocument* pDocP,
-            const SfxItemPool* pFromPool )  :
-        ScBaseCell( CELLTYPE_EDIT ),
-        pString( NULL ),
-        pDoc( pDocP )
+ScEditCell::ScEditCell(
+    const EditTextObject& rObject, ScDocument* pDocP, const SfxItemPool* pFromPool) :
+    ScBaseCell(CELLTYPE_EDIT),
+    pString(NULL),
+    pDoc(pDocP)
 {
-    SetTextObject( pObject, pFromPool );
+    SetTextObject(&rObject, pFromPool);
 }
 
 ScEditCell::ScEditCell(const ScEditCell& rCell, ScDocument& rDoc, const ScAddress& rDestPos) :
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index 134fdf3..2c9d628 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -86,6 +86,8 @@
 #include "docuno.hxx"
 #include "scresid.hxx"
 
+#include <memory>
+
 #define GET_SCALEVALUE(set,id)  ((const SfxUInt16Item&)(set.Get( id ))).GetValue()
 
 //  states for online spelling in the visible range (0 is set initially)
@@ -739,14 +741,15 @@ bool ScDocument::OnlineSpellInRange( const ScRange& rSpellRange, ScAddress& rSpe
 
                 if ( bNeedEdit )
                 {
-                    EditTextObject* pNewData = pEngine->CreateTextObject();
+                    SAL_WNODEPRECATED_DECLARATIONS_PUSH
+                    std::auto_ptr<EditTextObject> pNewData(pEngine->CreateTextObject());
+                    SAL_WNODEPRECATED_DECLARATIONS_POP
                     if ( eType == CELLTYPE_EDIT )
-                        ((ScEditCell*)pCell)->SetData( pNewData,
-                            pEngine->GetEditTextObjectPool() );
+                        // SetData will create a clone of pNewData and stores the clone.
+                        static_cast<ScEditCell*>(pCell)->SetData(pNewData.get(), pEngine->GetEditTextObjectPool());
                     else
-                        PutCell( nCol, nRow, nTab, new ScEditCell( pNewData,
-                            this, pEngine->GetEditTextObjectPool() ) );
-                    delete pNewData;
+                        // The cell will take ownership of pNewData.
+                        PutCell(nCol, nRow, nTab, new ScEditCell(pNewData.release(), this));
                 }
                 else                    // einfacher String
                     PutCell( nCol, nRow, nTab, new ScStringCell( pEngine->GetText() ) );
@@ -1582,10 +1585,8 @@ void ScDocument::TransliterateText( const ScMarkData& rMultiMark, sal_Int32 nTyp
                             SfxItemSet* pEmpty = new SfxItemSet( pEngine->GetEmptyItemSet() );
                             pEngine->SetDefaults( pEmpty, true );
 
-                            EditTextObject* pNewData = pEngine->CreateTextObject();
-                            PutCell( nCol, nRow, nTab,
-                                new ScEditCell( pNewData, this, pEngine->GetEditTextObjectPool() ) );
-                            delete pNewData;
+                            // The cell will take ownership of the text object instance.
+                            PutCell(nCol, nRow, nTab, new ScEditCell(pEngine->CreateTextObject(), this));
                         }
                         else
                         {
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index 38adeb8..674f212 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -61,6 +61,7 @@
 #include "conditio.hxx"
 
 #include <math.h>
+#include <boost/scoped_ptr.hpp>
 
 // STATIC DATA -----------------------------------------------------------
 
@@ -158,6 +159,8 @@ static ScBaseCell * lcl_getSuffixCell( ScDocument* pDocument, sal_Int32 nValue,
         return new ScStringCell( aValue += aOrdinalSuffix);
 
     EditEngine aEngine( pDocument->GetEnginePool() );
+    aEngine.SetEditTextObjectPool(pDocument->GetEditPool());
+
     SfxItemSet aAttr = aEngine.GetEmptyItemSet();
     aAttr.Put( SvxEscapementItem( SVX_ESCAPEMENT_SUPERSCRIPT, EE_CHAR_ESCAPEMENT));
     aEngine.SetText( aValue );
@@ -165,7 +168,9 @@ static ScBaseCell * lcl_getSuffixCell( ScDocument* pDocument, sal_Int32 nValue,
                 aValue.Len() + aOrdinalSuffix.Len()));
     aEngine.QuickSetAttribs( aAttr, ESelection( 0, aValue.Len(), 0, aValue.Len() +
                 aOrdinalSuffix.Len()));
-    return new ScEditCell( aEngine.CreateTextObject(), pDocument, NULL );
+
+    // Text object instance will be owned by the cell.
+    return new ScEditCell(aEngine.CreateTextObject(), pDocument);
 }
 
 void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx
index b4606ab..a455d89 100644
--- a/sc/source/filter/excel/xicontent.cxx
+++ b/sc/source/filter/excel/xicontent.cxx
@@ -195,11 +195,9 @@ void lclInsertUrl( const XclImpRoot& rRoot, const String& rUrl, SCCOL nScCol, SC
                     rEE.QuickSetAttribs( aItemSet, ESelection( 0, 0, 0xFFFF, 0 ) );
                 }
             }
-            SAL_WNODEPRECATED_DECLARATIONS_PUSH
-            ::std::auto_ptr< EditTextObject > xTextObj( rEE.CreateTextObject() );
-            SAL_WNODEPRECATED_DECLARATIONS_POP
 
-            ScEditCell* pCell = new ScEditCell( xTextObj.get(), &rDoc, rEE.GetEditTextObjectPool() );
+            // The cell will own the text object instance.
+            ScEditCell* pCell = new ScEditCell(rEE.CreateTextObject(), &rDoc);
             rDoc.PutCell( aScPos, pCell );
         }
         break;
diff --git a/sc/source/filter/excel/xihelper.cxx b/sc/source/filter/excel/xihelper.cxx
index ad5d1f8..ef840f9 100644
--- a/sc/source/filter/excel/xihelper.cxx
+++ b/sc/source/filter/excel/xihelper.cxx
@@ -231,8 +231,8 @@ ScBaseCell* XclImpStringHelper::CreateCell(
         ScDocument& rDoc = rRoot.GetDoc();
 
         if( pTextObj.get() )
-            // ScEditCell creates own copy of text object
-            pCell = new ScEditCell( pTextObj.get(), &rDoc, rRoot.GetEditEngine().GetEditTextObjectPool() );
+            // ScEditCell will own the text object instance.
+            pCell = new ScEditCell(pTextObj.release(), &rDoc);
         else
             pCell = ScBaseCell::CreateTextCell( rString.GetText(), &rDoc );
     }
diff --git a/sc/source/filter/oox/richstring.cxx b/sc/source/filter/oox/richstring.cxx
index acbaea6..1a746d6 100644
--- a/sc/source/filter/oox/richstring.cxx
+++ b/sc/source/filter/oox/richstring.cxx
@@ -417,7 +417,6 @@ void RichString::convert( const Reference< XText >& rxText, bool bReplaceOld, co
 
 ::EditTextObject* RichString::convert( ScEditEngineDefaulter& rEE, const Font* pFirstPortionFont ) const
 {
-    EditTextObject* pTextObj = NULL;
     ESelection aSelection;
 
     OUString sString;
@@ -432,8 +431,7 @@ void RichString::convert( const Reference< XText >& rxText, bool bReplaceOld, co
         pFirstPortionFont = 0;
     }
 
-    pTextObj = rEE.CreateTextObject();
-    return pTextObj;
+    return rEE.CreateTextObject();
 }
 
 // private --------------------------------------------------------------------
diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx
index b993e34..fe072cb 100644
--- a/sc/source/filter/oox/worksheethelper.cxx
+++ b/sc/source/filter/oox/worksheethelper.cxx
@@ -1552,8 +1552,8 @@ void WorksheetHelper::putRichString( const CellAddress& rAddress, const RichStri
     ScDocument& rDoc = getScDocument();
     ScEditEngineDefaulter& rEE = getEditEngine();
 
-    ::std::auto_ptr< ::EditTextObject > pTextObj( rString.convert( rEE, pFirstPortionFont ) );
-    ScBaseCell* pNewCell = new ScEditCell( pTextObj.get(), &rDoc, rEE.GetEditTextObjectPool() );
+    // 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 );
diff --git a/sc/source/filter/rtf/eeimpars.cxx b/sc/source/filter/rtf/eeimpars.cxx
index 95dba19..522ab3b 100644
--- a/sc/source/filter/rtf/eeimpars.cxx
+++ b/sc/source/filter/rtf/eeimpars.cxx
@@ -56,6 +56,8 @@
 
 #include "globstr.hrc"
 
+#include <boost/scoped_ptr.hpp>
+
 // in fuins1.cxx
 extern void ScLimitSizeOnDrawPage( Size& rSize, Point& rPos, const Size& rPage );
 
@@ -68,7 +70,7 @@ ScEEImport::ScEEImport( ScDocument* pDocP, const ScRange& rRange ) :
 {
     const ScPatternAttr* pPattern = mpDoc->GetPattern(
         maRange.aStart.Col(), maRange.aStart.Row(), maRange.aStart.Tab() );
-    mpEngine = new ScTabEditEngine( *pPattern, mpDoc->GetEditPool() );
+    mpEngine = new ScTabEditEngine(*pPattern, mpDoc->GetEditPool(), mpDoc->GetEditPool());
     mpEngine->SetUpdateMode( false );
     mpEngine->EnableUndo( false );
 }
@@ -394,10 +396,9 @@ void ScEEImport::WriteToDocument( bool bSizeColsRows, double nOutputFactor, SvNu
             }
             else
             {
-                EditTextObject* pObject = mpEngine->CreateTextObject( pE->aSel );
-                mpDoc->PutCell( nCol, nRow, nTab, new ScEditCell( pObject,
-                    mpDoc, mpEngine->GetEditTextObjectPool() ) );
-                delete pObject;
+                // The cell will own the text object instance.
+                mpDoc->PutCell(
+                    nCol, nRow, nTab, new ScEditCell(mpEngine->CreateTextObject(pE->aSel), mpDoc));
             }
             if ( pE->maImageList.size() )
                 bHasGraphics |= GraphicSize( nCol, nRow, nTab, pE );
diff --git a/sc/source/filter/xml/XMLTrackedChangesContext.cxx b/sc/source/filter/xml/XMLTrackedChangesContext.cxx
index 9673851..64a3dc4 100644
--- a/sc/source/filter/xml/XMLTrackedChangesContext.cxx
+++ b/sc/source/filter/xml/XMLTrackedChangesContext.cxx
@@ -1280,7 +1280,8 @@ void ScXMLChangeCellContext::EndElement()
                 }
             }
             if (GetScImport().GetDocument())
-                rOldCell = new ScEditCell(pEditTextObj->CreateTextObject(), GetScImport().GetDocument(), GetScImport().GetDocument()->GetEditPool());
+                // The cell will own the text object instance.
+                rOldCell = new ScEditCell(pEditTextObj->CreateTextObject(), GetScImport().GetDocument());
             GetScImport().GetTextImport()->ResetCursor();
             pEditTextObj->release();
         }
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 4115377..2c8e5e5 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -944,11 +944,11 @@ sal_Bool ScDocFunc::PutData( const ScAddress& rPos, ScEditEngineDefaulter& rEngi
             }
         }
 
-        EditTextObject* pNewData = rEngine.CreateTextObject();
+        // A copy of pNewData will be stored in the cell.
+        boost::scoped_ptr<EditTextObject> pNewData(rEngine.CreateTextObject());
         bRet = PutCell( rPos,
-                        new ScEditCell( pNewData, pDoc, rEngine.GetEditTextObjectPool() ),
+                        new ScEditCell(*pNewData, pDoc, rEngine.GetEditTextObjectPool()),
                         bApi );
-        delete pNewData;
 
         // Set the paragraph attributes back to the EditEngine.
         if (!aRememberItems.empty())
diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx
index 057a74cf..2ef5b44 100644
--- a/sc/source/ui/inc/viewfunc.hxx
+++ b/sc/source/ui/inc/viewfunc.hxx
@@ -81,10 +81,15 @@ public:
     void            EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString,
                                const EditTextObject* pData = NULL );
     void            EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab,
-                               const EditTextObject* pData, bool bTestSimple = false );
+                               const EditTextObject& rData, bool bTestSimple = false );
     void            EnterValue( SCCOL nCol, SCROW nRow, SCTAB nTab, const double& rValue );
 
     void            EnterMatrix( const String& rString, ::formula::FormulaGrammar::Grammar eGram );
+
+    /**
+     * @param pData The caller must manage the life cycle of the object this
+     *              pointer points to.  NULL is allowed.
+     */
     void            EnterBlock( const String& rString, const EditTextObject* pData );
 
     void            EnterDataAtCursor( const String& rString );         //! Not used?
diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx
index a96d192..b1f7c98 100644
--- a/sc/source/ui/undo/undocell.cxx
+++ b/sc/source/ui/undo/undocell.cxx
@@ -296,7 +296,8 @@ void ScUndoEnterData::Redo()
     for (sal_uInt16 i=0; i<nCount; i++)
     {
         if (pNewEditData)
-            pDoc->PutCell( nCol, nRow, pTabs[i], new ScEditCell( pNewEditData,
+            // A clone of pNewEditData will be stored in ScEditCell.
+            pDoc->PutCell( nCol, nRow, pTabs[i], new ScEditCell(*pNewEditData,
                 pDoc, NULL ) );
         else
             pDoc->SetString( nCol, nRow, pTabs[i], aNewString );
@@ -661,7 +662,8 @@ ScUndoThesaurus::ScUndoThesaurus( ScDocShell* pNewDocShell,
 
     ScBaseCell* pOldCell;
     if ( pUndoTObject )
-        pOldCell = new ScEditCell( pUndoTObject, pDocShell->GetDocument(), NULL );
+        // A clone of pUndoTObject will be stored in the cell.
+        pOldCell = new ScEditCell(*pUndoTObject, pDocShell->GetDocument(), NULL);
     else
         pOldCell = new ScStringCell( aUndoStr );
     SetChangeTrack( pOldCell );
@@ -713,7 +715,8 @@ void ScUndoThesaurus::DoChange( sal_Bool bUndo, const String& rStr,
         {
             if (pCell->GetCellType() == CELLTYPE_EDIT )
             {
-                ScEditCell* pNewCell = new ScEditCell( pTObj, pDoc, NULL );
+                // A copy of pTObj will be stored in the cell.
+                ScEditCell* pNewCell = new ScEditCell(*pTObj, pDoc, NULL);
                 pDoc->PutCell( nCol, nRow, nTab, pNewCell );
                 if ( !bUndo )
                     SetChangeTrack( pCell );
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 4bd3855..669b3b6 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -120,6 +120,7 @@
 #include "editeng/escpitem.hxx"
 
 #include <list>
+#include <boost/scoped_ptr.hpp>
 
 using namespace com::sun::star;
 
@@ -2341,6 +2342,8 @@ void ScCellRangesBase::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pE
                                 ScBaseCell *pCell = pDoc->GetCell( aAddr );
                                 String aStr( pCell->GetStringData() );
                                 EditEngine aEngine( pDoc->GetEnginePool() );
+                                aEngine.SetEditTextObjectPool(pDoc->GetEditPool());
+
                                 /* EE_CHAR_ESCAPEMENT seems to be set on the cell _only_ when
                                  * there are no other attribs for the cell.
                                  * So, it is safe to overwrite the complete attribute set.
@@ -2354,7 +2357,9 @@ void ScCellRangesBase::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pE
                                 else                // Superscript
                                     aAttr.Put( SvxEscapementItem( SVX_ESCAPEMENT_SUPERSCRIPT, EE_CHAR_ESCAPEMENT ) );
                                 aEngine.QuickSetAttribs( aAttr, ESelection( 0, 0, 0, aStr.Len()));
-                                pDoc->PutCell( (aRanges[ 0 ])->aStart, new ScEditCell( aEngine.CreateTextObject(), pDoc, NULL ) );
+
+                                // The cell will own the text object instance.
+                                pDoc->PutCell(aRanges[0]->aStart, new ScEditCell(aEngine.CreateTextObject(), pDoc));
                             }
                         }
                     }
diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx
index 88a41dd..e916bda 100644
--- a/sc/source/ui/view/cellsh3.cxx
+++ b/sc/source/ui/view/cellsh3.cxx
@@ -245,7 +245,7 @@ void ScCellShell::Execute( SfxRequest& rReq )
                     }
                     else
                     {
-                        pTabViewShell->EnterData( aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab(), pData );
+                        pTabViewShell->EnterData(aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab(), *pData);
                     }
                 }
                 else
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 2dd4871..64cea57 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -772,7 +772,7 @@ void ScViewFunc::EnterBlock( const String& rString, const EditTextObject* pData
 
             //  insert into single cell
             if ( pData )
-                EnterData( nCol, nRow, nTab, pData );
+                EnterData(nCol, nRow, nTab, *pData);
             else
                 EnterData( nCol, nRow, nTab, rString );
             return;
@@ -811,7 +811,8 @@ void ScViewFunc::EnterBlock( const String& rString, const EditTextObject* pData
         pInsDoc->PutCell( nCol, nRow, nTab, pFCell );
     }
     else if ( pData )
-        pInsDoc->PutCell( nCol, nRow, nTab, new ScEditCell( pData, pDoc, NULL ) );
+        // A copy of pData will be stored.
+        pInsDoc->PutCell(nCol, nRow, nTab, new ScEditCell(*pData, pDoc, NULL));
     else
         pInsDoc->SetString( nCol, nRow, nTab, aNewStr );
 
diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx
index 5698878..695b2ab 100644
--- a/sc/source/ui/view/viewfun4.cxx
+++ b/sc/source/ui/view/viewfun4.cxx
@@ -65,6 +65,8 @@
 #include "reffind.hxx"
 #include "compiler.hxx"
 
+#include <boost/scoped_ptr.hpp>
+
 using namespace com::sun::star;
 
 // STATIC DATA -----------------------------------------------------------
@@ -127,9 +129,8 @@ void ScViewFunc::PasteRTF( SCCOL nStartCol, SCROW nStartRow,
             pDoc->EnableUndo( false );
             for( sal_uInt16 n = 0; n < nParCnt; n++ )
             {
-                EditTextObject* pObject = pEngine->CreateTextObject( n );
-                EnterData( nStartCol, nRow, nTab, pObject, true );
-                delete pObject;
+                boost::scoped_ptr<EditTextObject> pObject(pEngine->CreateTextObject(n));
+                EnterData(nStartCol, nRow, nTab, *pObject, true);
                 if( ++nRow > MAXROW )
                     break;
             }
@@ -413,10 +414,10 @@ void ScViewFunc::DoThesaurus( sal_Bool bRecord )
         EditTextObject* pNewTObj = NULL;
         if (pCell && pTObject)
         {
-            pNewTObj = pThesaurusEngine->CreateTextObject();
-            pCell = new ScEditCell( pNewTObj, pDoc,
-                pThesaurusEngine->GetEditTextObjectPool() );
-            pDoc->PutCell( nCol, nRow, nTab, pCell );
+            // The cell will own the text object instance.
+            pDoc->PutCell(
+                nCol, nRow, nTab,
+                new ScEditCell(pThesaurusEngine->CreateTextObject(), pDoc));
         }
         else
         {
@@ -764,9 +765,8 @@ void ScViewFunc::InsertBookmark( const String& rDescription, const String& rURL,
         aField.SetTargetFrame(*pTarget);
     aEngine.QuickInsertField( SvxFieldItem( aField, EE_FEATURE_FIELD ), aInsSel );
 
-    EditTextObject* pData = aEngine.CreateTextObject();
-    EnterData( nPosX, nPosY, nTab, pData );
-    delete pData;
+    boost::scoped_ptr<EditTextObject> pData(aEngine.CreateTextObject());
+    EnterData(nPosX, nPosY, nTab, *pData);
 }
 
 sal_Bool ScViewFunc::HasBookmarkAtCursor( SvxHyperlinkItem* pContent )
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 2ff86f1..02e7366 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -504,7 +504,8 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab,
                 {
                     ScBaseCell *pCell;
                     if ( pData )
-                        pCell = new ScEditCell( pData, pDoc, NULL );
+                        // A clone of pData will be stored in the cell.
+                        pCell = new ScEditCell(*pData, pDoc, NULL);
                     else
                         pCell = new ScStringCell( aFormula );
                     rFunc.PutCell( aPos, pCell, sal_False );
@@ -611,7 +612,7 @@ void ScViewFunc::EnterValue( SCCOL nCol, SCROW nRow, SCTAB nTab, const double& r
 }
 
 void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab,
-                            const EditTextObject* pData, bool bTestSimple )
+                            const EditTextObject& rData, bool bTestSimple )
 {
     ScDocShell* pDocSh = GetViewData()->GetDocShell();
     ScMarkData& rMark = GetViewData()->GetMarkData();
@@ -634,7 +635,7 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab,
 
         const ScPatternAttr* pOldPattern = pDoc->GetPattern( nCol, nRow, nTab );
         ScTabEditEngine aEngine( *pOldPattern, pDoc->GetEnginePool() );
-        aEngine.SetText(*pData);
+        aEngine.SetText(rData);
 
         if (bTestSimple)                    // test, if simple string without attribute
         {
@@ -690,7 +691,7 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab,
 
             OSL_ENSURE( nPos==nSelCount, "nPos!=nSelCount" );
 
-            pUndoData = pData->Clone();
+            pUndoData = rData.Clone();
         }
 
         //
@@ -711,7 +712,7 @@ 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( pData, pDoc, NULL ) );
+                pDoc->PutCell(nCol, nRow, *itr, new ScEditCell(rData, pDoc, NULL));
 
             if ( bRecord )
             {   //  because of ChangeTrack current first
commit 117b3a13b82aaac0977fd17ee5b7b63204e659f4
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Tue Feb 12 09:40:39 2013 -0500

    Avoid unnecessary cloning of text object when instantiating ScEditCell.
    
    This alone cuts about 3 seconds off of the total import time with the
    test document from fdo#54638.
    
    Change-Id: I3be3229532b9e982f03565fd3fb630f70f2bce03

diff --git a/sc/inc/cell.hxx b/sc/inc/cell.hxx
index d146a98..a66d779 100644
--- a/sc/inc/cell.hxx
+++ b/sc/inc/cell.hxx
@@ -234,6 +234,16 @@ public:
 
                     ~ScEditCell();              // always because of pData!
 
+    /**
+     * Constructor that takes ownership of the passed EditTextObject instance
+     * which the caller must not delete afterward!
+     *
+     * <p>Also ensure that the passed edit text object <i>uses the SfxItemPool
+     * instance returned from ScDocument::GetEditPool()</i>.  This is
+     * important.</p>
+     */
+    ScEditCell(EditTextObject* pObject, ScDocument* pDocP);
+
                     ScEditCell( const EditTextObject* pObject, ScDocument*,
                                 const SfxItemPool* pFromPool /* = NULL */ );
     ScEditCell(const ScEditCell& rCell, ScDocument& rDoc, const ScAddress& rDestPos);
diff --git a/sc/source/core/data/cell2.cxx b/sc/source/core/data/cell2.cxx
index 2bd326c..004b553 100644
--- a/sc/source/core/data/cell2.cxx
+++ b/sc/source/core/data/cell2.cxx
@@ -52,6 +52,10 @@ IMPL_FIXEDMEMPOOL_NEWDEL( ScEditCell )
 
 // ============================================================================
 
+ScEditCell::ScEditCell(EditTextObject* pObject, ScDocument* pDocP) :
+    ScBaseCell(CELLTYPE_EDIT),
+    pData(pObject), pString(NULL), pDoc(pDocP) {}
+
 ScEditCell::ScEditCell( const EditTextObject* pObject, ScDocument* pDocP,
             const SfxItemPool* pFromPool )  :
         ScBaseCell( CELLTYPE_EDIT ),
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 3510514..ba9f1da 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -1050,8 +1050,10 @@ void ScXMLTableRowCellContext::PutTextCell( const ScAddress& rCurrentPos,
                         mpEditEngine->QuickInsertField(SvxFieldItem(*it->mpData, EE_FEATURE_FIELD), it->maSelection);
                 }
 
-                boost::scoped_ptr<EditTextObject> pTextObj(mpEditEngine->CreateTextObject());
-                pNewCell = new ScEditCell(pTextObj.get(), pDoc, pDoc->GetEditPool());
+                // 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);
             }
         }
         else if ( nCurrentCol > 0 && pOUText && !pOUText->isEmpty() )


More information about the Libreoffice-commits mailing list