[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - include/svtools sc/inc sc/source svtools/source
Kohei Yoshida
kohei.yoshida at collabora.com
Wed Apr 30 07:42:58 PDT 2014
include/svtools/treelist.hxx | 4 ++++
sc/inc/column.hxx | 5 ++++-
sc/source/core/data/column3.cxx | 7 +++++--
sc/source/core/data/table3.cxx | 9 +++++++--
sc/source/ui/cctrl/checklistmenu.cxx | 32 +++++++++++++++++++++++++-------
sc/source/ui/inc/checklistmenu.hxx | 4 ++--
svtools/source/contnr/treelist.cxx | 11 ++++++++++-
7 files changed, 57 insertions(+), 15 deletions(-)
New commits:
commit 5e1fdc8cdf3bd35cee2e7c193827f5f5a1c534ac
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Tue Apr 29 15:32:18 2014 -0400
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 at googlemail.com>
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/include/svtools/treelist.hxx b/include/svtools/treelist.hxx
index 4d0264f..b39dd88 100644
--- a/include/svtools/treelist.hxx
+++ b/include/svtools/treelist.hxx
@@ -75,6 +75,8 @@ class SVT_DLLPUBLIC SvTreeList
sal_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;
@@ -146,6 +148,8 @@ public:
sal_uLong nPos=0
);
+ void EnableInvalidate( bool bEnable );
+
// Notify all Listeners
void InvalidateEntry( SvTreeListEntry* );
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 092ec06..53ca5cc 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 8dcf20e..ef726d1 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 429cd52..1765f25 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 848d84c..88ad240 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 f324482..224a56b 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 );
diff --git a/svtools/source/contnr/treelist.cxx b/svtools/source/contnr/treelist.cxx
index 3ef468d..cbd011a 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 = sal_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