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 <m.weghorn@posteo.de>
This commit is contained in:
Michael Weghorn
2026-09-29 19:40:29 +02:00
parent 6296615b8d
commit ec99b899d4
8 changed files with 24 additions and 23 deletions
+3 -6
View File
@@ -93,8 +93,7 @@ public:
} }
virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev,
vcl::RenderContext& rRenderContext, vcl::RenderContext& rRenderContext, const SvViewDataEntry& rView,
const SvViewDataEntry* pView,
const SvTreeListEntry& rEntry) override; const SvTreeListEntry& rEntry) override;
virtual std::unique_ptr<SvLBoxItem> Clone(SvLBoxItem const * pSource) const override; virtual std::unique_ptr<SvLBoxItem> Clone(SvLBoxItem const * pSource) const override;
@@ -112,10 +111,8 @@ public:
virtual SvLBoxItemType GetType() const override; virtual SvLBoxItemType GetType() const override;
virtual void InitViewData(SvTreeListBox& rView, SvTreeListEntry& rEntry, virtual void InitViewData(SvTreeListBox& rView, SvTreeListEntry& rEntry,
SvViewDataItem* pViewData = nullptr) override; SvViewDataItem* pViewData = nullptr) override;
virtual void Paint(const Point& rPos, virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev,
SvTreeListBox& rOutDev, vcl::RenderContext& rRenderContext, const SvViewDataEntry& rView,
vcl::RenderContext& rRenderContext,
const SvViewDataEntry* pView,
const SvTreeListEntry& rEntry) override; const SvTreeListEntry& rEntry) override;
virtual std::unique_ptr<SvLBoxItem> Clone(SvLBoxItem const * pSource) const override; virtual std::unique_ptr<SvLBoxItem> Clone(SvLBoxItem const * pSource) const override;
+4 -1
View File
@@ -134,7 +134,10 @@ public:
void Enable(bool bEnabled) { mbDisabled = !bEnabled; } void Enable(bool bEnabled) { mbDisabled = !bEnabled; }
bool isEnable() const { return !mbDisabled; } 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, virtual void InitViewData(SvTreeListBox& rView, SvTreeListEntry& rEntry,
// If != 0: this Pointer must be used! // If != 0: this Pointer must be used!
@@ -122,8 +122,9 @@ public:
void SetImage( const Image& rImage ); void SetImage( const Image& rImage );
const OUString& GetGraphicURL() const { return maGraphicURL;} const OUString& GetGraphicURL() const { return maGraphicURL;}
void SetGraphicURL( const OUString& rGraphicURL ); void SetGraphicURL( const OUString& rGraphicURL );
virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, vcl::RenderContext& rRenderContext, virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev,
const SvViewDataEntry* pView, const SvTreeListEntry& rEntry) override; vcl::RenderContext& rRenderContext, const SvViewDataEntry& rView,
const SvTreeListEntry& rEntry) override;
std::unique_ptr<SvLBoxItem> Clone( SvLBoxItem const * pSource ) const override; std::unique_ptr<SvLBoxItem> Clone( SvLBoxItem const * pSource ) const override;
private: private:
@@ -1467,8 +1468,9 @@ UnoTreeListItem::UnoTreeListItem()
{ {
} }
void UnoTreeListItem::Paint( void UnoTreeListItem::Paint(const Point& rPos, SvTreeListBox& rDev,
const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext, const SvViewDataEntry* /*pView*/, const SvTreeListEntry& rEntry) vcl::RenderContext& rRenderContext, const SvViewDataEntry& /*rView*/,
const SvTreeListEntry& rEntry)
{ {
Point aPos(rPos); Point aPos(rPos);
Size aSize(GetWidth(rDev, rEntry), GetHeight(rDev, rEntry)); Size aSize(GetWidth(rDev, rEntry), GetHeight(rDev, rEntry));
+1 -1
View File
@@ -81,7 +81,7 @@ public:
void ClickHdl(SvTreeListEntry*); void ClickHdl(SvTreeListEntry*);
virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev,
vcl::RenderContext& rRenderContext, const SvViewDataEntry* pView, vcl::RenderContext& rRenderContext, const SvViewDataEntry& rView,
const SvTreeListEntry& rEntry) override; const SvTreeListEntry& rEntry) override;
virtual std::unique_ptr<SvLBoxItem> Clone(SvLBoxItem const* pSource) const override; virtual std::unique_ptr<SvLBoxItem> Clone(SvLBoxItem const* pSource) const override;
+1 -1
View File
@@ -142,7 +142,7 @@ void SvLBoxButton::ClickHdl(SvTreeListEntry* pEntry)
} }
void SvLBoxButton::Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext, 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); SvBmp nIndex = SvLBoxButtonData::GetIndex(m_nItemFlags);
DrawImageFlags nStyle DrawImageFlags nStyle
+2 -2
View File
@@ -252,7 +252,7 @@ void IconView::PaintEntry(SvTreeListEntry& rEntry, tools::Long nX, tools::Long n
auto nItemHeight = SvLBoxItem::GetHeight(rViewDataEntry, nCurItem); auto nItemHeight = SvLBoxItem::GetHeight(rViewDataEntry, nCurItem);
nLabelYPos += nItemHeight; nLabelYPos += nItemHeight;
rEntry.GetItem(nCurItem).Paint(aEntryPos, *this, rRenderContext, &rViewDataEntry, rEntry); rEntry.GetItem(nCurItem).Paint(aEntryPos, *this, rRenderContext, rViewDataEntry, rEntry);
} }
if (bFillColorSet) if (bFillColorSet)
@@ -277,7 +277,7 @@ void IconView::PaintEntry(SvTreeListEntry& rEntry, tools::Long nX, tools::Long n
} }
aEntryPos.AdjustY((nImageAreaHeight - nItemHeight) / 2 + m_nSpacing); aEntryPos.AdjustY((nImageAreaHeight - nItemHeight) / 2 + m_nSpacing);
rItem.Paint(aEntryPos, *this, rRenderContext, &rViewDataEntry, rEntry); rItem.Paint(aEntryPos, *this, rRenderContext, rViewDataEntry, rEntry);
} }
} }
+6 -7
View File
@@ -71,9 +71,8 @@ namespace
} }
} }
void SvLBoxString::Paint( void SvLBoxString::Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext,
const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext, const SvViewDataEntry& /*rView*/, const SvTreeListEntry& rEntry)
const SvViewDataEntry* /*pView*/, const SvTreeListEntry& rEntry)
{ {
DrawTextFlags nStyle = (rDev.IsEnabled() && !mbDisabled) ? DrawTextFlags::NONE : DrawTextFlags::Disable; DrawTextFlags nStyle = (rDev.IsEnabled() && !mbDisabled) ? DrawTextFlags::NONE : DrawTextFlags::Disable;
if (rEntry.IsSeparator()) if (rEntry.IsSeparator())
@@ -219,13 +218,13 @@ void SvLBoxContextBmp::InitViewData(SvTreeListBox& rView, SvTreeListEntry& rEntr
pViewData->mnHeight = aSize.Height(); pViewData->mnHeight = aSize.Height();
} }
void SvLBoxContextBmp::Paint( void SvLBoxContextBmp::Paint(const Point& _rPos, SvTreeListBox& _rDev,
const Point& _rPos, SvTreeListBox& _rDev, vcl::RenderContext& rRenderContext, vcl::RenderContext& rRenderContext, const SvViewDataEntry& rView,
const SvViewDataEntry* pView, const SvTreeListEntry& rEntry) const SvTreeListEntry& rEntry)
{ {
// get the image. // 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( ) ); bool _bSemiTransparent = bool( SvTLEntryFlags::SEMITRANSPARENT & rEntry.GetFlags( ) );
// draw // draw
+1 -1
View File
@@ -2928,7 +2928,7 @@ void SvTreeListBox::PaintEntry1(SvTreeListEntry& rEntry, tools::Long nLine, vcl:
// center vertically // center vertically
aEntryPos.AdjustY((nTempEntryHeight - aSize.Height()) / 2 ); 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) // division line between tabs (but not if this is a separator line)
if (!bSeparator && pNextTab && rItem.GetType() == SvLBoxItemType::String && if (!bSeparator && pNextTab && rItem.GetType() == SvLBoxItemType::String &&