diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-12-10 17:10:24 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-12-11 14:17:42 +0100 |
commit | 46604b1a38d800fd70a22be0ee18668b131038a6 (patch) | |
tree | 286c8c397b93b62105ef5fbbf6b7de4103fdb9a0 | |
parent | d250aa5b6be298fc28f4beaaf1eb722c6418e39a (diff) |
Related: tdf#129267 format numbers with the UI locale
Change-Id: I70d8cc48869073596c101eec6a6d3a79db044a78
Reviewed-on: https://gerrit.libreoffice.org/84883
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
(cherry picked from commit b26f29a976838247175576f17fb4a3087e1bb922)
Reviewed-on: https://gerrit.libreoffice.org/84937
-rw-r--r-- | sd/inc/pageformatpanel.hrc | 38 | ||||
-rw-r--r-- | sd/source/ui/sidebar/SlideBackground.cxx | 15 |
2 files changed, 35 insertions, 18 deletions
diff --git a/sd/inc/pageformatpanel.hrc b/sd/inc/pageformatpanel.hrc index 732f39e19c53..6d45a7957e87 100644 --- a/sd/inc/pageformatpanel.hrc +++ b/sd/inc/pageformatpanel.hrc @@ -16,27 +16,33 @@ namespace sd { // To translators: this is a listbox labelled by "Margins:", inch units -const char* RID_PAGEFORMATPANEL_MARGINS_INCH[] = +const std::pair<const char*, int> RID_PAGEFORMATPANEL_MARGINS_INCH[] = { - NC_("RID_PAGEFORMATPANEL_MARGINS_INCH", "None"), - NC_("RID_PAGEFORMATPANEL_MARGINS_INCH", "Narrow"), - NC_("RID_PAGEFORMATPANEL_MARGINS_INCH", "Moderate"), - NC_("RID_PAGEFORMATPANEL_MARGINS_INCH", "Normal (0.75″)"), - NC_("RID_PAGEFORMATPANEL_MARGINS_INCH", "Normal (1″)"), - NC_("RID_PAGEFORMATPANEL_MARGINS_INCH", "Normal (1.25″)"), - NC_("RID_PAGEFORMATPANEL_MARGINS_INCH", "Wide"), + { NC_("RID_PAGEFORMATPANEL_MARGINS_INCH", "None"), 0 }, + { NC_("RID_PAGEFORMATPANEL_MARGINS_INCH", "Narrow"), 0 }, + { NC_("RID_PAGEFORMATPANEL_MARGINS_INCH", "Moderate"), 0 }, + // Normal (0.75") + { NC_("RID_PAGEFORMATPANEL_MARGINS_INCH", "Normal (%1)"), 75 }, + // Normal (1") + { NC_("RID_PAGEFORMATPANEL_MARGINS_INCH", "Normal (%1)"), 100 }, + // Normal (1.25") + { NC_("RID_PAGEFORMATPANEL_MARGINS_INCH", "Normal (%1)"), 125 }, + { NC_("RID_PAGEFORMATPANEL_MARGINS_INCH", "Wide"), 0 } }; // To translators: this is a listbox labelled by "Margins:", cm units -const char* RID_PAGEFORMATPANEL_MARGINS_CM[] = +const std::pair<const char*, int> RID_PAGEFORMATPANEL_MARGINS_CM[] = { - NC_("RID_PAGEFORMATPANEL_MARGINS_CM", "None"), - NC_("RID_PAGEFORMATPANEL_MARGINS_CM", "Narrow"), - NC_("RID_PAGEFORMATPANEL_MARGINS_CM", "Moderate"), - NC_("RID_PAGEFORMATPANEL_MARGINS_CM", "Normal (1.9 cm)"), - NC_("RID_PAGEFORMATPANEL_MARGINS_CM", "Normal (2.54 cm)"), - NC_("RID_PAGEFORMATPANEL_MARGINS_CM", "Normal (3.18 cm)"), - NC_("RID_PAGEFORMATPANEL_MARGINS_CM", "Wide"), + { NC_("RID_PAGEFORMATPANEL_MARGINS_CM", "None"), 0 }, + { NC_("RID_PAGEFORMATPANEL_MARGINS_CM", "Narrow"), 0 }, + { NC_("RID_PAGEFORMATPANEL_MARGINS_CM", "Moderate"), 0 }, + // Normal (1.9 cm) + { NC_("RID_PAGEFORMATPANEL_MARGINS_CM", "Normal (%1)"), 190 }, + // Normal (2.54 cm) + { NC_("RID_PAGEFORMATPANEL_MARGINS_CM", "Normal (%1)"), 254 }, + // Normal (3.18 cm) + { NC_("RID_PAGEFORMATPANEL_MARGINS_CM", "Normal (%1)"), 318 }, + { NC_("RID_PAGEFORMATPANEL_MARGINS_CM", "Wide"), 0 } }; } diff --git a/sd/source/ui/sidebar/SlideBackground.cxx b/sd/source/ui/sidebar/SlideBackground.cxx index 958970f49390..acb1e513ff08 100644 --- a/sd/source/ui/sidebar/SlideBackground.cxx +++ b/sd/source/ui/sidebar/SlideBackground.cxx @@ -52,6 +52,7 @@ #include <sfx2/dispatch.hxx> #include <sfx2/sidebar/Panel.hxx> #include <EventMultiplexer.hxx> +#include <unotools/localedatawrapper.hxx> #include <vcl/EnumContext.hxx> #include <editeng/sizeitem.hxx> @@ -186,15 +187,25 @@ void SlideBackground::SetMarginsFieldUnit() auto nSelected = mpMarginSelectBox->GetSelectedEntryPos(); mpMarginSelectBox->Clear(); + const LocaleDataWrapper& rLocaleData = Application::GetSettings().GetLocaleDataWrapper(); + if (IsInch(meFUnit)) { + OUString sSuffix = weld::MetricSpinButton::MetricToString(FieldUnit::INCH); for (size_t i = 0; i < SAL_N_ELEMENTS(RID_PAGEFORMATPANEL_MARGINS_INCH); ++i) - mpMarginSelectBox->InsertEntry(SdResId(RID_PAGEFORMATPANEL_MARGINS_INCH[i])); + { + OUString sMeasurement = rLocaleData.getNum(RID_PAGEFORMATPANEL_MARGINS_INCH[i].second, 2, true, false) + sSuffix; + mpMarginSelectBox->InsertEntry(SdResId(RID_PAGEFORMATPANEL_MARGINS_INCH[i].first).replaceFirst("%1", sMeasurement)); + } } else { + OUString sSuffix = " " + weld::MetricSpinButton::MetricToString(FieldUnit::CM); for (size_t i = 0; i < SAL_N_ELEMENTS(RID_PAGEFORMATPANEL_MARGINS_CM); ++i) - mpMarginSelectBox->InsertEntry(SdResId(RID_PAGEFORMATPANEL_MARGINS_CM[i])); + { + OUString sMeasurement = rLocaleData.getNum(RID_PAGEFORMATPANEL_MARGINS_CM[i].second, 2, true, false) + sSuffix; + mpMarginSelectBox->InsertEntry(SdResId(RID_PAGEFORMATPANEL_MARGINS_CM[i].first).replaceFirst("%1", sMeasurement)); + } } mpMarginSelectBox->SelectEntryPos(nSelected); |