[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter' - sc/source
Kohei Yoshida
kohei.yoshida at gmail.com
Mon Jul 8 08:10:00 PDT 2013
sc/source/core/data/formulacell.cxx | 59 +++++++++++++-----------------------
1 file changed, 22 insertions(+), 37 deletions(-)
New commits:
commit d68ac7db691440d0e3db4fb60963864c92f59f5d
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Mon Jul 8 11:09:00 2013 -0400
Always use DoubleVectorRefToken when resolving a range reference.
ResolveStaticReference is reserved for calculating invariant formula
groups.
Change-Id: I58aeabb01f11f98a5c300780734b31079417f4c7
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 6da2a5c..e146f4a 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -3044,49 +3044,34 @@ public:
{
ScComplexRefData aRef = pToken->GetDoubleRef();
aRef.CalcAbsIfRel(mrCell.aPos);
- if (aRef.Ref1.IsRowRel() || aRef.Ref2.IsRowRel())
- {
- // Row reference is relative.
- 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 nArrayLength = mrCell.GetCellGroup()->mnLength;
- SCROW nRefRowSize = aRef.Ref2.nRow - aRef.Ref1.nRow + 1;
- if (!bAbsLast)
- {
- // range end position is relative. Extend the array length.
- nArrayLength += nRefRowSize - 1;
- }
-
- for (SCCOL i = aRef.Ref1.nCol; i <= aRef.Ref2.nCol; ++i)
- {
- aRefPos.SetCol(i);
- const double* pArray = mrDoc.FetchDoubleArray(mrCxt, aRefPos, nArrayLength);
- if (!pArray)
- return false;
- aArrays.push_back(pArray);
- }
-
- formula::DoubleVectorRefToken aTok(aArrays, nArrayLength, nRefRowSize, bAbsFirst, bAbsLast);
- mrGroupTokens.AddToken(aTok);
- }
- else
+ // Row reference is relative.
+ 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 nArrayLength = mrCell.GetCellGroup()->mnLength;
+ SCROW nRefRowSize = aRef.Ref2.nRow - aRef.Ref1.nRow + 1;
+ if (!bAbsLast)
{
- // Absolute row reference.
- ScRange aRefRange(
- aRef.Ref1.nCol, aRef.Ref1.nRow, aRef.Ref1.nTab,
- aRef.Ref2.nCol, aRef.Ref2.nRow, aRef.Ref2.nTab);
+ // range end position is relative. Extend the array length.
+ nArrayLength += nRefRowSize - 1;
+ }
- formula::FormulaTokenRef pNewToken = mrDoc.ResolveStaticReference(aRefRange);
- if (!pNewToken)
+ for (SCCOL i = aRef.Ref1.nCol; i <= aRef.Ref2.nCol; ++i)
+ {
+ aRefPos.SetCol(i);
+ const double* pArray = mrDoc.FetchDoubleArray(mrCxt, aRefPos, nArrayLength);
+ if (!pArray)
return false;
- mrGroupTokens.AddToken(*pNewToken);
+ aArrays.push_back(pArray);
}
+
+ formula::DoubleVectorRefToken aTok(aArrays, nArrayLength, nRefRowSize, bAbsFirst, bAbsLast);
+ mrGroupTokens.AddToken(aTok);
}
break;
case svIndex:
More information about the Libreoffice-commits
mailing list