sd/source/ui/sidebar/MasterPageContainer.hxx |    2 +-
 sd/source/ui/sidebar/MasterPagesSelector.cxx |    6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 2110223c262871b97784e8e540c6884b3be4ae7b
Author:     Rashesh <rashesh.pa...@collabora.com>
AuthorDate: Wed Mar 12 13:46:03 2025 +0530
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Wed Apr 9 15:32:47 2025 +0200

    tdf#165606 fix: master slide panel doesn't resized correctly in gtk
    
    - follow up to 98b86bff2c73
    - the problem was get_rect give 0 height when preview are loading.
    - this patch fixes the problem by taking image size from
    MasterPageContainer
    
    Change-Id: Ie4a3e25826e871ae5cbda58edba092e9a3eae193
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182806
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>
    Tested-by: Jenkins
    (cherry picked from commit 60cfd11276d6cef6f796f7b45ae1da8a29bbe430)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183162
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    (cherry picked from commit fef5fa64b947f39260389a74ee4ac9f267300d08)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183182
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sd/source/ui/sidebar/MasterPageContainer.hxx 
b/sd/source/ui/sidebar/MasterPageContainer.hxx
index 9de4eb6bc8cc..5a9805918ad7 100644
--- a/sd/source/ui/sidebar/MasterPageContainer.hxx
+++ b/sd/source/ui/sidebar/MasterPageContainer.hxx
@@ -76,7 +76,7 @@ public:
 
     /** Return the preview size in pixels.
     */
-    Size const& GetPreviewSizePixel() const;
+    const Size& GetPreviewSizePixel() const;
 
     enum PreviewState
     {
diff --git a/sd/source/ui/sidebar/MasterPagesSelector.cxx 
b/sd/source/ui/sidebar/MasterPagesSelector.cxx
index b098486054ed..e8be353bd53e 100644
--- a/sd/source/ui/sidebar/MasterPagesSelector.cxx
+++ b/sd/source/ui/sidebar/MasterPagesSelector.cxx
@@ -584,7 +584,8 @@ css::ui::LayoutSize 
MasterPagesSelector::GetHeightForWidth(const sal_Int32 nWidt
 {
     // there is no way to get margin of item programatically, we use value 
provided in ui file.
     const int nMargin = 6;
-    sal_Int32 nColumnCount = nWidth / (mxPreviewIconView->get_item_width() + 
(5 * nMargin));
+    const Size& previewSize = mpContainer->GetPreviewSizePixel();
+    sal_Int32 nColumnCount = nWidth / (previewSize.Width() + (2 * nMargin));
     if (nColumnCount < 1)
         nColumnCount = 1;
 
@@ -593,8 +594,7 @@ css::ui::LayoutSize 
MasterPagesSelector::GetHeightForWidth(const sal_Int32 nWidt
     if (nRowCount < 1)
         nRowCount = 1;
 
-    sal_Int32 nPreferedHeight
-        = nRowCount * (mxPreviewIconView->get_rect(nTotalItems - 
1).GetHeight() + (2 * nMargin));
+    sal_Int32 nPreferedHeight = nRowCount * (previewSize.getHeight() + (4 * 
nMargin));
     return css::ui::LayoutSize(nPreferedHeight, nPreferedHeight, 
nPreferedHeight);
 }
 

Reply via email to