summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@collabora.com>2014-06-09 22:43:01 +0200
committerMatúš Kukan <matus.kukan@collabora.com>2014-06-10 13:36:00 +0200
commit6188a7197aae39a21ef80d1b177f5be613dc9808 (patch)
tree9c2c48f2e54f0d010f18649953feb24e08a4b3e4
parent172bfad385f914a94ce22b4ba71ce23d8839aa16 (diff)
fdo#76324: Make pasting a lot of cell notes faster by disabling broadcasting.
Change-Id: If76e80af8dcecf70e4ea624a7f538023c48a5108 (cherry picked from commit e7a3aacff7d28577dee371ed5b27317522db7b3b)
-rw-r--r--sc/source/core/data/column2.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 763e6584e494..f72c99ee607a 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,