diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-10-09 17:09:39 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-10-10 08:14:05 +0200 |
commit | f26a5f32dc11cd8b4a72ef1519b8f38ec80e126c (patch) | |
tree | b6db4485ad3b60ca148902a68e2fc7b104329a6a /svx/source/svdraw | |
parent | 1ce0a72094fd09b4506a2380ff7787ac03c6e534 (diff) |
rename TakeUnitStr to GetUnitStr
and return a value instead of an awkward out-parameter
Change-Id: Ia78bf0188dd9ca1078230ed7cd020ab77d05757e
Reviewed-on: https://gerrit.libreoffice.org/80555
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source/svdraw')
-rw-r--r-- | svx/source/svdraw/svdattr.cxx | 19 | ||||
-rw-r--r-- | svx/source/svdraw/svdtrans.cxx | 142 |
2 files changed, 36 insertions, 125 deletions
diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx index 5ea950355a04..528af23ac7e1 100644 --- a/svx/source/svdraw/svdattr.cxx +++ b/svx/source/svdraw/svdattr.cxx @@ -862,9 +862,7 @@ bool SdrMetricItem::GetPresentation(SfxItemPresentation ePres, long nValue=GetValue(); SdrFormatter aFmt(eCoreMetric,ePresMetric); rText = aFmt.GetStr(nValue); - OUString aStr; - SdrFormatter::TakeUnitStr(ePresMetric,aStr); - rText += " " + aStr; + rText += " " + SdrFormatter::GetUnitStr(ePresMetric); if (ePres==SfxItemPresentation::Complete) { rText = SdrItemPool::GetItemName(Which()) + " " + rText; } @@ -1263,11 +1261,8 @@ bool SdrTextAniAmountItem::GetPresentation( else { SdrFormatter aFmt(eCoreMetric, ePresMetric); - OUString aStr; - - rText = aFmt.GetStr(nValue); - SdrFormatter::TakeUnitStr(ePresMetric, aStr); - rText += aStr; + rText = aFmt.GetStr(nValue) + + SdrFormatter::GetUnitStr(ePresMetric); } if(ePres == SfxItemPresentation::Complete) @@ -1638,14 +1633,10 @@ sal_uInt16 SdrMeasureUnitItem::GetValueCount() const { return 14; } OUString SdrMeasureUnitItem::GetValueTextByPos(sal_uInt16 nPos) { - OUString aRetval; - if(static_cast<FieldUnit>(nPos) == FieldUnit::NONE) - aRetval = "default"; + return "default"; else - SdrFormatter::TakeUnitStr(static_cast<FieldUnit>(nPos), aRetval); - - return aRetval; + return SdrFormatter::GetUnitStr(static_cast<FieldUnit>(nPos)); } bool SdrMeasureUnitItem::GetPresentation(SfxItemPresentation ePres, diff --git a/svx/source/svdraw/svdtrans.cxx b/svx/source/svdraw/svdtrans.cxx index 1605e592da5f..49e6f0cf2929 100644 --- a/svx/source/svdraw/svdtrans.cxx +++ b/svx/source/svdraw/svdtrans.cxx @@ -838,166 +838,86 @@ OUString SdrFormatter::GetStr(long nVal) const return aStr.makeStringAndClear(); } -void SdrFormatter::TakeUnitStr(MapUnit eUnit, OUString& rStr) +OUString SdrFormatter::GetUnitStr(MapUnit eUnit) { switch(eUnit) { // metrically case MapUnit::Map100thMM : - { - rStr = "/100mm"; - break; - } + return "/100mm"; case MapUnit::Map10thMM : - { - rStr = "/10mm"; - break; - } + return "/10mm"; case MapUnit::MapMM : - { - rStr = "mm"; - break; - } + return "mm"; case MapUnit::MapCM : - { - rStr = "cm"; - break; - } + return "cm"; // Inch case MapUnit::Map1000thInch: - { - rStr = "/1000\""; - break; - } + return "/1000\""; case MapUnit::Map100thInch : - { - rStr = "/100\""; - break; - } + return "/100\""; case MapUnit::Map10thInch : - { - rStr = "/10\""; - break; - } + return "/10\""; case MapUnit::MapInch : - { - rStr = "\""; - break; - } + return "\""; case MapUnit::MapPoint : - { - rStr = "pt"; - break; - } + return "pt"; case MapUnit::MapTwip : - { - rStr = "twip"; - break; - } + return "twip"; // others case MapUnit::MapPixel : - { - rStr = "pixel"; - break; - } + return "pixel"; case MapUnit::MapSysFont : - { - rStr = "sysfont"; - break; - } + return "sysfont"; case MapUnit::MapAppFont : - { - rStr = "appfont"; - break; - } + return "appfont"; case MapUnit::MapRelative : - { - rStr = "%"; - break; - } - default: break; + return "%"; + default: + return OUString(); } } -void SdrFormatter::TakeUnitStr(FieldUnit eUnit, OUString& rStr) +OUString SdrFormatter::GetUnitStr(FieldUnit eUnit) { switch(eUnit) { default : case FieldUnit::NONE : case FieldUnit::CUSTOM : - { - rStr.clear(); - break; - } + return OUString(); // metrically case FieldUnit::MM_100TH: - { - rStr = "/100mm"; - break; - } + return "/100mm"; case FieldUnit::MM : - { - rStr = "mm"; - break; - } + return "mm"; case FieldUnit::CM : - { - rStr = "cm"; - break; - } + return "cm"; case FieldUnit::M : - { - rStr = "m"; - break; - } + return "m"; case FieldUnit::KM : - { - rStr = "km"; - break; - } + return "km"; // Inch case FieldUnit::TWIP : - { - rStr = "twip"; - break; - } + return "twip"; case FieldUnit::POINT : - { - rStr = "pt"; - break; - } + return "pt"; case FieldUnit::PICA : - { - rStr = "pica"; - break; - } + return "pica"; case FieldUnit::INCH : - { - rStr = "\""; - break; - } + return "\""; case FieldUnit::FOOT : - { - rStr = "ft"; - break; - } + return "ft"; case FieldUnit::MILE : - { - rStr = "mile(s)"; - break; - } + return "mile(s)"; // others case FieldUnit::PERCENT: - { - rStr = "%"; - break; - } + return "%"; } } |