diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-04-29 16:25:47 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-04-29 21:30:54 -0400 |
commit | 0b03f7ed575838f90e6b1ebec3538a3a214f81fb (patch) | |
tree | 70b87e5d764cbb2796e2e99f5e2988e249060f18 | |
parent | fa8d10adbf12bef19cfe6dd39d2667944a2fb7d6 (diff) |
fdo#75058: Optimize autofilter item filling for non-tree items.
-rw-r--r-- | include/svtools/treelist.hxx | 4 | ||||
-rw-r--r-- | sc/source/ui/cctrl/checklistmenu.cxx | 34 | ||||
-rw-r--r-- | sc/source/ui/inc/checklistmenu.hxx | 6 | ||||
-rw-r--r-- | svtools/source/contnr/treelist.cxx | 11 |
4 files changed, 41 insertions, 14 deletions
diff --git a/include/svtools/treelist.hxx b/include/svtools/treelist.hxx index 4bb7f0a0ba58..04ab892e0828 100644 --- a/include/svtools/treelist.hxx +++ b/include/svtools/treelist.hxx @@ -76,6 +76,8 @@ class SVT_DLLPUBLIC SvTreeList bool bAbsPositionsValid; + bool mbEnableInvalidate; + SvTreeListEntry* FirstVisible() const { return First(); } SvTreeListEntry* NextVisible( const SvListView*,SvTreeListEntry* pEntry, sal_uInt16* pDepth=0 ) const; SvTreeListEntry* PrevVisible( const SvListView*,SvTreeListEntry* pEntry, sal_uInt16* pDepth=0 ) const; @@ -147,6 +149,8 @@ public: sal_uLong nPos=0 ); + void EnableInvalidate( bool bEnable ); + // Notify all Listeners void InvalidateEntry( SvTreeListEntry* ); diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx index 59cf40fd02c2..1cc556632d9b 100644 --- a/sc/source/ui/cctrl/checklistmenu.cxx +++ b/sc/source/ui/cctrl/checklistmenu.cxx @@ -1376,7 +1376,7 @@ void ScCheckListBox::Init() SetNodeDefaultImages(); } -bool ScCheckListBox::IsChecked( OUString& sName, SvTreeListEntry* pParent ) +bool ScCheckListBox::IsChecked( const OUString& sName, SvTreeListEntry* pParent ) { SvTreeListEntry* pEntry = FindEntry( pParent, sName ); if ( pEntry && GetCheckButtonState( pEntry ) == SV_BUTTON_CHECKED) @@ -1384,7 +1384,7 @@ bool ScCheckListBox::IsChecked( OUString& sName, SvTreeListEntry* pParent ) return false; } -void ScCheckListBox::CheckEntry( OUString& sName, SvTreeListEntry* pParent, bool bCheck ) +void ScCheckListBox::CheckEntry( const OUString& sName, SvTreeListEntry* pParent, bool bCheck ) { SvTreeListEntry* pEntry = FindEntry( pParent, sName ); if ( pEntry ) @@ -1500,22 +1500,34 @@ void ScCheckListMenuWindow::initMembers() { size_t n = maMembers.size(); size_t nVisMemCount = 0; + maChecks.SetUpdateMode(false); + maChecks.GetModel()->EnableInvalidate(false); + for (size_t i = 0; i < n; ++i) { - if ( !maMembers[ i ].mbDate ) + if (maMembers[i].mbDate) { maChecks.InsertEntry(maMembers[i].maName, NULL, false, TREELIST_APPEND, NULL, SvLBoxButtonKind_enabledCheckbox ); - } - maChecks.CheckEntry( maMembers[i].maName, maMembers[i].mpParent, maMembers[i].mbVisible); - // Expand first node of checked dates - if ( maMembers[ i ].mpParent == NULL && maChecks.IsChecked( maMembers[i].maName, maMembers[i].mpParent ) ) + maChecks.CheckEntry(maMembers[i].maName, maMembers[i].mpParent, maMembers[i].mbVisible); + // Expand first node of checked dates + if (!maMembers[i].mpParent && maChecks.IsChecked(maMembers[i].maName, maMembers[i].mpParent)) + { + SvTreeListEntry* pEntry = maChecks.FindEntry(NULL, maMembers[i].maName); + if (pEntry) + maChecks.Expand(pEntry); + } + } + else { - SvTreeListEntry* pEntry = maChecks.FindEntry( NULL, maMembers[ i ].maName ); - if (pEntry) - maChecks.Expand( pEntry ); + SvTreeListEntry* pEntry = maChecks.InsertEntry( + maMembers[i].maName, NULL, false, TREELIST_APPEND, NULL, + SvLBoxButtonKind_enabledCheckbox); + + maChecks.SetCheckButtonState( + pEntry, maMembers[i].mbVisible ? SV_BUTTON_CHECKED : SV_BUTTON_UNCHECKED); } if (maMembers[i].mbVisible) @@ -1538,6 +1550,8 @@ void ScCheckListMenuWindow::initMembers() maChkToggleAll.SetState(TRISTATE_INDET); mePrevToggleAllState = TRISTATE_INDET; } + + maChecks.GetModel()->EnableInvalidate(true); maChecks.SetUpdateMode(true); } diff --git a/sc/source/ui/inc/checklistmenu.hxx b/sc/source/ui/inc/checklistmenu.hxx index 15b761ba9285..5119c0248345 100644 --- a/sc/source/ui/inc/checklistmenu.hxx +++ b/sc/source/ui/inc/checklistmenu.hxx @@ -198,9 +198,9 @@ class ScCheckListBox : public SvTreeListBox ScCheckListBox( Window* pParent, WinBits nWinStyle = 0 ); virtual ~ScCheckListBox() { delete mpCheckButton; } void Init(); - void CheckEntry( OUString& sName, SvTreeListEntry* pParent, bool bCheck = true ); - void CheckEntry( SvTreeListEntry* pEntry, bool bCheck = true ); - bool IsChecked( OUString& sName, SvTreeListEntry* pParent ); + void CheckEntry( const OUString& sName, SvTreeListEntry* pParent, bool bCheck = true ); + void CheckEntry( SvTreeListEntry* pEntry, bool bCheck = true ); + bool IsChecked( const OUString& sName, SvTreeListEntry* pParent ); SvTreeListEntry* FindEntry( SvTreeListEntry* pParent, const OUString& sNode ); sal_uInt16 GetCheckedEntryCount() const; void ExpandChildren( SvTreeListEntry* pParent ); diff --git a/svtools/source/contnr/treelist.cxx b/svtools/source/contnr/treelist.cxx index bb38545aa2d1..b1eff7b76e0e 100644 --- a/svtools/source/contnr/treelist.cxx +++ b/svtools/source/contnr/treelist.cxx @@ -24,7 +24,8 @@ #include <stdio.h> -SvTreeList::SvTreeList() +SvTreeList::SvTreeList() : + mbEnableInvalidate(true) { nEntryCount = 0; bAbsPositionsValid = false; @@ -1098,8 +1099,16 @@ void SvTreeList::SetListPositions( SvTreeListEntries& rEntries ) rFirst.pParent->InvalidateChildrensListPositions(); } +void SvTreeList::EnableInvalidate( bool bEnable ) +{ + mbEnableInvalidate = bEnable; +} + void SvTreeList::InvalidateEntry( SvTreeListEntry* pEntry ) { + if (!mbEnableInvalidate) + return; + Broadcast( LISTACTION_INVALIDATE_ENTRY, pEntry ); } |