diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-02-12 09:40:39 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-02-12 12:32:59 -0500 |
commit | 117b3a13b82aaac0977fd17ee5b7b63204e659f4 (patch) | |
tree | 46054333d66d78c66ba8ad06c77686a572a560a4 /sc | |
parent | 36e30d9772a32de94e104424316fcd3320a21adb (diff) |
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
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/cell.hxx | 10 | ||||
-rw-r--r-- | sc/source/core/data/cell2.cxx | 4 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlcelli.cxx | 6 |
3 files changed, 18 insertions, 2 deletions
diff --git a/sc/inc/cell.hxx b/sc/inc/cell.hxx index d146a98d2ee3..a66d7795fd0d 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 2bd326ce2e9a..004b553b7078 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 351051412596..ba9f1da86160 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() ) |