Kaydet (Commit) 83a88b94 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

fdo#77056: Treat empty cells as if they have a value of 0.0.

Change-Id: Ibe64cf7177a5298c1878e0014c049dc9c82b1344
üst b44f8185
...@@ -1158,6 +1158,23 @@ class MixDataHandler ...@@ -1158,6 +1158,23 @@ class MixDataHandler
bool mbSkipEmpty; bool mbSkipEmpty;
void doFunction( size_t nDestRow, double fVal1, double fVal2 )
{
bool bOk = lcl_DoFunction(fVal1, fVal2, mnFunction);
if (bOk)
miNewCellsPos = maNewCells.set(miNewCellsPos, nDestRow-mnRowOffset, fVal1);
else
{
ScAddress aPos(mrDestColumn.GetCol(), nDestRow, mrDestColumn.GetTab());
ScFormulaCell* pFC = new ScFormulaCell(&mrDestColumn.GetDoc(), aPos);
pFC->SetErrCode(errNoValue);
miNewCellsPos = maNewCells.set(miNewCellsPos, nDestRow-mnRowOffset, pFC);
}
}
public: public:
MixDataHandler( MixDataHandler(
sc::ColumnBlockPosition& rBlockPos, sc::ColumnBlockPosition& rBlockPos,
...@@ -1180,22 +1197,15 @@ public: ...@@ -1180,22 +1197,15 @@ public:
mrBlockPos.miCellPos = aPos.first; mrBlockPos.miCellPos = aPos.first;
switch (aPos.first->type) switch (aPos.first->type)
{ {
case sc::element_type_empty:
case sc::element_type_numeric: case sc::element_type_numeric:
{ {
// Both src and dest are of numeric type. double fSrcVal = 0.0;
bool bOk = lcl_DoFunction(f, sc::numeric_block::at(*aPos.first->data, aPos.second), mnFunction); if (aPos.first->type == sc::element_type_numeric)
fSrcVal = sc::numeric_block::at(*aPos.first->data, aPos.second);
if (bOk)
miNewCellsPos = maNewCells.set(miNewCellsPos, nRow-mnRowOffset, f);
else
{
ScFormulaCell* pFC =
new ScFormulaCell(
&mrDestColumn.GetDoc(), ScAddress(mrDestColumn.GetCol(), nRow, mrDestColumn.GetTab()));
pFC->SetErrCode(errNoValue); // Both src and dest are of numeric type.
miNewCellsPos = maNewCells.set(miNewCellsPos, nRow-mnRowOffset, pFC); doFunction(nRow, f, fSrcVal);
}
} }
break; break;
case sc::element_type_formula: case sc::element_type_formula:
...@@ -1229,7 +1239,6 @@ public: ...@@ -1229,7 +1239,6 @@ public:
break; break;
case sc::element_type_string: case sc::element_type_string:
case sc::element_type_edittext: case sc::element_type_edittext:
case sc::element_type_empty:
{ {
// Destination cell is not a number. Just take the source cell. // Destination cell is not a number. Just take the source cell.
miNewCellsPos = maNewCells.set(miNewCellsPos, nRow-mnRowOffset, f); miNewCellsPos = maNewCells.set(miNewCellsPos, nRow-mnRowOffset, f);
...@@ -1346,9 +1355,9 @@ public: ...@@ -1346,9 +1355,9 @@ public:
{ {
case sc::element_type_numeric: case sc::element_type_numeric:
{ {
double fVal = sc::numeric_block::at(*aPos.first->data, aPos.second); double fVal1 = 0.0;
miNewCellsPos = maNewCells.set( double fVal2 = sc::numeric_block::at(*aPos.first->data, aPos.second);
miNewCellsPos, nDestRow-mnRowOffset, fVal); doFunction(nDestRow, fVal1, fVal2);
} }
break; break;
case sc::element_type_string: case sc::element_type_string:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment