tdf#165606 fix: master slide panel doesn't resized correctly in gtk
- follow up to 98b86bff2c
- 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 <quikee@gmail.com>
Tested-by: Jenkins
This commit is contained in:
@@ -103,6 +103,8 @@ public:
|
||||
|
||||
void ReleaseDescriptor (Token aToken);
|
||||
|
||||
const Size& GetPreviewSizePixel(PreviewSize pPreviewSize);
|
||||
|
||||
/** Called by the MasterPageContainerFiller to notify that all master
|
||||
pages from template documents have been added.
|
||||
*/
|
||||
@@ -444,6 +446,11 @@ void MasterPageContainer::InvalidatePreview (MasterPageContainer::Token aToken)
|
||||
mpImpl->InvalidatePreview(aToken);
|
||||
}
|
||||
|
||||
const Size& MasterPageContainer::GetPreviewSizePixel()
|
||||
{
|
||||
return mpImpl->GetPreviewSizePixel(mePreviewSize);
|
||||
}
|
||||
|
||||
Image MasterPageContainer::GetPreviewForToken (MasterPageContainer::Token aToken)
|
||||
{
|
||||
return mpImpl->GetPreviewForToken(aToken,mePreviewSize);
|
||||
@@ -809,6 +816,14 @@ SdDrawDocument* MasterPageContainer::Implementation::GetDocument()
|
||||
return mpDocument;
|
||||
}
|
||||
|
||||
const Size& MasterPageContainer::Implementation::GetPreviewSizePixel(PreviewSize pPreviewSize)
|
||||
{
|
||||
if (pPreviewSize == PreviewSize::SMALL)
|
||||
return maSmallPreviewSizePixel;
|
||||
else
|
||||
return maLargePreviewSizePixel;
|
||||
}
|
||||
|
||||
Image MasterPageContainer::Implementation::GetPreviewSubstitution (
|
||||
TranslateId pId,
|
||||
PreviewSize ePreviewSize)
|
||||
|
||||
@@ -85,6 +85,8 @@ public:
|
||||
};
|
||||
PreviewState GetPreviewState(Token aToken);
|
||||
|
||||
const Size& GetPreviewSizePixel();
|
||||
|
||||
/** This method is typically called for entries in the container for
|
||||
which GetPreviewState() returns OS_CREATABLE. The creation of the
|
||||
preview is then scheduled to be executed asynchronously at a later
|
||||
|
||||
@@ -585,7 +585,8 @@ css::ui::LayoutSize MasterPagesSelector::GetHeightForWidth(const sal_Int32 nWidt
|
||||
{
|
||||
// there is no way to get margin of item programmatically, 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;
|
||||
|
||||
@@ -594,8 +595,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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user