summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-12-17 17:42:09 +0000
committerCaolán McNamara <caolanm@redhat.com>2018-12-18 12:33:54 +0100
commit9fcca59d30ab69bfbb07b40d7429bcba6fcf869c (patch)
tree127c3701dd0de6f6efc321124b0a46da02bdcae9
parentffb921559f39c3d53c29518cf2a5024b4078e8c0 (diff)
Related: tdf#122120 left align text if preview won't fit
in the number format page Change-Id: Ic398e5302ee54dfd437e07fdf892269e6eefd8fa Reviewed-on: https://gerrit.libreoffice.org/65285 Tested-by: Jenkins Tested-by: Xisco Faulí <xiscofauli@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--cui/source/tabpages/numfmt.cxx13
1 files changed, 11 insertions, 2 deletions
diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx
index 69b25330c98e..c7366193008f 100644
--- a/cui/source/tabpages/numfmt.cxx
+++ b/cui/source/tabpages/numfmt.cxx
@@ -168,8 +168,17 @@ void SvxNumberPreview::Paint(vcl::RenderContext& rRenderContext, const ::tools::
aTmpStr = aTmpStr.replaceAt(mnPos, 0, OUString(mnChar));
}
}
- Point aPosText = Point((mnPos != -1) ? 0 : nLeadSpace,
- (aSzWnd.Height() - GetTextHeight()) / 2);
+ long nX;
+ if (mnPos != -1)
+ nX = 0;
+ else
+ {
+ //tdf#122120 if it won't fit anyway, then left align it
+ if (nLeadSpace > 0)
+ nX = nLeadSpace;
+ nX = 0;
+ }
+ Point aPosText = Point(nX, (aSzWnd.Height() - GetTextHeight()) / 2);
rRenderContext.DrawText(aPosText, aTmpStr);
rRenderContext.Pop();
}