Skip to content

Commit 4d2ed3c

Browse files
Rash419s8321414
authored andcommitted
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 <[email protected]> Tested-by: Jenkins (cherry picked from commit 60cfd11276d6cef6f796f7b45ae1da8a29bbe430) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183162 Tested-by: Jenkins CollaboraOffice <[email protected]> (cherry picked from commit fef5fa64b947f39260389a74ee4ac9f267300d08) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183161
1 parent 9c57c7c commit 4d2ed3c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

sd/source/ui/sidebar/MasterPageContainer.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public:
7676

7777
/** Return the preview size in pixels.
7878
*/
79-
Size const& GetPreviewSizePixel() const;
79+
const Size& GetPreviewSizePixel() const;
8080

8181
enum PreviewState
8282
{

sd/source/ui/sidebar/MasterPagesSelector.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,8 @@ css::ui::LayoutSize MasterPagesSelector::GetHeightForWidth(const sal_Int32 nWidt
586586
{
587587
// there is no way to get margin of item programatically, we use value provided in ui file.
588588
const int nMargin = 6;
589-
sal_Int32 nColumnCount = nWidth / (mxPreviewIconView->get_item_width() + (5 * nMargin));
589+
const Size& previewSize = mpContainer->GetPreviewSizePixel();
590+
sal_Int32 nColumnCount = nWidth / (previewSize.Width() + (2 * nMargin));
590591
if (nColumnCount < 1)
591592
nColumnCount = 1;
592593

@@ -595,8 +596,7 @@ css::ui::LayoutSize MasterPagesSelector::GetHeightForWidth(const sal_Int32 nWidt
595596
if (nRowCount < 1)
596597
nRowCount = 1;
597598

598-
sal_Int32 nPreferedHeight
599-
= nRowCount * (mxPreviewIconView->get_rect(nTotalItems - 1).GetHeight() + (2 * nMargin));
599+
sal_Int32 nPreferedHeight = nRowCount * (previewSize.getHeight() + (4 * nMargin));
600600
return css::ui::LayoutSize(nPreferedHeight, nPreferedHeight, nPreferedHeight);
601601
}
602602

0 commit comments

Comments
 (0)