[Libreoffice-commits] .: Branch 'libreoffice-3-4' - svl/source

Katarina Machalkova bubli at kemper.freedesktop.org
Fri Jul 8 05:59:33 PDT 2011


 svl/source/numbers/zforlist.cxx |   59 +++++++++++++++++++++-------------------
 1 file changed, 32 insertions(+), 27 deletions(-)

New commits:
commit b74f2e0c4ff7a0f8a0b5c031825aef7a7d211daf
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Thu Jul 7 12:05:01 2011 +0200

    fdo#38963: crash in number format dialog
    
    Signed-off-by: Katarina Machalkova <kmachalkova at novell.com>

diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index ae7cfae..2a62b2b 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -2749,7 +2749,6 @@ void SvNumberFormatter::GenerateFormat(String& sString,
     const String& rThSep = GetNumThousandSep();
 
     SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(nIndex);
-    sal_Bool insertBrackets = pFormat->IsNegativeInBracket();
 
     if (nAnzLeading == 0)
     {
@@ -2843,36 +2842,42 @@ void SvNumberFormatter::GenerateFormat(String& sString,
             sString += ';';
         sString += sNegStr;
     }
-    if ( (IsRed || insertBrackets ) && eType != NUMBERFORMAT_CURRENCY)
+    if (eType != NUMBERFORMAT_CURRENCY)
     {
-        String sTmpStr = sString;
-
-        if ( pFormat->HasPositiveBracketPlaceholder() )
+        bool insertBrackets = false;
+        if ( eType != NUMBERFORMAT_UNDEFINED)
+            insertBrackets = pFormat->IsNegativeInBracket();
+        if (IsRed || insertBrackets)
         {
-             sTmpStr += '_';
-             sTmpStr += ')';
-        }
-        sTmpStr += ';';
+            String sTmpStr = sString;
 
-        if (IsRed)
-        {
-            sTmpStr += '[';
-            sTmpStr += pFormatScanner->GetRedString();
-            sTmpStr += ']';
-        }
+            if ( pFormat->HasPositiveBracketPlaceholder() )
+            {
+                 sTmpStr += '_';
+                 sTmpStr += ')';
+            }
+            sTmpStr += ';';
 
-        if (insertBrackets)
-        {
-            sTmpStr += '(';
-            sTmpStr += sString;
-            sTmpStr += ')';
-        }
-        else
-        {
-            sTmpStr += '-';
-            sTmpStr +=sString;
-        }
-        sString = sTmpStr;
+            if (IsRed)
+            {
+                sTmpStr += '[';
+                sTmpStr += pFormatScanner->GetRedString();
+                sTmpStr += ']';
+            }
+
+            if (insertBrackets)
+            {
+                sTmpStr += '(';
+                sTmpStr += sString;
+                sTmpStr += ')';
+            }
+            else
+            {
+                sTmpStr += '-';
+                sTmpStr +=sString;
+            }
+            sString = sTmpStr;
+            }
     }
 }
 


More information about the Libreoffice-commits mailing list