summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-02-02 12:59:49 +0000
committerAdolfo Jayme Barrientos <fitojb@ubuntu.com>2022-02-04 15:39:25 +0100
commit61339f316ec7a91733b62ca667faeca0b75297e9 (patch)
tree99a59e0a4ba3afdc5eb36cd7592f1b7aebc05180 /vcl
parent04b4c269fc2e4001eb37c4b2c34a023a44ca6ebe (diff)
tdf#125849 cannot modify the ruler unit of measure in translated UI
Change-Id: Ica74dd5e55d30605ee03affa4b724ffa4ec65b5a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129334 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/app/svdata.cxx17
-rw-r--r--vcl/source/control/field.cxx4
2 files changed, 19 insertions, 2 deletions
diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx
index 1d1375b24d7b..7d815ad0acc9 100644
--- a/vcl/source/app/svdata.cxx
+++ b/vcl/source/app/svdata.cxx
@@ -29,6 +29,7 @@
#include <vcl/QueueInfo.hxx>
#include <vcl/cvtgrf.hxx>
#include <vcl/dockwin.hxx>
+#include <vcl/fieldvalues.hxx>
#include <vcl/menu.hxx>
#include <vcl/print.hxx>
#include <vcl/settings.hxx>
@@ -277,6 +278,22 @@ const FieldUnitStringList& ImplGetFieldUnits()
return pSVData->maCtrlData.maFieldUnitStrings;
}
+namespace vcl
+{
+ FieldUnit EnglishStringToMetric(const OUString& rEnglishMetricString)
+ {
+ sal_uInt32 nUnits = SAL_N_ELEMENTS(SV_FUNIT_STRINGS);
+ for (sal_uInt32 i = 0; i < nUnits; ++i)
+ {
+ const char *pId = strchr(SV_FUNIT_STRINGS[i].first, '\004');
+ assert(pId);
+ if (rEnglishMetricString.equalsAscii(pId+1))
+ return SV_FUNIT_STRINGS[i].second;
+ }
+ return FieldUnit::NONE;
+ }
+}
+
const FieldUnitStringList& ImplGetCleanedFieldUnits()
{
ImplSVData* pSVData = ImplGetSVData();
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index cc5a6330d1a9..281566ed174a 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -960,7 +960,7 @@ static OUString ImplMetricToString( FieldUnit rUnit )
return OUString();
}
-namespace vcl
+namespace
{
FieldUnit StringToMetric(const OUString &rMetricString)
{
@@ -979,7 +979,7 @@ namespace vcl
static FieldUnit ImplMetricGetUnit(const OUString& rStr)
{
OUString aStr = ImplMetricGetUnitText(rStr);
- return vcl::StringToMetric(aStr);
+ return StringToMetric(aStr);
}
static FieldUnit ImplMap2FieldUnit( MapUnit meUnit, tools::Long& nDecDigits )