[Libreoffice-commits] .: sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Thu Mar 3 14:48:50 PST 2011


 sc/source/core/tool/interpr1.cxx |   20 +-------------------
 sc/source/core/tool/interpr3.cxx |   32 ++++++++++++++++++++++++--------
 sc/source/core/tool/interpr5.cxx |    8 ++++++--
 3 files changed, 31 insertions(+), 29 deletions(-)

New commits:
commit 600538f2310259b47f0b80458cd2b7dadd253240
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Thu Mar 3 17:45:33 2011 -0500

    Support external references in a whole bunch of other functions.
    
    GetMatrix() now returns a matrix instance even from external single
    and double ref tokens.  Let's use this to easily add support for
    external refs to several functions at once.

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 0803270..759cfc9 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -4934,25 +4934,7 @@ void ScInterpreter::ScSumIf()
             case svExternalSingleRef:
             case svExternalDoubleRef:
             {
-                if (GetStackType() == svMatrix)
-                    pQueryMatrix = PopMatrix();
-                else if (GetStackType() == svExternalDoubleRef)
-                    PopExternalDoubleRef(pQueryMatrix);
-                else
-                {
-                    OSL_ENSURE(GetStackType() == svExternalSingleRef, "external single ref is expected, but that's not what we found.");
-                    ScExternalRefCache::TokenRef pToken;
-                    PopExternalSingleRef(pToken);
-                    if (pToken)
-                    {
-                        pQueryMatrix = new ScMatrix(1, 1);
-                        if (pToken->GetType() == svDouble)
-                            pQueryMatrix->PutDouble(pToken->GetDouble(), 0, 0);
-                        else
-                            pQueryMatrix->PutString(pToken->GetString(), 0, 0);
-                    }
-                }
-
+                pQueryMatrix = GetMatrix();
                 if (!pQueryMatrix)
                 {
                     PushIllegalParameter();
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index d8551f4..60f9446 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -2298,8 +2298,10 @@ void ScInterpreter::ScZTest()
         }
         break;
         case svMatrix :
+        case svExternalSingleRef:
+        case svExternalDoubleRef:
         {
-            ScMatrixRef pMat = PopMatrix();
+            ScMatrixRef pMat = GetMatrix();
             if (pMat)
             {
                 SCSIZE nCount = pMat->GetElementCount();
@@ -2735,8 +2737,10 @@ void ScInterpreter::ScHarMean()
             }
             break;
             case svMatrix :
+            case svExternalSingleRef:
+            case svExternalDoubleRef:
             {
-                ScMatrixRef pMat = PopMatrix();
+                ScMatrixRef pMat = GetMatrix();
                 if (pMat)
                 {
                     SCSIZE nCount = pMat->GetElementCount();
@@ -2856,8 +2860,10 @@ void ScInterpreter::ScGeoMean()
             }
             break;
             case svMatrix :
+            case svExternalSingleRef:
+            case svExternalDoubleRef:
             {
-                ScMatrixRef pMat = PopMatrix();
+                ScMatrixRef pMat = GetMatrix();
                 if (pMat)
                 {
                     SCSIZE nCount = pMat->GetElementCount();
@@ -2980,8 +2986,10 @@ bool ScInterpreter::CalculateSkew(double& fSum,double& fCount,double& vSum,std::
             }
             break;
             case svMatrix :
+            case svExternalSingleRef:
+            case svExternalDoubleRef:
             {
-                ScMatrixRef pMat = PopMatrix();
+                ScMatrixRef pMat = GetMatrix();
                 if (pMat)
                 {
                     SCSIZE nCount = pMat->GetElementCount();
@@ -3380,8 +3388,10 @@ void ScInterpreter::GetNumberSequenceArray( BYTE nParamCount, vector<double>& rA
             }
             break;
             case svMatrix :
+            case svExternalSingleRef:
+            case svExternalDoubleRef:
             {
-                ScMatrixRef pMat = PopMatrix();
+                ScMatrixRef pMat = GetMatrix();
                 if (!pMat)
                     break;
 
@@ -3584,8 +3594,10 @@ void ScInterpreter::ScRank()
         }
         break;
         case svMatrix :
+        case svExternalSingleRef:
+        case svExternalDoubleRef:
         {
-            ScMatrixRef pMat = PopMatrix();
+            ScMatrixRef pMat = GetMatrix();
             double fVal = GetDouble();
             if (pMat)
             {
@@ -3681,8 +3693,10 @@ void ScInterpreter::ScAveDev()
             }
             break;
             case svMatrix :
+            case svExternalSingleRef:
+            case svExternalDoubleRef:
             {
-                ScMatrixRef pMat = PopMatrix();
+                ScMatrixRef pMat = GetMatrix();
                 if (pMat)
                 {
                     SCSIZE nCount = pMat->GetElementCount();
@@ -3752,8 +3766,10 @@ void ScInterpreter::ScAveDev()
             }
             break;
             case svMatrix :
+            case svExternalSingleRef:
+            case svExternalDoubleRef:
             {
-                ScMatrixRef pMat = PopMatrix();
+                ScMatrixRef pMat = GetMatrix();
                 if (pMat)
                 {
                     SCSIZE nCount = pMat->GetElementCount();
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index a5b8450..b19f3e9 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -194,8 +194,10 @@ void ScInterpreter::ScGCD()
                 }
                 break;
                 case svMatrix :
+                case svExternalSingleRef:
+                case svExternalDoubleRef:
                 {
-                    ScMatrixRef pMat = PopMatrix();
+                    ScMatrixRef pMat = GetMatrix();
                     if (pMat)
                     {
                         SCSIZE nC, nR;
@@ -288,8 +290,10 @@ void ScInterpreter:: ScLCM()
                 }
                 break;
                 case svMatrix :
+                case svExternalSingleRef:
+                case svExternalDoubleRef:
                 {
-                    ScMatrixRef pMat = PopMatrix();
+                    ScMatrixRef pMat = GetMatrix();
                     if (pMat)
                     {
                         SCSIZE nC, nR;


More information about the Libreoffice-commits mailing list