diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2023-09-13 14:57:23 +0200 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-09-18 17:45:47 +0200 |
commit | cea900fe9864bbc5314415cb369fc7b6111cd050 (patch) | |
tree | bd948b6ccbed62e446509e52aec3829a962bc63a /sc/inc/conditio.hxx | |
parent | d19fb1dd668473f2d4f8dbde8bac1fcb34042a6a (diff) |
Schedule conditional formating repaint after filtering is completed
When we have sheet with lots of data with applied conditional formatting
and that data is used with autofilter feature - filtering is very slow.
That was caused by repaints synchronously called on every row show/hide.
ScConditionalFormat::DoRepaint() called by ScFormulaListener callback
...
ScDocument::Broadcast
ScColumn::BroadcastRows
ScTable::SetRowHidden
ScTable::DBShowRows
This patch schedules repaint in the Idle so we do that after all changes
are already applied.
Change-Id: If0876ada0f336a41b69560db6a581d6e24d7ac16
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157016
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'sc/inc/conditio.hxx')
-rw-r--r-- | sc/inc/conditio.hxx | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx index 47f5fdb3addb..8e5af1dd3c3c 100644 --- a/sc/inc/conditio.hxx +++ b/sc/inc/conditio.hxx @@ -40,6 +40,7 @@ #include <memory> #include <set> +class RepaintInIdle; class ScFormulaCell; class ScTokenArray; struct ScRefCellValue; @@ -442,6 +443,8 @@ private: }; mutable std::unique_ptr<ScConditionEntryCache> mpCache; + + std::unique_ptr<RepaintInIdle> mpRepaintTask; }; // single condition entry for conditional formatting @@ -605,6 +608,23 @@ public: void CalcAll(); }; +class RepaintInIdle final : public Idle +{ + ScConditionalFormat* mpCondFormat; + +public: + RepaintInIdle(ScConditionalFormat* pCondFormat) + : Idle("Contitional Format Repaint Idle") + , mpCondFormat(pCondFormat) + {} + + void Invoke() override + { + if (mpCondFormat) + mpCondFormat->DoRepaint(); + } +}; + struct CompareScConditionalFormat { using is_transparent = void; |