[Libreoffice-commits] core.git: include/svtools sc/source svtools/source
Kohei Yoshida
kohei.yoshida at collabora.com
Tue Apr 29 18:30:35 PDT 2014
include/svtools/treelist.hxx | 4 ++++
sc/source/ui/cctrl/checklistmenu.cxx | 34 ++++++++++++++++++++++++----------
sc/source/ui/inc/checklistmenu.hxx | 6 +++---
svtools/source/contnr/treelist.cxx | 11 ++++++++++-
4 files changed, 41 insertions(+), 14 deletions(-)
New commits:
commit 0b03f7ed575838f90e6b1ebec3538a3a214f81fb
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Tue Apr 29 16:25:47 2014 -0400
fdo#75058: Optimize autofilter item filling for non-tree items.
diff --git a/include/svtools/treelist.hxx b/include/svtools/treelist.hxx
index 4bb7f0a..04ab892 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 59cf40f..1cc5566 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 15b761b..5119c02 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 bb38545..b1eff7b 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 );
}
More information about the Libreoffice-commits
mailing list