diff options
| author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-04-29 15:32:18 -0400 | 
|---|---|---|
| committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-04-30 14:42:25 +0000 | 
| commit | 5e1fdc8cdf3bd35cee2e7c193827f5f5a1c534ac (patch) | |
| tree | c662c240cb627a53553833fbbeec984c63976135 | |
| parent | 74b45188b71a9fe22bb8997e3a23cc9a4b43d3c8 (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>
| -rw-r--r-- | include/svtools/treelist.hxx | 4 | ||||
| -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 | ||||
| -rw-r--r-- | svtools/source/contnr/treelist.cxx | 11 | 
7 files changed, 57 insertions, 15 deletions
diff --git a/include/svtools/treelist.hxx b/include/svtools/treelist.hxx index 4d0264f1ba9c..b39dd88ab6ba 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 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 ); diff --git a/svtools/source/contnr/treelist.cxx b/svtools/source/contnr/treelist.cxx index 3ef468d3f39b..cbd011a524eb 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 );  }  | 
