include/vcl/toolkit/treelist.hxx | 6 ++++++ vcl/source/treelist/treelist.cxx | 8 ++++++++ vcl/source/treelist/treelistbox.cxx | 1 + 3 files changed, 15 insertions(+)
New commits: commit bf253b234e37f69c030cc531343f26d416224297 Author: Henry Castro <hcas...@collabora.com> AuthorDate: Thu Dec 17 10:33:19 2020 -0400 Commit: Henry Castro <hcas...@collabora.com> CommitDate: Fri Dec 18 18:23:54 2020 +0100 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 <hcas...@collabora.com> 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 bbafb2a4ba95..6a305b8d98ef 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() _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits