From d33b4c311e3b9c0b8f50080cb38a31c19f587a16 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 20 Jan 2014 13:55:03 +0000 Subject: Related: #i56998# use locale rules to format percentage Change-Id: I4b744cf10165383153d2a71c05df0c0ed327c641 --- editeng/source/items/frmitems.cxx | 46 ++++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 10 deletions(-) (limited to 'editeng') diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index 6fd91136ec60..69bdcf16f630 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -43,6 +43,7 @@ #include #include +#include #include #include #include @@ -56,6 +57,7 @@ #include #include #include +#include #include #include #include @@ -600,19 +602,28 @@ SfxItemPresentation SvxLRSpaceItem::GetPresentation case SFX_ITEM_PRESENTATION_NAMELESS: { if ( 100 != nPropLeftMargin ) - rText = OUString::number( nPropLeftMargin ) + "%"; + { + rText = unicode::formatPercent(nPropLeftMargin, + Application::GetSettings().GetUILanguageTag()); + } else rText = GetMetricText( (long)nLeftMargin, eCoreUnit, ePresUnit, pIntl ); rText += OUString(cpDelim); if ( 100 != nPropFirstLineOfst ) - rText = rText + OUString::number( nPropFirstLineOfst ) + "%"; + { + rText += unicode::formatPercent(nPropFirstLineOfst, + Application::GetSettings().GetUILanguageTag()); + } else rText += GetMetricText( (long)nFirstLineOfst, eCoreUnit, ePresUnit, pIntl ); rText += OUString(cpDelim); if ( 100 != nRightMargin ) - rText = rText + OUString::number( nRightMargin ) + "%"; + { + rText += unicode::formatPercent(nRightMargin, + Application::GetSettings().GetUILanguageTag()); + } else rText += GetMetricText( (long)nRightMargin, eCoreUnit, ePresUnit, pIntl ); @@ -622,7 +633,8 @@ SfxItemPresentation SvxLRSpaceItem::GetPresentation { rText = EE_RESSTR(RID_SVXITEMS_LRSPACE_LEFT); if ( 100 != nPropLeftMargin ) - rText += OUString::number( nPropLeftMargin ) + "%"; + rText += unicode::formatPercent(nPropLeftMargin, + Application::GetSettings().GetUILanguageTag()); else { rText = rText + @@ -634,7 +646,8 @@ SfxItemPresentation SvxLRSpaceItem::GetPresentation { rText += EE_RESSTR(RID_SVXITEMS_LRSPACE_FLINE); if ( 100 != nPropFirstLineOfst ) - rText = rText + OUString::number( nPropFirstLineOfst ) + "%"; + rText = rText + unicode::formatPercent(nPropFirstLineOfst, + Application::GetSettings().GetUILanguageTag()); else { rText = rText + @@ -646,7 +659,8 @@ SfxItemPresentation SvxLRSpaceItem::GetPresentation } rText += EE_RESSTR(RID_SVXITEMS_LRSPACE_RIGHT); if ( 100 != nPropRightMargin ) - rText = rText + OUString::number( nPropRightMargin ) + "%"; + rText = rText + unicode::formatPercent(nPropRightMargin, + Application::GetSettings().GetUILanguageTag()); else { rText = rText + @@ -961,12 +975,18 @@ SfxItemPresentation SvxULSpaceItem::GetPresentation case SFX_ITEM_PRESENTATION_NAMELESS: { if ( 100 != nPropUpper ) - rText = OUString::number( nPropUpper ) + "%"; + { + rText = unicode::formatPercent(nPropUpper, + Application::GetSettings().GetUILanguageTag()); + } else rText = GetMetricText( (long)nUpper, eCoreUnit, ePresUnit, pIntl ); rText += OUString(cpDelim); if ( 100 != nPropLower ) - rText += OUString::number( nPropLower ) + "%"; + { + rText += unicode::formatPercent(nPropLower, + Application::GetSettings().GetUILanguageTag()); + } else rText += GetMetricText( (long)nLower, eCoreUnit, ePresUnit, pIntl ); return SFX_ITEM_PRESENTATION_NAMELESS; @@ -975,7 +995,10 @@ SfxItemPresentation SvxULSpaceItem::GetPresentation { rText = EE_RESSTR(RID_SVXITEMS_ULSPACE_UPPER); if ( 100 != nPropUpper ) - rText += OUString::number( nPropUpper ) + "%"; + { + rText += unicode::formatPercent(nPropUpper, + Application::GetSettings().GetUILanguageTag()); + } else { rText = rText + @@ -984,7 +1007,10 @@ SfxItemPresentation SvxULSpaceItem::GetPresentation } rText = rText + OUString(cpDelim) + EE_RESSTR(RID_SVXITEMS_ULSPACE_LOWER); if ( 100 != nPropLower ) - rText += OUString::number( nPropLower ) + "%"; + { + rText += unicode::formatPercent(nPropLower, + Application::GetSettings().GetUILanguageTag()); + } else { rText = rText + -- cgit