vcl/inc/iconview.hxx             |    4 ++++
 vcl/source/app/salvtables.cxx    |   10 +++-------
 vcl/source/treelist/iconview.cxx |    7 +++++++
 3 files changed, 14 insertions(+), 7 deletions(-)

New commits:
commit 9f2fc6fbf74cbc0643f380aa4b799e36997734aa
Author:     Rashesh <rashesh.pa...@collabora.com>
AuthorDate: Sat Mar 8 17:29:01 2025 +0530
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Tue Mar 11 13:14:28 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>
    (cherry picked from commit 756a4a85d0362264e82389d5924c2ded30f25885)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182765
    Tested-by: Jenkins

diff --git a/vcl/inc/iconview.hxx b/vcl/inc/iconview.hxx
index 0ddfc9c00eb7..a0cf975377c2 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
 {
@@ -51,6 +52,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 602d8bf41a3b..4cc7090697bc 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -5732,10 +5732,7 @@ void SalInstanceIconView::set_image(int pos, 
VirtualDevice& rIcon)
     SvLBoxContextBmp* aItem
         = 
static_cast<SvLBoxContextBmp*>(aEntry->GetFirstItem(SvLBoxItemType::ContextBmp));
 
-    const Point aNull(0, 0);
-    const Size aSize = rIcon.GetOutputSize();
-    Image aImage(rIcon.GetBitmapEx(aNull, aSize));
-
+    Image aImage = createImage(rIcon);
     if (aItem == nullptr)
     {
         aEntry->AddItem(std::make_unique<SvLBoxContextBmp>(aImage, aImage, 
false));
@@ -5744,10 +5741,9 @@ void SalInstanceIconView::set_image(int pos, 
VirtualDevice& rIcon)
     {
         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 93e07ae32126..9dc4e45727b5 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;

Reply via email to