sc/source/core/data/column2.cxx | 12 ++++++++++++ sc/source/core/data/postit.cxx | 6 +++--- sc/source/ui/drawfunc/fuins2.cxx | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-)
New commits: commit e7a3aacff7d28577dee371ed5b27317522db7b3b Author: Matúš Kukan <matus.ku...@collabora.com> Date: Mon Jun 9 22:43:01 2014 +0200 fdo#76324: Make pasting a lot of cell notes faster by disabling broadcasting. Change-Id: If76e80af8dcecf70e4ea624a7f538023c48a5108 diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 763e658..f72c99e 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -22,6 +22,7 @@ #include "formulacell.hxx" #include "document.hxx" #include "docpool.hxx" +#include "drwlayer.hxx" #include "attarray.hxx" #include "patattr.hxx" #include "cellform.hxx" @@ -1697,8 +1698,19 @@ public: void ScColumn::CopyCellNotesToDocument( SCROW nRow1, SCROW nRow2, ScColumn& rDestCol, bool bCloneCaption, SCROW nRowOffsetDest ) const { + ScDrawLayer *pDrawLayer = rDestCol.GetDoc().GetDrawLayer(); + bool bWasLocked; + if (pDrawLayer) + { + // Avoid O(n^2) by temporary locking SdrModel which disables broadcasting. + // Each cell note adds undo listener, and all of them would be woken up in ScPostIt::CreateCaption. + bWasLocked = pDrawLayer->isLocked(); + pDrawLayer->setLock(true); + } CopyCellNotesHandler aFunc(*this, rDestCol, nRowOffsetDest, bCloneCaption); sc::ParseNote(maCellNotes.begin(), maCellNotes, nRow1, nRow2, aFunc); + if (pDrawLayer) + pDrawLayer->setLock(bWasLocked); } void ScColumn::DuplicateNotes(SCROW nStartRow, size_t nDataSize, ScColumn& rDestCol, sc::ColumnBlockPosition& maDestBlockPos, commit 1ea62b87abc64bd280b35ac683be6aad47e155ba Author: Matúš Kukan <matus.ku...@collabora.com> Date: Mon Jun 9 15:04:08 2014 +0200 Do not use GetSdrUndoFactory() in sc. Change-Id: Ib1753203a8ca99d9a62b765bbe6e39f567064033 diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx index 703dc8a..09b6f51 100644 --- a/sc/source/core/data/postit.cxx +++ b/sc/source/core/data/postit.cxx @@ -333,7 +333,7 @@ void ScCaptionCreator::UpdateCaptionPos( const Rectangle* pVisRect ) { // create drawing undo action if( pDrawLayer && pDrawLayer->IsRecording() ) - pDrawLayer->AddCalcUndo( pDrawLayer->GetSdrUndoFactory().CreateUndoGeoObject( *mpCaption ) ); + pDrawLayer->AddCalcUndo( new SdrUndoGeoObj( *mpCaption ) ); // calculate new caption rectangle (#i98141# handle LTR<->RTL switch correctly) Rectangle aCaptRect = mpCaption->GetLogicRect(); long nDiffX = (rOldTailPos.X() >= 0) ? (aCaptRect.Left() - rOldTailPos.X()) : (rOldTailPos.X() - aCaptRect.Right()); @@ -733,7 +733,7 @@ void ScPostIt::CreateCaption( const ScAddress& rPos, const SdrCaptionObj* pCapti // create undo action if( ScDrawLayer* pDrawLayer = mrDoc.GetDrawLayer() ) if( pDrawLayer->IsRecording() ) - pDrawLayer->AddCalcUndo( pDrawLayer->GetSdrUndoFactory().CreateUndoNewObject( *maNoteData.mpCaption ) ); + pDrawLayer->AddCalcUndo( new SdrUndoNewObj( *maNoteData.mpCaption ) ); } } @@ -755,7 +755,7 @@ void ScPostIt::RemoveCaption() // create drawing undo action (before removing the object to have valid draw page in undo action) bool bRecording = ( pDrawLayer && pDrawLayer->IsRecording() ); if( bRecording ) - pDrawLayer->AddCalcUndo( pDrawLayer->GetSdrUndoFactory().CreateUndoDeleteObject( *maNoteData.mpCaption ) ); + pDrawLayer->AddCalcUndo( new SdrUndoDelObj( *maNoteData.mpCaption ) ); // remove the object from the drawing page, delete if undo is disabled SdrObject* pObj = pDrawPage->RemoveObject( maNoteData.mpCaption->GetOrdNum() ); if( !bRecording ) diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx index 4e7b0dc..09a866a 100644 --- a/sc/source/ui/drawfunc/fuins2.cxx +++ b/sc/source/ui/drawfunc/fuins2.cxx @@ -779,7 +779,7 @@ FuInsertChart::FuInsertChart(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* { // add undo action the same way as in SdrEditView::InsertObjectAtView // (using UndoActionHdl etc.) - pView->AddUndo(pDoc->GetSdrUndoFactory().CreateUndoNewObject(*pObj)); + pView->AddUndo(new SdrUndoNewObj(*pObj)); } // BM/IHA --
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits