vcl/inc/iconview.hxx | 4 ++++ vcl/source/app/salvtables.cxx | 16 ++++++---------- vcl/source/treelist/iconview.cxx | 7 +++++++ 3 files changed, 17 insertions(+), 10 deletions(-)
New commits: commit 756a4a85d0362264e82389d5924c2ded30f25885 Author: Rashesh <rashesh.pa...@collabora.com> AuthorDate: Sat Mar 8 17:29:01 2025 +0530 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Mon Mar 10 07:02:03 2025 +0100 tdf#165610 sd: master slide panel is broken with "show large preview" Change-Id: If7d6350ca289ab165f11af71bd1f22dee7be86d1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182668 Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/vcl/inc/iconview.hxx b/vcl/inc/iconview.hxx index 438590b083ab..c6b67df852ef 100644 --- a/vcl/inc/iconview.hxx +++ b/vcl/inc/iconview.hxx @@ -22,6 +22,7 @@ #include <tools/json_writer.hxx> #include <vcl/toolkit/treelistbox.hxx> +#include <vcl/image.hxx> class IconView final : public SvTreeListBox { @@ -57,6 +58,9 @@ public: /// returns string with encoded image for an entry OUString renderEntry(int pos, int dpix, int dpiy) const; + /// Update entry size based on image size + void UpdateEntrySize(const Image& pImage); + protected: virtual void CalcEntryHeight(SvTreeListEntry const* pEntry) override; diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 2e4dfeb14016..4abb3041734c 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -5701,13 +5701,10 @@ void SalInstanceIconView::set_image(int pos, VirtualDevice* pIcon) SvLBoxContextBmp* aItem = static_cast<SvLBoxContextBmp*>(aEntry->GetFirstItem(SvLBoxItemType::ContextBmp)); - Image aImage; - if (pIcon) - { - const Point aNull(0, 0); - const Size aSize = pIcon->GetOutputSize(); - aImage = Image(pIcon->GetBitmapEx(aNull, aSize)); - } + if (!pIcon) + return; + + Image aImage = createImage(*pIcon); if (aItem == nullptr) { aEntry->AddItem(std::make_unique<SvLBoxContextBmp>(aImage, aImage, false)); @@ -5716,10 +5713,9 @@ void SalInstanceIconView::set_image(int pos, VirtualDevice* pIcon) { aItem->SetBitmap1(aImage); aItem->SetBitmap2(aImage); - } - - if (!m_xIconView->GetModel()->IsEnableInvalidate()) + m_xIconView->UpdateEntrySize(aImage); m_xIconView->ModelHasEntryInvalidated(aEntry); + } } void SalInstanceIconView::remove(int pos) diff --git a/vcl/source/treelist/iconview.cxx b/vcl/source/treelist/iconview.cxx index 0f512fb819e3..1817298bcb7d 100644 --- a/vcl/source/treelist/iconview.cxx +++ b/vcl/source/treelist/iconview.cxx @@ -54,6 +54,13 @@ Size IconView::GetEntrySize(const SvTreeListEntry& entry) const return { GetEntryWidth(), GetEntryHeight() }; } +void IconView::UpdateEntrySize(const Image& pImage) +{ + int spacing = nSpacing * 2; + SetEntryHeight(pImage.GetSizePixel().getHeight() + spacing); + SetEntryWidth(pImage.GetSizePixel().getWidth() + spacing); +} + void IconView::CalcEntryHeight(SvTreeListEntry const* pEntry) { int nHeight = nSpacing * 2;