[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - 3 commits - sc/source

Kohei Yoshida kohei.yoshida at gmail.com
Thu Mar 28 07:46:26 PDT 2013


 sc/source/core/inc/interpre.hxx  |    3 
 sc/source/core/tool/interpr1.cxx |  185 +++++++++++++++++++++------------------
 sc/source/core/tool/interpr2.cxx |    7 -
 sc/source/core/tool/interpr3.cxx |   56 ++++++-----
 sc/source/core/tool/interpr4.cxx |   15 ---
 sc/source/core/tool/interpr5.cxx |   24 ++---
 6 files changed, 152 insertions(+), 138 deletions(-)

New commits:
commit 35506095fcb7ac68dc3e18e8409ddb625d8f86ed
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Thu Mar 28 10:42:10 2013 -0400

    Remove HasCellValueData() and adjusted all its call sites.
    
    Change-Id: Idd651a0f970607d5f5434128e5270af10336048c

diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 8a3fc77..4cac100 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -196,7 +196,6 @@ ScBaseCell* GetCell( const ScAddress& rPos );
 void GetCellString( String& rStr, const ScBaseCell* pCell );
 void GetCellString( OUString& rStr, ScRefCellValue& rCell );
 sal_uInt16 GetCellErrCode( const ScRefCellValue& rCell );
-bool HasCellValueData( const ScBaseCell* pCell );
 
 bool CreateDoubleArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
                      SCCOL nCol2, SCROW nRow2, SCTAB nTab2, sal_uInt8* pCellArr);
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index fcdf226..53ebdf2 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -1415,11 +1415,12 @@ void ScInterpreter::ScAnd()
                         PopSingleRef( aAdr );
                         if ( !nGlobalError )
                         {
-                            ScBaseCell* pCell = GetCell( aAdr );
-                            if ( HasCellValueData( pCell ) )
+                            ScRefCellValue aCell;
+                            aCell.assign(*pDok, aAdr);
+                            if (aCell.hasNumeric())
                             {
                                 bHaveValue = true;
-                                nRes &= ( GetCellValue( aAdr, pCell ) != 0.0 );
+                                nRes &= ( GetCellValue(aAdr, aCell) != 0.0 );
                             }
                             // else: Xcl raises no error here
                         }
@@ -1515,11 +1516,12 @@ void ScInterpreter::ScOr()
                         PopSingleRef( aAdr );
                         if ( !nGlobalError )
                         {
-                            ScBaseCell* pCell = GetCell( aAdr );
-                            if ( HasCellValueData( pCell ) )
+                            ScRefCellValue aCell;
+                            aCell.assign(*pDok, aAdr);
+                            if (aCell.hasNumeric())
                             {
                                 bHaveValue = true;
-                                nRes |= ( GetCellValue( aAdr, pCell ) != 0.0 );
+                                nRes |= ( GetCellValue(aAdr, aCell) != 0.0 );
                             }
                             // else: Xcl raises no error here
                         }
@@ -1617,11 +1619,12 @@ void ScInterpreter::ScXor()
                         PopSingleRef( aAdr );
                         if ( !nGlobalError )
                         {
-                            ScBaseCell* pCell = GetCell( aAdr );
-                            if ( HasCellValueData( pCell ) )
+                            ScRefCellValue aCell;
+                            aCell.assign(*pDok, aAdr);
+                            if (aCell.hasNumeric())
                             {
                                 bHaveValue = true;
-                                nRes ^= ( GetCellValue( aAdr, pCell ) != 0.0 );
+                                nRes ^= ( GetCellValue(aAdr, aCell) != 0.0 );
                             }
                             /* TODO: set error? Excel doesn't have XOR, but
                              * doesn't set an error in this case for AND and
@@ -5110,7 +5113,7 @@ void ScInterpreter::ScMatch()
         if (nGlobalError == 0)
         {
             double fVal;
-            String sStr;
+            OUString sStr;
             ScQueryParam rParam;
             rParam.nCol1       = nCol1;
             rParam.nRow1       = nRow1;
@@ -5149,16 +5152,17 @@ void ScInterpreter::ScMatch()
                         PushInt(0);
                         return ;
                     }
-                    ScBaseCell* pCell = GetCell( aAdr );
-                    if (HasCellValueData(pCell))
+                    ScRefCellValue aCell;
+                    aCell.assign(*pDok, aAdr);
+                    if (aCell.hasNumeric())
                     {
-                        fVal = GetCellValue( aAdr, pCell );
+                        fVal = GetCellValue(aAdr, aCell);
                         rItem.meType = ScQueryEntry::ByValue;
                         rItem.mfVal = fVal;
                     }
                     else
                     {
-                        GetCellString(sStr, pCell);
+                        GetCellString(sStr, aCell);
                         rItem.meType = ScQueryEntry::ByString;
                         rItem.maString = sStr;
                     }
@@ -5741,10 +5745,11 @@ double ScInterpreter::IterateParametersIf( ScIterFuncIf eFunc )
                             {
                                 aAdr.SetCol( nCol + nColDiff);
                                 aAdr.SetRow( nRow + nRowDiff);
-                                ScBaseCell* pCell = GetCell( aAdr );
-                                if ( HasCellValueData(pCell) )
+                                ScRefCellValue aCell;
+                                aCell.assign(*pDok, aAdr);
+                                if (aCell.hasNumeric())
                                 {
-                                    fVal = GetCellValue( aAdr, pCell );
+                                    fVal = GetCellValue(aAdr, aCell);
                                     ++fCount;
                                     if ( bNull && fVal != 0.0 )
                                     {
@@ -5792,10 +5797,11 @@ double ScInterpreter::IterateParametersIf( ScIterFuncIf eFunc )
                         {
                             aAdr.SetCol( aCellIter.GetCol() + nColDiff);
                             aAdr.SetRow( aCellIter.GetRow() + nRowDiff);
-                            ScBaseCell* pCell = GetCell( aAdr );
-                            if ( HasCellValueData(pCell) )
+                            ScRefCellValue aCell;
+                            aCell.assign(*pDok, aAdr);
+                            if (aCell.hasNumeric())
                             {
-                                fVal = GetCellValue( aAdr, pCell );
+                                fVal = GetCellValue(aAdr, aCell);
                                 ++fCount;
                                 if ( bNull && fVal != 0.0 )
                                 {
@@ -6397,10 +6403,11 @@ double ScInterpreter::IterateParametersIfs( ScIterFuncIfs eFunc )
                         {
                             aAdr.SetCol( static_cast<SCCOL>(nCol) + nMainCol1);
                             aAdr.SetRow( static_cast<SCROW>(nRow) + nMainRow1);
-                            ScBaseCell* pCell = GetCell( aAdr );
-                            if ( HasCellValueData(pCell) )
+                            ScRefCellValue aCell;
+                            aCell.assign(*pDok, aAdr);
+                            if (aCell.hasNumeric())
                             {
-                                fVal = GetCellValue( aAdr, pCell );
+                                fVal = GetCellValue(aAdr, aCell);
                                 ++fCount;
                                 if ( bNull && fVal != 0.0 )
                                 {
@@ -7399,7 +7406,7 @@ ScDBQueryParamBase* ScInterpreter::GetDBParams( bool& rMissingField )
 
         bool    bByVal = true;
         double  nVal = 0.0;
-        String  aStr;
+        OUString  aStr;
         ScRange aMissingRange;
         bool bRangeFake = false;
         switch (GetStackType())
@@ -7417,13 +7424,14 @@ ScDBQueryParamBase* ScInterpreter::GetDBParams( bool& rMissingField )
                 {
                     ScAddress aAdr;
                     PopSingleRef( aAdr );
-                    ScBaseCell* pCell = GetCell( aAdr );
-                    if (HasCellValueData(pCell))
-                        nVal = GetCellValue( aAdr, pCell );
+                    ScRefCellValue aCell;
+                    aCell.assign(*pDok, aAdr);
+                    if (aCell.hasNumeric())
+                        nVal = GetCellValue(aAdr, aCell);
                     else
                     {
                         bByVal = false;
-                        GetCellString(aStr, pCell);
+                        GetCellString(aStr, aCell);
                     }
                 }
                 break;
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index bb87e61..3fadc45 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -2234,10 +2234,11 @@ void ScInterpreter::ScZTest()
         {
             ScAddress aAdr;
             PopSingleRef( aAdr );
-            ScBaseCell* pCell = GetCell( aAdr );
-            if (HasCellValueData(pCell))
+            ScRefCellValue aCell;
+            aCell.assign(*pDok, aAdr);
+            if (aCell.hasNumeric())
             {
-                fVal = GetCellValue( aAdr, pCell );
+                fVal = GetCellValue(aAdr, aCell);
                 fSum += fVal;
                 fSumSqr += fVal*fVal;
                 rValCount++;
@@ -2665,10 +2666,11 @@ void ScInterpreter::ScHarMean()
             case svSingleRef :
             {
                 PopSingleRef( aAdr );
-                ScBaseCell* pCell = GetCell( aAdr );
-                if (HasCellValueData(pCell))
+                ScRefCellValue aCell;
+                aCell.assign(*pDok, aAdr);
+                if (aCell.hasNumeric())
                 {
-                    double x = GetCellValue( aAdr, pCell );
+                    double x = GetCellValue(aAdr, aCell);
                     if (x > 0.0)
                     {
                         nVal += 1.0/x;
@@ -2788,10 +2790,11 @@ void ScInterpreter::ScGeoMean()
             case svSingleRef :
             {
                 PopSingleRef( aAdr );
-                ScBaseCell* pCell = GetCell( aAdr );
-                if (HasCellValueData(pCell))
+                ScRefCellValue aCell;
+                aCell.assign(*pDok, aAdr);
+                if (aCell.hasNumeric())
                 {
-                    double x = GetCellValue( aAdr, pCell );
+                    double x = GetCellValue(aAdr, aCell);
                     if (x > 0.0)
                     {
                         nVal += log(x);
@@ -2927,10 +2930,11 @@ bool ScInterpreter::CalculateSkew(double& fSum,double& fCount,double& vSum,std::
             case svSingleRef :
             {
                 PopSingleRef( aAdr );
-                ScBaseCell* pCell = GetCell( aAdr );
-                if (HasCellValueData(pCell))
+                ScRefCellValue aCell;
+                aCell.assign(*pDok, aAdr);
+                if (aCell.hasNumeric())
                 {
-                    fVal = GetCellValue( aAdr, pCell );
+                    fVal = GetCellValue(aAdr, aCell);
                     fSum += fVal;
                     values.push_back(fVal);
                     fCount++;
@@ -3345,9 +3349,10 @@ void ScInterpreter::GetNumberSequenceArray( sal_uInt8 nParamCount, vector<double
             case svSingleRef :
             {
                 PopSingleRef( aAdr );
-                ScBaseCell* pCell = GetCell( aAdr );
-                if (HasCellValueData(pCell))
-                    rArray.push_back( GetCellValue( aAdr, pCell));
+                ScRefCellValue aCell;
+                aCell.assign(*pDok, aAdr);
+                if (aCell.hasNumeric())
+                    rArray.push_back(GetCellValue(aAdr, aCell));
             }
             break;
             case formula::svDoubleRef :
@@ -3532,10 +3537,11 @@ void ScInterpreter::ScRank()
             ScAddress aAdr;
             PopSingleRef( aAdr );
             double fVal = GetDouble();
-            ScBaseCell* pCell = GetCell( aAdr );
-            if (HasCellValueData(pCell))
+            ScRefCellValue aCell;
+            aCell.assign(*pDok, aAdr);
+            if (aCell.hasNumeric())
             {
-                double x = GetCellValue( aAdr, pCell );
+                double x = GetCellValue(aAdr, aCell);
                 if (x == fVal)
                     bValid = true;
             }
@@ -3651,10 +3657,11 @@ void ScInterpreter::ScAveDev()
             case svSingleRef :
             {
                 PopSingleRef( aAdr );
-                ScBaseCell* pCell = GetCell( aAdr );
-                if (HasCellValueData(pCell))
+                ScRefCellValue aCell;
+                aCell.assign(*pDok, aAdr);
+                if (aCell.hasNumeric())
                 {
-                    rVal += GetCellValue( aAdr, pCell );
+                    rVal += GetCellValue(aAdr, aCell);
                     rValCount++;
                 }
             }
@@ -3733,9 +3740,10 @@ void ScInterpreter::ScAveDev()
             case svSingleRef :
             {
                 PopSingleRef( aAdr );
-                ScBaseCell* pCell = GetCell( aAdr );
-                if (HasCellValueData(pCell))
-                    rVal += fabs(GetCellValue( aAdr, pCell ) - nMiddle);
+                ScRefCellValue aCell;
+                aCell.assign(*pDok, aAdr);
+                if (aCell.hasNumeric())
+                    rVal += fabs(GetCellValue(aAdr, aCell) - nMiddle);
             }
             break;
             case formula::svDoubleRef :
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 92d4467..8f9133a 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -193,11 +193,6 @@ sal_uInt16 ScInterpreter::GetCellErrCode( const ScRefCellValue& rCell )
     return rCell.meType == CELLTYPE_FORMULA ? rCell.mpFormula->GetErrorCode() : 0;
 }
 
-bool ScInterpreter::HasCellValueData( const ScBaseCell* pCell )
-{
-    return pCell ? pCell->HasValueData() : false;
-}
-
 /** Convert string content to numeric value.
 
     Converted are only integer numbers including exponent, and ISO 8601 dates
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index 5e0c464..829a1e0 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -666,13 +666,14 @@ void ScInterpreter::ScMatValue()
                 {
                     ScAddress aAdr( sal::static_int_cast<SCCOL>( nCol1 + nR ),
                                     sal::static_int_cast<SCROW>( nRow1 + nC ), nTab1 );
-                    ScBaseCell* pCell = GetCell( aAdr );
-                    if (HasCellValueData(pCell))
-                        PushDouble(GetCellValue( aAdr, pCell ));
+                    ScRefCellValue aCell;
+                    aCell.assign(*pDok, aAdr);
+                    if (aCell.hasNumeric())
+                        PushDouble(GetCellValue(aAdr, aCell));
                     else
                     {
-                        String aStr;
-                        GetCellString(aStr, pCell);
+                        OUString aStr;
+                        GetCellString(aStr, aCell);
                         PushString(aStr);
                     }
                 }
commit 2f55dd643f813799efd0193f13c080fa734a461b
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Thu Mar 28 10:27:20 2013 -0400

    Remove HasCellStringData() and modifiy all its call sites.
    
    Change-Id: I2a127b8433bc6f2629ad8d41b532c630a433c59b

diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 26082b4..8a3fc77 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -197,7 +197,6 @@ void GetCellString( String& rStr, const ScBaseCell* pCell );
 void GetCellString( OUString& rStr, ScRefCellValue& rCell );
 sal_uInt16 GetCellErrCode( const ScRefCellValue& rCell );
 bool HasCellValueData( const ScBaseCell* pCell );
-bool HasCellStringData( const ScBaseCell* pCell );
 
 bool CreateDoubleArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
                      SCCOL nCol2, SCROW nRow2, SCTAB nTab2, sal_uInt8* pCellArr);
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 4dc426c..fcdf226 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -2449,7 +2449,8 @@ void ScInterpreter::ScCell()
             PushIllegalParameter();
         else
         {
-            ScBaseCell*     pCell = GetCell( aCellPos );
+            ScRefCellValue aCell;
+            aCell.assign(*pDok, aCellPos);
 
             ScCellKeywordTranslator::transKeyword(aInfoType, ScGlobal::GetLocale(), ocCell);
 
@@ -2518,22 +2519,22 @@ void ScInterpreter::ScCell()
 // *** CELL PROPERTIES ***
             else if( aInfoType.EqualsAscii( "CONTENTS" ) )
             {   // contents of the cell, no formatting
-                if( pCell && pCell->HasStringData() )
+                if (aCell.hasString())
                 {
-                    String aStr;
-                    GetCellString( aStr, pCell );
+                    OUString aStr;
+                    GetCellString(aStr, aCell);
                     PushString( aStr );
                 }
                 else
-                    PushDouble( GetCellValue( aCellPos, pCell ) );
+                    PushDouble(GetCellValue(aCellPos, aCell));
             }
             else if( aInfoType.EqualsAscii( "TYPE" ) )
             {   // b = blank; l = string (label); v = otherwise (value)
                 sal_Unicode c;
-                if( HasCellStringData( pCell ) )
+                if (aCell.hasString())
                     c = 'l';
                 else
-                    c = HasCellValueData( pCell ) ? 'v' : 'b';
+                    c = aCell.hasNumeric() ? 'v' : 'b';
                 PushString( OUString(c) );
             }
             else if( aInfoType.EqualsAscii( "WIDTH" ) )
@@ -2556,7 +2557,7 @@ void ScInterpreter::ScCell()
             else if( aInfoType.EqualsAscii( "PREFIX" ) )
             {   // ' = left; " = right; ^ = centered
                 sal_Unicode c = 0;
-                if( HasCellStringData( pCell ) )
+                if (aCell.hasString())
                 {
                     const SvxHorJustifyItem* pJustAttr = (const SvxHorJustifyItem*)
                         pDok->GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_HOR_JUSTIFY );
@@ -3685,14 +3686,15 @@ void ScInterpreter::ScMin( bool bTextAsZero )
             case svSingleRef :
             {
                 PopSingleRef( aAdr );
-                ScBaseCell* pCell = GetCell( aAdr );
-                if (HasCellValueData(pCell))
+                ScRefCellValue aCell;
+                aCell.assign(*pDok, aAdr);
+                if (aCell.hasNumeric())
                 {
-                    nVal = GetCellValue( aAdr, pCell );
+                    nVal = GetCellValue(aAdr, aCell);
                     CurFmtToFuncFmt();
                     if (nMin > nVal) nMin = nVal;
                 }
-                else if ( bTextAsZero && HasCellStringData( pCell ) )
+                else if (bTextAsZero && aCell.hasString())
                 {
                     if ( nMin > 0.0 )
                         nMin = 0.0;
@@ -3808,14 +3810,15 @@ void ScInterpreter::ScMax( bool bTextAsZero )
             case svSingleRef :
             {
                 PopSingleRef( aAdr );
-                ScBaseCell* pCell = GetCell( aAdr );
-                if (HasCellValueData(pCell))
+                ScRefCellValue aCell;
+                aCell.assign(*pDok, aAdr);
+                if (aCell.hasNumeric())
                 {
-                    nVal = GetCellValue( aAdr, pCell );
+                    nVal = GetCellValue(aAdr, aCell);
                     CurFmtToFuncFmt();
                     if (nMax < nVal) nMax = nVal;
                 }
-                else if ( bTextAsZero && HasCellStringData( pCell ) )
+                else if (bTextAsZero && aCell.hasString())
                 {
                     if ( nMax < 0.0 )
                         nMax = 0.0;
@@ -4371,15 +4374,16 @@ void ScInterpreter::GetStVarParams( double& rVal, double& rValCount,
             case svSingleRef :
             {
                 PopSingleRef( aAdr );
-                ScBaseCell* pCell = GetCell( aAdr );
-                if (HasCellValueData(pCell))
+                ScRefCellValue aCell;
+                aCell.assign(*pDok, aAdr);
+                if (aCell.hasNumeric())
                 {
-                    fVal = GetCellValue( aAdr, pCell );
+                    fVal = GetCellValue(aAdr, aCell);
                     values.push_back(fVal);
                     fSum += fVal;
                     rValCount++;
                 }
-                else if ( bTextAsZero && HasCellStringData( pCell ) )
+                else if (bTextAsZero && aCell.hasString())
                 {
                     values.push_back(0.0);
                     rValCount++;
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 361663c..92d4467 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -198,11 +198,6 @@ bool ScInterpreter::HasCellValueData( const ScBaseCell* pCell )
     return pCell ? pCell->HasValueData() : false;
 }
 
-bool ScInterpreter::HasCellStringData( const ScBaseCell* pCell )
-{
-    return pCell ? pCell->HasStringData() : false;
-}
-
 /** Convert string content to numeric value.
 
     Converted are only integer numbers including exponent, and ISO 8601 dates
commit 38ffd5653c38046722ffbfdc06c05158a30518a7
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Thu Mar 28 10:14:46 2013 -0400

    Remove HasCellEmptyData() from ScInterpreter.
    
    Change-Id: Ide68fed6195adb655539e2d3ea3d16cf0b3363d5

diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 6359e82..26082b4 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -196,7 +196,6 @@ ScBaseCell* GetCell( const ScAddress& rPos );
 void GetCellString( String& rStr, const ScBaseCell* pCell );
 void GetCellString( OUString& rStr, ScRefCellValue& rCell );
 sal_uInt16 GetCellErrCode( const ScRefCellValue& rCell );
-bool HasCellEmptyData( const ScBaseCell* pCell );
 bool HasCellValueData( const ScBaseCell* pCell );
 bool HasCellStringData( const ScBaseCell* pCell );
 
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 3e480e1..4dc426c 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -617,12 +617,13 @@ bool ScInterpreter::JumpMatrix( short nStackLevel )
                     }
                     else
                     {
-                        ScBaseCell* pCell = GetCell( aAdr );
-                        if (HasCellEmptyData( pCell))
+                        ScRefCellValue aCell;
+                        aCell.assign(*pDok, aAdr);
+                        if (aCell.hasEmptyValue())
                             pResMat->PutEmpty( nC, nR );
-                        else if (HasCellValueData( pCell))
+                        else if (aCell.hasNumeric())
                         {
-                            double fVal = GetCellValue( aAdr, pCell);
+                            double fVal = GetCellValue(aAdr, aCell);
                             if ( nGlobalError )
                             {
                                 fVal = CreateDoubleError(
@@ -633,8 +634,8 @@ bool ScInterpreter::JumpMatrix( short nStackLevel )
                         }
                         else
                         {
-                            String aStr;
-                            GetCellString( aStr, pCell );
+                            OUString aStr;
+                            GetCellString(aStr, aCell);
                             if ( nGlobalError )
                             {
                                 pResMat->PutDouble( CreateDoubleError(
@@ -684,12 +685,13 @@ bool ScInterpreter::JumpMatrix( short nStackLevel )
                                 nRow = aRange.aStart.Row();
                             aAdr.SetCol( static_cast<SCCOL>(nCol) );
                             aAdr.SetRow( static_cast<SCROW>(nRow) );
-                            ScBaseCell* pCell = GetCell( aAdr );
-                            if (HasCellEmptyData( pCell))
+                            ScRefCellValue aCell;
+                            aCell.assign(*pDok, aAdr);
+                            if (aCell.hasEmptyValue())
                                 pResMat->PutEmpty( nC, nR );
-                            else if (HasCellValueData( pCell))
+                            else if (aCell.hasNumeric())
                               {
-                                double fCellVal = GetCellValue( aAdr, pCell);
+                                double fCellVal = GetCellValue(aAdr, aCell);
                                 if ( nGlobalError )
                                 {
                                     fCellVal = CreateDoubleError(
@@ -700,8 +702,8 @@ bool ScInterpreter::JumpMatrix( short nStackLevel )
                               }
                               else
                             {
-                                String aStr;
-                                GetCellString( aStr, pCell );
+                                OUString aStr;
+                                GetCellString(aStr, aCell);
                                 if ( nGlobalError )
                                 {
                                     pResMat->PutDouble( CreateDoubleError(
@@ -1022,18 +1024,21 @@ double ScInterpreter::Compare()
                 ScAddress aAdr;
                 if ( !PopDoubleRefOrSingleRef( aAdr ) )
                     break;
-                ScBaseCell* pCell = GetCell( aAdr );
-                if (HasCellEmptyData( pCell))
-                    aComp.bEmpty[ i ] = true;
-                else if (HasCellStringData( pCell))
+                ScRefCellValue aCell;
+                aCell.assign(*pDok, aAdr);
+                if (aCell.hasEmptyValue())
+                    aComp.bEmpty[i] = true;
+                else if (aCell.hasString())
                 {
-                    GetCellString( *aComp.pVal[ i ], pCell);
-                    aComp.bVal[ i ] = false;
+                    OUString aStr;
+                    GetCellString(aStr, aCell);
+                    *aComp.pVal[i] = aStr;
+                    aComp.bVal[i] = false;
                 }
                 else
                 {
-                    aComp.nVal[ i ] = GetCellValue( aAdr, pCell );
-                    aComp.bVal[ i ] = true;
+                    aComp.nVal[i] = GetCellValue(aAdr, aCell);
+                    aComp.bVal[i] = true;
                 }
             }
             break;
@@ -1108,18 +1113,21 @@ ScMatrixRef ScInterpreter::CompareMat( ScCompareOptions* pOptions )
             case svSingleRef:
             {
                 PopSingleRef( aAdr );
-                ScBaseCell* pCell = GetCell( aAdr );
-                if (HasCellEmptyData( pCell))
-                    aComp.bEmpty[ i ] = true;
-                else if (HasCellStringData( pCell))
+                ScRefCellValue aCell;
+                aCell.assign(*pDok, aAdr);
+                if (aCell.hasEmptyValue())
+                    aComp.bEmpty[i] = true;
+                else if (aCell.hasString())
                 {
-                    GetCellString( *aComp.pVal[ i ], pCell);
-                    aComp.bVal[ i ] = false;
+                    OUString aStr;
+                    GetCellString(aStr, aCell);
+                    *aComp.pVal[i] = aStr;
+                    aComp.bVal[i] = false;
                 }
                 else
                 {
-                    aComp.nVal[ i ] = GetCellValue( aAdr, pCell );
-                    aComp.bVal[ i ] = true;
+                    aComp.nVal[i] = GetCellValue(aAdr, aCell);
+                    aComp.bVal[i] = true;
                 }
             }
             break;
@@ -6521,7 +6529,7 @@ void ScInterpreter::ScLookup()
 
     // For double, string and single reference.
     double fDataVal = 0.0;
-    String aDataStr;
+    OUString aDataStr;
     ScAddress aDataAdr;
     bool bValueData = false;
 
@@ -6575,19 +6583,20 @@ void ScInterpreter::ScLookup()
         case svSingleRef:
         {
             PopSingleRef( aDataAdr );
-            const ScBaseCell* pDataCell = GetCell( aDataAdr );
-            if (HasCellEmptyData( pDataCell))
+            ScRefCellValue aCell;
+            aCell.assign(*pDok, aDataAdr);
+            if (aCell.hasEmptyValue())
             {
                 // Empty cells aren't found anywhere, bail out early.
                 SetError( NOTAVAILABLE);
             }
-            else if (HasCellValueData( pDataCell))
+            else if (aCell.hasNumeric())
             {
-                fDataVal = GetCellValue( aDataAdr, pDataCell );
+                fDataVal = GetCellValue(aDataAdr, aCell);
                 bValueData = true;
             }
             else
-                GetCellString( aDataStr, pDataCell );
+                GetCellString(aDataStr, aCell);
         }
         break;
         default:
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index a2b6041..449806f 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -793,10 +793,11 @@ void ScInterpreter::ScNPV()
                     {
                         ScAddress aAdr;
                         PopSingleRef( aAdr );
-                        ScBaseCell* pCell = GetCell( aAdr );
-                        if (!HasCellEmptyData(pCell) && HasCellValueData(pCell))
+                        ScRefCellValue aCell;
+                        aCell.assign(*pDok, aAdr);
+                        if (!aCell.hasEmptyValue() && aCell.hasNumeric())
                         {
-                            double nCellVal = GetCellValue( aAdr, pCell );
+                            double nCellVal = GetCellValue(aAdr, aCell);
                             nVal += (nCellVal / pow(1.0 + nZins, (double)nCount));
                             nCount++;
                         }
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index ef39a4a..361663c 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -193,11 +193,6 @@ sal_uInt16 ScInterpreter::GetCellErrCode( const ScRefCellValue& rCell )
     return rCell.meType == CELLTYPE_FORMULA ? rCell.mpFormula->GetErrorCode() : 0;
 }
 
-bool ScInterpreter::HasCellEmptyData( const ScBaseCell* pCell )
-{
-    return pCell ? pCell->HasEmptyData() : true;
-}
-
 bool ScInterpreter::HasCellValueData( const ScBaseCell* pCell )
 {
     return pCell ? pCell->HasValueData() : false;
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index f574c4a..5e0c464 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -521,15 +521,16 @@ ScMatrixRef ScInterpreter::GetMatrix()
             pMat = GetNewMat(1, 1);
             if (pMat)
             {
-                ScBaseCell* pCell = GetCell( aAdr );
-                if (HasCellEmptyData(pCell))
+                ScRefCellValue aCell;
+                aCell.assign(*pDok, aAdr);
+                if (aCell.hasEmptyValue())
                     pMat->PutEmpty(0, 0);
-                else if (HasCellValueData(pCell))
-                    pMat->PutDouble(GetCellValue(aAdr, pCell), 0);
+                else if (aCell.hasNumeric())
+                    pMat->PutDouble(GetCellValue(aAdr, aCell), 0);
                 else
                 {
-                    String aStr;
-                    GetCellString(aStr, pCell);
+                    OUString aStr;
+                    GetCellString(aStr, aCell);
                     pMat->PutString(aStr, 0);
                 }
             }


More information about the Libreoffice-commits mailing list