include/vcl/toolkit/svlbitm.hxx | 33 ++++----------------------------- vcl/inc/iconview.hxx | 2 +- vcl/source/app/salvtables.cxx | 18 +++++++++--------- vcl/source/treelist/iconview.cxx | 6 +++--- vcl/source/treelist/svlbitm.cxx | 14 ++++++++------ 5 files changed, 25 insertions(+), 48 deletions(-)
New commits: commit 8d4d26a99f75062633ebe90591820447904f2784 Author: Michael Weghorn <[email protected]> AuthorDate: Mon Feb 9 13:18:26 2026 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Mon Feb 9 20:03:13 2026 +0100 vcl: Drop SvLBoxContextBmp::implGetImageStore indirection Access SvLBoxContextBmp_Impl::mm_aImage1 and SvLBoxContextBmp_Impl::mm_aImage2 directly instead of going via that indirection, which also drops the need to const_cast in SvLBoxContextBmp::GetBitmap1 and SvLBoxContextBmp::GetBitmap2. Change-Id: Iedb8faccbdf9df8e61ef5c1929601bca6fc3fb9a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198985 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/include/vcl/toolkit/svlbitm.hxx b/include/vcl/toolkit/svlbitm.hxx index 1845a57d33cb..ce28331fc96d 100644 --- a/include/vcl/toolkit/svlbitm.hxx +++ b/include/vcl/toolkit/svlbitm.hxx @@ -251,35 +251,10 @@ public: void SetModeImages(const Image& rBitmap1, const Image& rBitmap2); - inline void SetBitmap1(const Image& rImage); - inline void SetBitmap2(const Image& rImage); - inline const Image& GetBitmap1() const; - inline const Image& GetBitmap2() const; - -private: - Image& implGetImageStore(bool bFirst); + void SetBitmap1(const Image& rImage); + void SetBitmap2(const Image& rImage); + const Image& GetBitmap1() const; + const Image& GetBitmap2() const; }; -inline void SvLBoxContextBmp::SetBitmap1(const Image& _rImage) -{ - implGetImageStore(true) = _rImage; -} - -inline void SvLBoxContextBmp::SetBitmap2(const Image& _rImage) -{ - implGetImageStore(false) = _rImage; -} - -inline const Image& SvLBoxContextBmp::GetBitmap1() const -{ - Image& rImage = const_cast<SvLBoxContextBmp*>(this)->implGetImageStore(true); - return rImage; -} - -inline const Image& SvLBoxContextBmp::GetBitmap2() const -{ - Image& rImage = const_cast<SvLBoxContextBmp*>(this)->implGetImageStore(false); - return rImage; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/treelist/svlbitm.cxx b/vcl/source/treelist/svlbitm.cxx index f9c3b43e4cce..e5e234ff19ae 100644 --- a/vcl/source/treelist/svlbitm.cxx +++ b/vcl/source/treelist/svlbitm.cxx @@ -478,12 +478,13 @@ void SvLBoxContextBmp::SetModeImages( const Image& _rBitmap1, const Image& _rBit m_pImpl->m_aImage2 = _rBitmap2; } -Image& SvLBoxContextBmp::implGetImageStore( bool _bFirst ) -{ +void SvLBoxContextBmp::SetBitmap1(const Image& _rImage) { m_pImpl->m_aImage1 = _rImage; } - // OJ: #i27071# wrong mode so we just return the normal images - return _bFirst ? m_pImpl->m_aImage1 : m_pImpl->m_aImage2; -} +void SvLBoxContextBmp::SetBitmap2(const Image& _rImage) { m_pImpl->m_aImage2 = _rImage; } + +const Image& SvLBoxContextBmp::GetBitmap1() const { return m_pImpl->m_aImage1; } + +const Image& SvLBoxContextBmp::GetBitmap2() const { return m_pImpl->m_aImage2; } void SvLBoxContextBmp::InitViewData( SvTreeListBox* pView,SvTreeListEntry* pEntry, SvViewDataItem* pViewData) @@ -501,7 +502,8 @@ void SvLBoxContextBmp::Paint( { // get the image. - const Image& rImage = implGetImageStore(pView->IsExpanded() != m_pImpl->m_bExpanded); + const Image& rImage + = pView->IsExpanded() != m_pImpl->m_bExpanded ? m_pImpl->m_aImage1 : m_pImpl->m_aImage2; bool _bSemiTransparent = bool( SvTLEntryFlags::SEMITRANSPARENT & rEntry.GetFlags( ) ); // draw commit f6d3bf57ebef5f6960087eb9261060f296ef1683 Author: Michael Weghorn <[email protected]> AuthorDate: Mon Feb 9 12:01:31 2026 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Mon Feb 9 20:03:03 2026 +0100 vcl IconView: Use "p" instead of "a" prefix for pointers, etc Adhere to variable naming convention: "p" is for pointers, "r" for references. Change-Id: I7ae102cea9ce4fd9cfd1c737634d59f1d7a50db2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198984 Reviewed-by: Michael Weghorn <[email protected]> Tested-by: Jenkins diff --git a/vcl/inc/iconview.hxx b/vcl/inc/iconview.hxx index 67908deafe9d..bb18bedea45f 100644 --- a/vcl/inc/iconview.hxx +++ b/vcl/inc/iconview.hxx @@ -57,7 +57,7 @@ public: OUString renderEntry(int pos, int dpix, int dpiy) const; /// Update entry size based on image size - void UpdateEntrySize(const Image& pImage); + void UpdateEntrySize(const Image& rImage); protected: virtual void CalcEntryHeight(SvTreeListEntry const* pEntry) override; diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 052bbe69d822..971e14494f47 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -5294,24 +5294,24 @@ void SalInstanceIconView::selected_foreach(const std::function<bool(weld::TreeIt void SalInstanceIconView::set_image(int pos, VirtualDevice& rIcon) { - SvTreeListEntry* aEntry = m_xIconView->GetEntry(nullptr, pos); - if (aEntry == nullptr) + SvTreeListEntry* pEntry = m_xIconView->GetEntry(nullptr, pos); + if (pEntry == nullptr) return; - SvLBoxContextBmp* aItem - = static_cast<SvLBoxContextBmp*>(aEntry->GetFirstItem(SvLBoxItemType::ContextBmp)); + SvLBoxContextBmp* pItem + = static_cast<SvLBoxContextBmp*>(pEntry->GetFirstItem(SvLBoxItemType::ContextBmp)); Image aImage = createImage(rIcon); - if (aItem == nullptr) + if (pItem == nullptr) { - aEntry->AddItem(std::make_unique<SvLBoxContextBmp>(aImage, aImage, false)); + pEntry->AddItem(std::make_unique<SvLBoxContextBmp>(aImage, aImage, false)); } else { - aItem->SetBitmap1(aImage); - aItem->SetBitmap2(aImage); + pItem->SetBitmap1(aImage); + pItem->SetBitmap2(aImage); if (!m_bFixedItemWidth) m_xIconView->UpdateEntrySize(aImage); - m_xIconView->ModelHasEntryInvalidated(aEntry); + m_xIconView->ModelHasEntryInvalidated(pEntry); } } diff --git a/vcl/source/treelist/iconview.cxx b/vcl/source/treelist/iconview.cxx index 3e65cf847a0b..5acb148688de 100644 --- a/vcl/source/treelist/iconview.cxx +++ b/vcl/source/treelist/iconview.cxx @@ -59,11 +59,11 @@ void IconView::SetFixedColumnCount(short nColumnCount) m_nColumnCount = nColumnCount; } -void IconView::UpdateEntrySize(const Image& pImage) +void IconView::UpdateEntrySize(const Image& rImage) { int spacing = nSpacing * 2; - SetEntryHeight(pImage.GetSizePixel().getHeight() + spacing); - SetEntryWidth(pImage.GetSizePixel().getWidth() + spacing); + SetEntryHeight(rImage.GetSizePixel().getHeight() + spacing); + SetEntryWidth(rImage.GetSizePixel().getWidth() + spacing); } bool IconView::HasSeparatorEntry() const
