[ooo-build-commit] patches/dev300

Kohei Yoshida kohei at kemper.freedesktop.org
Thu Nov 12 11:53:33 PST 2009


 patches/dev300/apply                               |    8 
 patches/dev300/calc-string-number-decimal.diff     |   38 ++
 patches/dev300/sc-string-arg-counta-fix.diff       |   14 
 patches/dev300/sc-string-arg-ref-formula-cell.diff |   20 -
 patches/dev300/sc-string-arg.diff                  |  300 ---------------------
 5 files changed, 39 insertions(+), 341 deletions(-)

New commits:
commit 25b5b398710e8f8aafe3da10bbfda122c4ac74f5
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Thu Nov 12 14:49:58 2009 -0500

    (Finally) ported string number patches from 3.1.1 to 3.2.
    
    * patches/dev300/apply:
    * patches/dev300/calc-string-number-decimal.diff: re-implemented
      decimal number conversion on top of the upstream implementation.
    
    * patches/dev300/sc-string-arg-counta-fix.diff:
    * patches/dev300/sc-string-arg-ref-formula-cell.diff:
    * patches/dev300/sc-string-arg.diff: removed; obsoleted by the
      patch above.

diff --git a/patches/dev300/apply b/patches/dev300/apply
index 17da882..893a644 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -833,13 +833,7 @@ calc-xls-export-encryption-condfmt-fix-m60.diff, n#541058, i#105933, kohei
 
 [ CalcFixes ]
 # Excel compatibility for handling of "string numbers".
-# LATER: I'll take care of this later. --kohei
-# sc-string-arg.diff, i#5658, kohei
-# Fix for the above string number patch, for cases where a formula cell is
-# being referenced by the origin cell.
-# sc-string-arg-ref-formula-cell.diff, n#391330, kohei
-# Fix an error in presence of string literals in COUNTA.
-# sc-string-arg-counta-fix.diff, n#446622, kohei
+calc-string-number-decimal.diff, kohei
 
 # Support PHONETIC function to display asian phonetic guide.
 # LATER: I'll take care of this later.  --kohei
diff --git a/patches/dev300/calc-string-number-decimal.diff b/patches/dev300/calc-string-number-decimal.diff
new file mode 100644
index 0000000..a2f7ed4
--- /dev/null
+++ b/patches/dev300/calc-string-number-decimal.diff
@@ -0,0 +1,38 @@
+diff --git sc/source/core/inc/interpre.hxx sc/source/core/inc/interpre.hxx
+index b1ef2ef..2bf9e62 100644
+--- sc/source/core/inc/interpre.hxx
++++ sc/source/core/inc/interpre.hxx
+@@ -190,6 +190,9 @@ private:
+ 
+     VolatileType meVolaileType;
+ 
++    sal_Unicode cDecSep;                // decimal separator 
++    sal_Unicode cGrpSep;                // group separator
++
+ //---------------------------------Funktionen in interpre.cxx---------
+ // nMust <= nAct <= nMax ? ok : PushError
+ inline BOOL MustHaveParamCount( short nAct, short nMust );
+diff --git sc/source/core/tool/interpr4.cxx sc/source/core/tool/interpr4.cxx
+index 70540d1..d738dcf 100644
+--- sc/source/core/tool/interpr4.cxx
++++ sc/source/core/tool/interpr4.cxx
+@@ -257,7 +257,7 @@ double ScInterpreter::ConvertStringToValue( const String& rStr )
+     sal_Int32 nParseEnd;
+     // Decimal and group separator 0 => only integer and possibly exponent, 
+     // stops at first non-digit non-sign.
+-    fValue = ::rtl::math::stringToDouble( aStr, 0, 0, &eStatus, &nParseEnd);
++    fValue = ::rtl::math::stringToDouble( aStr, cDecSep, cGrpSep, &eStatus, &nParseEnd);
+     sal_Int32 nLen;
+     if (eStatus == rtl_math_ConversionStatus_Ok && nParseEnd < (nLen = aStr.getLength()))
+     {
+@@ -3652,6 +3652,10 @@ ScInterpreter::ScInterpreter( ScFormulaCell* pCell, ScDocument* pDoc,
+         pStackObj = new ScTokenStack;
+     }
+     pStack = pStackObj->pPointer;
++
++    const i18n::LocaleDataItem& rLocaleData = ScGlobal::GetpLocaleData()->getLocaleItem();
++    cDecSep = rLocaleData.decimalSeparator.getLength() ? rLocaleData.decimalSeparator.getStr()[0] : 0;
++    cGrpSep = rLocaleData.thousandSeparator.getLength() ? rLocaleData.thousandSeparator.getStr()[0] : 0;
+ }
+ 
+ ScInterpreter::~ScInterpreter()
diff --git a/patches/dev300/sc-string-arg-counta-fix.diff b/patches/dev300/sc-string-arg-counta-fix.diff
deleted file mode 100644
index b2d708f..0000000
--- a/patches/dev300/sc-string-arg-counta-fix.diff
+++ /dev/null
@@ -1,14 +0,0 @@
-diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
-index 4f1976a..a2adbe9 100644
---- sc/source/core/tool/interpr1.cxx
-+++ sc/source/core/tool/interpr1.cxx
-@@ -3078,6 +3078,9 @@ double ScInterpreter::IterateParameters( ScIterFunc eFunc, BOOL bTextAsZero )
-                     if ( bTextAsZero || pFormatter->IsNumberFormat(aStr, nFIndex, fVal))
-                         nCount++;
-                 }
-+                else if (eFunc == ifCOUNT2)
-+                    // COUNTA - we should count both number and string.
-+                    ++nCount;
-                 else
-                 {
-                     if ( bTextAsZero && eStackType == svString )
diff --git a/patches/dev300/sc-string-arg-ref-formula-cell.diff b/patches/dev300/sc-string-arg-ref-formula-cell.diff
deleted file mode 100644
index 25b62c8..0000000
--- a/patches/dev300/sc-string-arg-ref-formula-cell.diff
+++ /dev/null
@@ -1,20 +0,0 @@
-diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/core/tool/interpr4.cxx sc/source/core/tool/interpr4.cxx
---- sc.clean/source/core/tool/interpr4.cxx	2008-05-16 12:06:11.000000000 -0400
-+++ sc/source/core/tool/interpr4.cxx	2008-05-16 12:18:44.000000000 -0400
-@@ -242,8 +242,14 @@ double ScInterpreter::GetCellValueOrZero
- 					}
- 					else
- 					{
--                        SetError(errCellNoValue);
--						fValue = 0.0;
-+                        String aStr;
-+                        pFCell->GetString(aStr);
-+                        sal_uInt32 nFIndex = 0;
-+                        if (!pFormatter->IsNumberFormat(aStr, nFIndex, fValue))
-+                        {
-+                            SetError(errCellNoValue);
-+                            fValue = 0.0;
-+                        }
- 					}
- 				}
- 				else
diff --git a/patches/dev300/sc-string-arg.diff b/patches/dev300/sc-string-arg.diff
deleted file mode 100644
index fc9c139..0000000
--- a/patches/dev300/sc-string-arg.diff
+++ /dev/null
@@ -1,300 +0,0 @@
-diff --git sc/source/core/inc/interpre.hxx sc/source/core/inc/interpre.hxx
-index b9b91a8..681766d 100644
---- sc/source/core/inc/interpre.hxx
-+++ sc/source/core/inc/interpre.hxx
-@@ -178,8 +178,18 @@ void ReplaceCell( ScAddress& );     // for TableOp
- void ReplaceCell( SCCOL& rCol, SCROW& rRow, SCTAB& rTab );  // for TableOp
- BOOL IsTableOpInRange( const ScRange& );
- ULONG GetCellNumberFormat( const ScAddress&, const ScBaseCell* );
--double GetCellValue( const ScAddress&, const ScBaseCell* );
--double GetCellValueOrZero( const ScAddress&, const ScBaseCell* );
-+
-+/** 
-+ * @param bNoValueAsError when true, cell having no numerical value 
-+ *                        (errCellNoValue) is interpreted as a legitimate
-+ *                        no-value (errNoValue) error.
-+ * @param bBlankAsZero when true, a cell having a blank text value is 
-+ *                     interpreted as a no-value error.
-+ * 
-+ * @return double cell value.
-+ */
-+double GetCellValue( const ScAddress&, const ScBaseCell*, bool bNoValueAsError = false, bool bBlankAsZero = false );
-+double GetCellValueOrZero( const ScAddress&, const ScBaseCell*, bool bBlankAsZero );
- double GetValueCellValue( const ScAddress&, const ScValueCell* );
- ScBaseCell* GetCell( const ScAddress& rPos )
-     { return pDok->GetCell( rPos ); }
-@@ -318,7 +328,7 @@ formula::StackVar GetStackType( BYTE nParam );
- BYTE GetByte() { return cPar; }
- // generiert aus DoubleRef positionsabhaengige SingleRef
- BOOL DoubleRefToPosSingleRef( const ScRange& rRange, ScAddress& rAdr );
--double GetDouble();
-+double GetDouble( bool bNoValueAsError = false, bool bBlankAsZero = false );
- double GetDoubleWithDefault(double nDefault);
- BOOL IsMissing();
- BOOL GetBool() { return GetDouble() != 0.0; }
-diff --git sc/source/core/tool/interpr1.cxx sc/source/core/tool/interpr1.cxx
-index 5a6eb67..7e5a478 100644
---- sc/source/core/tool/interpr1.cxx
-+++ sc/source/core/tool/interpr1.cxx
-@@ -3189,12 +3189,13 @@ double ScInterpreter::IterateParameters( ScIterFunc eFunc, BOOL bTextAsZero )
-         nGlobalError = 0;
-     while (nParamCount-- > 0)
-     {
--        switch (GetStackType())
-+        StackVar eStackType = GetStackType();
-+        switch (eStackType)
-         {
--
-+            case svDouble:
-             case svString:
-             {
--                if( eFunc == ifCOUNT )
-+                if( eFunc == ifCOUNT && eStackType == svString  )
-                 {
-                     String aStr( PopString() );
-                     sal_uInt32 nFIndex = 0;                 // damit default Land/Spr.
-@@ -3203,42 +3204,23 @@ double ScInterpreter::IterateParameters( ScIterFunc eFunc, BOOL bTextAsZero )
-                 }
-                 else
-                 {
-+                    if ( bTextAsZero && eStackType == svString )
-+                    {
-+                        Pop();
-+                        nCount++;
-+                        if ( eFunc == ifPRODUCT )
-+                            fRes = 0.0;
-+                        fVal = 0;
-+                    }
-+                    else
-+                    {
-+                        fVal = GetDouble();
-+                        nCount++;
-+                    }
-                     switch ( eFunc )
-                     {
-                         case ifAVERAGE:
-                         case ifSUM:
--                        case ifSUMSQ:
--                        case ifPRODUCT:
--                        {
--                            if ( bTextAsZero )
--                            {
--                                Pop();
--                                nCount++;
--                                if ( eFunc == ifPRODUCT )
--                                    fRes = 0.0;
--                            }
--                            else
--                            {
--                                while (nParamCount-- > 0)
--                                    Pop();
--                                SetError( errNoValue );
--                            }
--                        }
--                        break;
--                        default:
--                            Pop();
--                            nCount++;
--                    }
--                }
--            }
--            break;
--            case svDouble    :
--                fVal = GetDouble();
--                nCount++;
--                switch( eFunc )
--                {
--                    case ifAVERAGE:
--                    case ifSUM:
-                         if ( bNull && fVal != 0.0 )
-                         {
-                             bNull = FALSE;
-@@ -3247,12 +3229,15 @@ double ScInterpreter::IterateParameters( ScIterFunc eFunc, BOOL bTextAsZero )
-                         else
-                             fRes += fVal;
-                         break;
--                    case ifSUMSQ:   fRes += fVal * fVal; break;
--                    case ifPRODUCT: fRes *= fVal; break;
--                    default: ; // nothing
-+                        case ifSUMSQ:   fRes += fVal * fVal; break;
-+                        case ifPRODUCT: fRes *= fVal; break;
-+ 
-+                        default:;
-+                    }
-                 }
-                 nFuncFmtType = NUMBERFORMAT_NUMBER;
--                break;
-+            }
-+            break;
-             case svSingleRef :
-             {
-                 PopSingleRef( aAdr );
-diff --git sc/source/core/tool/interpr4.cxx sc/source/core/tool/interpr4.cxx
-index cd2fccc..ef0d533 100644
---- sc/source/core/tool/interpr4.cxx
-+++ sc/source/core/tool/interpr4.cxx
-@@ -207,19 +207,27 @@ double ScInterpreter::GetValueCellValue( const ScAddress& rPos, const ScValueCel
- }
- 
- 
--double ScInterpreter::GetCellValue( const ScAddress& rPos, const ScBaseCell* pCell )
-+double ScInterpreter::GetCellValue( const ScAddress& rPos, const ScBaseCell* pCell, 
-+                                    bool bNoValueAsError, bool bBlankAsZero )
- {
-     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke at sun.com", "ScInterpreter::GetCellValue" );
-     USHORT nErr = nGlobalError;
-     nGlobalError = 0;
--    double nVal = GetCellValueOrZero( rPos, pCell );
--    if ( !nGlobalError || nGlobalError == errCellNoValue )
-+    double nVal = GetCellValueOrZero( rPos, pCell, bBlankAsZero );
-+    if (!nGlobalError)
-+        // no global error.  good.
-         nGlobalError = nErr;
-+    else if (nGlobalError == errCellNoValue)
-+        // Internal cell-no-value error.  If the caller wants to treat no
-+        // value as error, then we need to translate this to a legitimate
-+        // error number (#VALUE!). If not, we should re-assign the prior error
-+        // number.
-+        nGlobalError = bNoValueAsError ? errNoValue : nErr;
-     return nVal;
- }
- 
- 
--double ScInterpreter::GetCellValueOrZero( const ScAddress& rPos, const ScBaseCell* pCell )
-+double ScInterpreter::GetCellValueOrZero( const ScAddress& rPos, const ScBaseCell* pCell, bool bBlankAsZero )
- {
-     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke at sun.com", "ScInterpreter::GetCellValueOrZero" );
-     double fValue;
-@@ -264,7 +272,7 @@ double ScInterpreter::GetCellValueOrZero( const ScAddress& rPos, const ScBaseCel
-             break;
-             case  CELLTYPE_STRING:
-             case  CELLTYPE_EDIT:
--#if 0
-+#if 1 /* JEG : re-enable because compatibility is more important than consistency for this */
- // Xcl does it, but SUM(A1:A2) differs from A1+A2. No good.
-             {
-                 String aStr;
-@@ -275,14 +283,15 @@ double ScInterpreter::GetCellValueOrZero( const ScAddress& rPos, const ScBaseCel
-                 sal_uInt32 nFIndex = 0;                 // damit default Land/Spr.
-                 if ( !pFormatter->IsNumberFormat( aStr, nFIndex, fValue ) )
-                 {
--                    SetError(errNoValue);
-+                    SetError(errCellNoValue);   /* CellNoValue is not really an error */
-                     fValue = 0.0;
-                 }
-             }
-             break;
- #endif
-             default:
--                SetError(errCellNoValue);
-+                if (!bBlankAsZero)
-+                    SetError(errCellNoValue);
-                 fValue = 0.0;
-         }
-     }
-@@ -1621,7 +1630,7 @@ BOOL ScInterpreter::DoubleRefToPosSingleRef( const ScRange& rRange, ScAddress& r
- }
- 
- 
--double ScInterpreter::GetDouble()
-+double ScInterpreter::GetDouble( bool bNoValueAsError, bool bBlankAsZero )
- {
-     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke at sun.com", "ScInterpreter::GetDouble" );
-     double nVal;
-@@ -1646,7 +1655,7 @@ double ScInterpreter::GetDouble()
-             ScAddress aAdr;
-             PopSingleRef( aAdr );
-             ScBaseCell* pCell = GetCell( aAdr );
--            nVal = GetCellValue( aAdr, pCell );
-+            nVal = GetCellValue( aAdr, pCell, bNoValueAsError, bBlankAsZero );
-         }
-         break;
-         case svDoubleRef:
-diff --git sc/source/core/tool/interpr5.cxx sc/source/core/tool/interpr5.cxx
-index 5b05f0c..c5b4770 100644
---- sc/source/core/tool/interpr5.cxx
-+++ sc/source/core/tool/interpr5.cxx
-@@ -1184,7 +1184,12 @@ void ScInterpreter::CalculateAddSub(BOOL _bSub)
-         pMat2 = GetMatrix();
-     else
-     {
--        fVal2 = GetDouble();
-+        fVal2 = GetDouble(true, true);
-+        if (nGlobalError)
-+        {
-+            PushError(nGlobalError);
-+            return;
-+        }
-         switch ( nCurFmtType )
-         {
-             case NUMBERFORMAT_DATE :
-@@ -1205,7 +1210,12 @@ void ScInterpreter::CalculateAddSub(BOOL _bSub)
-         pMat1 = GetMatrix();
-     else
-     {
--        fVal1 = GetDouble();
-+        fVal1 = GetDouble(true, true);
-+        if (nGlobalError)
-+        {
-+            PushError(nGlobalError);
-+            return;
-+        }
-         switch ( nCurFmtType )
-         {
-             case NUMBERFORMAT_DATE :
-@@ -1414,7 +1424,12 @@ void ScInterpreter::ScMul()
-         pMat2 = GetMatrix();
-     else
-     {
--        fVal2 = GetDouble();
-+        fVal2 = GetDouble(true, true);
-+        if (nGlobalError)
-+        {
-+            PushError(nGlobalError);
-+            return;
-+        }
-         switch ( nCurFmtType )
-         {
-             case NUMBERFORMAT_CURRENCY :
-@@ -1427,7 +1442,12 @@ void ScInterpreter::ScMul()
-         pMat1 = GetMatrix();
-     else
-     {
--        fVal1 = GetDouble();
-+        fVal1 = GetDouble(true, true);
-+        if (nGlobalError)
-+        {
-+            PushError(nGlobalError);
-+            return;
-+        }
-         switch ( nCurFmtType )
-         {
-             case NUMBERFORMAT_CURRENCY :
-@@ -1494,7 +1514,12 @@ void ScInterpreter::ScDiv()
-         pMat2 = GetMatrix();
-     else
-     {
--        fVal2 = GetDouble();
-+        fVal2 = GetDouble(true, true);
-+        if (nGlobalError)
-+        {
-+            PushError(nGlobalError);
-+            return;
-+        }
-         // hier kein Currency uebernehmen, 123kg/456DM sind nicht DM
-         nFmtCurrencyType2 = nCurFmtType;
-     }
-@@ -1502,7 +1527,12 @@ void ScInterpreter::ScDiv()
-         pMat1 = GetMatrix();
-     else
-     {
--        fVal1 = GetDouble();
-+        fVal1 = GetDouble(true, true);
-+        if (nGlobalError)
-+        {
-+            PushError(nGlobalError);
-+            return;
-+        }
-         switch ( nCurFmtType )
-         {
-             case NUMBERFORMAT_CURRENCY :


More information about the ooo-build-commit mailing list