vcl: Move logic to notify about SvTreeListBox model changes to base
Stop having various virtual methods in SvTreeListBox and overriding them in LclTabListBox to notify about model changes. Instead, move the corresponding logic to notify about such changes directly into the SvTreeListBox base class, which already supports notifying about various other changes. Change-Id: I918c5768afea70e8c0992d5c8c6be1f584909a12 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/206424 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
@@ -220,6 +220,7 @@ class UNLESS_MERGELIBS_MORE(VCL_DLLPUBLIC) SvTreeListBox : public Control,
|
||||
Link<SvTreeListBox*, bool> m_aExpandingHdl;
|
||||
Link<SvTreeListBox*, void> m_aSelectHdl;
|
||||
Link<SvTreeListBox*, void> m_aDeselectHdl;
|
||||
Link<SvTreeListBox*, void> m_aModelChangedHdl;
|
||||
Link<SvTreeListEntry&, OUString> m_aTooltipHdl;
|
||||
Link<svtree_render_args, void> m_aCustomRenderHdl;
|
||||
Link<svtree_measure_args, Size> m_aCustomMeasureHdl;
|
||||
@@ -502,6 +503,7 @@ public:
|
||||
}
|
||||
void SetExpandingHdl(const Link<SvTreeListBox*, bool>& rNewHdl) { m_aExpandingHdl = rNewHdl; }
|
||||
void SetExpandedHdl(const Link<SvTreeListBox*, void>& rNewHdl) { m_aExpandedHdl = rNewHdl; }
|
||||
void SetModelChangedHdl(const Link<SvTreeListBox*, void>& rLink) { m_aModelChangedHdl = rLink; }
|
||||
void SetTooltipHdl(const Link<SvTreeListEntry&, OUString>& rLink) { m_aTooltipHdl = rLink; }
|
||||
void SetCustomRenderHdl(const Link<svtree_render_args, void>& rLink)
|
||||
{
|
||||
@@ -517,6 +519,7 @@ public:
|
||||
void SelectHdl();
|
||||
void DeselectHdl();
|
||||
bool DoubleClickHdl();
|
||||
void ModelChangedHdl();
|
||||
SvTreeListEntry* GetHdlEntry() const { return m_pHdlEntry; }
|
||||
|
||||
// Is called for an Entry that gets expanded with the Flag
|
||||
@@ -677,13 +680,13 @@ public:
|
||||
virtual void LoseFocus() override;
|
||||
void SetUpdateMode( bool );
|
||||
|
||||
virtual void ModelHasCleared();
|
||||
virtual void ModelHasInserted(SvTreeListEntry* pEntry);
|
||||
virtual void ModelHasInsertedTree(SvTreeListEntry* pEntry);
|
||||
virtual void ModelIsMoving(SvTreeListEntry* pSource);
|
||||
virtual void ModelHasMoved(SvTreeListEntry* pSource);
|
||||
virtual void ModelIsRemoving(SvTreeListEntry* pEntry);
|
||||
virtual void ModelHasRemoved(SvTreeListEntry* pEntry);
|
||||
void ModelHasCleared();
|
||||
void ModelHasInserted(SvTreeListEntry* pEntry);
|
||||
void ModelHasInsertedTree(SvTreeListEntry* pEntry);
|
||||
void ModelIsMoving(SvTreeListEntry* pSource);
|
||||
void ModelHasMoved(SvTreeListEntry* pSource);
|
||||
void ModelIsRemoving(SvTreeListEntry* pEntry);
|
||||
void ModelHasRemoved(SvTreeListEntry* pEntry);
|
||||
void ModelHasEntryInvalidated(SvTreeListEntry* pEntry);
|
||||
|
||||
void ScrollOutputArea( short nDeltaEntries );
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
|
||||
class LclTabListBox final : public SvTabListBox
|
||||
{
|
||||
Link<SvTreeListBox*, void> m_aModelChangedHdl;
|
||||
Link<SvTreeListBox*, bool> m_aStartDragHdl;
|
||||
Link<SvTreeListBox*, void> m_aEndDragHdl;
|
||||
|
||||
@@ -22,7 +21,6 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
void SetModelChangedHdl(const Link<SvTreeListBox*, void>& rLink) { m_aModelChangedHdl = rLink; }
|
||||
void SetStartDragHdl(const Link<SvTreeListBox*, bool>& rLink) { m_aStartDragHdl = rLink; }
|
||||
void SetEndDragHdl(const Link<SvTreeListBox*, void>& rLink) { m_aEndDragHdl = rLink; }
|
||||
|
||||
@@ -39,36 +37,6 @@ public:
|
||||
m_aEndDragHdl.Call(this);
|
||||
}
|
||||
|
||||
virtual void ModelHasCleared() override
|
||||
{
|
||||
SvTabListBox::ModelHasCleared();
|
||||
m_aModelChangedHdl.Call(this);
|
||||
}
|
||||
|
||||
virtual void ModelHasInserted(SvTreeListEntry* pEntry) override
|
||||
{
|
||||
SvTabListBox::ModelHasInserted(pEntry);
|
||||
m_aModelChangedHdl.Call(this);
|
||||
}
|
||||
|
||||
virtual void ModelHasInsertedTree(SvTreeListEntry* pEntry) override
|
||||
{
|
||||
SvTabListBox::ModelHasInsertedTree(pEntry);
|
||||
m_aModelChangedHdl.Call(this);
|
||||
}
|
||||
|
||||
virtual void ModelHasMoved(SvTreeListEntry* pSource) override
|
||||
{
|
||||
SvTabListBox::ModelHasMoved(pSource);
|
||||
m_aModelChangedHdl.Call(this);
|
||||
}
|
||||
|
||||
virtual void ModelHasRemoved(SvTreeListEntry* pEntry) override
|
||||
{
|
||||
SvTabListBox::ModelHasRemoved(pEntry);
|
||||
m_aModelChangedHdl.Call(this);
|
||||
}
|
||||
|
||||
SvTreeListEntry* GetTargetAtPoint(const Point& rPos, bool bHighLightTarget, bool bScroll = true)
|
||||
{
|
||||
SvTreeListEntry* pOldTargetEntry = m_pTargetEntry;
|
||||
|
||||
@@ -502,6 +502,8 @@ bool SvTreeListBox::DoubleClickHdl()
|
||||
return !m_aDoubleClickHdl.IsSet() || m_aDoubleClickHdl.Call(this);
|
||||
}
|
||||
|
||||
void SvTreeListBox::ModelChangedHdl() { m_aModelChangedHdl.Call(this); }
|
||||
|
||||
bool SvTreeListBox::CheckDragAndDropMode( SvTreeListBox const * pSource, sal_Int8 nAction )
|
||||
{
|
||||
if ( pSource != this )
|
||||
@@ -2166,6 +2168,8 @@ void SvTreeListBox::ModelHasCleared()
|
||||
AdjustEntryHeight();
|
||||
AdjustEntryHeight( GetDefaultExpandedEntryBmp() );
|
||||
AdjustEntryHeight( GetDefaultCollapsedEntryBmp() );
|
||||
|
||||
ModelChangedHdl();
|
||||
}
|
||||
|
||||
bool SvTreeListBox::PosOverBody(const Point& rPos) const
|
||||
@@ -2416,12 +2420,16 @@ void SvTreeListBox::ModelHasInsertedTree( SvTreeListEntry* pEntry )
|
||||
pTmp = Next( pTmp );
|
||||
} while (pTmp && nRefDepth < m_pModel->GetDepth(pTmp));
|
||||
m_pImpl->TreeInserted(pEntry);
|
||||
|
||||
ModelChangedHdl();
|
||||
}
|
||||
|
||||
void SvTreeListBox::ModelHasInserted( SvTreeListEntry* pEntry )
|
||||
{
|
||||
ImpEntryInserted( pEntry );
|
||||
m_pImpl->EntryInserted(pEntry);
|
||||
|
||||
ModelChangedHdl();
|
||||
}
|
||||
|
||||
void SvTreeListBox::ModelIsMoving(SvTreeListEntry* pSource )
|
||||
@@ -2432,6 +2440,8 @@ void SvTreeListBox::ModelIsMoving(SvTreeListEntry* pSource )
|
||||
void SvTreeListBox::ModelHasMoved( SvTreeListEntry* pSource )
|
||||
{
|
||||
m_pImpl->EntryMoved(pSource);
|
||||
|
||||
ModelChangedHdl();
|
||||
}
|
||||
|
||||
void SvTreeListBox::ModelIsRemoving( SvTreeListEntry* pEntry )
|
||||
@@ -2454,6 +2464,8 @@ void SvTreeListBox::ModelHasRemoved( SvTreeListEntry* pEntry )
|
||||
m_pTargetEntry = nullptr;
|
||||
|
||||
m_pImpl->EntryRemoved();
|
||||
|
||||
ModelChangedHdl();
|
||||
}
|
||||
|
||||
void SvTreeListBox::SetCollapsedNodeBmp( const Image& rBmp)
|
||||
|
||||
Reference in New Issue
Block a user