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>
diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx
index 6f2b605..282a504 100644
--- a/cui/source/tabpages/numfmt.cxx
+++ b/cui/source/tabpages/numfmt.cxx
@@ -167,16 +167,13 @@
                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();