summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-04-29 16:25:47 -0400
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-04-29 21:30:54 -0400
commit0b03f7ed575838f90e6b1ebec3538a3a214f81fb (patch)
tree70b87e5d764cbb2796e2e99f5e2988e249060f18 /sc
parentfa8d10adbf12bef19cfe6dd39d2667944a2fb7d6 (diff)
fdo#75058: Optimize autofilter item filling for non-tree items.
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/cctrl/checklistmenu.cxx34
-rw-r--r--sc/source/ui/inc/checklistmenu.hxx6
2 files changed, 27 insertions, 13 deletions
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 );