[Libreoffice-commits] .: 13 commits - basic/source editeng/source sal/inc sc/source svl/inc svl/source svtools/source svx/source sw/source xmloff/inc xmloff/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sun Nov 18 17:59:59 PST 2012


 basic/source/runtime/runtime.cxx    |    4 
 basic/source/sbx/sbxdate.cxx        |    4 
 basic/source/sbx/sbxscan.cxx        |    2 
 editeng/source/items/flditem.cxx    |   29 
 sal/inc/rtl/ustrbuf.hxx             |   14 
 sc/source/filter/excel/xestyle.cxx  |   16 
 sc/source/filter/html/htmlpars.cxx  |    2 
 sc/source/ui/app/inputhdl.cxx       |   10 
 sc/source/ui/docshell/impex.cxx     |    7 
 sc/source/ui/formdlg/formula.cxx    |    6 
 sc/source/ui/view/output2.cxx       |   15 
 svl/inc/svl/nfkeytab.hxx            |    6 
 svl/inc/svl/zforlist.hxx            |   17 
 svl/inc/svl/zformat.hxx             |   26 
 svl/source/numbers/numfmuno.cxx     |   25 
 svl/source/numbers/zforfind.cxx     |   12 
 svl/source/numbers/zforlist.cxx     |  128 -
 svl/source/numbers/zformat.cxx      | 4308 +++++++++++++++++++-----------------
 svl/source/numbers/zforscan.cxx     | 3626 +++++++++++++++---------------
 svl/source/numbers/zforscan.hxx     |   82 
 svtools/source/control/fmtfield.cxx |   27 
 svx/source/items/numfmtsh.cxx       |   22 
 sw/source/core/fields/fldbas.cxx    |   16 
 sw/source/core/table/swtable.cxx    |    6 
 sw/source/ui/utlui/numfmtlb.cxx     |   12 
 xmloff/inc/xmloff/xmlnumfi.hxx      |    1 
 xmloff/source/style/xmlnumfe.cxx    |   41 
 xmloff/source/style/xmlnumfi.cxx    |   38 
 28 files changed, 4637 insertions(+), 3865 deletions(-)

New commits:
commit 731ba0ef925f2005ec54e856e0bc3c54a3874707
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Sun Nov 18 19:53:27 2012 -0600

    convert a GetOutputString variant to OUString
    
    Change-Id: I4bed439df3d4f4c0a87a6e406048de2af6995b89

diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 2bf2721..7146cd2 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -626,10 +626,14 @@ void ScDrawStringsVars::SetTextToWidthOrHash( ScBaseCell* pCell, long nWidth )
 
     long nMaxDigit = GetMaxDigitWidth();
     sal_uInt16 nNumDigits = static_cast<sal_uInt16>(nWidth / nMaxDigit);
-
-    if (!pNumFormat->GetOutputString(fVal, nNumDigits, aString))
+    OUString sTempOut(aString);
+    if (!pNumFormat->GetOutputString(fVal, nNumDigits, sTempOut))
+    {
+        aString = sTempOut;
         // Failed to get output string.  Bail out.
         return;
+    }
+    aString = sTempOut;
 
     sal_uInt8 nSignCount = 0, nDecimalCount = 0, nExpCount = 0;
     xub_StrLen nLen = aString.Len();
@@ -661,9 +665,14 @@ void ScDrawStringsVars::SetTextToWidthOrHash( ScBaseCell* pCell, long nWidth )
     {
         // Re-calculate.
         nNumDigits = static_cast<sal_uInt16>(nWidth / nMaxDigit);
-        if (!pNumFormat->GetOutputString(fVal, nNumDigits, aString))
+        OUString sTempOut(aString);
+        if (!pNumFormat->GetOutputString(fVal, nNumDigits, sTempOut))
+        {
+            aString = sTempOut;
             // Failed to get output string.  Bail out.
             return;
+        }
+        aString = sTempOut;
     }
 
     long nActualTextWidth = pOutput->pFmtDevice->GetTextWidth(aString);
diff --git a/svl/inc/svl/zformat.hxx b/svl/inc/svl/zformat.hxx
index 6e13b2d..430af33 100644
--- a/svl/inc/svl/zformat.hxx
+++ b/svl/inc/svl/zformat.hxx
@@ -245,7 +245,7 @@ public:
      * Get output string from a numeric value that fits the number of
      * characters specified.
      */
-    bool GetOutputString( double fNumber, sal_uInt16 nCharCount, String& rOutString ) const;
+    bool GetOutputString( double fNumber, sal_uInt16 nCharCount, OUString& rOutString ) const;
 
     bool GetOutputString( double fNumber, String& OutString, Color** ppColor );
     bool GetOutputString( OUString& sString, OUString& OutString, Color** ppColor );
@@ -569,7 +569,8 @@ private:
 
     // standard number output
     SVL_DLLPRIVATE void ImpGetOutputStandard( double& fNumber, String& OutString );
-    SVL_DLLPRIVATE void ImpGetOutputStdToPrecision( double& rNumber, String& rOutString, sal_uInt16 nPrecision ) const;
+    SVL_DLLPRIVATE void ImpGetOutputStandard( double& fNumber, OUString& OutString );
+    SVL_DLLPRIVATE void ImpGetOutputStdToPrecision( double& rNumber, OUString& rOutString, sal_uInt16 nPrecision ) const;
     // numbers in input line
     SVL_DLLPRIVATE void ImpGetOutputInputLine( double fNumber, String& OutString );
 
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index b691dba..52ae19c 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -2089,6 +2089,13 @@ void SvNumberformat::Build50Formatstring( String& rStr ) const
 
 void SvNumberformat::ImpGetOutputStandard(double& fNumber, String& OutString)
 {
+    OUString sTemp(OutString);
+    ImpGetOutputStandard(fNumber, sTemp);
+    OutString = sTemp;
+}
+
+void SvNumberformat::ImpGetOutputStandard(double& fNumber, OUString& OutString)
+{
     sal_uInt16 nStandardPrec = rScan.GetStandardPrec();
 
     if ( fabs(fNumber) > 1.0E15 )       // #58531# war E16
@@ -2104,7 +2111,7 @@ void SvNumberformat::ImpGetOutputStandard(double& fNumber, String& OutString)
     }
 }
 
-void SvNumberformat::ImpGetOutputStdToPrecision(double& rNumber, String& rOutString, sal_uInt16 nPrecision) const
+void SvNumberformat::ImpGetOutputStdToPrecision(double& rNumber, OUString& rOutString, sal_uInt16 nPrecision) const
 {
     // Make sure the precision doesn't go over the maximum allowable precision.
     nPrecision = ::std::min(UPPER_PRECISION, nPrecision);
@@ -2142,8 +2149,8 @@ void SvNumberformat::ImpGetOutputStdToPrecision(double& rNumber, String& rOutStr
     rOutString = ::rtl::math::doubleToUString( rNumber,
                                                rtl_math_StringFormat_F, nPrecision /*2*/,
                                                GetFormatter().GetNumDecimalSep().GetChar(0), true );
-    if (rOutString.GetChar(0) == '-' &&
-        comphelper::string::getTokenCount(rOutString, '0') == rOutString.Len())
+    if (rOutString[0] == (sal_Unicode)'-' &&
+        comphelper::string::getTokenCount(rOutString, '0') == rOutString.getLength())
     {
         rOutString = comphelper::string::stripStart(rOutString, '-');            // nicht -0
     }
@@ -2302,7 +2309,7 @@ sal_uLong SvNumberformat::ImpGGTRound(sal_uLong x, sal_uLong y)
 namespace {
 
 void lcl_GetOutputStringScientific(double fNumber, sal_uInt16 nCharCount,
-                                   const SvNumberFormatter& rFormatter, String& rOutString)
+                                   const SvNumberFormatter& rFormatter, OUString& rOutString)
 {
     bool bSign = ::rtl::math::isSignBitSet(fNumber);
 
@@ -2359,7 +2366,7 @@ sal_Int32 SvNumberformat::GetForcedDenominatorForType( sal_uInt16 nNumFor ) cons
     return lcl_GetForcedDenominator( rInfo, nAnz );
 }
 
-bool SvNumberformat::GetOutputString(double fNumber, sal_uInt16 nCharCount, String& rOutString) const
+bool SvNumberformat::GetOutputString(double fNumber, sal_uInt16 nCharCount, OUString& rOutString) const
 {
     using namespace std;
 
@@ -2401,7 +2408,7 @@ bool SvNumberformat::GetOutputString(double fNumber, sal_uInt16 nCharCount, Stri
         --nPrec;
     }
     ImpGetOutputStdToPrecision(fNumber, rOutString, nPrec);
-    if (rOutString.Len() > nCharCount)
+    if (rOutString.getLength() > nCharCount)
     {
         // String still wider than desired.  Switch to scientific notation.
         lcl_GetOutputStringScientific(fNumber, nCharCount, GetFormatter(), rOutString);
@@ -2455,7 +2462,11 @@ bool SvNumberformat::GetOutputString(double fNumber,
                     }
                     fNumber = -fNumber;
                 }
-                ImpGetOutputStdToPrecision(fNumber, OutString, 10); // Use 10 decimals for general 'unlimited' format.
+                {
+                    OUString sTemp(OutString);
+                    ImpGetOutputStdToPrecision(fNumber, sTemp, 10); // Use 10 decimals for general 'unlimited' format.
+                    OutString = sTemp;
+                }
                 if (fNumber < EXP_LOWER_BOUND)
                 {
                     xub_StrLen nLen = OutString.Len();
commit 271b11a3d56ba0c5f542a142ab859a0819530dba
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Sun Nov 18 18:55:49 2012 -0600

    migrate one GetOutputString variatn to OUString
    
    that create some clutter on some of the caller, this will
    be resolved as things progress to ward OUString only
    This is done that way to be incremental and avoid creating too big patches
    
    Change-Id: I4a881d85cc2ee1eb53bc0c0d0902838b1d3720a2

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 9b92164..172dd54 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -1360,8 +1360,14 @@ static String lcl_Calculate( const String& rFormula, ScDocument* pDoc, const ScA
                 String aStr = pCell->GetString();
                 sal_uLong nFormat = aFormatter.GetStandardFormat(
                                 pCell->GetFormatType(), ScGlobal::eLnge);
-                aFormatter.GetOutputString( aStr, nFormat,
-                                            aValue, &pColor );
+                {
+                OUString sTempIn(aStr);
+                OUString sTempOut(aValue);
+                aFormatter.GetOutputString( sTempIn, nFormat,
+                                            sTempOut, &pColor );
+                aStr = sTempIn;
+                aValue = sTempOut;
+                }
 
                 aValue.Insert('"',0);   // in Anfuehrungszeichen
                 aValue+='"';
diff --git a/sc/source/ui/formdlg/formula.cxx b/sc/source/ui/formdlg/formula.cxx
index b969192..4c01577 100644
--- a/sc/source/ui/formdlg/formula.cxx
+++ b/sc/source/ui/formdlg/formula.cxx
@@ -367,11 +367,13 @@ bool ScFormulaDlg::calculateValue( const String& rStrExp, String& rStrResult )
         }
         else
         {
-            String aStr = pFCell->GetString();
+            OUString aStr = pFCell->GetString();
+            OUString sTempOut(rStrResult);
             sal_uLong nFormat = aFormatter.GetStandardFormat(
                             pFCell->GetFormatType(), ScGlobal::eLnge);
             aFormatter.GetOutputString( aStr, nFormat,
-                                        rStrResult, &pColor );
+                                        sTempOut, &pColor );
+            rStrResult = sTempOut;
         }
 
         ScRange aTestRange;
diff --git a/svl/inc/svl/zforlist.hxx b/svl/inc/svl/zforlist.hxx
index 4c7b949..71e6bba 100644
--- a/svl/inc/svl/zforlist.hxx
+++ b/svl/inc/svl/zforlist.hxx
@@ -490,13 +490,6 @@ public:
     /** Format a string according to a format index, return string and color.
         Formats only if the format code is of type text or the 4th subcode
         of a format code is specified, otherwise sOutString will be == "" */
-    void GetOutputString( String& sString, sal_uInt32 nFIndex,
-                          String& sOutString, Color** ppColor, bool bUseStarFormat = false );
-
-
-    /** Format a string according to a format index, return string and color.
-        Formats only if the format code is of type text or the 4th subcode
-        of a format code is specified, otherwise sOutString will be == "" */
     void GetOutputString( OUString& sString, sal_uInt32 nFIndex,
                           OUString& sOutString, Color** ppColor, bool bUseStarFormat = false );
 
diff --git a/svl/inc/svl/zformat.hxx b/svl/inc/svl/zformat.hxx
index 5abec42..6e13b2d 100644
--- a/svl/inc/svl/zformat.hxx
+++ b/svl/inc/svl/zformat.hxx
@@ -248,7 +248,7 @@ public:
     bool GetOutputString( double fNumber, sal_uInt16 nCharCount, String& rOutString ) const;
 
     bool GetOutputString( double fNumber, String& OutString, Color** ppColor );
-    bool GetOutputString( String& sString, String& OutString, Color** ppColor );
+    bool GetOutputString( OUString& sString, OUString& OutString, Color** ppColor );
 
     // True if type text
     bool IsTextFormat() const { return (eType & NUMBERFORMAT_TEXT) != 0; }
@@ -388,6 +388,10 @@ public:
         the width of character c for underscore formats */
     static xub_StrLen InsertBlanks( String& r, xub_StrLen nPos, sal_Unicode c );
 
+    /** Insert the number of blanks into the string that is needed to simulate
+        the width of character c for underscore formats */
+    static sal_Int32 InsertBlanks( OUStringBuffer& r, sal_Int32 nPos, sal_Unicode c );
+
     /// One of YMD,DMY,MDY if date format
     DateFormat GetDateOrder() const;
 
diff --git a/svl/source/numbers/numfmuno.cxx b/svl/source/numbers/numfmuno.cxx
index 80ec23a..f3041b0 100644
--- a/svl/source/numbers/numfmuno.cxx
+++ b/svl/source/numbers/numfmuno.cxx
@@ -253,28 +253,31 @@ util::Color SAL_CALL SvNumberFormatterServiceObj::queryColorForNumber( sal_Int32
     return nRet;
 }
 
-rtl::OUString SAL_CALL SvNumberFormatterServiceObj::formatString( sal_Int32 nKey,
-                                    const rtl::OUString& aString ) throw(uno::RuntimeException)
+OUString SAL_CALL SvNumberFormatterServiceObj::formatString( sal_Int32 nKey,
+                                                             const OUString& aString )
+    throw(uno::RuntimeException)
 {
     ::osl::MutexGuard aGuard( m_aMutex );
 
-    String aRet;
+    OUString aRet;
     SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL;
     if (pFormatter)
     {
-        String aTemp = aString;
+        OUString aTemp = aString;
         Color* pColor = NULL;
         pFormatter->GetOutputString(aTemp, nKey, aRet, &pColor);
     }
     else
+    {
         throw uno::RuntimeException();
-
+    }
     return aRet;
 }
 
 util::Color SAL_CALL SvNumberFormatterServiceObj::queryColorForString( sal_Int32 nKey,
-                                    const rtl::OUString& aString,util::Color aDefaultColor )
-                            throw(uno::RuntimeException)
+                                                                       const OUString& aString,
+                                                                       util::Color aDefaultColor )
+    throw(uno::RuntimeException)
 {
     ::osl::MutexGuard aGuard( m_aMutex );
 
@@ -282,16 +285,20 @@ util::Color SAL_CALL SvNumberFormatterServiceObj::queryColorForString( sal_Int32
     SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL;
     if (pFormatter)
     {
-        String aTemp = aString;
-        String aStr;
+        OUString aTemp = aString;
+        OUString aStr;
         Color* pColor = NULL;
         pFormatter->GetOutputString(aTemp, nKey, aStr, &pColor);
         if (pColor)
+        {
             nRet = pColor->GetColor();
+        }
         // sonst Default behalten
     }
     else
+    {
         throw uno::RuntimeException();
+    }
 
     return nRet;
 }
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 2e1c20d..ae02773 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -1481,15 +1481,17 @@ void SvNumberFormatter::GetOutputString(const double& fOutNumber,
         pFormat->SetStarFormatSupport( false );
 }
 
-void SvNumberFormatter::GetOutputString(String& sString,
+void SvNumberFormatter::GetOutputString(OUString& sString,
                                         sal_uInt32 nFIndex,
-                                        String& sOutString,
+                                        OUString& sOutString,
                                         Color** ppColor,
                                         bool bUseStarFormat )
 {
     SvNumberformat* pFormat = GetFormatEntry( nFIndex );
     if (!pFormat)
+    {
         pFormat = GetFormatEntry(ZF_STANDARD_TEXT);
+    }
     if (!pFormat->IsTextFormat() && !pFormat->HasTextFormat())
     {
         *ppColor = NULL;
@@ -1499,10 +1501,14 @@ void SvNumberFormatter::GetOutputString(String& sString,
     {
         ChangeIntl(pFormat->GetLanguage());
         if ( bUseStarFormat )
+        {
            pFormat->SetStarFormatSupport( true );
+        }
         pFormat->GetOutputString(sString, sOutString, ppColor);
         if ( bUseStarFormat )
+        {
            pFormat->SetStarFormatSupport( false );
+        }
     }
 }
 
@@ -1530,35 +1536,6 @@ void SvNumberFormatter::GetOutputString(const double& fOutNumber,
     sOutString = aOutString;
 }
 
-void SvNumberFormatter::GetOutputString(OUString& sString,
-                                        sal_uInt32 nFIndex,
-                                        OUString& sOutString,
-                                        Color** ppColor,
-                                        bool bUseStarFormat )
-{
-    SvNumberformat* pFormat = GetFormatEntry( nFIndex );
-    if (!pFormat)
-        pFormat = GetFormatEntry(ZF_STANDARD_TEXT);
-    if (!pFormat->IsTextFormat() && !pFormat->HasTextFormat())
-    {
-        *ppColor = NULL;
-        sOutString = sString;
-    }
-    else
-    {
-        ChangeIntl(pFormat->GetLanguage());
-        String aString = sString;
-        String aOutString = sOutString;
-        if ( bUseStarFormat )
-           pFormat->SetStarFormatSupport( true );
-        pFormat->GetOutputString(aString, aOutString, ppColor);
-        if ( bUseStarFormat )
-           pFormat->SetStarFormatSupport( false );
-        sString = aString;
-        sOutString = aOutString;
-    }
-}
-
 bool SvNumberFormatter::GetPreviewString(const String& sFormatString,
                                          double fPreviewNumber,
                                          String& sOutString,
@@ -1723,19 +1700,26 @@ bool SvNumberFormatter::GetPreviewString( const String& sFormatString,
                                                   eLnge);
     if (nCheckPos == 0)                          // String ok
     {
-        String aNonConstPreview( sPreviewString);
+        OUString aNonConstPreview( sPreviewString);
+        OUString sTemp;
         // May have to create standard formats for this locale.
         sal_uInt32 CLOffset = ImpGenerateCL(eLnge);
         nKey = ImpIsEntry( p_Entry->GetFormatstring(), CLOffset, eLnge);
         if (nKey != NUMBERFORMAT_ENTRY_NOT_FOUND)       // already present
-            GetOutputString( aNonConstPreview, nKey, sOutString, ppColor);
+        {
+            GetOutputString( aNonConstPreview, nKey, sTemp, ppColor);
+            sOutString = sTemp;
+        }
         else
         {
             // If the format is valid but not a text format and does not
             // include a text subformat, an empty string would result. Same as
             // in SvNumberFormatter::GetOutputString()
             if (p_Entry->IsTextFormat() || p_Entry->HasTextFormat())
-                p_Entry->GetOutputString( aNonConstPreview, sOutString, ppColor);
+            {
+                p_Entry->GetOutputString( aNonConstPreview, sTemp, ppColor);
+                sOutString = sTemp;
+            }
             else
             {
                 *ppColor = NULL;
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index ce0a35d..b691dba 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -101,6 +101,23 @@ xub_StrLen SvNumberformat::InsertBlanks( String& r, xub_StrLen nPos, sal_Unicode
     return nPos;
 }
 
+sal_Int32 SvNumberformat::InsertBlanks( OUStringBuffer& r, sal_Int32 nPos, sal_Unicode c )
+{
+    if( c >= 32 )
+    {
+        int n = 2;   // Default fuer Zeichen > 128 (HACK!)
+        if( c <= 127 )
+        {
+            n = (int)cCharWidths[ c - 32 ];
+        }
+        while( n-- )
+        {
+            r.insert( nPos++, (sal_Unicode)' ');
+        }
+    }
+    return nPos;
+}
+
 static long GetPrecExp( double fAbsVal )
 {
     DBG_ASSERT( fAbsVal > 0.0, "GetPrecExp: fAbsVal <= 0.0" );
@@ -2190,11 +2207,11 @@ short SvNumberformat::ImpCheckCondition(double& fNumber,
     }
 }
 
-bool SvNumberformat::GetOutputString(String& sString,
-                                     String& OutString,
+bool SvNumberformat::GetOutputString(OUString& sString,
+                                     OUString& OutString,
                                      Color** ppColor)
 {
-    OutString.Erase();
+    OUStringBuffer sOutBuff;
     sal_uInt16 nIx;
     if (eType & NUMBERFORMAT_TEXT)
     {
@@ -2211,9 +2228,9 @@ bool SvNumberformat::GetOutputString(String& sString,
     }
     *ppColor = NumFor[nIx].GetColor();
     const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info();
+    bool bRes = false;
     if (rInfo.eScannedType == NUMBERFORMAT_TEXT)
     {
-        bool bRes = false;
         const sal_uInt16 nAnz = NumFor[nIx].GetCount();
         for (sal_uInt16 i = 0; i < nAnz; i++)
         {
@@ -2222,26 +2239,26 @@ bool SvNumberformat::GetOutputString(String& sString,
             case NF_SYMBOLTYPE_STAR:
                 if( bStarFlag )
                 {
-                    OutString += (sal_Unicode) 0x1B;
-                    OutString += rInfo.sStrArray[i][1];
+                    sOutBuff.append((sal_Unicode) 0x1B);
+                    sOutBuff.append(rInfo.sStrArray[i][1]);
                     bRes = true;
                 }
                 break;
             case NF_SYMBOLTYPE_BLANK:
-                InsertBlanks( OutString, OutString.Len(),
+                InsertBlanks( sOutBuff, sOutBuff.getLength(),
                               rInfo.sStrArray[i][1] );
                 break;
             case NF_KEY_GENERAL :   // #77026# "General" is the same as "@"
             case NF_SYMBOLTYPE_DEL :
-                OutString += sString;
+                sOutBuff.append(sString);
                 break;
             default:
-                OutString += rInfo.sStrArray[i];
+                sOutBuff.append(rInfo.sStrArray[i]);
             }
         }
-        return bRes;
     }
-    return false;
+    OutString = sOutBuff.makeStringAndClear();
+    return bRes;
 }
 
 sal_uLong SvNumberformat::ImpGGT(sal_uLong x, sal_uLong y)
diff --git a/svtools/source/control/fmtfield.cxx b/svtools/source/control/fmtfield.cxx
index 3bfa00a..2d1445f 100644
--- a/svtools/source/control/fmtfield.cxx
+++ b/svtools/source/control/fmtfield.cxx
@@ -413,9 +413,17 @@ void FormattedField::SetTextFormatted(const OUString& rStr)
     sal_uInt32 nTempFormatKey = static_cast< sal_uInt32 >( m_nFormatKey );
     if( IsUsingInputStringForFormatting() &&
         ImplGetFormatter()->IsNumberFormat(m_sCurrentTextValue, nTempFormatKey, dNumber) )
+    {
         ImplGetFormatter()->GetInputLineString(dNumber, m_nFormatKey, sFormatted);
+    }
     else
-        ImplGetFormatter()->GetOutputString(m_sCurrentTextValue, m_nFormatKey, sFormatted, &m_pLastOutputColor);
+    {
+        OUString sTempIn(m_sCurrentTextValue);
+        OUString sTempOut(sFormatted);
+        ImplGetFormatter()->GetOutputString(sTempIn, m_nFormatKey, sTempOut, &m_pLastOutputColor);
+        m_sCurrentTextValue = sTempIn;
+        sFormatted = sTempOut;
+    }
 
     // calculate the new selection
     Selection aSel(GetSelection());
@@ -956,14 +964,23 @@ void FormattedField::ImplSetValue(double dVal, sal_Bool bForce)
         String sTemp;
         ImplGetFormatter()->GetOutputString(dVal, 0, sTemp, &m_pLastOutputColor);
         // dann den String entsprechend dem Text-Format
-        ImplGetFormatter()->GetOutputString(sTemp, m_nFormatKey, sNewText, &m_pLastOutputColor);
+        {
+        OUString sTempIn(m_sCurrentTextValue);
+        OUString sTempOut;
+        ImplGetFormatter()->GetOutputString(sTempIn, m_nFormatKey, sTempOut, &m_pLastOutputColor);
+        sNewText = sTempOut;
+        }
     }
     else
     {
         if( IsUsingInputStringForFormatting())
+        {
             ImplGetFormatter()->GetInputLineString(dVal, m_nFormatKey, sNewText);
+        }
         else
+        {
             ImplGetFormatter()->GetOutputString(dVal, m_nFormatKey, sNewText, &m_pLastOutputColor);
+        }
     }
 
     ImplSetTextImpl(sNewText, NULL);
diff --git a/svx/source/items/numfmtsh.cxx b/svx/source/items/numfmtsh.cxx
index c249531..5e12eb8 100644
--- a/svx/source/items/numfmtsh.cxx
+++ b/svx/source/items/numfmtsh.cxx
@@ -449,11 +449,19 @@ void SvxNumberFormatShell::MakePreviewString( const String& rFormatStr,
         bool bUseText = ( eValType == SVX_VALUE_TYPE_STRING ||
                             ( aValStr.Len() && ( pFormatter->GetType(nExistingFormat) & NUMBERFORMAT_TEXT ) ) );
         if ( bUseText )
-            pFormatter->GetOutputString( aValStr, nExistingFormat,
-                                         rPreviewStr, &rpFontColor );
+        {
+            OUString sTempIn(aValStr);
+            OUString sTempOut(rPreviewStr);
+            pFormatter->GetOutputString( sTempIn, nExistingFormat,
+                                         sTempOut, &rpFontColor );
+            aValStr = sTempIn;
+            rPreviewStr = sTempOut;
+        }
         else
+        {
             pFormatter->GetOutputString( nValNum, nExistingFormat,
                                          rPreviewStr, &rpFontColor, bUseStarFormat );
+        }
     }
 }
 
@@ -1150,9 +1158,17 @@ void SvxNumberFormatShell::GetPreviewString_Impl( String& rString, Color*& rpCol
                         ( aValStr.Len() && ( pFormatter->GetType(nCurFormatKey) & NUMBERFORMAT_TEXT ) ) );
 
     if ( bUseText )
-        pFormatter->GetOutputString( aValStr, nCurFormatKey, rString, &rpColor );
+    {
+        OUString sTempIn(aValStr);
+        OUString sTempOut(rString);
+        pFormatter->GetOutputString( sTempIn, nCurFormatKey, sTempOut, &rpColor );
+        aValStr = sTempIn;
+        rString = sTempOut;
+    }
     else
+    {
         pFormatter->GetOutputString( nValNum, nCurFormatKey, rString, &rpColor, bUseStarFormat );
+    }
 }
 
 // -----------------------------------------------------------------------
diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx
index 38bcee9..f2439f1 100644
--- a/sw/source/core/fields/fldbas.cxx
+++ b/sw/source/core/fields/fldbas.cxx
@@ -511,11 +511,15 @@ String SwValueFieldType::ExpandValue( const double& rVal,
     {
         String sValue;
         DoubleToString(sValue, rVal, nFmtLng);
-        pFormatter->GetOutputString(sValue, nFmt, sExpand, &pCol);
+        OUString sTempIn(sValue);
+        OUString sTempOut(sExpand);
+        pFormatter->GetOutputString(sTempIn, nFmt, sTempOut, &pCol);
+        sExpand = sTempOut;
     }
     else
+    {
         pFormatter->GetOutputString(rVal, nFmt, sExpand, &pCol);
-
+    }
     return sExpand;
 }
 
@@ -748,11 +752,15 @@ String SwFormulaField::GetExpandedFormula() const
         {
             String sValue;
             ((SwValueFieldType *)GetTyp())->DoubleToString(sValue, GetValue(), nFmt);
-            pFormatter->GetOutputString(sValue, nFmt, sFormattedValue, &pCol);
+            OUString sTempOut(sFormattedValue);
+            OUString sTempIn(sValue);
+            pFormatter->GetOutputString(sTempIn, nFmt, sTempOut, &pCol);
+            sFormattedValue = sTempOut;
         }
         else
+        {
             pFormatter->GetOutputString(GetValue(), nFmt, sFormattedValue, &pCol);
-
+        }
         return sFormattedValue;
     }
     else
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index b790bbe..413b7ef 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -2148,7 +2148,11 @@ void ChgNumToText( SwTableBox& rBox, sal_uLong nFmt )
         {
             // special text format:
             String sTmp, sTxt( pTNd->GetTxt() );
-            pDoc->GetNumberFormatter()->GetOutputString( sTxt, nFmt, sTmp, &pCol );
+            OUString sTempIn(sTxt);
+            OUString sTempOut;
+            pDoc->GetNumberFormatter()->GetOutputString( sTempIn, nFmt, sTempOut, &pCol );
+            sTxt = sTempIn;
+            sTmp = sTempOut;
             if( sTxt != sTmp )
             {
                 // exchange text
diff --git a/sw/source/ui/utlui/numfmtlb.cxx b/sw/source/ui/utlui/numfmtlb.cxx
index 8f3679f..71def9e 100644
--- a/sw/source/ui/utlui/numfmtlb.cxx
+++ b/sw/source/ui/utlui/numfmtlb.cxx
@@ -242,8 +242,10 @@ void NumFormatListBox::SetFormatType(const short nFormatType)
                     sValue = pFmt->GetFormatstring();
             else if( nFormatType == NUMBERFORMAT_TEXT )
             {
-                String sTxt(rtl::OUString("\"ABC\""));
-                pFormatter->GetOutputString( sTxt, nFormat, sValue, &pCol);
+                OUString sTxt("\"ABC\"");
+                OUString sTempOut(sValue);
+                pFormatter->GetOutputString( sTxt, nFormat, sTempOut, &pCol);
+                sValue = sTempOut;
             }
 
             if (nFormat != nSysNumFmt       &&
@@ -317,8 +319,10 @@ void NumFormatListBox::SetDefFormat(const sal_uLong nDefFmt)
 
     if (nType == NUMBERFORMAT_TEXT)
     {
-        String sTxt(rtl::OUString("\"ABC\""));
-        pFormatter->GetOutputString(sTxt, nDefFmt, sValue, &pCol);
+        OUString sTxt("\"ABC\"");
+        OUString sTempOut(sValue);
+        pFormatter->GetOutputString(sTxt, nDefFmt, sTempOut, &pCol);
+        sValue = sTempOut;
     }
     else
         pFormatter->GetOutputString(fValue, nDefFmt, sValue, &pCol);
commit cc63555fd02217e3b68caccfa5c8a0171aca149c
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Sun Nov 18 14:01:16 2012 -0600

    PutEntry familly of functions use consistent pairing OUString/sal_Int32
    
    Change-Id: I23ae9d3e8bf71ef9ece75ea013d18c36ab2e69d4

diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index 3c2c661..4825263 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -373,7 +373,7 @@ void SbiInstance::PrepareNumberFormatter( SvNumberFormatter*& rpNumberFormatter,
 
     rpNumberFormatter = new SvNumberFormatter( xFactory, eLangType );
 
-    sal_uInt16 nCheckPos = 0; short nType;
+    sal_Int32 nCheckPos = 0; short nType;
     rnStdTimeIdx = rpNumberFormatter->GetStandardFormat( NUMBERFORMAT_TIME, eLangType );
 
     // the formatter's standard templates have only got a two-digit date
@@ -393,7 +393,7 @@ void SbiInstance::PrepareNumberFormatter( SvNumberFormatter*& rpNumberFormatter,
     default:  aDateStr = "MM.TT.JJJJ"; break;
     }
     rpNumberFormatter->PutandConvertEntry( aDateStr, nCheckPos, nType,
-        rnStdDateIdx, LANGUAGE_GERMAN, eLangType );
+                                           rnStdDateIdx, LANGUAGE_GERMAN, eLangType );
     nCheckPos = 0;
     OUString aStrHHMMSS(" HH:MM:SS");
     aDateStr += aStrHHMMSS;
diff --git a/basic/source/sbx/sbxdate.cxx b/basic/source/sbx/sbxdate.cxx
index cc6aedc..7c01827 100644
--- a/basic/source/sbx/sbxdate.cxx
+++ b/basic/source/sbx/sbxdate.cxx
@@ -104,7 +104,7 @@ double ImpGetDate( const SbxValues* p )
             pFormatter = new SvNumberFormatter( xFactory, eLangType );
 
             sal_uInt32 nIndex;
-            sal_uInt16 nCheckPos = 0;
+            sal_Int32 nCheckPos = 0;
             short nType = 127;
 
             // Default templates of the formatter have only two-digit
@@ -277,7 +277,7 @@ start:
             pFormatter = new SvNumberFormatter( xFactory, eLangType );
 
             sal_uInt32 nIndex;
-            sal_uInt16 nCheckPos = 0;
+            sal_Int32 nCheckPos = 0;
             short nType;
 
             SvtSysLocale aSysLocale;
diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx
index 3257354..111c8b3 100644
--- a/basic/source/sbx/sbxscan.cxx
+++ b/basic/source/sbx/sbxscan.cxx
@@ -739,7 +739,7 @@ void SbxValue::Format( OUString& rRes, const OUString* pFmt ) const
         // number format, use SvNumberFormatter to handle it.
         if( bSuccess )
         {
-            sal_uInt16 nCheckPos = 0;
+            sal_Int32 nCheckPos = 0;
             short nType;
             OUString aFmtStr = *pFmt;
             VbaFormatInfo* pInfo = getFormatInfo( aFmtStr );
diff --git a/editeng/source/items/flditem.cxx b/editeng/source/items/flditem.cxx
index a26f533..c9eebe6 100644
--- a/editeng/source/items/flditem.cxx
+++ b/editeng/source/items/flditem.cxx
@@ -838,39 +838,42 @@ rtl::OUString SvxExtTimeField::GetFormatted( Time& aTime, SvxTimeFormat eFormat,
     {
         case SVXTIMEFORMAT_12_HM:
             nFormatKey = rFormatter.GetFormatIndex( NF_TIME_HHMMAMPM, eLang );
-        break;
+            break;
         case SVXTIMEFORMAT_12_HMSH:
-        {   // no builtin format available, try to insert or reuse
-            rtl::OUString aFormatCode( RTL_CONSTASCII_USTRINGPARAM( "HH:MM:SS.00 AM/PM" ) );
-            xub_StrLen nCheckPos;
+        {
+            // no builtin format available, try to insert or reuse
+            OUString aFormatCode( RTL_CONSTASCII_USTRINGPARAM( "HH:MM:SS.00 AM/PM" ) );
+            sal_Int32 nCheckPos;
             short nType;
-            rFormatter.PutandConvertEntry( aFormatCode,
-                nCheckPos, nType, nFormatKey, LANGUAGE_ENGLISH_US, eLang );
+            rFormatter.PutandConvertEntry( aFormatCode, nCheckPos, nType,
+                                           nFormatKey, LANGUAGE_ENGLISH_US, eLang );
             DBG_ASSERT( nCheckPos == 0, "SVXTIMEFORMAT_12_HMSH: could not insert format code" );
             if ( nCheckPos )
+            {
                 nFormatKey = rFormatter.GetFormatIndex( NF_TIME_HH_MMSS00, eLang );
+            }
+            break;
         }
-        break;
         case SVXTIMEFORMAT_24_HM:
             nFormatKey = rFormatter.GetFormatIndex( NF_TIME_HHMM, eLang );
-        break;
+            break;
         case SVXTIMEFORMAT_24_HMSH:
             nFormatKey = rFormatter.GetFormatIndex( NF_TIME_HH_MMSS00, eLang );
-        break;
+            break;
         case SVXTIMEFORMAT_12_HMS:
             nFormatKey = rFormatter.GetFormatIndex( NF_TIME_HHMMSSAMPM, eLang );
-        break;
+            break;
         case SVXTIMEFORMAT_24_HMS:
             nFormatKey = rFormatter.GetFormatIndex( NF_TIME_HHMMSS, eLang );
-        break;
+            break;
         case SVXTIMEFORMAT_STANDARD:
         default:
             nFormatKey = rFormatter.GetStandardFormat( NUMBERFORMAT_TIME, eLang );
     }
 
     double fFracTime = aTime.GetTimeInDays();
-    rtl::OUString aStr;
-       Color* pColor = NULL;
+    OUString aStr;
+    Color* pColor = NULL;
     rFormatter.GetOutputString( fFracTime, nFormatKey, aStr, &pColor );
     return aStr;
 }
diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index d5ad5e7..a60fa55 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -2251,7 +2251,7 @@ void ScHTMLTable::DataOn( const ImportInfo& rInfo )
                     nNumberFormat = GetFormatTable()->GetEntryKey(aNumFmt);
                     if (nNumberFormat == NUMBERFORMAT_ENTRY_NOT_FOUND)
                     {
-                        xub_StrLen nErrPos  = 0;
+                        sal_Int32 nErrPos  = 0;
                         short nDummy;
                         bool bValidFmt = GetFormatTable()->PutEntry(aNumFmt, nErrPos, nDummy, nNumberFormat);
                         if (!bValidFmt)
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 6e65a15..3d1d391 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -1898,12 +1898,11 @@ bool ScImportExport::Sylk2Doc( SvStream& rStrm )
                     aCode = aCode.replaceAll(";;", ";");
                     // get rid of Xcl escape characters
                     aCode = aCode.replaceAll(rtl::OUString(static_cast<sal_Unicode>(0x1b)), rtl::OUString());
-                    xub_StrLen nCheckPos;
+                    sal_Int32 nCheckPos;
                     short nType;
                     sal_uInt32 nKey;
-                    pDoc->GetFormatTable()->PutandConvertEntry(
-                        aCode, nCheckPos, nType, nKey, LANGUAGE_ENGLISH_US,
-                        ScGlobal::eLnge );
+                    pDoc->GetFormatTable()->PutandConvertEntry( aCode, nCheckPos, nType, nKey,
+                                                                LANGUAGE_ENGLISH_US, ScGlobal::eLnge );
                     if ( nCheckPos )
                         nKey = 0;
                     aFormats.push_back( nKey );
diff --git a/svl/inc/svl/zforlist.hxx b/svl/inc/svl/zforlist.hxx
index ea40a50..4c7b949 100644
--- a/svl/inc/svl/zforlist.hxx
+++ b/svl/inc/svl/zforlist.hxx
@@ -395,7 +395,7 @@ public:
     bool PutEntry( String& rString, xub_StrLen& nCheckPos, short& nType, sal_uInt32& nKey,
                   LanguageType eLnge = LANGUAGE_DONTKNOW );
 
-    bool PutEntry( OUString& rString, xub_StrLen& nCheckPos, short& nType, sal_uInt32& nKey,
+    bool PutEntry( OUString& rString, sal_Int32& nCheckPos, short& nType, sal_uInt32& nKey,
                   LanguageType eLnge = LANGUAGE_DONTKNOW );
 
     /** Same as <method>PutEntry</method> but the format code string is
@@ -405,7 +405,7 @@ public:
                              short& nType, sal_uInt32& nKey,
                              LanguageType eLnge, LanguageType eNewLnge );
 
-    bool PutandConvertEntry( OUString& rString, xub_StrLen& nCheckPos,
+    bool PutandConvertEntry( OUString& rString, sal_Int32& nCheckPos,
                              short& nType, sal_uInt32& nKey,
                              LanguageType eLnge, LanguageType eNewLnge );
 
@@ -413,6 +413,10 @@ public:
          is considered to be of the System language/country eLnge and is
         converted to another System language/country eNewLnge. In this case
          the automatic currency is converted too. */
+    bool PutandConvertEntrySystem( OUString& rString, sal_Int32& nCheckPos,
+                             short& nType, sal_uInt32& nKey,
+                             LanguageType eLnge, LanguageType eNewLnge );
+
     bool PutandConvertEntrySystem( String& rString, xub_StrLen& nCheckPos,
                              short& nType, sal_uInt32& nKey,
                              LanguageType eLnge, LanguageType eNewLnge );
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 60726af..2e1c20d 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -416,29 +416,39 @@ void SvNumberFormatter::ReplaceSystemCL( LanguageType eOldLanguage )
         SvNumberformat* pOldEntry = aOldTable.begin()->second;
         aOldTable.erase( nKey );
         String aString( pOldEntry->GetFormatstring() );
-        xub_StrLen nCheckPos = STRING_NOTFOUND;
 
         // Same as PutEntry() but assures key position even if format code is
         // a duplicate. Also won't mix up any LastInsertKey.
         ChangeIntl( eOldLanguage );
         LanguageType eLge = eOldLanguage;   // ConvertMode changes this
         bool bCheck = false;
+        xub_StrLen nCheckPos;
         SvNumberformat* pNewEntry = new SvNumberformat( aString, pFormatScanner,
-            pStringScanner, nCheckPos, eLge );
+                                                        pStringScanner, nCheckPos, eLge );
         if ( nCheckPos != 0 )
+        {
             delete pNewEntry;
+        }
         else
         {
             short eCheckType = pNewEntry->GetType();
             if ( eCheckType != NUMBERFORMAT_UNDEFINED )
+            {
                 pNewEntry->SetType( eCheckType | NUMBERFORMAT_DEFINED );
+            }
             else
+            {
                 pNewEntry->SetType( NUMBERFORMAT_DEFINED );
+            }
 
             if ( !aFTable.insert( make_pair( nKey, pNewEntry) ).second )
+            {
                 delete pNewEntry;
+            }
             else
+            {
                 bCheck = true;
+            }
         }
         DBG_ASSERT( bCheck, "SvNumberFormatter::ReplaceSystemCL: couldn't convert" );
         (void)bCheck;
@@ -486,6 +496,7 @@ bool SvNumberFormatter::PutEntry(String& rString,
                                                  pStringScanner,
                                                  nCheckPos,
                                                  eLge);
+
     if (nCheckPos == 0)                         // Format ok
     {                                           // Type comparison:
         short eCheckType = p_Entry->GetType();
@@ -532,14 +543,16 @@ bool SvNumberFormatter::PutEntry(String& rString,
     return bCheck;
 }
 
-bool SvNumberFormatter::PutEntry(
-    OUString& rString, xub_StrLen& nCheckPos, short& nType, sal_uInt32& nKey,
-    LanguageType eLnge)
+bool SvNumberFormatter::PutEntry(OUString& rString, sal_Int32& nCheckPos32,
+                                 short& nType, sal_uInt32& nKey,
+                                 LanguageType eLnge)
 {
     // Wrapper to allow OUString to be used.
     String aStr(rString);
+    xub_StrLen nCheckPos = nCheckPos32 < 0 ? 0xFFFF : (xub_StrLen)nCheckPos32;
     bool bRet = PutEntry(aStr, nCheckPos, nType, nKey, eLnge);
     rString = aStr;
+    nCheckPos32 = nCheckPos == 0xFFFF ? -1 : nCheckPos;
     return bRet;
 }
 
@@ -561,24 +574,45 @@ bool SvNumberFormatter::PutandConvertEntry(String& rString,
 }
 
 bool SvNumberFormatter::PutandConvertEntry(OUString& rString,
-                                           xub_StrLen& nCheckPos,
+                                           sal_Int32& nCheckPos,
                                            short& nType,
                                            sal_uInt32& nKey,
                                            LanguageType eLnge,
                                            LanguageType eNewLnge)
 {
-    String aStr;
-    bool bRet = PutandConvertEntry(aStr, nCheckPos, nType, nKey, eLnge, eNewLnge);
-    rString = aStr;
-    return bRet;
+    bool bRes;
+    if (eNewLnge == LANGUAGE_DONTKNOW)
+        eNewLnge = IniLnge;
+
+    pFormatScanner->SetConvertMode(eLnge, eNewLnge);
+    bRes = PutEntry(rString, nCheckPos, nType, nKey, eLnge);
+    pFormatScanner->SetConvertMode(false);
+    return bRes;
+}
+
+bool SvNumberFormatter::PutandConvertEntrySystem(OUString& rString,
+                                                 sal_Int32& nCheckPos,
+                                                 short& nType,
+                                                 sal_uInt32& nKey,
+                                                 LanguageType eLnge,
+                                                 LanguageType eNewLnge)
+{
+    bool bRes;
+    if (eNewLnge == LANGUAGE_DONTKNOW)
+        eNewLnge = IniLnge;
+
+    pFormatScanner->SetConvertMode(eLnge, eNewLnge, true);
+    bRes = PutEntry(rString, nCheckPos, nType, nKey, eLnge);
+    pFormatScanner->SetConvertMode(false);
+    return bRes;
 }
 
 bool SvNumberFormatter::PutandConvertEntrySystem(String& rString,
-                                           xub_StrLen& nCheckPos,
-                                           short& nType,
-                                           sal_uInt32& nKey,
-                                           LanguageType eLnge,
-                                           LanguageType eNewLnge)
+                                                 xub_StrLen& nCheckPos,
+                                                 short& nType,
+                                                 sal_uInt32& nKey,
+                                                 LanguageType eLnge,
+                                                 LanguageType eNewLnge)
 {
     bool bRes;
     if (eNewLnge == LANGUAGE_DONTKNOW)
@@ -617,7 +651,7 @@ sal_uInt32 SvNumberFormatter::GetIndexPuttingAndConverting( String & rString,
             // language and wouldn't match eSysLnge anymore, do that on a copy.
             String aTmp( rString);
             rNewInserted = PutandConvertEntrySystem( aTmp, rCheckPos, rType,
-                    nKey, eLnge, SvtSysLocale().GetLanguage());
+                                                     nKey, eLnge, SvtSysLocale().GetLanguage());
             if (rCheckPos > 0)
             {
                 SAL_WARN( "svl.numbers", "SvNumberFormatter::GetIndexPuttingAndConverting: bad format code string for current locale");
@@ -3194,7 +3228,7 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultSystemCurrencyFormat()
 {
     if ( nDefaultSystemCurrencyFormat == NUMBERFORMAT_ENTRY_NOT_FOUND )
     {
-        xub_StrLen nCheck;
+        sal_Int32 nCheck;
         short nType;
         NfWSStringsDtor aCurrList;
         sal_uInt16 nDefault = GetCurrencyFormatStrings( aCurrList,
@@ -3237,7 +3271,7 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultCurrencyFormat()
 
         if ( nDefaultCurrencyFormat == NUMBERFORMAT_ENTRY_NOT_FOUND )
         {   // none found, create one
-            xub_StrLen nCheck;
+            sal_Int32 nCheck;
             NfWSStringsDtor aCurrList;
             sal_uInt16 nDefault = GetCurrencyFormatStrings( aCurrList,
                 GetCurrencyEntry( ActLnge ), false );
diff --git a/svtools/source/control/fmtfield.cxx b/svtools/source/control/fmtfield.cxx
index 8bb336f..3bfa00a 100644
--- a/svtools/source/control/fmtfield.cxx
+++ b/svtools/source/control/fmtfield.cxx
@@ -640,7 +640,7 @@ void FormattedField::SetFormatter(SvNumberFormatter* pFormatter, sal_Bool bReset
             LanguageType aNewLang = pDefaultEntry ? pDefaultEntry->GetLanguage() : LANGUAGE_DONTKNOW;
 
             // den alten Format-String in die neue Sprache konvertieren
-            sal_uInt16 nCheckPos;
+            sal_Int32 nCheckPos;
             short nType;
             pFormatter->PutandConvertEntry(sOldFormat, nCheckPos, nType, nDestKey, aOldLang, aNewLang);
             m_nFormatKey = nDestKey;
@@ -716,7 +716,7 @@ void FormattedField::SetThousandsSep(sal_Bool _bUseSeparator)
     // generate a new format ...
     OUString sFmtDescription = ImplGetFormatter()->GenerateFormat(m_nFormatKey, eLang, _bUseSeparator, IsRed, nPrecision, nAnzLeading);
     // ... and introduce it to the formatter
-    sal_uInt16 nCheckPos;
+    sal_Int32 nCheckPos;
     sal_uInt32  nNewKey;
     short nType;
     ImplGetFormatter()->PutEntry(sFmtDescription, nCheckPos, nType, nNewKey, eLang);
@@ -759,7 +759,7 @@ void FormattedField::SetDecimalDigits(sal_uInt16 _nPrecision)
     // generate a new format ...
     OUString sFmtDescription = ImplGetFormatter()->GenerateFormat(m_nFormatKey, eLang, bThousand, IsRed, _nPrecision, nAnzLeading);
     // ... and introduce it to the formatter
-    sal_uInt16 nCheckPos;
+    sal_Int32 nCheckPos;
     sal_uInt32 nNewKey;
     short nType;
     ImplGetFormatter()->PutEntry(sFmtDescription, nCheckPos, nType, nNewKey, eLang);
commit 82a134c1569e9ca10dd096e866afd1b42454a8d2
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Sun Nov 11 12:33:10 2012 -0600

    add a variant of OUStringBuffer::remove() to truncate or empty the content
    
    Change-Id: I9f5f6106ec81c33383f5936335dc965b84360116

diff --git a/sal/inc/rtl/ustrbuf.hxx b/sal/inc/rtl/ustrbuf.hxx
index 8400ac9..3855ac1 100644
--- a/sal/inc/rtl/ustrbuf.hxx
+++ b/sal/inc/rtl/ustrbuf.hxx
@@ -919,6 +919,20 @@ public:
         return *this;
     }
 
+    /**
+        Removes the tail of a string buffer start at the indicate position
+
+        start must be >= 0 && <= This->length
+
+        @param  start       The beginning index, inclusive. default to 0
+        @return this string buffer.
+     */
+    OUStringBuffer & remove( sal_Int32 start = 0)
+    {
+        rtl_uStringbuffer_remove( &pData, start, getLength() - start );
+        return *this;
+    }
+
     /** Allows access to the internal data of this OUStringBuffer, for effective
         manipulation.
 
commit 357a6f8e3b6ac292c7a692fbcddf305744032f70
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Tue Nov 6 18:32:10 2012 -0600

    svl: cosmetic prep work to OUString conversion
    
    Change-Id: I2b87838136f01ff463c66863803eea3c9cd17df9

diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 408bd6a..ce0a35d 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -53,17 +53,18 @@ using ::rtl::OUString;
 using ::rtl::OUStringBuffer;
 
 namespace {
-struct Gregorian
-    : public rtl::StaticWithInit<const ::rtl::OUString, Gregorian> {
-    const ::rtl::OUString operator () () {
-        return ::rtl::OUString("gregorian");
-    }
+struct Gregorian : public rtl::StaticWithInit<const OUString, Gregorian>
+{
+    const OUString operator () ()
+        {
+            return OUString("gregorian");
+        }
 };
 
 const sal_uInt16 UPPER_PRECISION = 300; // entirely arbitrary...
 const double EXP_LOWER_BOUND = 1.0E-4; // prefer scientific notation below this value.
 
-}
+} // namespace
 
 const double _D_MAX_U_LONG_ = (double) 0xffffffff;      // 4294967295.0
 const double _D_MAX_LONG_   = (double) 0x7fffffff;      // 2147483647.0
@@ -89,9 +90,13 @@ xub_StrLen SvNumberformat::InsertBlanks( String& r, xub_StrLen nPos, sal_Unicode
     {
         sal_uInt16 n = 2;   // Default fuer Zeichen > 128 (HACK!)
         if( c <= 127 )
+        {
             n = cCharWidths[ c - 32 ];
+        }
         while( n-- )
+        {
             r.Insert( ' ', nPos++ );
+        }
     }
     return nPos;
 }
@@ -100,7 +105,8 @@ static long GetPrecExp( double fAbsVal )
 {
     DBG_ASSERT( fAbsVal > 0.0, "GetPrecExp: fAbsVal <= 0.0" );
     if ( fAbsVal < 1e-7 || fAbsVal > 1e7 )
-    {   // die Schere, ob's schneller ist oder nicht, liegt zwischen 1e6 und 1e7
+    {
+        // die Schere, ob's schneller ist oder nicht, liegt zwischen 1e6 und 1e7
         return (long) floor( log10( fAbsVal ) ) + 1;
     }
     else
@@ -148,19 +154,24 @@ void ImpSvNumberformatInfo::Save(SvStream& rStream, sal_uInt16 nAnz) const
         rStream.WriteUniOrByteString( sStrArray[i], rStream.GetStreamCharSet() );
         short nType = nTypeArray[i];
         switch ( nType )
-        {   // der Krampf fuer Versionen vor SV_NUMBERFORMATTER_VERSION_NEW_CURR
-            case NF_SYMBOLTYPE_CURRENCY :
-                rStream << short( NF_SYMBOLTYPE_STRING );
+        {
+            // der Krampf fuer Versionen vor SV_NUMBERFORMATTER_VERSION_NEW_CURR
+        case NF_SYMBOLTYPE_CURRENCY :
+            rStream << short( NF_SYMBOLTYPE_STRING );
             break;
-            case NF_SYMBOLTYPE_CURRDEL :
-            case NF_SYMBOLTYPE_CURREXT :
-                rStream << short(0);        // werden ignoriert (hoffentlich..)
+        case NF_SYMBOLTYPE_CURRDEL :
+        case NF_SYMBOLTYPE_CURREXT :
+            rStream << short(0);        // werden ignoriert (hoffentlich..)
             break;
-            default:
-                if ( nType > NF_KEY_LASTKEYWORD_SO5 )
-                    rStream << short( NF_SYMBOLTYPE_STRING );  // all new keywords are string
-                else
-                    rStream << nType;
+        default:
+            if ( nType > NF_KEY_LASTKEYWORD_SO5 )
+            {
+                rStream << short( NF_SYMBOLTYPE_STRING );  // all new keywords are string
+            }
+            else
+            {
+                rStream << nType;
+            }
         }
 
     }
@@ -192,53 +203,79 @@ sal_uInt8 SvNumberNatNum::MapDBNumToNatNum( sal_uInt8 nDBNum, LanguageType eLang
     if ( bDate )
     {
         if ( nDBNum == 4 && eLang == LANGUAGE_KOREAN )
+        {
             nNatNum = 9;
+        }
         else if ( nDBNum <= 3 )
+        {
             nNatNum = nDBNum;   // known to be good for: zh,ja,ko / 1,2,3
+        }
     }
     else
     {
         switch ( nDBNum )
         {
-            case 1:
-                switch ( eLang )
-                {
-                    case (LANGUAGE_CHINESE  & 0x03FF) : nNatNum = 4; break;
-                    case (LANGUAGE_JAPANESE & 0x03FF) : nNatNum = 1; break;
-                    case (LANGUAGE_KOREAN   & 0x03FF) : nNatNum = 1; break;
-                }
+        case 1:
+            switch ( eLang )
+            {
+            case (LANGUAGE_CHINESE  & 0x03FF):
+                nNatNum = 4;
                 break;
-            case 2:
-                switch ( eLang )
-                {
-                    case (LANGUAGE_CHINESE  & 0x03FF) : nNatNum = 5; break;
-                    case (LANGUAGE_JAPANESE & 0x03FF) : nNatNum = 4; break;
-                    case (LANGUAGE_KOREAN   & 0x03FF) : nNatNum = 2; break;
-                }
+            case (LANGUAGE_JAPANESE & 0x03FF):
+                nNatNum = 1;
                 break;
-            case 3:
-                switch ( eLang )
-                {
-                    case (LANGUAGE_CHINESE  & 0x03FF) : nNatNum = 6; break;
-                    case (LANGUAGE_JAPANESE & 0x03FF) : nNatNum = 5; break;
-                    case (LANGUAGE_KOREAN   & 0x03FF) : nNatNum = 3; break;
-                }
+            case (LANGUAGE_KOREAN   & 0x03FF):
+                nNatNum = 1;
                 break;
-            case 4:
-                switch ( eLang )
-                {
-                    case (LANGUAGE_JAPANESE & 0x03FF) : nNatNum = 7; break;
-                    case (LANGUAGE_KOREAN   & 0x03FF) : nNatNum = 9; break;
-                }
+            }
+            break;
+        case 2:
+            switch ( eLang )
+            {
+            case (LANGUAGE_CHINESE  & 0x03FF):
+                nNatNum = 5;
                 break;
+            case (LANGUAGE_JAPANESE & 0x03FF):
+                nNatNum = 4;
+                break;
+            case (LANGUAGE_KOREAN   & 0x03FF):
+                nNatNum = 2;
+                break;
+            }
+            break;
+        case 3:
+            switch ( eLang )
+            {
+            case (LANGUAGE_CHINESE  & 0x03FF):
+                nNatNum = 6;
+                break;
+            case (LANGUAGE_JAPANESE & 0x03FF):
+                nNatNum = 5;
+                break;
+            case (LANGUAGE_KOREAN   & 0x03FF):
+                nNatNum = 3;
+                break;
+            }
+            break;
+        case 4:
+            switch ( eLang )
+            {
+            case (LANGUAGE_JAPANESE & 0x03FF):
+                nNatNum = 7;
+                break;
+            case (LANGUAGE_KOREAN   & 0x03FF):
+                nNatNum = 9;
+                break;
+            }
+            break;
         }
     }
     return nNatNum;
 }
 
 #ifdef THE_FUTURE
-/* XXX NOTE: even though the MapNatNumToDBNum method is currently unused please 
- * don't remove it in case we'd have to use it for some obscure exports to 
+/* XXX NOTE: even though the MapNatNumToDBNum method is currently unused please
+ * don't remove it in case we'd have to use it for some obscure exports to
  * Excel. */
 
 // static
@@ -250,71 +287,97 @@ sal_uInt8 SvNumberNatNum::MapNatNumToDBNum( sal_uInt8 nNatNum, LanguageType eLan
     if ( bDate )
     {
         if ( nNatNum == 9 && eLang == LANGUAGE_KOREAN )
+        {
             nDBNum = 4;
+        }
         else if ( nNatNum <= 3 )
+        {
             nDBNum = nNatNum;   // known to be good for: zh,ja,ko / 1,2,3
+        }
     }
     else
     {
         switch ( nNatNum )
         {
-            case 1:
-                switch ( eLang )
-                {
-                    case (LANGUAGE_JAPANESE & 0x03FF) : nDBNum = 1; break;
-                    case (LANGUAGE_KOREAN   & 0x03FF) : nDBNum = 1; break;
-                }
+        case 1:
+            switch ( eLang )
+            {
+            case (LANGUAGE_JAPANESE & 0x03FF):
+                nDBNum = 1;
                 break;
-            case 2:
-                switch ( eLang )
-                {
-                    case (LANGUAGE_KOREAN   & 0x03FF) : nDBNum = 2; break;
-                }
+            case (LANGUAGE_KOREAN   & 0x03FF):
+                nDBNum = 1;
                 break;
-            case 3:
-                switch ( eLang )
-                {
-                    case (LANGUAGE_KOREAN   & 0x03FF) : nDBNum = 3; break;
-                }
+            }
+            break;
+        case 2:
+            switch ( eLang )
+            {
+            case (LANGUAGE_KOREAN   & 0x03FF):
+                nDBNum = 2;
                 break;
-            case 4:
-                switch ( eLang )
-                {
-                    case (LANGUAGE_CHINESE  & 0x03FF) : nDBNum = 1; break;
-                    case (LANGUAGE_JAPANESE & 0x03FF) : nDBNum = 2; break;
-                }
+            }
+            break;
+        case 3:
+            switch ( eLang )
+            {
+            case (LANGUAGE_KOREAN   & 0x03FF):
+                nDBNum = 3;
                 break;
-            case 5:
-                switch ( eLang )
-                {
-                    case (LANGUAGE_CHINESE  & 0x03FF) : nDBNum = 2; break;
-                    case (LANGUAGE_JAPANESE & 0x03FF) : nDBNum = 3; break;
-                }
+            }
+            break;
+        case 4:
+            switch ( eLang )
+            {
+            case (LANGUAGE_CHINESE  & 0x03FF):
+                nDBNum = 1;
                 break;
-            case 6:
-                switch ( eLang )
-                {
-                    case (LANGUAGE_CHINESE  & 0x03FF) : nDBNum = 3; break;
-                }
+            case (LANGUAGE_JAPANESE & 0x03FF):
+                nDBNum = 2;
                 break;
-            case 7:
-                switch ( eLang )
-                {
-                    case (LANGUAGE_JAPANESE & 0x03FF) : nDBNum = 4; break;
-                }
+            }
+            break;
+        case 5:
+            switch ( eLang )
+            {
+            case (LANGUAGE_CHINESE  & 0x03FF):
+                nDBNum = 2;
                 break;
-            case 8:
+            case (LANGUAGE_JAPANESE & 0x03FF):
+                nDBNum = 3;
                 break;
-            case 9:
-                switch ( eLang )
-                {
-                    case (LANGUAGE_KOREAN   & 0x03FF) : nDBNum = 4; break;
-                }
+            }
+            break;
+        case 6:
+            switch ( eLang )
+            {
+            case (LANGUAGE_CHINESE  & 0x03FF):
+                nDBNum = 3;
                 break;
-            case 10:
+            }
+            break;
+        case 7:
+            switch ( eLang )
+            {
+            case (LANGUAGE_JAPANESE & 0x03FF):
+                nDBNum = 4;
                 break;
-            case 11:
+            }
+            break;
+        case 8:
+            break;
+        case 9:
+            switch ( eLang )
+            {
+            case (LANGUAGE_KOREAN   & 0x03FF):
+                nDBNum = 4;
                 break;
+            }
+            break;
+        case 10:
+            break;
+        case 11:
+            break;
         }
     }
     return nDBNum;
@@ -403,13 +466,15 @@ bool ImpSvNumFor::HasNewCurrency() const
     for ( sal_uInt16 j=0; j<nAnzStrings; j++ )
     {
         if ( aI.nTypeArray[j] == NF_SYMBOLTYPE_CURRENCY )
+        {
             return true;
+        }
     }
     return false;
 }
 
 bool ImpSvNumFor::GetNewCurrencySymbol( OUString& rSymbol,
-            OUString& rExtension ) const
+                                        OUString& rExtension ) const
 {
     for ( sal_uInt16 j=0; j<nAnzStrings; j++ )
     {
@@ -417,9 +482,13 @@ bool ImpSvNumFor::GetNewCurrencySymbol( OUString& rSymbol,
         {
             rSymbol = aI.sStrArray[j];
             if ( j < nAnzStrings-1 && aI.nTypeArray[j+1] == NF_SYMBOLTYPE_CURREXT )
+            {
                 rExtension = aI.sStrArray[j+1];
+            }
             else
+            {
                 rExtension = "";
+            }
             return true;
         }
     }
@@ -435,10 +504,10 @@ void ImpSvNumFor::SaveNewCurrencyMap( SvStream& rStream ) const
     {
         switch ( aI.nTypeArray[j] )
         {
-            case NF_SYMBOLTYPE_CURRENCY :
-            case NF_SYMBOLTYPE_CURRDEL :
-            case NF_SYMBOLTYPE_CURREXT :
-                nCnt++;
+        case NF_SYMBOLTYPE_CURRENCY :
+        case NF_SYMBOLTYPE_CURRDEL :
+        case NF_SYMBOLTYPE_CURREXT :
+            nCnt++;
             break;
         }
     }
@@ -447,10 +516,10 @@ void ImpSvNumFor::SaveNewCurrencyMap( SvStream& rStream ) const
     {
         switch ( aI.nTypeArray[j] )
         {
-            case NF_SYMBOLTYPE_CURRENCY :
-            case NF_SYMBOLTYPE_CURRDEL :
-            case NF_SYMBOLTYPE_CURREXT :
-                rStream << j << aI.nTypeArray[j];
+        case NF_SYMBOLTYPE_CURRENCY :
+        case NF_SYMBOLTYPE_CURRDEL :
+        case NF_SYMBOLTYPE_CURREXT :
+            rStream << j << aI.nTypeArray[j];
             break;
         }
     }
@@ -466,7 +535,9 @@ void ImpSvNumFor::LoadNewCurrencyMap( SvStream& rStream )
         short nType;
         rStream >> nPos >> nType;
         if ( nPos < nAnzStrings )
+        {
             aI.nTypeArray[nPos] = nType;
+        }
     }
 }
 
@@ -510,10 +581,9 @@ enum BracketFormatSymbolType
 };
 
 SvNumberformat::SvNumberformat( ImpSvNumberformatScan& rSc, LanguageType eLge )
-        :
-        rScan(rSc),
-        nNewStandardDefined(0),
-        bStarFlag( false )
+        : rScan(rSc)
+        , nNewStandardDefined(0)
+        , bStarFlag( false )
 {
     maLocale.meLanguage = eLge;
 }
@@ -536,7 +606,9 @@ void SvNumberformat::ImpCopyNumberformat( const SvNumberformat& rFormat )
     ImpSvNumberformatScan* pColorSc = ( &rScan != &rFormat.rScan ) ? &rScan : NULL;
 
     for (sal_uInt16 i = 0; i < 4; i++)
+    {
         NumFor[i].Copy(rFormat.NumFor[i], pColorSc);
+    }
 }
 
 SvNumberformat::SvNumberformat( SvNumberformat& rFormat )
@@ -546,7 +618,8 @@ SvNumberformat::SvNumberformat( SvNumberformat& rFormat )
 }
 
 SvNumberformat::SvNumberformat( SvNumberformat& rFormat, ImpSvNumberformatScan& rSc )
-    : rScan(rSc), bStarFlag( rFormat.bStarFlag )
+    : rScan(rSc)
+    , bStarFlag( rFormat.bStarFlag )
 {
     ImpCopyNumberformat( rFormat );
 }
@@ -554,41 +627,43 @@ SvNumberformat::SvNumberformat( SvNumberformat& rFormat, ImpSvNumberformatScan&
 static bool lcl_SvNumberformat_IsBracketedPrefix( short nSymbolType )
 {
     if ( nSymbolType > 0  )
+    {
         return true;        // conditions
+    }
     switch ( nSymbolType )
     {
-        case BRACKET_SYMBOLTYPE_COLOR :
-        case BRACKET_SYMBOLTYPE_DBNUM1 :
-        case BRACKET_SYMBOLTYPE_DBNUM2 :
-        case BRACKET_SYMBOLTYPE_DBNUM3 :
-        case BRACKET_SYMBOLTYPE_DBNUM4 :
-        case BRACKET_SYMBOLTYPE_DBNUM5 :
-        case BRACKET_SYMBOLTYPE_DBNUM6 :
-        case BRACKET_SYMBOLTYPE_DBNUM7 :
-        case BRACKET_SYMBOLTYPE_DBNUM8 :
-        case BRACKET_SYMBOLTYPE_DBNUM9 :
-        case BRACKET_SYMBOLTYPE_LOCALE :
-        case BRACKET_SYMBOLTYPE_NATNUM0 :
-        case BRACKET_SYMBOLTYPE_NATNUM1 :
-        case BRACKET_SYMBOLTYPE_NATNUM2 :
-        case BRACKET_SYMBOLTYPE_NATNUM3 :
-        case BRACKET_SYMBOLTYPE_NATNUM4 :
-        case BRACKET_SYMBOLTYPE_NATNUM5 :
-        case BRACKET_SYMBOLTYPE_NATNUM6 :
-        case BRACKET_SYMBOLTYPE_NATNUM7 :
-        case BRACKET_SYMBOLTYPE_NATNUM8 :
-        case BRACKET_SYMBOLTYPE_NATNUM9 :
-        case BRACKET_SYMBOLTYPE_NATNUM10 :
-        case BRACKET_SYMBOLTYPE_NATNUM11 :
-        case BRACKET_SYMBOLTYPE_NATNUM12 :
-        case BRACKET_SYMBOLTYPE_NATNUM13 :
-        case BRACKET_SYMBOLTYPE_NATNUM14 :
-        case BRACKET_SYMBOLTYPE_NATNUM15 :
-        case BRACKET_SYMBOLTYPE_NATNUM16 :
-        case BRACKET_SYMBOLTYPE_NATNUM17 :
-        case BRACKET_SYMBOLTYPE_NATNUM18 :
-        case BRACKET_SYMBOLTYPE_NATNUM19 :
-            return true;
+    case BRACKET_SYMBOLTYPE_COLOR :
+    case BRACKET_SYMBOLTYPE_DBNUM1 :
+    case BRACKET_SYMBOLTYPE_DBNUM2 :
+    case BRACKET_SYMBOLTYPE_DBNUM3 :
+    case BRACKET_SYMBOLTYPE_DBNUM4 :
+    case BRACKET_SYMBOLTYPE_DBNUM5 :
+    case BRACKET_SYMBOLTYPE_DBNUM6 :
+    case BRACKET_SYMBOLTYPE_DBNUM7 :
+    case BRACKET_SYMBOLTYPE_DBNUM8 :
+    case BRACKET_SYMBOLTYPE_DBNUM9 :
+    case BRACKET_SYMBOLTYPE_LOCALE :
+    case BRACKET_SYMBOLTYPE_NATNUM0 :
+    case BRACKET_SYMBOLTYPE_NATNUM1 :
+    case BRACKET_SYMBOLTYPE_NATNUM2 :
+    case BRACKET_SYMBOLTYPE_NATNUM3 :
+    case BRACKET_SYMBOLTYPE_NATNUM4 :
+    case BRACKET_SYMBOLTYPE_NATNUM5 :
+    case BRACKET_SYMBOLTYPE_NATNUM6 :
+    case BRACKET_SYMBOLTYPE_NATNUM7 :
+    case BRACKET_SYMBOLTYPE_NATNUM8 :
+    case BRACKET_SYMBOLTYPE_NATNUM9 :
+    case BRACKET_SYMBOLTYPE_NATNUM10 :
+    case BRACKET_SYMBOLTYPE_NATNUM11 :
+    case BRACKET_SYMBOLTYPE_NATNUM12 :
+    case BRACKET_SYMBOLTYPE_NATNUM13 :
+    case BRACKET_SYMBOLTYPE_NATNUM14 :
+    case BRACKET_SYMBOLTYPE_NATNUM15 :
+    case BRACKET_SYMBOLTYPE_NATNUM16 :
+    case BRACKET_SYMBOLTYPE_NATNUM17 :
+    case BRACKET_SYMBOLTYPE_NATNUM18 :
+    case BRACKET_SYMBOLTYPE_NATNUM19 :
+        return true;
     }
     return false;
 }
@@ -606,8 +681,9 @@ String SvNumberformat::ImpObtainCalendarAndNumerals( String & rString,
     {
         // Numeral shape code "D" = Thai digits.
         if (aTmpLocale.mnNumeralShape == 0xD)
+        {
             rString.InsertAscii( "[NatNum1]", nPos);
-
+        }
         // Calendar type code "07" = Thai Buddhist calendar, insert this after
         // all prefixes have been consumed as it is actually a format modifier
         // and not a prefix.
@@ -639,10 +715,9 @@ SvNumberformat::SvNumberformat(String& rString,
                                xub_StrLen& nCheckPos,
                                LanguageType& eLan,
                                bool bStan)
-        :
-        rScan(*pSc),
-        nNewStandardDefined(0),
-        bStarFlag( false )
+        : rScan(*pSc)
+        , nNewStandardDefined(0)
+        , bStarFlag( false )
 {
     // If the group (AKA thousand) separator is a Non-Breaking Space (French)
     // replace all occurrences by a simple space.
@@ -653,7 +728,9 @@ SvNumberformat::SvNumberformat(String& rString,
     {
         xub_StrLen nIndex = 0;
         do
+        {
             nIndex = rString.SearchAndReplace( cNBSp, ' ', nIndex );
+        }
         while ( nIndex != STRING_NOTFOUND );
     }
 
@@ -663,7 +740,9 @@ SvNumberformat::SvNumberformat(String& rString,
         eLan = maLocale.meLanguage;      // Wechsel auch zurueckgeben
     }
     else
+    {
         maLocale.meLanguage = eLan;
+    }
     bStandard = bStan;
     bIsUsed = false;
     fLimit1 = 0.0;
@@ -685,8 +764,9 @@ SvNumberformat::SvNumberformat(String& rString,
     {
         // Original language/country may have to be reestablished
         if (rScan.GetConvertMode())
+        {
             (rScan.GetNumberformatter())->ChangeIntl(rScan.GetTmpLnge());
-
+        }
         String sInsertCalendar;     // a calendar resulting from parsing LCID
         String sStr;
         nPosOld = nPos;                         // Start position of substring
@@ -702,7 +782,9 @@ SvNumberformat::SvNumberformat(String& rString,
                     eOp1 = (SvNumberformatLimitOps) eSymbolType;
                 }
                 else if ( nIndex == 1 && bCondition )
+                {
                     eOp2 = (SvNumberformatLimitOps) eSymbolType;
+                }
                 else                                // error
                 {
                     bCancel = true;                 // break for
@@ -717,7 +799,7 @@ SvNumberformat::SvNumberformat(String& rString,
                         short F_Type = NUMBERFORMAT_UNDEFINED;
                         if (!pISc->IsNumberFormat(sStr,F_Type,fNumber) ||
                             ( F_Type != NUMBERFORMAT_NUMBER &&
-                            F_Type != NUMBERFORMAT_SCIENTIFIC) )
+                              F_Type != NUMBERFORMAT_SCIENTIFIC) )
                         {
                             fNumber = 0.0;
                             nPos = nPos - nAnzChars;
@@ -732,11 +814,17 @@ SvNumberformat::SvNumberformat(String& rString,
                         rString.Insert('0',nPos++);
                     }
                     if (nIndex == 0)
+                    {
                         fLimit1 = fNumber;
+                    }
                     else
+                    {
                         fLimit2 = fNumber;
+                    }
                     if ( rString.GetChar(nPos) == ']' )
+                    {
                         nPos++;
+                    }
                     else
                     {
                         bCancel = true;             // break for
@@ -750,147 +838,141 @@ SvNumberformat::SvNumberformat(String& rString,
                 String sSymbol( sStr);
                 switch ( eSymbolType )
                 {
-                    case BRACKET_SYMBOLTYPE_COLOR :
+                case BRACKET_SYMBOLTYPE_COLOR :
+                    if ( NumFor[nIndex].GetColor() != NULL )
+                    {                           // error, more than one color
+                        bCancel = true;         // break for
+                        nCheckPos = nPosOld;
+                    }
+                    else
                     {
-                        if ( NumFor[nIndex].GetColor() != NULL )
-                        {                           // error, more than one color
-                            bCancel = true;         // break for
+                        OUString aStr(sStr);
+                        Color* pColor = pSc->GetColor( aStr);
+                        NumFor[nIndex].SetColor( pColor, aStr);
+                        sStr = aStr;
+                        if (pColor == NULL)
+                        {                       // error
+                            bCancel = true;     // break for
                             nCheckPos = nPosOld;
                         }
-                        else
-                        {
-                            OUString aStr(sStr);
-                            Color* pColor = pSc->GetColor( aStr);
-                            NumFor[nIndex].SetColor( pColor, aStr);
-                            sStr = aStr;
-                            if (pColor == NULL)
-                            {                       // error
-                                bCancel = true;     // break for
-                                nCheckPos = nPosOld;
-                            }
-                        }
                     }
                     break;
-                    case BRACKET_SYMBOLTYPE_NATNUM0 :
-                    case BRACKET_SYMBOLTYPE_NATNUM1 :
-                    case BRACKET_SYMBOLTYPE_NATNUM2 :
-                    case BRACKET_SYMBOLTYPE_NATNUM3 :
-                    case BRACKET_SYMBOLTYPE_NATNUM4 :
-                    case BRACKET_SYMBOLTYPE_NATNUM5 :
-                    case BRACKET_SYMBOLTYPE_NATNUM6 :
-                    case BRACKET_SYMBOLTYPE_NATNUM7 :
-                    case BRACKET_SYMBOLTYPE_NATNUM8 :
-                    case BRACKET_SYMBOLTYPE_NATNUM9 :
-                    case BRACKET_SYMBOLTYPE_NATNUM10 :
-                    case BRACKET_SYMBOLTYPE_NATNUM11 :
-                    case BRACKET_SYMBOLTYPE_NATNUM12 :
-                    case BRACKET_SYMBOLTYPE_NATNUM13 :
-                    case BRACKET_SYMBOLTYPE_NATNUM14 :
-                    case BRACKET_SYMBOLTYPE_NATNUM15 :
-                    case BRACKET_SYMBOLTYPE_NATNUM16 :
-                    case BRACKET_SYMBOLTYPE_NATNUM17 :
-                    case BRACKET_SYMBOLTYPE_NATNUM18 :
-                    case BRACKET_SYMBOLTYPE_NATNUM19 :
+                case BRACKET_SYMBOLTYPE_NATNUM0 :
+                case BRACKET_SYMBOLTYPE_NATNUM1 :
+                case BRACKET_SYMBOLTYPE_NATNUM2 :
+                case BRACKET_SYMBOLTYPE_NATNUM3 :
+                case BRACKET_SYMBOLTYPE_NATNUM4 :
+                case BRACKET_SYMBOLTYPE_NATNUM5 :
+                case BRACKET_SYMBOLTYPE_NATNUM6 :
+                case BRACKET_SYMBOLTYPE_NATNUM7 :
+                case BRACKET_SYMBOLTYPE_NATNUM8 :
+                case BRACKET_SYMBOLTYPE_NATNUM9 :
+                case BRACKET_SYMBOLTYPE_NATNUM10 :
+                case BRACKET_SYMBOLTYPE_NATNUM11 :
+                case BRACKET_SYMBOLTYPE_NATNUM12 :
+                case BRACKET_SYMBOLTYPE_NATNUM13 :
+                case BRACKET_SYMBOLTYPE_NATNUM14 :
+                case BRACKET_SYMBOLTYPE_NATNUM15 :
+                case BRACKET_SYMBOLTYPE_NATNUM16 :
+                case BRACKET_SYMBOLTYPE_NATNUM17 :
+                case BRACKET_SYMBOLTYPE_NATNUM18 :
+                case BRACKET_SYMBOLTYPE_NATNUM19 :
+                    if ( NumFor[nIndex].GetNatNum().IsSet() )
                     {
-                        if ( NumFor[nIndex].GetNatNum().IsSet() )
-                        {
-                            bCancel = true;         // break for
-                            nCheckPos = nPosOld;
-                        }
-                        else
-                        {
-                            sStr.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "NatNum" ) );
-                            //! eSymbolType is negative
-                            sal_uInt8 nNum = sal::static_int_cast< sal_uInt8 >(0 - (eSymbolType - BRACKET_SYMBOLTYPE_NATNUM0));
-                            sStr += String::CreateFromInt32( nNum );
-                            NumFor[nIndex].SetNatNumNum( nNum, false );
-                        }
+                        bCancel = true;         // break for
+                        nCheckPos = nPosOld;
+                    }
+                    else
+                    {
+                        sStr.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "NatNum" ) );
+                        //! eSymbolType is negative
+                        sal_uInt8 nNum = sal::static_int_cast< sal_uInt8 >(0 - (eSymbolType - BRACKET_SYMBOLTYPE_NATNUM0));
+                        sStr += String::CreateFromInt32( nNum );
+                        NumFor[nIndex].SetNatNumNum( nNum, false );
                     }
                     break;
-                    case BRACKET_SYMBOLTYPE_DBNUM1 :
-                    case BRACKET_SYMBOLTYPE_DBNUM2 :
-                    case BRACKET_SYMBOLTYPE_DBNUM3 :
-                    case BRACKET_SYMBOLTYPE_DBNUM4 :
-                    case BRACKET_SYMBOLTYPE_DBNUM5 :
-                    case BRACKET_SYMBOLTYPE_DBNUM6 :
-                    case BRACKET_SYMBOLTYPE_DBNUM7 :
-                    case BRACKET_SYMBOLTYPE_DBNUM8 :
-                    case BRACKET_SYMBOLTYPE_DBNUM9 :
+                case BRACKET_SYMBOLTYPE_DBNUM1 :
+                case BRACKET_SYMBOLTYPE_DBNUM2 :
+                case BRACKET_SYMBOLTYPE_DBNUM3 :
+                case BRACKET_SYMBOLTYPE_DBNUM4 :
+                case BRACKET_SYMBOLTYPE_DBNUM5 :
+                case BRACKET_SYMBOLTYPE_DBNUM6 :
+                case BRACKET_SYMBOLTYPE_DBNUM7 :
+                case BRACKET_SYMBOLTYPE_DBNUM8 :
+                case BRACKET_SYMBOLTYPE_DBNUM9 :
+                    if ( NumFor[nIndex].GetNatNum().IsSet() )
                     {
-                        if ( NumFor[nIndex].GetNatNum().IsSet() )
-                        {
-                            bCancel = true;         // break for
-                            nCheckPos = nPosOld;
-                        }
-                        else
-                        {
-                            sStr.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "DBNum" ) );
-                            //! eSymbolType is negative
-                            sal_uInt8 nNum = sal::static_int_cast< sal_uInt8 >(1 - (eSymbolType - BRACKET_SYMBOLTYPE_DBNUM1));
-                            sStr += static_cast< sal_Unicode >('0' + nNum);
-                            NumFor[nIndex].SetNatNumNum( nNum, true );
-                        }
+                        bCancel = true;         // break for
+                        nCheckPos = nPosOld;
+                    }
+                    else
+                    {
+                        sStr.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "DBNum" ) );
+                        //! eSymbolType is negative
+                        sal_uInt8 nNum = sal::static_int_cast< sal_uInt8 >(1 - (eSymbolType - BRACKET_SYMBOLTYPE_DBNUM1));
+                        sStr += static_cast< sal_Unicode >('0' + nNum);
+                        NumFor[nIndex].SetNatNumNum( nNum, true );
                     }
                     break;
-                    case BRACKET_SYMBOLTYPE_LOCALE :
+                case BRACKET_SYMBOLTYPE_LOCALE :
+                    if ( NumFor[nIndex].GetNatNum().GetLang() != LANGUAGE_DONTKNOW ||
+                         rString.GetChar(nPos-1) != ']' )
+                        // Check also for ']' to avoid pulling in
+                        // locale data for the preview string for not
+                        // yet completed LCIDs in the dialog.
                     {
-                        if ( NumFor[nIndex].GetNatNum().GetLang() != LANGUAGE_DONTKNOW ||
-                                rString.GetChar(nPos-1) != ']' )
-                                // Check also for ']' to avoid pulling in
-                                // locale data for the preview string for not
-                                // yet completed LCIDs in the dialog.
+                        bCancel = true;         // break for
+                        nCheckPos = nPosOld;
+                    }
+                    else
+                    {
+                        xub_StrLen nTmp = 2;
+                        LocaleType aTmpLocale( ImpGetLocaleType( sStr, nTmp));
+                        if (aTmpLocale.meLanguage == LANGUAGE_DONTKNOW)
                         {
                             bCancel = true;         // break for
                             nCheckPos = nPosOld;
                         }
                         else
                         {
-                            xub_StrLen nTmp = 2;
-                            LocaleType aTmpLocale( ImpGetLocaleType( sStr, nTmp));
-                            if (aTmpLocale.meLanguage == LANGUAGE_DONTKNOW)
+                            // Only the first sub format's locale will be
+                            // used as the format's overall locale.
+                            // Sorts this also under the corresponding
+                            // locale for the dialog.
+                            // If we don't support the locale this would
+                            // result in an unknown (empty) language
+                            // listbox entry and the user would never see
+                            // this format.
+                            if (nIndex == 0 && (aTmpLocale.meLanguage == 0 ||
+                                                SvNumberFormatter::IsLocaleInstalled( aTmpLocale.meLanguage)))
                             {
-                                bCancel = true;         // break for
-                                nCheckPos = nPosOld;
+                                maLocale = aTmpLocale;
+                                eLan = aTmpLocale.meLanguage;   // return to caller
+                                /* TODO: fiddle with scanner to make this
+                                 * known? A change in the locale may affect
+                                 * separators and keywords. On the other
+                                 * hand they may have been entered as used
+                                 * in the originating locale, there's no
+                                 * way to predict other than analyzing the
+                                 * format code, we assume here the current
+                                 * context is used, which is most likely
+                                 * the case.
+                                 * */
                             }
-                            else
+                            sStr.AssignAscii( RTL_CONSTASCII_STRINGPARAM("$-") );
+                            sStr += String( aTmpLocale.generateCode());
+                            NumFor[nIndex].SetNatNumLang( MsLangId::getRealLanguage( aTmpLocale.meLanguage));
+
+                            // "$-NNCCLLLL" Numerals and Calendar
+                            if (sSymbol.Len() > 6)
                             {
-                                // Only the first sub format's locale will be
-                                // used as the format's overall locale.
-                                // Sorts this also under the corresponding
-                                // locale for the dialog.
-                                // If we don't support the locale this would
-                                // result in an unknown (empty) language
-                                // listbox entry and the user would never see
-                                // this format.
-                                if (nIndex == 0 && (aTmpLocale.meLanguage == 0 ||
-                                            SvNumberFormatter::IsLocaleInstalled( aTmpLocale.meLanguage)))
-                                {
-                                    maLocale = aTmpLocale;
-                                    eLan = aTmpLocale.meLanguage;   // return to caller
-                                    /* TODO: fiddle with scanner to make this
-                                     * known? A change in the locale may affect
-                                     * separators and keywords. On the other
-                                     * hand they may have been entered as used
-                                     * in the originating locale, there's no
-                                     * way to predict other than analyzing the
-                                     * format code, we assume here the current
-                                     * context is used, which is most likely
-                                     * the case.
-                                     * */
-                                }
-                                sStr.AssignAscii( RTL_CONSTASCII_STRINGPARAM("$-") );
-                                sStr += String( aTmpLocale.generateCode());
-                                NumFor[nIndex].SetNatNumLang( MsLangId::getRealLanguage( aTmpLocale.meLanguage));
-
-                                // "$-NNCCLLLL" Numerals and Calendar
-                                if (sSymbol.Len() > 6)
-                                    sInsertCalendar = ImpObtainCalendarAndNumerals( rString, nPos, eLan, aTmpLocale);
-                                    /* NOTE: there can be only one calendar
-                                     * inserted so the last one wins, though
-                                     * our own calendar modifiers support
-                                     * multiple calendars within one sub format
-                                     * code if at different positions. */
+                                sInsertCalendar = ImpObtainCalendarAndNumerals( rString, nPos, eLan, aTmpLocale);
                             }
+                            /* NOTE: there can be only one calendar
+                             * inserted so the last one wins, though
+                             * our own calendar modifiers support
+                             * multiple calendars within one sub format
+                             * code if at different positions. */
                         }
                     }
                     break;
@@ -898,7 +980,9 @@ SvNumberformat::SvNumberformat(String& rString,
                 if ( !bCancel )
                 {
                     if (sStr == sSymbol)
+                    {
                         nPosOld = nPos;
+                    }
                     else
                     {
                         rString.Erase(nPosOld,nPos-nPosOld);
@@ -918,7 +1002,8 @@ SvNumberformat::SvNumberformat(String& rString,
                     }
                 }
             }
-        } while ( !bCancel && lcl_SvNumberformat_IsBracketedPrefix( eSymbolType ) );
+        }
+        while ( !bCancel && lcl_SvNumberformat_IsBracketedPrefix( eSymbolType ) );
 
         // The remaining format code string
         if ( !bCancel )
@@ -926,17 +1011,23 @@ SvNumberformat::SvNumberformat(String& rString,
             if (eSymbolType == BRACKET_SYMBOLTYPE_FORMAT)
             {
                 if (nIndex == 1 && eOp1 == NUMBERFORMAT_OP_NO)
+                {
                     eOp1 = NUMBERFORMAT_OP_GT;  // undefined condition, default: > 0
+                }
                 else if (nIndex == 2 && eOp2 == NUMBERFORMAT_OP_NO)
+                {
                     eOp2 = NUMBERFORMAT_OP_LT;  // undefined condition, default: < 0
+                }
                 if (sStr.Len() == 0)
-                {   // empty sub format
+                {
+                    // empty sub format
                 }
                 else
                 {
                     if (sInsertCalendar.Len())
+                    {
                         sStr.Insert( sInsertCalendar, 0);
-
+                    }
                     OUString aStr(sStr);
                     sal_Int32 nStrPos = pSc->ScanFormat( aStr);
                     sStr = aStr;
@@ -970,15 +1061,11 @@ SvNumberformat::SvNumberformat(String& rString,
                         // XclExpNumFmtBuffer::WriteFormatRecord().
                         LanguageType eLanguage;
                         if (NumFor[nIndex].GetNatNum().GetNatNum() == 1 &&
-                                ((eLanguage =
-                                  MsLangId::getRealLanguage( eLan))
-                                 == LANGUAGE_THAI) &&
-                                NumFor[nIndex].GetNatNum().GetLang() ==
-                                LANGUAGE_DONTKNOW)
+                            ((eLanguage = MsLangId::getRealLanguage( eLan)) == LANGUAGE_THAI) &&
+                            NumFor[nIndex].GetNatNum().GetLang() == LANGUAGE_DONTKNOW)
                         {
                             rtl::OUString aLID("[$-");
-                            aLID += rtl::OUString::valueOf( sal_Int32(
-                                        eLanguage), 16 ).toAsciiUpperCase();
+                            aLID += rtl::OUString::valueOf( sal_Int32(eLanguage), 16 ).toAsciiUpperCase();
                             aLID += "]";
                             sStr.Insert( aLID, 0);
                             NumFor[nIndex].SetNatNumLang( eLanguage);
@@ -995,14 +1082,17 @@ SvNumberformat::SvNumberformat(String& rString,
                         pSc->CopyInfo(&(NumFor[nIndex].Info()), nAnz);
                         // type check
                         if (nIndex == 0)
+                        {
                             eType = (short) NumFor[nIndex].Info().eScannedType;
+                        }
                         else if (nIndex == 3)
                         {   // #77026# Everything recognized IS text
                             NumFor[nIndex].Info().eScannedType = NUMBERFORMAT_TEXT;
                         }
-                        else if ( (short) NumFor[nIndex].Info().eScannedType !=
-                            eType)
+                        else if ( (short) NumFor[nIndex].Info().eScannedType != eType)
+                        {
                             eType = NUMBERFORMAT_DEFINED;
+                        }
                     }
                     else
                     {
@@ -1037,7 +1127,7 @@ SvNumberformat::SvNumberformat(String& rString,
         if (rString.Len() == nPos)
         {
             if ( nIndex == 2 && eSymbolType == BRACKET_SYMBOLTYPE_FORMAT &&
-                    rString.GetChar(nPos-1) == ';' )
+                 rString.GetChar(nPos-1) == ';' )
             {
                 // #83510# A 4th subformat explicitly specified to be empty
                 // hides any text. Need the type here for HasTextFormat()
@@ -1047,8 +1137,7 @@ SvNumberformat::SvNumberformat(String& rString,
         }
         if ( NumFor[nIndex].GetNatNum().IsSet() )
         {
-            NumFor[nIndex].SetNatNumDate(
-                (NumFor[nIndex].Info().eScannedType & NUMBERFORMAT_DATE) != 0 );
+            NumFor[nIndex].SetNatNumDate( (NumFor[nIndex].Info().eScannedType & NUMBERFORMAT_DATE) != 0 );
         }
     }
 
@@ -1071,9 +1160,10 @@ SvNumberformat::SvNumberformat(String& rString,
             }
         }
         else if ( nIndex == 1 && NumFor[nIndex].GetCount() == 0 &&
-                rString.GetChar(rString.Len()-1) != ';' &&
-                (NumFor[0].GetCount() > 1 || (NumFor[0].GetCount() == 1 &&
-                NumFor[0].Info().nTypeArray[0] != NF_KEY_GENERAL)) )
+                  rString.GetChar(rString.Len()-1) != ';' &&
+                  (NumFor[0].GetCount() > 1 ||
+                   (NumFor[0].GetCount() == 1 &&
+                    NumFor[0].Info().nTypeArray[0] != NF_KEY_GENERAL)) )
         {
             // No trailing second subformat => GENERAL   but not if specified empty
             // and not if first subformat is GENERAL
@@ -1091,8 +1181,8 @@ SvNumberformat::SvNumberformat(String& rString,
             }
         }
         else if ( nIndex == 2 && NumFor[nIndex].GetCount() == 0 &&
-                rString.GetChar(rString.Len()-1) != ';' &&
-                eOp2 != NUMBERFORMAT_OP_NO )
+                  rString.GetChar(rString.Len()-1) != ';' &&
+                  eOp2 != NUMBERFORMAT_OP_NO )
         {
             // No trailing third subformat => GENERAL   but not if specified empty
             OUString aAdd( pSc->GetStandardName() );
@@ -1114,7 +1204,9 @@ SvNumberformat::SvNumberformat(String& rString,
     if (NumFor[2].GetCount() == 0 &&                 // kein 3. Teilstring
         eOp1 == NUMBERFORMAT_OP_GT && eOp2 == NUMBERFORMAT_OP_NO &&
         fLimit1 == 0.0 && fLimit2 == 0.0)
+    {
         eOp1 = NUMBERFORMAT_OP_GE;                  // 0 zum ersten Format dazu
+    }
 
 }
 
@@ -1175,8 +1267,8 @@ enum ScanState
 // read a string until ']' and delete spaces in input
 // static
 xub_StrLen SvNumberformat::ImpGetNumber(String& rString,
-                                 xub_StrLen& nPos,
-                                 String& sSymbol)
+                                        xub_StrLen& nPos,
+                                        String& sSymbol)
 {
     xub_StrLen nStartPos = nPos;
     sal_Unicode cToken;
@@ -1204,13 +1296,17 @@ sal_Unicode toUniChar(sal_uInt8 n)
 {
     sal_Char c;
     if (n < 10)
+    {
         c = '0' + n;
+    }
     else
+    {
         c = 'A' + n - 10;
+    }
     return sal_Unicode(c);
 }
 
-}
+} // namespace
 
 OUString SvNumberformat::LocaleType::generateCode() const
 {
@@ -1224,7 +1320,9 @@ OUString SvNumberformat::LocaleType::generateCode() const
         {
             sal_uInt8 n = (nVal & 0xF0) >> 4;
             if (n || aBuf.getLength())
+            {
                 aBuf.append(toUniChar(n));
+            }
             nVal = nVal << 4;
         }
     }
@@ -1236,7 +1334,9 @@ OUString SvNumberformat::LocaleType::generateCode() const
         {
             sal_uInt8 n = (nVal & 0xF0) >> 4;
             if (n || aBuf.getLength())
+            {
                 aBuf.append(toUniChar(n));
+            }
             nVal = nVal << 4;
         }
     }
@@ -1248,24 +1348,26 @@ OUString SvNumberformat::LocaleType::generateCode() const
         sal_uInt8 n = static_cast<sal_uInt8>((n16 & 0xF000) >> 12);
         // Omit leading zeros for consistency.
         if (n || aBuf.getLength() || i == 3)
+        {
             aBuf.append(toUniChar(n));
+        }
         n16 = n16 << 4;
     }
 
     return aBuf.makeStringAndClear();
 }
 
-SvNumberformat::LocaleType::LocaleType() :
-    mnNumeralShape(0),
-    mnCalendarType(0),
-    meLanguage(LANGUAGE_DONTKNOW)
+SvNumberformat::LocaleType::LocaleType()
+    : mnNumeralShape(0)
+    , mnCalendarType(0)
+    , meLanguage(LANGUAGE_DONTKNOW)
 {
 }
 
-SvNumberformat::LocaleType::LocaleType(sal_uInt32 nRawNum) :
-    mnNumeralShape(0),
-    mnCalendarType(0),
-    meLanguage(LANGUAGE_DONTKNOW)
+SvNumberformat::LocaleType::LocaleType(sal_uInt32 nRawNum)
+    : mnNumeralShape(0)
+    , mnCalendarType(0)
+    , meLanguage(LANGUAGE_DONTKNOW)
 {
     meLanguage = static_cast<LanguageType>(nRawNum & 0x0000FFFF);
     nRawNum = (nRawNum >> 16);
@@ -1275,8 +1377,7 @@ SvNumberformat::LocaleType::LocaleType(sal_uInt32 nRawNum) :
 }
 
 // static
-SvNumberformat::LocaleType SvNumberformat::ImpGetLocaleType(
-    const String& rString, xub_StrLen& nPos )
+SvNumberformat::LocaleType SvNumberformat::ImpGetLocaleType(const String& rString, xub_StrLen& nPos )
 {
     sal_uInt32 nNum = 0;
     sal_Unicode cToken = 0;
@@ -1300,7 +1401,9 @@ SvNumberformat::LocaleType SvNumberformat::ImpGetLocaleType(
             nNum += cToken - 'A' + 10;
         }
         else
+        {
             return LANGUAGE_DONTKNOW;
+        }
         ++nPos;
     }
 
@@ -1308,8 +1411,8 @@ SvNumberformat::LocaleType SvNumberformat::ImpGetLocaleType(
 }
 
 short SvNumberformat::ImpNextSymbol(String& rString,
-                                 xub_StrLen& nPos,
-                                 String& sSymbol)
+                                    xub_StrLen& nPos,
+                                    String& sSymbol)
 {
     short eSymbolType = BRACKET_SYMBOLTYPE_FORMAT;
     sal_Unicode cToken;
@@ -1324,254 +1427,238 @@ short SvNumberformat::ImpNextSymbol(String& rString,
         nPos++;
         switch (eState)
         {
-            case SsStart:
+        case SsStart:
+            if (cToken == '[')
+            {
+                eState = SsGetBracketed;
+                sSymbol += cToken;
+            }
+            else if (cToken == ';')
+            {
+                eState = SsGetString;
+                nPos--;
+                eSymbolType = BRACKET_SYMBOLTYPE_FORMAT;
+            }
+            else if (cToken == ']')
             {
-                if (cToken == '[')
+                eState = SsStop;
+                eSymbolType = BRACKET_SYMBOLTYPE_ERROR;
+            }
+            else if (cToken == ' ')             // Skip Blanks
+            {
+                rString.Erase(nPos-1,1);
+                nPos--;
+                nLen--;
+            }
+            else
+            {
+                sSymbol += cToken;
+                eState = SsGetString;
+                eSymbolType = BRACKET_SYMBOLTYPE_FORMAT;
+            }
+            break;
+        case SsGetBracketed:
+            switch (cToken)
+            {
+            case '<':
+            case '>':
+            case '=':
+                sSymbol = comphelper::string::remove(sSymbol, '[');
+                sSymbol += cToken;
+                cLetter = cToken;
+                eState = SsGetCon;
+                switch (cToken)
                 {
-                    eState = SsGetBracketed;
-                    sSymbol += cToken;
+                case '<':
+                    eSymbolType = NUMBERFORMAT_OP_LT;
+                    break;
+                case '>':
+                    eSymbolType = NUMBERFORMAT_OP_GT;
+                    break;
+                case '=':
+                    eSymbolType = NUMBERFORMAT_OP_EQ;
+                    break;
+                default: break;
                 }
-                else if (cToken == ';')
-                {
-                    eState = SsGetString;
-                    nPos--;
+                break;
+            case ' ':
+                rString.Erase(nPos-1,1);
+                nPos--;
+                nLen--;
+                break;
+            case '$' :
+                if ( rString.GetChar(nPos) == '-' )
+                {   // [$-xxx] locale
+                    sSymbol = comphelper::string::remove(sSymbol, '[');
+                    eSymbolType = BRACKET_SYMBOLTYPE_LOCALE;
+                    eState = SsGetPrefix;
+                }
+                else
+                {   // currency as of SV_NUMBERFORMATTER_VERSION_NEW_CURR
                     eSymbolType = BRACKET_SYMBOLTYPE_FORMAT;
+                    eState = SsGetString;
+                }
+                sSymbol += cToken;
+                break;
+            case '~' :
+                // calendarID as of SV_NUMBERFORMATTER_VERSION_CALENDAR
+                eSymbolType = BRACKET_SYMBOLTYPE_FORMAT;
+                sSymbol += cToken;
+                eState = SsGetString;
+                break;
+            default:
+            {
+                const String aNatNum(RTL_CONSTASCII_USTRINGPARAM("NATNUM"));
+                const String aDBNum(RTL_CONSTASCII_USTRINGPARAM("DBNUM"));
+                String aUpperNatNum( rChrCls().uppercase( rString, nPos-1, aNatNum.Len() ) );
+                String aUpperDBNum( rChrCls().uppercase( rString, nPos-1, aDBNum.Len() ) );
+                sal_Unicode cUpper = aUpperNatNum.GetChar(0);
+                sal_Int32 nNatNumNum = rString.Copy( nPos-1+aNatNum.Len() ).ToInt32();
+                sal_Unicode cDBNum = rString.GetChar( nPos-1+aDBNum.Len() );
+                if ( aUpperNatNum == aNatNum && 0 <= nNatNumNum && nNatNumNum <= 19 )
+                {
+                    sSymbol = comphelper::string::remove(sSymbol, '[');
+                    sSymbol += rString.Copy( --nPos, aNatNum.Len()+1 );
+                    nPos += aNatNum.Len()+1;
+                    //! SymbolType is negative
+                    eSymbolType = (short) (BRACKET_SYMBOLTYPE_NATNUM0 - nNatNumNum);
+                    eState = SsGetPrefix;
                 }
-                else if (cToken == ']')
+                else if ( aUpperDBNum == aDBNum && '1' <= cDBNum && cDBNum <= '9' )
                 {
-                    eState = SsStop;
-                    eSymbolType = BRACKET_SYMBOLTYPE_ERROR;
+                    sSymbol = comphelper::string::remove(sSymbol, '[');
+                    sSymbol += rString.Copy( --nPos, aDBNum.Len()+1 );
+                    nPos += aDBNum.Len()+1;
+                    //! SymbolType is negative
+                    eSymbolType = sal::static_int_cast< short >(
+                        BRACKET_SYMBOLTYPE_DBNUM1 - (cDBNum - '1'));
+                    eState = SsGetPrefix;
                 }
-                else if (cToken == ' ')             // Skip Blanks
+                else if (cUpper == rKeywords[NF_KEY_H][0] ||  // H
+                         cUpper == rKeywords[NF_KEY_MI][0] ||  // M
+                         cUpper == rKeywords[NF_KEY_S][0] )   // S
                 {
-                    rString.Erase(nPos-1,1);
-                    nPos--;
-                    nLen--;
+                    sSymbol += cToken;
+                    eState = SsGetTime;
+                    cLetter = cToken;
                 }
                 else
                 {
+                    sSymbol = comphelper::string::remove(sSymbol, '[');
                     sSymbol += cToken;
-                    eState = SsGetString;
-                    eSymbolType = BRACKET_SYMBOLTYPE_FORMAT;
+                    eSymbolType = BRACKET_SYMBOLTYPE_COLOR;
+                    eState = SsGetPrefix;
                 }
             }
+            }
             break;
-            case SsGetBracketed:
+        case SsGetString:
+            if (cToken == ';')
             {
-                switch (cToken)
+                eState = SsStop;
+            }
+            else
+            {
+                sSymbol += cToken;
+            }
+            break;
+        case SsGetTime:
+            if (cToken == ']')
+            {
+                sSymbol += cToken;
+                eState = SsGetString;
+                eSymbolType = BRACKET_SYMBOLTYPE_FORMAT;
+            }
+            else
+            {
+                sal_Unicode cUpper = rChrCls().uppercase(rString, nPos-1, 1)[0];
+                if (cUpper == rKeywords[NF_KEY_H][0] ||  // H
+                    cUpper == rKeywords[NF_KEY_MI][0] ||  // M
+                    cUpper == rKeywords[NF_KEY_S][0] )   // S
                 {
-                    case '<':
-                    case '>':
-                    case '=':
+                    if (cLetter == cToken)
                     {
-                        sSymbol = comphelper::string::remove(sSymbol, '[');
                         sSymbol += cToken;
-                        cLetter = cToken;
-                        eState = SsGetCon;
-                        switch (cToken)
-                        {
-                            case '<': eSymbolType = NUMBERFORMAT_OP_LT; break;
-                            case '>': eSymbolType = NUMBERFORMAT_OP_GT; break;
-                            case '=': eSymbolType = NUMBERFORMAT_OP_EQ; break;
-                            default: break;
-                        }
-                    }
-                    break;
-                    case ' ':
-                    {
-                        rString.Erase(nPos-1,1);
-                        nPos--;
-                        nLen--;
+                        cLetter = ' ';
                     }
-                    break;
-                    case '$' :
+                    else
                     {
-                        if ( rString.GetChar(nPos) == '-' )
-                        {   // [$-xxx] locale

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list