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

Kohei Yoshida kohei.yoshida at collabora.com
Wed Oct 15 17:53:02 PDT 2014


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

New commits:
commit c1b850ed0ad3740fb7dc731f0f1bb49b7f5562d4
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Wed Oct 15 20:07:33 2014 -0400

    fdo#73080: Correctly count blank cells in COUNTBLANK.
    
    Especially when formula cells are involved.
    
    Change-Id: I40950e7108778821c17d08354f01bb157b1551e6
    (cherry picked from commit 3e2bd1e4022e25b77bcc8eba5e02c1adc57008a1)

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index a42dbad..7d5b8f3 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -4632,8 +4632,26 @@ void ScInterpreter::ScCountEmptyCells()
                     ScCellIterator aIter( pDok, aRange, glSubTotal);
                     for (bool bHas = aIter.first(); bHas; bHas = aIter.next())
                     {
-                        if (!aIter.hasEmptyData())
-                            ++nCount;
+                        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:
+                                ;
+                        }
                     }
                 }
             }


More information about the Libreoffice-commits mailing list