sc/source/core/tool/interpr1.cxx | 140 +++++++++++++++++++-------------------- 1 file changed, 70 insertions(+), 70 deletions(-)
New commits: commit 6df362b4b01a1f645009b45e1a7dd902f1de089b Author: Eike Rathke <er...@redhat.com> Date: Tue May 23 20:40:50 2017 +0200 Extend the loop over svRefList to cover also the query evaluation ... otherwise all but the last reflist entry are thrown away.. Change-Id: Ic8e66cfb6179a86140e566d25cbffc901527f269 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; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits