summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
Diffstat (limited to 'svx')
-rw-r--r--svx/source/styles/CommonStylePreviewRenderer.cxx18
1 files changed, 14 insertions, 4 deletions
diff --git a/svx/source/styles/CommonStylePreviewRenderer.cxx b/svx/source/styles/CommonStylePreviewRenderer.cxx
index ab1271ac8fe0..2d9ac3f5dd10 100644
--- a/svx/source/styles/CommonStylePreviewRenderer.cxx
+++ b/svx/source/styles/CommonStylePreviewRenderer.cxx
@@ -174,8 +174,10 @@ Size CommonStylePreviewRenderer::getRenderSize()
return maPixelSize;
}
-bool CommonStylePreviewRenderer::render(const Rectangle& aRectangle)
+bool CommonStylePreviewRenderer::render(const Rectangle& aRectangle, RenderAlign eRenderAlign)
{
+ const OUString& rText = msRenderText.isEmpty() ? maStyleName : msRenderText;
+
// setup the device & draw
vcl::Font aOldFont(mrOutputDev.GetFont());
Color aOldColor(mrOutputDev.GetTextColor());
@@ -192,10 +194,18 @@ bool CommonStylePreviewRenderer::render(const Rectangle& aRectangle)
mrOutputDev.SetTextColor(maFontColor);
Point aFontDrawPosition = aRectangle.TopLeft();
- if (aRectangle.GetHeight() > maPixelSize.Height())
- aFontDrawPosition.Y() += ( aRectangle.GetHeight() - maPixelSize.Height() ) / 2;
+ if (eRenderAlign == RenderAlign::CENTER)
+ {
+ if (aRectangle.GetHeight() > maPixelSize.Height())
+ aFontDrawPosition.Y() += (aRectangle.GetHeight() - maPixelSize.Height()) / 2;
+ }
+ else if (eRenderAlign == RenderAlign::BOTTOM)
+ {
+ if (aRectangle.GetHeight() > maPixelSize.Height())
+ aFontDrawPosition.Y() += aRectangle.GetHeight() - maPixelSize.Height();
+ }
- mrOutputDev.DrawText(aFontDrawPosition, maStyleName);
+ mrOutputDev.DrawText(aFontDrawPosition, rText);
mrOutputDev.SetFillColor(aOldFillColor);
mrOutputDev.SetTextColor(aOldColor);