[Libreoffice-commits] core.git: sc/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Thu May 21 14:02:10 UTC 2020
sc/source/ui/cctrl/checklistmenu.cxx | 60 ++++++++++++++++-------------------
1 file changed, 29 insertions(+), 31 deletions(-)
New commits:
commit f71557e958a8a626dfc1eef646b84b3c8b72569a
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu May 21 15:05:08 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu May 21 16:01:29 2020 +0200
tdf#76481 speed up searching in autofilter pulldown
turning setUpdateMode on/off fixes the common case, but we need to
special case the "return to show all items" situation
On my machine this takes the searching time from "more than 30s" to
"just under 1s"
Change-Id: I02d11c428e82dba1e840e981507337a1012dd09f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94633
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx
index f6cc3fef223d..2a3d272f2397 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -1223,20 +1223,27 @@ IMPL_LINK_NOARG(ScCheckListMenuWindow, EdModifyHdl, Edit&, void)
bool bSearchTextEmpty = aSearchText.isEmpty();
size_t n = maMembers.size();
size_t nSelCount = 0;
- OUString aLabelDisp;
bool bSomeDateDeletes = false;
- for (size_t i = 0; i < n; ++i)
+ maChecks->SetUpdateMode(false);
+
+ if (bSearchTextEmpty)
+ {
+ // when there are a lot of rows, it is cheaper to simply clear the tree and re-initialise
+ maChecks->Clear();
+ initMembers();
+ }
+ else
{
- bool bIsDate = maMembers[i].mbDate;
- bool bPartialMatch = false;
+ for (size_t i = 0; i < n; ++i)
+ {
+ bool bIsDate = maMembers[i].mbDate;
+ bool bPartialMatch = false;
- aLabelDisp = maMembers[i].maName;
- if ( aLabelDisp.isEmpty() )
- aLabelDisp = ScResId( STR_EMPTYDATA );
+ OUString aLabelDisp = maMembers[i].maName;
+ if ( aLabelDisp.isEmpty() )
+ aLabelDisp = ScResId( STR_EMPTYDATA );
- if ( !bSearchTextEmpty )
- {
if ( !bIsDate )
bPartialMatch = ( ScGlobal::getCharClassPtr()->lowercase( aLabelDisp ).indexOf( aSearchText ) != -1 );
else if ( maMembers[i].meDatePartType == ScCheckListMember::DAY ) // Match with both numerical and text version of month
@@ -1244,30 +1251,19 @@ IMPL_LINK_NOARG(ScCheckListMenuWindow, EdModifyHdl, Edit&, void)
maMembers[i].maRealName + maMembers[i].maDateParts[1] )).indexOf( aSearchText ) != -1);
else
continue;
- }
- else if ( bIsDate && maMembers[i].meDatePartType != ScCheckListMember::DAY )
- continue;
- if ( bSearchTextEmpty )
- {
- SvTreeListEntry* pLeaf = maChecks->ShowCheckEntry( aLabelDisp, maMembers[i], true, maMembers[i].mbVisible );
- updateMemberParents( pLeaf, i );
- if ( maMembers[i].mbVisible )
+ if ( bPartialMatch )
+ {
+ SvTreeListEntry* pLeaf = maChecks->ShowCheckEntry( aLabelDisp, maMembers[i] );
+ updateMemberParents( pLeaf, i );
++nSelCount;
- continue;
- }
-
- if ( bPartialMatch )
- {
- SvTreeListEntry* pLeaf = maChecks->ShowCheckEntry( aLabelDisp, maMembers[i] );
- updateMemberParents( pLeaf, i );
- ++nSelCount;
- }
- else
- {
- maChecks->ShowCheckEntry( aLabelDisp, maMembers[i], false, false );
- if( bIsDate )
- bSomeDateDeletes = true;
+ }
+ else
+ {
+ maChecks->ShowCheckEntry( aLabelDisp, maMembers[i], false, false );
+ if( bIsDate )
+ bSomeDateDeletes = true;
+ }
}
}
@@ -1281,6 +1277,8 @@ IMPL_LINK_NOARG(ScCheckListMenuWindow, EdModifyHdl, Edit&, void)
}
}
+ maChecks->SetUpdateMode(true);
+
if ( nSelCount == n )
maChkToggleAll->SetState( TRISTATE_TRUE );
else if ( nSelCount == 0 )
More information about the Libreoffice-commits
mailing list