summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMuhammet Kara <muhammet.kara@collabora.com>2019-06-09 22:17:32 +0300
committerMuhammet Kara <muhammet.kara@collabora.com>2019-06-09 22:41:58 +0200
commit0d35f8f673ac4e6aa3f1e5f1edc0c6c7a45d2f95 (patch)
tree29afccfc27e1ad3a8f664e213628ceff66206a35
parent15fd2231401912a83d7c3a602cab5b9737a9d817 (diff)
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 <muhammet.kara@collabora.com>
-rw-r--r--cui/source/tabpages/numfmt.cxx13
1 files changed, 5 insertions, 8 deletions
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();