From 4a896078a332c0270276e9a89b01f415e2238b27 Mon Sep 17 00:00:00 2001 From: Luboš Luňák Date: Fri, 25 Feb 2022 22:56:00 +0100 Subject: lock paint when VBA sets value for a number of Calc cells MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- sc/source/ui/vba/vbarange.cxx | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'sc/source/ui/vba') 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(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 -- cgit