diff options
author | Henry Castro <hcastro@collabora.com> | 2020-12-17 10:33:19 -0400 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2021-04-09 17:39:09 +0100 |
commit | 8fb1d1159c8b67032d3dc5d6c92fcb4c2b84b2b5 (patch) | |
tree | 02edc73f42743192812d36d33c025a2f8d022269 | |
parent | lok: sort: invalidate the row-height cache too (diff) | |
download | core-8fb1d1159c8b67032d3dc5d6c92fcb4c2b84b2b5.tar.gz core-8fb1d1159c8b67032d3dc5d6c92fcb4c2b84b2b5.zip |
lok: check if the tree list box model has changed
It is necessary to know when the tree list model
has changed to notify client side changes.
Change-Id: I188a97223e06520d0b34cd9272eff6449a14d60e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107892
Tested-by: Jenkins
Reviewed-by: Henry Castro <hcastro@collabora.com>
-rw-r--r-- | include/vcl/toolkit/treelist.hxx | 6 | ||||
-rw-r--r-- | vcl/source/treelist/treelist.cxx | 8 | ||||
-rw-r--r-- | vcl/source/treelist/treelistbox.cxx | 1 |
3 files changed, 15 insertions, 0 deletions
diff --git a/include/vcl/toolkit/treelist.hxx b/include/vcl/toolkit/treelist.hxx index 09ed5da01df2..dbab485fde61 100644 --- a/include/vcl/toolkit/treelist.hxx +++ b/include/vcl/toolkit/treelist.hxx @@ -209,6 +209,7 @@ class VCL_DLLPUBLIC SvListView std::unique_ptr<Impl> m_pImpl; protected: + bool m_bDirtyModel; std::unique_ptr<SvTreeList> pModel; void ExpandListEntry( SvTreeListEntry* pParent ); @@ -227,6 +228,11 @@ public: sal_uLong nPos ); + bool IsDirtyModel() const + { return m_bDirtyModel; } + void SetDirtyModel(bool bValue) + { m_bDirtyModel = bValue; } + sal_uLong GetVisibleCount() const { return pModel->GetVisibleCount( const_cast<SvListView*>(this) ); } diff --git a/vcl/source/treelist/treelist.cxx b/vcl/source/treelist/treelist.cxx index e314329c10b8..1e4759ee6c85 100644 --- a/vcl/source/treelist/treelist.cxx +++ b/vcl/source/treelist/treelist.cxx @@ -1032,6 +1032,7 @@ SvListView::SvListView() { pModel.reset(new SvTreeList(*this)); m_pImpl->InitTable(); + m_bDirtyModel = false; } void SvListView::dispose() @@ -1248,15 +1249,18 @@ void SvListView::Impl::ActionClear() void SvListView::ModelNotification( SvListAction nActionId, SvTreeListEntry* pEntry1, SvTreeListEntry* /*pEntry2*/, sal_uLong /*nPos*/ ) { + switch( nActionId ) { case SvListAction::INSERTED: m_pImpl->ActionInserted( pEntry1 ); ModelHasInserted( pEntry1 ); + m_bDirtyModel = true; break; case SvListAction::INSERTED_TREE: m_pImpl->ActionInsertedTree( pEntry1 ); ModelHasInsertedTree( pEntry1 ); + m_bDirtyModel = true; break; case SvListAction::REMOVING: ModelIsRemoving( pEntry1 ); @@ -1264,6 +1268,7 @@ void SvListView::ModelNotification( SvListAction nActionId, SvTreeListEntry* pEn break; case SvListAction::REMOVED: ModelHasRemoved( pEntry1 ); + m_bDirtyModel = true; break; case SvListAction::MOVING: ModelIsMoving( pEntry1 ); @@ -1272,12 +1277,14 @@ void SvListView::ModelNotification( SvListAction nActionId, SvTreeListEntry* pEn case SvListAction::MOVED: m_pImpl->ActionMoved(); ModelHasMoved( pEntry1 ); + m_bDirtyModel = true; break; case SvListAction::CLEARING: m_pImpl->ActionClear(); ModelHasCleared(); // sic! for compatibility reasons! break; case SvListAction::CLEARED: + m_bDirtyModel = true; break; case SvListAction::INVALIDATE_ENTRY: // no action for the base class @@ -1285,6 +1292,7 @@ void SvListView::ModelNotification( SvListAction nActionId, SvTreeListEntry* pEn break; case SvListAction::RESORTED: m_pImpl->m_bVisPositionsValid = false; + m_bDirtyModel = true; break; case SvListAction::RESORTING: break; diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx index ba24d0e6cc73..08e8e68313ba 100644 --- a/vcl/source/treelist/treelistbox.cxx +++ b/vcl/source/treelist/treelistbox.cxx @@ -417,6 +417,7 @@ SvTreeListBox::SvTreeListBox(vcl::Window* pParent, WinBits nWinStyle) : pImpl->SetModel( pModel.get() ); SetSublistOpenWithLeftRight(); + m_bDirtyModel = false; } void SvTreeListBox::Clear() |