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

Handle range reference as well for group calculation. Not tested yet.

Change-Id: I3bf58a20f0b8c017862ae23202e4b2272f7c952c
üst dfc3f290
...@@ -3023,8 +3023,32 @@ bool ScFormulaCell::InterpretFormulaGroup() ...@@ -3023,8 +3023,32 @@ bool ScFormulaCell::InterpretFormulaGroup()
aRef.CalcAbsIfRel(aPos); aRef.CalcAbsIfRel(aPos);
if (aRef.Ref1.IsRowRel() || aRef.Ref2.IsRowRel()) if (aRef.Ref1.IsRowRel() || aRef.Ref2.IsRowRel())
{ {
// TODO: Implement this. // Row reference is relative.
return false; bool bAbsFirst = !aRef.Ref1.IsRowRel();
bool bAbsLast = !aRef.Ref2.IsRowRel();
ScAddress aRefPos(aRef.Ref1.nCol, aRef.Ref1.nRow, aRef.Ref1.nTab);
size_t nCols = aRef.Ref2.nCol - aRef.Ref1.nCol + 1;
std::vector<const double*> aArrays;
aArrays.reserve(nCols);
SCROW nLength = xGroup->mnLength;
if (!bAbsLast)
{
// range end position is relative. Extend it.
nLength += aRef.Ref2.nRow - aRef.Ref1.nRow;
}
for (SCCOL i = aRef.Ref1.nCol; i <= aRef.Ref2.nCol; ++i)
{
aRefPos.SetCol(i);
const double* pArray = pDocument->FetchDoubleArray(aCxt, aRefPos, nLength);
if (!pArray)
return false;
aArrays.push_back(pArray);
}
formula::DoubleVectorRefToken aTok(aArrays, nLength, bAbsFirst, bAbsLast);
aCode.AddToken(aTok);
} }
else else
{ {
......
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