diff options
-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; |