diff options
author | Eike Rathke <erack@redhat.com> | 2017-05-23 20:40:50 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-05-23 20:41:20 +0200 |
commit | 6df362b4b01a1f645009b45e1a7dd902f1de089b (patch) | |
tree | 68482c58fd6b748a1f3b827ce47b409d2cd82aa0 /sc | |
parent | b535d31f95809906c8eef5a8e8096e137f32a533 (diff) |
Extend the loop over svRefList to cover also the query evaluation
... otherwise all but the last reflist entry are thrown away..
Change-Id: Ic8e66cfb6179a86140e566d25cbffc901527f269
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/tool/interpr1.cxx | 140 |
1 files changed, 70 insertions, 70 deletions
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 4618bddec326..85d9ddb4259b 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -5790,87 +5790,87 @@ void ScInterpreter::IterateParametersIfs( double(*ResultFunc)( const sc::ParamIf PushError ( FormulaError::IllegalArgument); return; } - } - // recalculate matrix values - if (nGlobalError != FormulaError::NONE) - { - PushError( nGlobalError); - return; - } + // recalculate matrix values + if (nGlobalError != FormulaError::NONE) + { + PushError( nGlobalError); + return; + } - // initialize temporary result matrix - if (aResArray.empty()) - { - nColSize = nCol2 - nCol1 + 1; - nRowSize = nRow2 - nRow1 + 1; - aResArray.resize(nColSize*nRowSize, 0); - } + // initialize temporary result matrix + if (aResArray.empty()) + { + nColSize = nCol2 - nCol1 + 1; + nRowSize = nRow2 - nRow1 + 1; + aResArray.resize(nColSize*nRowSize, 0); + } - ScQueryParam rParam; - rParam.nRow1 = nRow1; - rParam.nRow2 = nRow2; + ScQueryParam rParam; + rParam.nRow1 = nRow1; + rParam.nRow2 = nRow2; - ScQueryEntry& rEntry = rParam.GetEntry(0); - ScQueryEntry::Item& rItem = rEntry.GetQueryItem(); - rEntry.bDoQuery = true; - if (!bIsString) - { - rItem.meType = ScQueryEntry::ByValue; - rItem.mfVal = fVal; - rEntry.eOp = SC_EQUAL; - } - else - { - rParam.FillInExcelSyntax(pDok->GetSharedStringPool(), aString.getString(), 0, pFormatter); - if (rItem.meType == ScQueryEntry::ByString) - rParam.eSearchType = DetectSearchType(rItem.maString.getString(), pDok); - } - ScAddress aAdr; - aAdr.SetTab( nTab1 ); - rParam.nCol1 = nCol1; - rParam.nCol2 = nCol2; - rEntry.nField = nCol1; - SCCOL nColDiff = -nCol1; - SCROW nRowDiff = -nRow1; - if (pQueryMatrix) - { - // Never case-sensitive. - sc::CompareOptions aOptions( pDok, rEntry, rParam.eSearchType); - ScMatrixRef pResultMatrix = QueryMat( pQueryMatrix, aOptions); - if (nGlobalError != FormulaError::NONE || !pResultMatrix) + ScQueryEntry& rEntry = rParam.GetEntry(0); + ScQueryEntry::Item& rItem = rEntry.GetQueryItem(); + rEntry.bDoQuery = true; + if (!bIsString) { - PushError( FormulaError::IllegalParameter); - return; + rItem.meType = ScQueryEntry::ByValue; + rItem.mfVal = fVal; + rEntry.eOp = SC_EQUAL; } - - // result matrix is filled with boolean values. - std::vector<double> aResValues; - pResultMatrix->GetDoubleArray(aResValues); - if (aResArray.size() != aResValues.size()) + else { - PushError( FormulaError::IllegalParameter); - return; + rParam.FillInExcelSyntax(pDok->GetSharedStringPool(), aString.getString(), 0, pFormatter); + if (rItem.meType == ScQueryEntry::ByString) + rParam.eSearchType = DetectSearchType(rItem.maString.getString(), pDok); } + ScAddress aAdr; + aAdr.SetTab( nTab1 ); + rParam.nCol1 = nCol1; + rParam.nCol2 = nCol2; + rEntry.nField = nCol1; + SCCOL nColDiff = -nCol1; + SCROW nRowDiff = -nRow1; + if (pQueryMatrix) + { + // Never case-sensitive. + sc::CompareOptions aOptions( pDok, rEntry, rParam.eSearchType); + ScMatrixRef pResultMatrix = QueryMat( pQueryMatrix, aOptions); + if (nGlobalError != FormulaError::NONE || !pResultMatrix) + { + PushError( FormulaError::IllegalParameter); + return; + } - std::vector<sal_uInt8>::iterator itRes = aResArray.begin(), itResEnd = aResArray.end(); - std::vector<double>::const_iterator itThisRes = aResValues.begin(); - for (; itRes != itResEnd; ++itRes, ++itThisRes) - *itRes += *itThisRes; - } - else - { - ScQueryCellIterator aCellIter(pDok, nTab1, rParam, false); - // Increment Entry.nField in iterator when switching to next column. - aCellIter.SetAdvanceQueryParamEntryField( true ); - if ( aCellIter.GetFirst() ) + // result matrix is filled with boolean values. + std::vector<double> aResValues; + pResultMatrix->GetDoubleArray(aResValues); + if (aResArray.size() != aResValues.size()) + { + PushError( FormulaError::IllegalParameter); + return; + } + + std::vector<sal_uInt8>::iterator itRes = aResArray.begin(), itResEnd = aResArray.end(); + std::vector<double>::const_iterator itThisRes = aResValues.begin(); + for (; itRes != itResEnd; ++itRes, ++itThisRes) + *itRes += *itThisRes; + } + else { - do + ScQueryCellIterator aCellIter(pDok, nTab1, rParam, false); + // Increment Entry.nField in iterator when switching to next column. + aCellIter.SetAdvanceQueryParamEntryField( true ); + if ( aCellIter.GetFirst() ) { - size_t nC = aCellIter.GetCol() + nColDiff; - size_t nR = aCellIter.GetRow() + nRowDiff; - ++aResArray[nC*nRowSize+nR]; - } while ( aCellIter.GetNext() ); + do + { + size_t nC = aCellIter.GetCol() + nColDiff; + size_t nR = aCellIter.GetRow() + nRowDiff; + ++aResArray[nC*nRowSize+nR]; + } while ( aCellIter.GetNext() ); + } } } nParamCount -= 2; |