From ec99b899d49a8bf5c553268da4e1c96c979d9464 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Tue, 29 Sep 2026 15:57:14 +0200 Subject: [PATCH] vcl: Pass SvLBoxItem::Paint's SvVieweDataEntry param by ref ... instead of by pointer. This makes clear it's always non-null. Change-Id: Iea22c33171572eec0533550293a793372d889ee9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211569 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- include/vcl/toolkit/svlbitm.hxx | 9 +++------ include/vcl/toolkit/treelistbox.hxx | 5 ++++- toolkit/source/controls/tree/treecontrolpeer.cxx | 10 ++++++---- vcl/inc/SvLBoxButton.hxx | 2 +- vcl/source/treelist/SvLBoxButton.cxx | 2 +- vcl/source/treelist/iconview.cxx | 4 ++-- vcl/source/treelist/svlbitm.cxx | 13 ++++++------- vcl/source/treelist/treelistbox.cxx | 2 +- 8 files changed, 24 insertions(+), 23 deletions(-) diff --git a/include/vcl/toolkit/svlbitm.hxx b/include/vcl/toolkit/svlbitm.hxx index 14ddf1961a93..bc8fa5488d2e 100644 --- a/include/vcl/toolkit/svlbitm.hxx +++ b/include/vcl/toolkit/svlbitm.hxx @@ -93,8 +93,7 @@ public: } virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, - vcl::RenderContext& rRenderContext, - const SvViewDataEntry* pView, + vcl::RenderContext& rRenderContext, const SvViewDataEntry& rView, const SvTreeListEntry& rEntry) override; virtual std::unique_ptr Clone(SvLBoxItem const * pSource) const override; @@ -112,10 +111,8 @@ public: virtual SvLBoxItemType GetType() const override; virtual void InitViewData(SvTreeListBox& rView, SvTreeListEntry& rEntry, SvViewDataItem* pViewData = nullptr) override; - virtual void Paint(const Point& rPos, - SvTreeListBox& rOutDev, - vcl::RenderContext& rRenderContext, - const SvViewDataEntry* pView, + virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, + vcl::RenderContext& rRenderContext, const SvViewDataEntry& rView, const SvTreeListEntry& rEntry) override; virtual std::unique_ptr Clone(SvLBoxItem const * pSource) const override; diff --git a/include/vcl/toolkit/treelistbox.hxx b/include/vcl/toolkit/treelistbox.hxx index f85979c31c9b..196412de923e 100644 --- a/include/vcl/toolkit/treelistbox.hxx +++ b/include/vcl/toolkit/treelistbox.hxx @@ -134,7 +134,10 @@ public: void Enable(bool bEnabled) { mbDisabled = !bEnabled; } bool isEnable() const { return !mbDisabled; } - virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, vcl::RenderContext& rRenderContext, const SvViewDataEntry* pView, const SvTreeListEntry& rEntry) = 0; + virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, + vcl::RenderContext& rRenderContext, const SvViewDataEntry& rView, + const SvTreeListEntry& rEntry) + = 0; virtual void InitViewData(SvTreeListBox& rView, SvTreeListEntry& rEntry, // If != 0: this Pointer must be used! diff --git a/toolkit/source/controls/tree/treecontrolpeer.cxx b/toolkit/source/controls/tree/treecontrolpeer.cxx index bd6e97129156..56505b1f53ab 100644 --- a/toolkit/source/controls/tree/treecontrolpeer.cxx +++ b/toolkit/source/controls/tree/treecontrolpeer.cxx @@ -122,8 +122,9 @@ public: void SetImage( const Image& rImage ); const OUString& GetGraphicURL() const { return maGraphicURL;} void SetGraphicURL( const OUString& rGraphicURL ); - virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, vcl::RenderContext& rRenderContext, - const SvViewDataEntry* pView, const SvTreeListEntry& rEntry) override; + virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, + vcl::RenderContext& rRenderContext, const SvViewDataEntry& rView, + const SvTreeListEntry& rEntry) override; std::unique_ptr Clone( SvLBoxItem const * pSource ) const override; private: @@ -1467,8 +1468,9 @@ UnoTreeListItem::UnoTreeListItem() { } -void UnoTreeListItem::Paint( - const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext, const SvViewDataEntry* /*pView*/, const SvTreeListEntry& rEntry) +void UnoTreeListItem::Paint(const Point& rPos, SvTreeListBox& rDev, + vcl::RenderContext& rRenderContext, const SvViewDataEntry& /*rView*/, + const SvTreeListEntry& rEntry) { Point aPos(rPos); Size aSize(GetWidth(rDev, rEntry), GetHeight(rDev, rEntry)); diff --git a/vcl/inc/SvLBoxButton.hxx b/vcl/inc/SvLBoxButton.hxx index a6bc44a38758..1cff4a12bbea 100644 --- a/vcl/inc/SvLBoxButton.hxx +++ b/vcl/inc/SvLBoxButton.hxx @@ -81,7 +81,7 @@ public: void ClickHdl(SvTreeListEntry*); virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, - vcl::RenderContext& rRenderContext, const SvViewDataEntry* pView, + vcl::RenderContext& rRenderContext, const SvViewDataEntry& rView, const SvTreeListEntry& rEntry) override; virtual std::unique_ptr Clone(SvLBoxItem const* pSource) const override; diff --git a/vcl/source/treelist/SvLBoxButton.cxx b/vcl/source/treelist/SvLBoxButton.cxx index 519a34d80125..c6419a501feb 100644 --- a/vcl/source/treelist/SvLBoxButton.cxx +++ b/vcl/source/treelist/SvLBoxButton.cxx @@ -142,7 +142,7 @@ void SvLBoxButton::ClickHdl(SvTreeListEntry* pEntry) } void SvLBoxButton::Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext, - const SvViewDataEntry* /*pView*/, const SvTreeListEntry& /*rEntry*/) + const SvViewDataEntry& /*rView*/, const SvTreeListEntry& /*rEntry*/) { SvBmp nIndex = SvLBoxButtonData::GetIndex(m_nItemFlags); DrawImageFlags nStyle diff --git a/vcl/source/treelist/iconview.cxx b/vcl/source/treelist/iconview.cxx index 17827a954104..c581a4d125cd 100644 --- a/vcl/source/treelist/iconview.cxx +++ b/vcl/source/treelist/iconview.cxx @@ -252,7 +252,7 @@ void IconView::PaintEntry(SvTreeListEntry& rEntry, tools::Long nX, tools::Long n auto nItemHeight = SvLBoxItem::GetHeight(rViewDataEntry, nCurItem); nLabelYPos += nItemHeight; - rEntry.GetItem(nCurItem).Paint(aEntryPos, *this, rRenderContext, &rViewDataEntry, rEntry); + rEntry.GetItem(nCurItem).Paint(aEntryPos, *this, rRenderContext, rViewDataEntry, rEntry); } if (bFillColorSet) @@ -277,7 +277,7 @@ void IconView::PaintEntry(SvTreeListEntry& rEntry, tools::Long nX, tools::Long n } aEntryPos.AdjustY((nImageAreaHeight - nItemHeight) / 2 + m_nSpacing); - rItem.Paint(aEntryPos, *this, rRenderContext, &rViewDataEntry, rEntry); + rItem.Paint(aEntryPos, *this, rRenderContext, rViewDataEntry, rEntry); } } diff --git a/vcl/source/treelist/svlbitm.cxx b/vcl/source/treelist/svlbitm.cxx index 77f4053927bc..3b6225d66f24 100644 --- a/vcl/source/treelist/svlbitm.cxx +++ b/vcl/source/treelist/svlbitm.cxx @@ -71,9 +71,8 @@ namespace } } -void SvLBoxString::Paint( - const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext, - const SvViewDataEntry* /*pView*/, const SvTreeListEntry& rEntry) +void SvLBoxString::Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext, + const SvViewDataEntry& /*rView*/, const SvTreeListEntry& rEntry) { DrawTextFlags nStyle = (rDev.IsEnabled() && !mbDisabled) ? DrawTextFlags::NONE : DrawTextFlags::Disable; if (rEntry.IsSeparator()) @@ -219,13 +218,13 @@ void SvLBoxContextBmp::InitViewData(SvTreeListBox& rView, SvTreeListEntry& rEntr pViewData->mnHeight = aSize.Height(); } -void SvLBoxContextBmp::Paint( - const Point& _rPos, SvTreeListBox& _rDev, vcl::RenderContext& rRenderContext, - const SvViewDataEntry* pView, const SvTreeListEntry& rEntry) +void SvLBoxContextBmp::Paint(const Point& _rPos, SvTreeListBox& _rDev, + vcl::RenderContext& rRenderContext, const SvViewDataEntry& rView, + const SvTreeListEntry& rEntry) { // get the image. - const Image& rImage = !pView->IsExpanded() ? m_aImage1 : m_aImage2; + const Image& rImage = !rView.IsExpanded() ? m_aImage1 : m_aImage2; bool _bSemiTransparent = bool( SvTLEntryFlags::SEMITRANSPARENT & rEntry.GetFlags( ) ); // draw diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx index a5857ea5ae9e..e0dcfd7ca2bb 100644 --- a/vcl/source/treelist/treelistbox.cxx +++ b/vcl/source/treelist/treelistbox.cxx @@ -2928,7 +2928,7 @@ void SvTreeListBox::PaintEntry1(SvTreeListEntry& rEntry, tools::Long nLine, vcl: // center vertically aEntryPos.AdjustY((nTempEntryHeight - aSize.Height()) / 2 ); - rItem.Paint(aEntryPos, *this, rRenderContext, &rViewDataEntry, rEntry); + rItem.Paint(aEntryPos, *this, rRenderContext, rViewDataEntry, rEntry); // division line between tabs (but not if this is a separator line) if (!bSeparator && pNextTab && rItem.GetType() == SvLBoxItemType::String &&