diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-04-29 15:32:18 -0400 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2014-05-01 12:33:20 +0200 |
commit | 6a65d6ae14cc67db08da58097053bac35b78bcce (patch) | |
tree | a3501eef87340c87309cbdf567c9174dc0ceb8bf /sc | |
parent | a4d7d01c8dd35a863637001e2ca906e00ecd09ec (diff) |
fdo#75058: Optimize autofilter item filling for non-tree items.
(cherry picked from commit 878a5dabff4669fb606a461e11eaf286d0c8b07f)
(cherry picked from commit 0b03f7ed575838f90e6b1ebec3538a3a214f81fb)
Conflicts:
sc/source/ui/cctrl/checklistmenu.cxx
sc/source/ui/inc/checklistmenu.hxx
Change-Id: I1b3ae601726401a0e70fb1a05b9a90c43773794c
Reviewed-on: https://gerrit.libreoffice.org/9211
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/column.hxx | 5 | ||||
-rw-r--r-- | sc/source/core/data/column3.cxx | 7 | ||||
-rw-r--r-- | sc/source/core/data/table3.cxx | 9 | ||||
-rw-r--r-- | sc/source/ui/cctrl/checklistmenu.cxx | 32 | ||||
-rw-r--r-- | sc/source/ui/inc/checklistmenu.hxx | 4 |
5 files changed, 43 insertions, 14 deletions
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 092ec069a5c9..53ca5cce3847 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -452,7 +452,10 @@ public: /// Including current, may return -1 SCsROW GetNextUnprotected( SCROW nRow, bool bUp ) const; - void GetFilterEntries(SCROW nStartRow, SCROW nEndRow, std::vector<ScTypedStrData>& rStrings, bool& rHasDates); + void GetFilterEntries( + sc::ColumnBlockConstPosition& rBlockPos, SCROW nStartRow, SCROW nEndRow, + std::vector<ScTypedStrData>& rStrings, bool& rHasDates ); + bool GetDataEntries( SCROW nRow, std::set<ScTypedStrData>& rStrings, bool bLimit ) const; void UpdateInsertTabAbs(SCTAB nNewPos); diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 8dcf20e7ce89..ef726d1a65f1 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -2055,10 +2055,13 @@ public: } -void ScColumn::GetFilterEntries(SCROW nStartRow, SCROW nEndRow, std::vector<ScTypedStrData>& rStrings, bool& rHasDates) +void ScColumn::GetFilterEntries( + sc::ColumnBlockConstPosition& rBlockPos, SCROW nStartRow, SCROW nEndRow, + std::vector<ScTypedStrData>& rStrings, bool& rHasDates ) { FilterEntriesHandler aFunc(*this, rStrings); - sc::ParseAllNonEmpty(maCells.begin(), maCells, nStartRow, nEndRow, aFunc); + rBlockPos.miCellPos = + sc::ParseAllNonEmpty(rBlockPos.miCellPos, maCells, nStartRow, nEndRow, aFunc); rHasDates = aFunc.hasDates(); } diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index 429cd52ede92..1765f251035d 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -2556,12 +2556,17 @@ bool ScTable::HasRowHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL /* nEndCol * void ScTable::GetFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, std::vector<ScTypedStrData>& rStrings, bool& rHasDates) { - aCol[nCol].GetFilterEntries( nRow1, nRow2, rStrings, rHasDates ); + sc::ColumnBlockConstPosition aBlockPos; + aCol[nCol].InitBlockPosition(aBlockPos); + aCol[nCol].GetFilterEntries(aBlockPos, nRow1, nRow2, rStrings, rHasDates); } void ScTable::GetFilteredFilterEntries( SCCOL nCol, SCROW nRow1, SCROW nRow2, const ScQueryParam& rParam, std::vector<ScTypedStrData>& rStrings, bool& rHasDates) { + sc::ColumnBlockConstPosition aBlockPos; + aCol[nCol].InitBlockPosition(aBlockPos); + // remove the entry for this column from the query parameter ScQueryParam aParam( rParam ); aParam.RemoveEntryByField(nCol); @@ -2573,7 +2578,7 @@ void ScTable::GetFilteredFilterEntries( if (ValidQuery(j, aParam)) { bool bThisHasDates = false; - aCol[nCol].GetFilterEntries( j, j, rStrings, bThisHasDates ); + aCol[nCol].GetFilterEntries(aBlockPos, j, j, rStrings, bThisHasDates); bHasDates |= bThisHasDates; } } diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx index 848d84cb62d1..88ad240c4432 100644 --- a/sc/source/ui/cctrl/checklistmenu.cxx +++ b/sc/source/ui/cctrl/checklistmenu.cxx @@ -1385,7 +1385,7 @@ void ScCheckListBox::Init() SetNodeDefaultImages(); } -sal_Bool ScCheckListBox::IsChecked( OUString& sName, SvTreeListEntry* pParent ) +sal_Bool ScCheckListBox::IsChecked( const OUString& sName, SvTreeListEntry* pParent ) { SvTreeListEntry* pEntry = FindEntry( pParent, sName ); if ( pEntry && GetCheckButtonState( pEntry ) == SV_BUTTON_CHECKED) @@ -1393,7 +1393,7 @@ sal_Bool ScCheckListBox::IsChecked( OUString& sName, SvTreeListEntry* pParent ) return sal_False; } -void ScCheckListBox::CheckEntry( OUString& sName, SvTreeListEntry* pParent, sal_Bool bCheck ) +void ScCheckListBox::CheckEntry( const OUString& sName, SvTreeListEntry* pParent, sal_Bool bCheck ) { SvTreeListEntry* pEntry = FindEntry( pParent, sName ); if ( pEntry ) @@ -1509,19 +1509,35 @@ 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, sal_False, LISTBOX_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 && 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.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.Expand( maChecks.FindEntry( NULL, maMembers[ i ].maName ) ); + maChecks.SetCheckButtonState( + pEntry, maMembers[i].mbVisible ? SV_BUTTON_CHECKED : SV_BUTTON_UNCHECKED); + } if (maMembers[i].mbVisible) ++nVisMemCount; @@ -1543,6 +1559,8 @@ void ScCheckListMenuWindow::initMembers() maChkToggleAll.SetState(STATE_DONTKNOW); mePrevToggleAllState = STATE_DONTKNOW; } + + maChecks.GetModel()->EnableInvalidate(true); maChecks.SetUpdateMode(true); } diff --git a/sc/source/ui/inc/checklistmenu.hxx b/sc/source/ui/inc/checklistmenu.hxx index f324482fee41..224a56bef74a 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 ); ~ScCheckListBox() { delete mpCheckButton; } void Init(); - void CheckEntry( OUString& sName, SvTreeListEntry* pParent, sal_Bool bCheck = sal_True ); + void CheckEntry( const OUString& sName, SvTreeListEntry* pParent, sal_Bool bCheck = sal_True ); void CheckEntry( SvTreeListEntry* pEntry, sal_Bool bCheck = sal_True ); - sal_Bool IsChecked( OUString& sName, SvTreeListEntry* pParent ); + sal_Bool IsChecked( const OUString& sName, SvTreeListEntry* pParent ); SvTreeListEntry* FindEntry( SvTreeListEntry* pParent, const OUString& sNode ); sal_uInt16 GetCheckedEntryCount() const; void ExpandChildren( SvTreeListEntry* pParent ); |