From 0d35f8f673ac4e6aa3f1e5f1edc0c6c7a45d2f95 Mon Sep 17 00:00:00 2001 From: Muhammet Kara Date: Sun, 9 Jun 2019 22:17:32 +0300 Subject: Fix logic error and simplify. Related: tdf#122120 To bring back centering of the preview on the Format Cells dialog. Change-Id: I2bf1e1dc5cb722c742713d3b245d2b6714976527 Reviewed-on: https://gerrit.libreoffice.org/73740 Tested-by: Jenkins Reviewed-by: Muhammet Kara --- cui/source/tabpages/numfmt.cxx | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'cui') diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx index 6f2b605d8be8..282a50460693 100644 --- a/cui/source/tabpages/numfmt.cxx +++ b/cui/source/tabpages/numfmt.cxx @@ -167,16 +167,13 @@ void SvxNumberPreview::Paint(vcl::RenderContext& rRenderContext, const ::tools:: aTmpStr = aTmpStr.replaceAt(mnPos, 0, OUString(mnChar)); } } - long nX; - if (mnPos != -1) - nX = 0; - else + + long nX = 0; + if (mnPos == -1 && nLeadSpace > 0) //tdf#122120 if it won't fit anyway, then left align it { - //tdf#122120 if it won't fit anyway, then left align it - if (nLeadSpace > 0) - nX = nLeadSpace; - nX = 0; + nX = nLeadSpace; } + Point aPosText = Point(nX, (aSzWnd.Height() - GetTextHeight()) / 2); rRenderContext.DrawText(aPosText, aTmpStr); rRenderContext.Pop(); -- cgit