[Libreoffice-commits] core.git: vcl/inc vcl/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Nov 22 16:57:48 UTC 2019


 vcl/inc/units.hrc             |    2 ++
 vcl/source/control/field.cxx  |   13 +++++++++++--
 vcl/source/window/builder.cxx |   11 ++++++++++-
 3 files changed, 23 insertions(+), 3 deletions(-)

New commits:
commit e227d96bbc500afd810064eee64175b800bfc11f
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Nov 22 14:44:29 2019 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Nov 22 17:56:57 2019 +0100

    use prime symbol for foot
    
    Change-Id: Ieb1743b89a3c069d7b24cab0869294522ae2a6d7
    Reviewed-on: https://gerrit.libreoffice.org/83503
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/inc/units.hrc b/vcl/inc/units.hrc
index b13ad4476904..74c4496755e1 100644
--- a/vcl/inc/units.hrc
+++ b/vcl/inc/units.hrc
@@ -38,6 +38,8 @@ std::pair<const char*, FieldUnit> SV_FUNIT_STRINGS[] =
     { NC_("SV_FUNIT_STRINGS", "\""), FieldUnit::INCH },
     { NC_("SV_FUNIT_STRINGS", "in"), FieldUnit::INCH },
     { NC_("SV_FUNIT_STRINGS", "inch"), FieldUnit::INCH },
+    /* To translators: prime symbol for foot */
+    { NC_("SV_FUNIT_STRINGS", "′"), FieldUnit::FOOT },
     { NC_("SV_FUNIT_STRINGS", "'"), FieldUnit::FOOT },
     { NC_("SV_FUNIT_STRINGS", "ft"), FieldUnit::FOOT },
     { NC_("SV_FUNIT_STRINGS", "foot"), FieldUnit::FOOT },
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index 6307b9ae49d7..2aa7e85a402f 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -1045,7 +1045,7 @@ static OUString ImplMetricGetUnitText(const OUString& rStr)
     for (sal_Int32 i = rStr.getLength()-1; i >= 0; --i)
     {
         sal_Unicode c = rStr[i];
-        if ( (c == '\'') || (c == '\"') || (c == '%') || (c == 0x2033) || unicode::isAlpha(c) || unicode::isControl(c) )
+        if ( (c == '\'') || (c == '\"') || (c == '%') || (c == 0x2032) || (c == 0x2033) || unicode::isAlpha(c) || unicode::isControl(c) )
             aStr.insert(0, c);
         else
         {
@@ -1464,7 +1464,7 @@ OUString MetricFormatter::CreateFieldText( sal_Int64 nValue ) const
     else
     {
         OUString aSuffix = ImplMetricToString( meUnit );
-        if (meUnit != FieldUnit::NONE && meUnit != FieldUnit::DEGREE && meUnit != FieldUnit::INCH)
+        if (meUnit != FieldUnit::NONE && meUnit != FieldUnit::DEGREE && meUnit != FieldUnit::INCH && meUnit != FieldUnit::FOOT)
             aStr += " ";
         if (meUnit == FieldUnit::INCH)
         {
@@ -1474,6 +1474,15 @@ OUString MetricFormatter::CreateFieldText( sal_Int64 nValue ) const
             else
                 aSuffix = sDoublePrime;
         }
+        else if (meUnit == FieldUnit::FOOT)
+        {
+            OUString sPrime = u"\u2032";
+            if (aSuffix != "'" && aSuffix != sPrime)
+                aStr += " ";
+            else
+                aSuffix = sPrime;
+        }
+
         assert(meUnit != FieldUnit::PERCENT);
         aStr += aSuffix;
     }
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 3936d94026f7..ee6259d4c5d3 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -247,7 +247,7 @@ namespace weld
         {
             aStr = rLocaleData.getNum(nValue, nDecimalDigits, true, true);
             OUString aSuffix = MetricToString(m_eSrcUnit);
-            if (m_eSrcUnit != FieldUnit::NONE && m_eSrcUnit != FieldUnit::DEGREE && m_eSrcUnit != FieldUnit::INCH)
+            if (m_eSrcUnit != FieldUnit::NONE && m_eSrcUnit != FieldUnit::DEGREE && m_eSrcUnit != FieldUnit::INCH && m_eSrcUnit != FieldUnit::FOOT)
                 aStr += " ";
             if (m_eSrcUnit == FieldUnit::INCH)
             {
@@ -257,6 +257,15 @@ namespace weld
                 else
                     aSuffix = sDoublePrime;
             }
+            else if (m_eSrcUnit == FieldUnit::FOOT)
+            {
+                OUString sPrime = u"\u2032";
+                if (aSuffix != "'" && aSuffix != sPrime)
+                    aStr += " ";
+                else
+                    aSuffix = sPrime;
+            }
+
             assert(m_eSrcUnit != FieldUnit::PERCENT);
             aStr += aSuffix;
         }


More information about the Libreoffice-commits mailing list