[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/inc sc/source
Kohei Yoshida
kohei.yoshida at gmail.com
Mon Jul 1 22:12:46 PDT 2013
sc/inc/formulacell.hxx | 1 +
sc/inc/formularesult.hxx | 2 ++
sc/source/core/data/column.cxx | 2 +-
sc/source/core/data/formulacell.cxx | 9 +++++++++
sc/source/core/tool/formularesult.cxx | 12 ++++++++++++
5 files changed, 25 insertions(+), 1 deletion(-)
New commits:
commit b82237c146284c3e3d88a30552eb820be071fbca
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Tue Jul 2 01:12:27 2013 -0400
COUNT should skip formula cells with error.
Change-Id: I829eaf309056403f77949526877888315a2ad720
diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx
index a63025c..52a1474 100644
--- a/sc/inc/formulacell.hxx
+++ b/sc/inc/formulacell.hxx
@@ -202,6 +202,7 @@ public:
// display as empty string if formula::svEmptyCell result
bool IsEmptyDisplayedAsString();
bool IsValue(); // also true if formula::svEmptyCell
+ bool IsValueNoError();
bool IsHybridValueCell(); // for cells after import to deal with inherited number formats
double GetValue();
double GetValueAlways(); // ignore errors
diff --git a/sc/inc/formularesult.hxx b/sc/inc/formularesult.hxx
index 6736a10..f1f7b5d 100644
--- a/sc/inc/formularesult.hxx
+++ b/sc/inc/formularesult.hxx
@@ -128,6 +128,8 @@ public:
details instead. */
bool IsValue() const;
+ bool IsValueNoError() const;
+
/** Determines whether or not the result is a string containing more than
one paragraph */
bool IsMultiline() const;
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 64aae03..61f57ab 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -511,7 +511,7 @@ public:
for (; it != itEnd; ++it)
{
ScFormulaCell& rCell = const_cast<ScFormulaCell&>(**it);
- if (rCell.IsValue())
+ if (rCell.IsValueNoError())
++mnCount;
}
}
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 1e86cfc..a129726 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -1711,6 +1711,15 @@ bool ScFormulaCell::IsValue()
return aResult.IsValue();
}
+bool ScFormulaCell::IsValueNoError()
+{
+ MaybeInterpret();
+ if (pCode->GetCodeError())
+ return false;
+
+ return aResult.IsValueNoError();
+}
+
bool ScFormulaCell::IsHybridValueCell()
{
return aResult.GetType() == formula::svHybridValueCell;
diff --git a/sc/source/core/tool/formularesult.cxx b/sc/source/core/tool/formularesult.cxx
index a20963b..72944a0 100644
--- a/sc/source/core/tool/formularesult.cxx
+++ b/sc/source/core/tool/formularesult.cxx
@@ -265,6 +265,18 @@ bool ScFormulaResult::IsValue() const
return isValue(GetCellResultType());
}
+bool ScFormulaResult::IsValueNoError() const
+{
+ switch (GetCellResultType())
+ {
+ case formula::svDouble:
+ case formula::svEmptyCell:
+ case formula::svHybridValueCell:
+ return true;
+ }
+ return false;
+}
+
bool ScFormulaResult::IsMultiline() const
{
if (meMultiline == MULTILINE_UNKNOWN)
More information about the Libreoffice-commits
mailing list