[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.2' - sc/source

Matúš Kukan matus.kukan at collabora.com
Wed Jun 11 08:37:08 PDT 2014


 sc/source/core/data/column2.cxx |   12 ++++++++++++
 1 file changed, 12 insertions(+)

New commits:
commit fe6dfe34af64cd7f63149a5ca02aa96695b7059c
Author: Matúš Kukan <matus.kukan at 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
    (cherry picked from commit e7a3aacff7d28577dee371ed5b27317522db7b3b)
    Reviewed-on: https://gerrit.libreoffice.org/9710
    Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    (cherry picked from commit 90132a32f8bc2e27c097d79c0cc1ddd7cae35da6)

diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 3fdbc52..18aee24 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"
@@ -1834,8 +1835,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,


More information about the Libreoffice-commits mailing list