diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-08-05 15:50:31 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-08-10 12:00:25 +0200 |
commit | d67cd0efbc08c92492f3b5fd7ffe35556052d52f (patch) | |
tree | 1ba915eb8d5f9a93d328cea14481cb73e475e776 | |
parent | 1bef764ac84d113a0bcb237a0634579ee8dccec0 (diff) |
tdf#135438 Paragraph styles preview in sidebar are clipped
since...
commit fe9a13dc0e6d1384416c2a2343223b33925fc925
Author: Caolán McNamara <caolanm@redhat.com>
Date: Sun Apr 26 15:43:25 2020 +0100
weld SfxTemplatePanelControl
getRenderSize used to be called after recalculate and before
render to change maSizePixel
Change-Id: Ifc1b6b0b3399c7de61d5f4d46f8346d13e72a4d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100069
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r-- | svx/inc/CommonStylePreviewRenderer.hxx | 2 | ||||
-rw-r--r-- | svx/source/styles/CommonStylePreviewRenderer.cxx | 12 |
2 files changed, 14 insertions, 0 deletions
diff --git a/svx/inc/CommonStylePreviewRenderer.hxx b/svx/inc/CommonStylePreviewRenderer.hxx index 55391327533e..5dfd41faa39a 100644 --- a/svx/inc/CommonStylePreviewRenderer.hxx +++ b/svx/inc/CommonStylePreviewRenderer.hxx @@ -31,6 +31,8 @@ class CommonStylePreviewRenderer final : public sfx2::StylePreviewRenderer Size maPixelSize; OUString maStyleName; + Size getRenderSize() const; + public: CommonStylePreviewRenderer(const SfxObjectShell& rShell, OutputDevice& rOutputDev, SfxStyleSheetBase* pStyle, long nMaxHeight); diff --git a/svx/source/styles/CommonStylePreviewRenderer.cxx b/svx/source/styles/CommonStylePreviewRenderer.cxx index d677a135461e..9920903df469 100644 --- a/svx/source/styles/CommonStylePreviewRenderer.cxx +++ b/svx/source/styles/CommonStylePreviewRenderer.cxx @@ -168,9 +168,21 @@ bool CommonStylePreviewRenderer::recalculate() } m_pFont = std::move(pFont); + maPixelSize = getRenderSize(); return true; } +Size CommonStylePreviewRenderer::getRenderSize() const +{ + assert(m_pFont); + Size aPixelSize = m_pFont->GetTextSize(&mrOutputDev, maStyleName); + + if (aPixelSize.Height() > mnMaxHeight) + aPixelSize.setHeight( mnMaxHeight ); + + return aPixelSize; +} + bool CommonStylePreviewRenderer::render(const tools::Rectangle& aRectangle, RenderAlign eRenderAlign) { const OUString& rText = maStyleName; |