summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-05-26 18:49:29 +0900
committerTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-08-27 08:30:49 +0900
commit48d2dca48d75fef67e3caa61d80f074fdbeb9984 (patch)
treef74d55c1ea4e86af468268a1cfaf02426f0cdc66 /svx
parenta0ab7c31a254285856f6520d069570647c56af22 (diff)
Show previews of style presets in sidebar
Change-Id: I0e3d6f00a79bc33e1db1329df217e7e867dfd511
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);