sc/source/ui/vba/vbarange.cxx |    7 +++++++
 1 file changed, 7 insertions(+)

New commits:
commit 4a896078a332c0270276e9a89b01f415e2238b27
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Fri Feb 25 22:56:00 2022 +0100
Commit:     Luboš Luňák <l.lu...@collabora.com>
CommitDate: Sat Feb 26 07:59:11 2022 +0100

    lock paint when VBA sets value for a number of Calc cells
    
    VBAMacroTest::testVba() spends the majority of time repeatedly
    repainting.
    
    Change-Id: Iea69221834b80b0fbe484ee3ec5f64ba9e28e37d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130569
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lu...@collabora.com>

diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index 0c0e5f256e02..fb72699ea98b 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -1477,6 +1477,11 @@ uno::Reference< XCollection >& ScVbaRange::getBorders()
 void
 ScVbaRange::visitArray( ArrayVisitor& visitor )
 {
+    ScDocShell* pDocSh = nullptr;
+    if(ScCellRangeObj* range = dynamic_cast<ScCellRangeObj*>(mxRange.get()))
+        pDocSh = range->GetDocShell();
+    if ( pDocSh )
+        pDocSh->LockPaint();
     table::CellRangeAddress aRangeAddr = lclGetRangeAddress( mxRange );
     sal_Int32 nRowCount = aRangeAddr.EndRow - aRangeAddr.StartRow + 1;
     sal_Int32 nColCount = aRangeAddr.EndColumn - aRangeAddr.StartColumn + 1;
@@ -1489,6 +1494,8 @@ ScVbaRange::visitArray( ArrayVisitor& visitor )
             visitor.visitNode( i, j, xCell );
         }
     }
+    if ( pDocSh )
+        pDocSh->UnlockPaint();
 }
 
 uno::Any

Reply via email to