summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2020-06-17 19:05:59 +0200
committerLuboš Luňák <l.lunak@collabora.com>2020-06-19 11:07:30 +0200
commit15a8357b3faaa360cc162593330e926863d4c51b (patch)
tree4630b8aa4fdb844eab1aecb48533aa2b6507cc62 /sc
parenta12b3da27613bfac7adeb6b847027e82c6649d5b (diff)
delay and batch calls to StartListeningFormulaCells() (tdf#132165)
This is pretty much the same as tdf#133302. Change-Id: I5325b90601f503e572faefc455a38e0f5b055bbf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96560 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com> (cherry picked from commit 7c99e23fddf089f2d52028944db8e435fc05088f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96580
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/scopetools.hxx1
-rw-r--r--sc/source/core/data/table4.cxx21
2 files changed, 22 insertions, 0 deletions
diff --git a/sc/inc/scopetools.hxx b/sc/inc/scopetools.hxx
index dd060615db67..eb2941f15777 100644
--- a/sc/inc/scopetools.hxx
+++ b/sc/inc/scopetools.hxx
@@ -82,6 +82,7 @@ class DelayStartListeningFormulaCells
public:
DelayStartListeningFormulaCells(ScColumn& column, bool delay);
DelayStartListeningFormulaCells(ScColumn& column);
+ DelayStartListeningFormulaCells(const DelayStartListeningFormulaCells&) = delete;
~DelayStartListeningFormulaCells();
void set();
};
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index b18752ca3a8a..c8f533c65708 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -45,9 +45,11 @@
#include <conditio.hxx>
#include <editutil.hxx>
#include <listenercontext.hxx>
+#include <scopetools.hxx>
#include <math.h>
#include <memory>
+#include <list>
#define D_MAX_LONG_ double(0x7fffffff)
@@ -592,6 +594,25 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
if (pProgress)
nProgress = pProgress->GetState();
+ // Avoid possible repeated calls to StartListeningFormulaCells() (tdf#132165).
+ std::list< sc::DelayStartListeningFormulaCells > delayStartListening;
+ SCCOL delayStartColumn, delayEndColumn;
+ if(bVertical)
+ {
+ delayStartColumn = std::min( nOStart, nOEnd );
+ delayEndColumn = std::max( nOStart, nOEnd );
+ }
+ else
+ {
+ delayStartColumn = std::min( nIStart, nIEnd );
+ delayEndColumn = std::max( nIStart, nIEnd );
+ }
+ for( SCROW col = delayStartColumn; col <= delayEndColumn; ++col )
+ {
+ if( ScColumn* column = FetchColumn( col ))
+ delayStartListening.emplace_back( *column, true );
+ }
+
// execute
sal_uLong nActFormCnt = 0;