[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.2' - sc/source

Kohei Yoshida kohei.yoshida at collabora.com
Fri Oct 17 08:04:59 PDT 2014


 sc/source/core/tool/interpr1.cxx |   54 +++++++++++++++++++++++----------------
 1 file changed, 32 insertions(+), 22 deletions(-)

New commits:
commit f2d60af6bec226e5a5490648b837b9825a6cbfc7
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Thu Oct 16 20:49:42 2014 -0400

    fdo#73080: Fix the single cell reference cases as well.
    
    Conflicts:
    	sc/source/core/tool/interpr1.cxx
    
    Change-Id: Ib9a8ae04733c5bcb982ef4d337112eb8249d0ee0

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 7d5b8f3..5058283 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -4596,13 +4596,39 @@ void ScInterpreter::ScMatch()
     }
 }
 
+namespace {
+
+bool isCellContentEmpty( const ScRefCellValue& rCell )
+{
+    switch (rCell.meType)
+    {
+        case CELLTYPE_VALUE:
+        case CELLTYPE_STRING:
+        case CELLTYPE_EDIT:
+            return false;
+        case CELLTYPE_FORMULA:
+        {
+            sc::FormulaResultValue aRes = rCell.mpFormula->GetResult();
+            if (aRes.meType != sc::FormulaResultValue::String)
+                return false;
+            if (!aRes.maString.isEmpty())
+                return false;
+        }
+        break;
+        default:
+            ;
+    }
+
+    return true;
+}
+
+}
 
 void ScInterpreter::ScCountEmptyCells()
 {
     if ( MustHaveParamCount( GetByte(), 1 ) )
     {
         sal_uLong nMaxCount = 0, nCount = 0;
-        CellType eCellType;
         switch (GetStackType())
         {
             case svSingleRef :
@@ -4610,8 +4636,9 @@ void ScInterpreter::ScCountEmptyCells()
                 nMaxCount = 1;
                 ScAddress aAdr;
                 PopSingleRef( aAdr );
-                eCellType = pDok->GetCellType(aAdr);
-                if (eCellType != CELLTYPE_NONE)
+                ScRefCellValue aCell;
+                aCell.assign(*pDok, aAdr);
+                if (!isCellContentEmpty(aCell))
                     nCount = 1;
             }
             break;
@@ -4633,25 +4660,8 @@ void ScInterpreter::ScCountEmptyCells()
                     for (bool bHas = aIter.first(); bHas; bHas = aIter.next())
                     {
                         const ScRefCellValue& rCell = aIter.getRefCellValue();
-                        switch (rCell.meType)
-                        {
-                            case CELLTYPE_VALUE:
-                            case CELLTYPE_STRING:
-                            case CELLTYPE_EDIT:
-                                ++nCount;
-                            break;
-                            case CELLTYPE_FORMULA:
-                            {
-                                sc::FormulaResultValue aRes = rCell.mpFormula->GetResult();
-                                if (aRes.meType != sc::FormulaResultValue::String)
-                                    ++nCount;
-                                else if (!aRes.maString.isEmpty())
-                                    ++nCount;
-                            }
-                            break;
-                            default:
-                                ;
-                        }
+                        if (!isCellContentEmpty(rCell))
+                            ++nCount;
                     }
                 }
             }


More information about the Libreoffice-commits mailing list