Kaydet (Commit) e7a3aacf authored tarafından Matúš Kukan's avatar Matúš Kukan

fdo#76324: Make pasting a lot of cell notes faster by disabling broadcasting.

Change-Id: If76e80af8dcecf70e4ea624a7f538023c48a5108
üst 1ea62b87
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment