[Libreoffice-commits] core.git: 2 commits - i18nutil/source sw/source vcl/source

Oliver-Rainer Wittmann orw at apache.org
Mon Jan 20 05:32:37 PST 2014


 i18nutil/source/utility/unicode.cxx |    2 +-
 sw/source/core/text/inftxt.hxx      |    1 -
 sw/source/core/text/portxt.cxx      |   10 ++++++++++
 vcl/source/control/field.cxx        |   11 ++++++++++-
 4 files changed, 21 insertions(+), 3 deletions(-)

New commits:
commit 6789e6de929c7685cf1573170534891aeffe5fa1
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date:   Mon Jan 20 10:57:12 2014 +0000

    Resolves: #i124039# assure correct line break for multi-lined Input Fields
    
    (cherry picked from commit 14e0270c3ebad9a1fb817fcfced2aa8ee2f3e3f0)
    
    Change-Id: If5664a5260e683cd5a80885b3f39b04f85de8db9

diff --git a/sw/source/core/text/inftxt.hxx b/sw/source/core/text/inftxt.hxx
index b6e40b7..3ce3972 100644
--- a/sw/source/core/text/inftxt.hxx
+++ b/sw/source/core/text/inftxt.hxx
@@ -594,7 +594,6 @@ public:
     inline void Right( const SwTwips nNew ) { nRight = nNew; }
     inline SwTwips First() const { return nFirst; }
     inline void First( const SwTwips nNew ) { nFirst = nNew; }
-    inline SwTwips CurrLeft() const { return (nLineStart ? nLeft : nFirst); }
     inline KSHORT RealWidth() const { return nRealWidth; }
     inline void RealWidth( const KSHORT nNew ) { nRealWidth = nNew; }
     inline KSHORT ForcedLeftMargin() const { return nForcedLeftMargin; }
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index 50767f1..bab1eb8 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -733,6 +733,12 @@ sal_Bool SwTxtInputFldPortion::Format( SwTxtFormatInfo &rInf )
         }
         else
         {
+            const sal_Int32 nFormerLineStart = rInf.GetLineStart();
+            if ( !mbContainsInputFieldStart )
+            {
+                rInf.SetLineStart( 0 );
+            }
+
             bRet = SwTxtPortion::Format( rInf );
 
             if ( mbContainsInputFieldEnd )
@@ -749,6 +755,10 @@ sal_Bool SwTxtInputFldPortion::Format( SwTxtFormatInfo &rInf )
                 // adjust portion length accordingly
                 SetLen( GetLen() + 1 );
             }
+            else
+            {
+                rInf.SetLineStart( nFormerLineStart );
+            }
         }
     }
 
commit 062e6f76ba26d2c0a54a476a1168202bae2322a7
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jan 20 13:31:17 2014 +0000

    Related: #i56998# use locale rules to format percentage
    
    Change-Id: I2cdeefc5a5a1ee970ee3da5191ceae28b58340a1

diff --git a/i18nutil/source/utility/unicode.cxx b/i18nutil/source/utility/unicode.cxx
index 56daacd..0fb6b72 100644
--- a/i18nutil/source/utility/unicode.cxx
+++ b/i18nutil/source/utility/unicode.cxx
@@ -955,7 +955,7 @@ OUString SAL_CALL unicode::formatPercent(double dNumber,
     }
 
     UnicodeString output;
-    xF->format(dNumber, output);
+    xF->format(dNumber/100, output);
     return OUString(reinterpret_cast<const sal_Unicode *>(output.getBuffer()),
         output.length());
 }
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index 9a0e569..b765ded 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -1423,13 +1423,22 @@ void MetricFormatter::SetValue( sal_Int64 nNewValue, FieldUnit eInUnit )
 
 OUString MetricFormatter::CreateFieldText( sal_Int64 nValue ) const
 {
+    //whether percent is separated from its number is locale
+    //specific, pawn it off to icu to decide
+    if (meUnit == FUNIT_PERCENT)
+    {
+        double dValue = nValue;
+        dValue /= ImplPower10(GetDecimalDigits());
+        return unicode::formatPercent(dValue, Application::GetSettings().GetUILanguageTag());
+    }
+
     OUString aStr = NumericFormatter::CreateFieldText( nValue );
 
     if( meUnit == FUNIT_CUSTOM )
         aStr += maCustomUnitText;
     else
     {
-        if (meUnit != FUNIT_NONE && meUnit != FUNIT_PERCENT && meUnit != FUNIT_DEGREE)
+        if (meUnit != FUNIT_NONE && meUnit != FUNIT_DEGREE)
             aStr += " ";
         aStr += ImplMetricToString( meUnit );
     }


More information about the Libreoffice-commits mailing list