sc/source/core/inc/interpre.hxx | 6 sc/source/core/tool/interpr1.cxx | 531 ++++++--------------------------------- 2 files changed, 96 insertions(+), 441 deletions(-)
New commits: commit b68c060d475d67e40ca3d35ed66654d6ab8f58be Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Sat Jan 25 12:38:44 2025 +0100 Commit: Aron Budea <aron.bu...@collabora.com> CommitDate: Tue Aug 26 21:37:19 2025 +0200 sc: factor out some more code Change-Id: I604bf182e9ac6f34298f7193cfffd1cc818132b0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180738 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> (cherry picked from commit 62a4a9659c914a71c89e90c3a71538d45930597b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190121 Reviewed-by: Aron Budea <aron.bu...@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx index d944dea63543..7635b2847b86 100644 --- a/sc/source/core/inc/interpre.hxx +++ b/sc/source/core/inc/interpre.hxx @@ -736,6 +736,12 @@ private: void ScWrapCols(); void ScWrapRows(); +private: + void ScToColOrRow(bool bCol); + void ScWrapColsOrRows(bool bCols); + void ScTakeOrDrop(bool bTake); + +public: // If upon call rMissingField==true then the database field parameter may be // missing (Xcl DCOUNT() syntax), or may be faked as missing by having the // value 0.0 or being exactly the entire database range reference (old SO diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index e393b2dad3de..d3fffd09554a 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -8864,7 +8864,7 @@ static void lcl_FillCell(const ScMatrixRef& pMatSource, const ScMatrixRef& pMatD } } -void ScInterpreter::ScDrop() +void ScInterpreter::ScTakeOrDrop(bool bTake) { sal_uInt8 nParamCount = GetByte(); if (!MustHaveParamCount(nParamCount, 1, 3)) @@ -8931,10 +8931,20 @@ void ScInterpreter::ScDrop() { if (o3tl::make_unsigned(std::abs(nArgCols.value())) < nsC) { - if (nArgCols.value() < 0) - nMaxCol = nsC + nArgCols.value(); + if (bTake) + { + if (nArgCols.value() < 0) + nMinCol = nsC + nArgCols.value(); + else + nMaxCol = nArgCols.value(); + } else - nMinCol = nArgCols.value(); + { + if (nArgCols.value() < 0) + nMaxCol = nsC + nArgCols.value(); + else + nMinCol = nArgCols.value(); + } } } @@ -8944,10 +8954,20 @@ void ScInterpreter::ScDrop() { if (o3tl::make_unsigned(std::abs(nArgRows.value())) < nsR) { - if (nArgRows.value() < 0) - nMaxRow = nsR + nArgRows.value(); + if (bTake) + { + if (nArgRows.value() < 0) + nMinRow = nsR + nArgRows.value(); + else + nMaxRow = nArgRows.value(); + } else - nMinRow = nArgRows.value(); + { + if (nArgRows.value() < 0) + nMaxRow = nsR + nArgRows.value(); + else + nMinRow = nArgRows.value(); + } } } @@ -8988,6 +9008,11 @@ void ScInterpreter::ScDrop() PushMatrix(pResMat); } +void ScInterpreter::ScDrop() +{ + ScTakeOrDrop(/*bTake*/ false); +} + void ScInterpreter::ScExpand() { sal_uInt8 nParamCount = GetByte(); @@ -9111,129 +9136,10 @@ void ScInterpreter::ScExpand() void ScInterpreter::ScTake() { - sal_uInt8 nParamCount = GetByte(); - if (!MustHaveParamCount(nParamCount, 1, 3)) - return; - - // 3rd argument optional - columns - std::optional<sal_Int32> nArgCols; - if (nParamCount == 3) - { - if (!IsMissing()) - nArgCols = GetInt32(); - else - Pop(); - } - - // 2nd argument optional - rows - std::optional<sal_Int32> nArgRows; - if (nParamCount >= 2) - { - if (!IsMissing()) - nArgRows = GetInt32(); - else - Pop(); - } - - // 1st argument: take unique search range - ScMatrixRef pMatSource = nullptr; - SCSIZE nsC = 0, nsR = 0; - switch (GetStackType()) - { - case svSingleRef: - case svDoubleRef: - case svMatrix: - case svExternalSingleRef: - case svExternalDoubleRef: - { - pMatSource = GetMatrix(); - if (!pMatSource) - { - PushIllegalParameter(); - return; - } - - pMatSource->GetDimensions(nsC, nsR); - } - break; - - default: - PushIllegalParameter(); - return; - } - - if (nGlobalError != FormulaError::NONE || nsC < 1 || nsR < 1) - { - PushIllegalArgument(); - return; - } - - std::vector<std::pair<SCSIZE, SCSIZE>> aResPos; - - SCSIZE nMinCol = 0; - SCSIZE nMaxCol = nsC; - if (nArgCols.has_value()) - { - if (o3tl::make_unsigned(std::abs(nArgCols.value())) < nsC) - { - if (nArgCols.value() < 0) - nMinCol = nsC + nArgCols.value(); - else - nMaxCol = nArgCols.value(); - } - } - - SCSIZE nMinRow = 0; - SCSIZE nMaxRow = nsR; - if (nArgRows.has_value()) - { - if (o3tl::make_unsigned(std::abs(nArgRows.value())) < nsR) - { - if (nArgRows.value() < 0) - nMinRow = nsR + nArgRows.value(); - else - nMaxRow = nArgRows.value(); - } - } - - for (SCSIZE col = nMinCol; col < nMaxCol; col++) - { - for (SCSIZE row = nMinRow; row < nMaxRow; row++) - { - aResPos.emplace_back(col, row); - } - } - - // No result - if (aResPos.size() == 0) - { - PushNA(); - return; - } - - SCSIZE nColumns = nMaxCol - nMinCol; - SCSIZE nRows = nMaxRow - nMinRow; - ScMatrixRef pResMat = GetNewMat(nColumns, nRows, /*bEmpty*/true); - if (!pResMat) - { - PushIllegalArgument(); - return; - } - - size_t iPos = 0; - for (SCSIZE col = 0; col < nColumns; ++col) - { - for (SCSIZE row = 0; row < nRows; ++row) - { - lcl_FillCell(pMatSource, pResMat, aResPos[iPos].first, aResPos[iPos].second, col, row); - ++iPos; - } - } - - PushMatrix(pResMat); + ScTakeOrDrop(/*bTake*/ true); } -void ScInterpreter::ScToCol() +void ScInterpreter::ScToColOrRow(bool bCol) { sal_uInt8 nParamCount = GetByte(); if (!MustHaveParamCount(nParamCount, 1, 3)) @@ -9316,8 +9222,10 @@ void ScInterpreter::ScToCol() PushNA(); return; } + SCSIZE nColumns = bCol? 1 : aResPos.size(); + SCSIZE nRows = bCol? aResPos.size() : 1; - ScMatrixRef pResMat = GetNewMat(1, aResPos.size(), /*bEmpty*/true); + ScMatrixRef pResMat = GetNewMat(nColumns, nRows, /*bEmpty*/true); if (!pResMat) { PushIllegalArgument(); @@ -9327,110 +9235,23 @@ void ScInterpreter::ScToCol() // fill result matrix to the same column for (SCSIZE iPos = 0; iPos < aResPos.size(); ++iPos) { - lcl_FillCell(pMatSource, pResMat, aResPos[iPos].first, aResPos[iPos].second, 0, iPos); + if (bCol) + lcl_FillCell(pMatSource, pResMat, aResPos[iPos].first, aResPos[iPos].second, 0, iPos); + else + lcl_FillCell(pMatSource, pResMat, aResPos[iPos].first, aResPos[iPos].second, iPos, 0); } PushMatrix(pResMat); } -void ScInterpreter::ScToRow() +void ScInterpreter::ScToCol() { - sal_uInt8 nParamCount = GetByte(); - if (!MustHaveParamCount(nParamCount, 1, 3)) - return; - - // 3rd argument optional - Scan_by_column: default FALSE - bool bByColumn = false; - if (nParamCount == 3) - bByColumn = GetBoolWithDefault(false); - - // 2nd argument optional - Ignore: default keep all values - IgnoreValues eIgnoreValues = IgnoreValues::DEFAULT; - if (nParamCount >= 2) - { - sal_Int32 k = GetInt32WithDefault(0); - if (k >= 0 && k <= 3) - eIgnoreValues = static_cast<IgnoreValues>(k); - else - { - PushIllegalParameter(); - return; - } - } - - // 1st argument: take torow range - ScMatrixRef pMatSource = nullptr; - SCSIZE nsC = 0, nsR = 0; - switch (GetStackType()) - { - case svSingleRef: - case svDoubleRef: - case svMatrix: - case svExternalSingleRef: - case svExternalDoubleRef: - { - pMatSource = GetMatrix(); - if (!pMatSource) - { - PushIllegalParameter(); - return; - } - - pMatSource->GetDimensions(nsC, nsR); - } - break; - - default: - PushIllegalParameter(); - return; - } - - if (nGlobalError != FormulaError::NONE || nsC < 1 || nsR < 1) - { - PushIllegalArgument(); - return; - } - - std::vector<std::pair<SCSIZE, SCSIZE>> aResPos; - SCSIZE nOut = bByColumn ? nsC : nsR; - SCSIZE nIn = bByColumn ? nsR : nsC; - - for (SCSIZE i = 0; i < nOut; i++) - { - for (SCSIZE j = 0; j < nIn; j++) - { - SCSIZE nCol = bByColumn ? i : j; - SCSIZE nRow = bByColumn ? j : i; - if ((eIgnoreValues == IgnoreValues::ALL || eIgnoreValues == IgnoreValues::BLANKS) && pMatSource->IsEmptyCell(nCol, nRow)) - continue; // Nothing to do - else if ((eIgnoreValues == IgnoreValues::ALL || eIgnoreValues == IgnoreValues::ERRORS) && pMatSource->GetError(nCol, nRow) != FormulaError::NONE) - continue; // Nothing to do - else - aResPos.emplace_back(nCol, nRow); - } - - } - // No result - if (aResPos.size() == 0) - { - PushNA(); - return; - } - - ScMatrixRef pResMat = GetNewMat(aResPos.size(), 1, /*bEmpty*/true); - if (!pResMat) - { - PushIllegalArgument(); - return; - } - - // fill result matrix to the same row - for (SCSIZE iPos = 0; iPos < aResPos.size(); ++iPos) - { - lcl_FillCell(pMatSource, pResMat, aResPos[iPos].first, aResPos[iPos].second, iPos, 0); - } + ScToColOrRow(/*bCol*/ true); +} - PushMatrix(pResMat); +void ScInterpreter::ScToRow() +{ + ScToColOrRow(/*bCol*/ false); } void ScInterpreter::ScUnique() @@ -9766,7 +9587,7 @@ void ScInterpreter::ScSubTotal() PushTokenRef( xRef); } -void ScInterpreter::ScWrapCols() +void ScInterpreter::ScWrapColsOrRows(bool bCols) { sal_uInt8 nParamCount = GetByte(); if (!MustHaveParamCount(nParamCount, 2, 3)) @@ -9780,8 +9601,8 @@ void ScInterpreter::ScWrapCols() bDouble = GetDoubleOrString(fNumber, aString); // 2nd argument - wrap_count - SCSIZE nRows = GetInt32WithDefault(0); - if (nRows <= 0) + SCSIZE nWrap = GetInt32WithDefault(0); + if (nWrap <= 0) { PushIllegalParameter(); return; @@ -9836,142 +9657,57 @@ void ScInterpreter::ScWrapCols() return; } - SCSIZE nCols(std::ceil(aResPos.size() / static_cast<double>(nRows))); - ScMatrixRef pResMat = GetNewMat(nCols, nRows, /*bEmpty*/true); + SCSIZE nCeil = std::ceil(aResPos.size() / static_cast<double>(nWrap)); + SCSIZE nColumns = bCols ? nCeil : nWrap; + SCSIZE nRows = bCols ? nWrap : nCeil; + ScMatrixRef pResMat = GetNewMat(nColumns, nRows, /*bEmpty*/true); if (!pResMat) { PushIllegalArgument(); return; } + if (!bCols) + std::swap(nColumns, nRows); + size_t iPos = 0; - for (SCSIZE col = 0; col < nCols; ++col) + for (SCSIZE col = 0; col < nColumns; ++col) { for (SCSIZE row = 0; row < nRows; ++row) { + SCSIZE nC = bCols ? col : row; + SCSIZE nR = bCols ? row : col; if (iPos < aResPos.size()) { - lcl_FillCell(pMatSource, pResMat, aResPos[iPos].first, aResPos[iPos].second, col, row); + lcl_FillCell(pMatSource, pResMat, aResPos[iPos].first, aResPos[iPos].second, nC, nR); ++iPos; } else if (bDouble.has_value()) { if (bDouble.value()) - pResMat->PutDouble(fNumber, col, row); + pResMat->PutDouble(fNumber, nC, nR); else - pResMat->PutString(aString, col, row); + pResMat->PutString(aString, nC, nR); } else - pResMat->PutError(FormulaError::NotAvailable, col, row); + pResMat->PutError(FormulaError::NotAvailable, nC, nR); } } PushMatrix(pResMat); } -void ScInterpreter::ScWrapRows() +void ScInterpreter::ScWrapCols() { - sal_uInt8 nParamCount = GetByte(); - if (!MustHaveParamCount(nParamCount, 2, 3)) - return; - - // 3rd argument optional - pad_with - std::optional<bool> bDouble; - double fNumber(0.0); - svl::SharedString aString; - if (nParamCount == 3) - bDouble = GetDoubleOrString(fNumber, aString); - - // 2nd argument - wrap_count - SCSIZE nCols = GetInt32WithDefault(0); - if (nCols <= 0) - { - PushIllegalParameter(); - return; - } - - // 1st argument: take range - ScMatrixRef pMatSource = nullptr; - SCSIZE nsC = 0, nsR = 0; - switch (GetStackType()) - { - case svSingleRef: - case svDoubleRef: - case svMatrix: - case svExternalSingleRef: - case svExternalDoubleRef: - { - pMatSource = GetMatrix(); - if (!pMatSource) - { - PushIllegalParameter(); - return; - } - - pMatSource->GetDimensions(nsC, nsR); - } - break; - - default: - PushIllegalParameter(); - return; - } - - if (nGlobalError != FormulaError::NONE || nsC < 1 || nsR < 1 || (nsC > 1 && nsR > 1)) - { - PushIllegalArgument(); - return; - } - - std::vector<std::pair<SCSIZE, SCSIZE>> aResPos; - for (SCSIZE col = 0; col < nsC; col++) - { - for (SCSIZE row = 0; row < nsR; row++) - { - aResPos.emplace_back(col, row); - } - } - - // No result - if (aResPos.size() == 0) - { - PushNA(); - return; - } - - SCSIZE nRows(std::ceil(aResPos.size() / static_cast<double>(nCols))); - ScMatrixRef pResMat = GetNewMat(nCols, nRows, /*bEmpty*/true); - if (!pResMat) - { - PushIllegalArgument(); - return; - } - - size_t iPos = 0; - for (SCSIZE row = 0; row < nRows; ++row) - { - for (SCSIZE col = 0; col < nCols; ++col) - { - if (iPos < aResPos.size()) - { - lcl_FillCell(pMatSource, pResMat, aResPos[iPos].first, aResPos[iPos].second, col, row); - ++iPos; - } - else if (bDouble.has_value()) - { - if (bDouble.value()) - pResMat->PutDouble(fNumber, col, row); - else - pResMat->PutString(aString, col, row); - } - else - pResMat->PutError(FormulaError::NotAvailable, col, row); - } - } + ScWrapColsOrRows(/*bCols*/ true); +} - PushMatrix(pResMat); +void ScInterpreter::ScWrapRows() +{ + ScWrapColsOrRows(/*bCols*/ false); } + void ScInterpreter::ScAggregate() { sal_uInt8 nParamCount = GetByte(); commit 5c9baeb47e09aa8fcb771878bdd08b0afdcf7f10 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Fri Jan 24 16:10:44 2025 +0100 Commit: Aron Budea <aron.bu...@collabora.com> CommitDate: Tue Aug 26 21:37:11 2025 +0200 sc: factor out common code Change-Id: Ie76ee43b4fd00d5a1e152532017b3a30581252cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180715 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> Tested-by: Jenkins (cherry picked from commit 577c47a279b4307a563f8387a16b354a470e6830) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190120 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Aron Budea <aron.bu...@collabora.com> diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index c4c2741b9e35..e393b2dad3de 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -8848,6 +8848,22 @@ void ScInterpreter::ScSortBy() } } +static void lcl_FillCell(const ScMatrixRef& pMatSource, const ScMatrixRef& pMatDest, SCSIZE nsC, SCSIZE nsR, SCSIZE ndC, SCSIZE ndR) +{ + if (pMatSource->IsEmptyCell(nsC, nsR)) + { + pMatDest->PutEmpty(ndC, ndR); + } + else if (!pMatSource->IsStringOrEmpty(nsC, nsR)) + { + pMatDest->PutDouble(pMatSource->GetDouble(nsC, nsR), ndC, ndR); + } + else + { + pMatDest->PutString(pMatSource->GetString(nsC, nsR), ndC, ndR); + } +} + void ScInterpreter::ScDrop() { sal_uInt8 nParamCount = GetByte(); @@ -8964,19 +8980,7 @@ void ScInterpreter::ScDrop() { for (SCSIZE row = 0; row < nRows; ++row) { - if (pMatSource->IsEmptyCell(aResPos[iPos].first, aResPos[iPos].second)) - { - pResMat->PutEmpty(col, row); - } - else if (!pMatSource->IsStringOrEmpty(aResPos[iPos].first, aResPos[iPos].second)) - { - pResMat->PutDouble(pMatSource->GetDouble(aResPos[iPos].first, aResPos[iPos].second), col, row); - } - else - { - pResMat->PutString(pMatSource->GetString(aResPos[iPos].first, aResPos[iPos].second), col, row); - } - + lcl_FillCell(pMatSource, pResMat, aResPos[iPos].first, aResPos[iPos].second, col, row); ++iPos; } } @@ -9086,20 +9090,7 @@ void ScInterpreter::ScExpand() for (SCSIZE row = 0; row < nRows; ++row) { if (col < nsC && row < nsR) - { - if (pMatSource->IsEmptyCell(col, row)) - { - pResMat->PutEmpty(col, row); - } - else if (!pMatSource->IsStringOrEmpty(col, row)) - { - pResMat->PutDouble(pMatSource->GetDouble(col, row), col, row); - } - else - { - pResMat->PutString(pMatSource->GetString(col, row), col, row); - } - } + lcl_FillCell(pMatSource, pResMat, col, row, col, row); else { if (bDouble.has_value()) @@ -9234,19 +9225,7 @@ void ScInterpreter::ScTake() { for (SCSIZE row = 0; row < nRows; ++row) { - if (pMatSource->IsEmptyCell(aResPos[iPos].first, aResPos[iPos].second)) - { - pResMat->PutEmpty(col, row); - } - else if (!pMatSource->IsStringOrEmpty(aResPos[iPos].first, aResPos[iPos].second)) - { - pResMat->PutDouble(pMatSource->GetDouble(aResPos[iPos].first, aResPos[iPos].second), col, row); - } - else - { - pResMat->PutString(pMatSource->GetString(aResPos[iPos].first, aResPos[iPos].second), col, row); - } - + lcl_FillCell(pMatSource, pResMat, aResPos[iPos].first, aResPos[iPos].second, col, row); ++iPos; } } @@ -9348,18 +9327,7 @@ void ScInterpreter::ScToCol() // fill result matrix to the same column for (SCSIZE iPos = 0; iPos < aResPos.size(); ++iPos) { - if (pMatSource->IsEmptyCell(aResPos[iPos].first, aResPos[iPos].second)) - { - pResMat->PutEmpty(0, iPos); - } - else if (!pMatSource->IsStringOrEmpty(aResPos[iPos].first, aResPos[iPos].second)) - { - pResMat->PutDouble(pMatSource->GetDouble(aResPos[iPos].first, aResPos[iPos].second), 0, iPos); - } - else - { - pResMat->PutString(pMatSource->GetString(aResPos[iPos].first, aResPos[iPos].second), 0, iPos); - } + lcl_FillCell(pMatSource, pResMat, aResPos[iPos].first, aResPos[iPos].second, 0, iPos); } PushMatrix(pResMat); @@ -9459,18 +9427,7 @@ void ScInterpreter::ScToRow() // fill result matrix to the same row for (SCSIZE iPos = 0; iPos < aResPos.size(); ++iPos) { - if (pMatSource->IsEmptyCell(aResPos[iPos].first, aResPos[iPos].second)) - { - pResMat->PutEmpty(iPos, 0); - } - else if (!pMatSource->IsStringOrEmpty(aResPos[iPos].first, aResPos[iPos].second)) - { - pResMat->PutDouble(pMatSource->GetDouble(aResPos[iPos].first, aResPos[iPos].second), iPos, 0); - } - else - { - pResMat->PutString(pMatSource->GetString(aResPos[iPos].first, aResPos[iPos].second), iPos, 0); - } + lcl_FillCell(pMatSource, pResMat, aResPos[iPos].first, aResPos[iPos].second, iPos, 0); } PushMatrix(pResMat); @@ -9581,36 +9538,14 @@ void ScInterpreter::ScUnique() { for (SCSIZE col = 0; col < nsC; col++) { - if (pMatSource->IsEmptyCell(col, aResPos[iPos].first)) - { - pResMat->PutEmpty(col, iPos); - } - else if (!pMatSource->IsStringOrEmpty(col, aResPos[iPos].first)) - { - pResMat->PutDouble(pMatSource->GetDouble(col, aResPos[iPos].first), col, iPos); - } - else - { - pResMat->PutString(pMatSource->GetString(col, aResPos[iPos].first), col, iPos); - } + lcl_FillCell(pMatSource, pResMat, col, aResPos[iPos].first, col, iPos); } } else { for (SCSIZE row = 0; row < nsR; row++) { - if (pMatSource->IsEmptyCell(aResPos[iPos].first, row)) - { - pResMat->PutEmpty(iPos, row); - } - else if (!pMatSource->IsStringOrEmpty(aResPos[iPos].first, row)) - { - pResMat->PutDouble(pMatSource->GetDouble(aResPos[iPos].first, row), iPos, row); - } - else - { - pResMat->PutString(pMatSource->GetString(aResPos[iPos].first, row), iPos, row); - } + lcl_FillCell(pMatSource, pResMat, aResPos[iPos].first, row, iPos, row); } } } @@ -9916,18 +9851,7 @@ void ScInterpreter::ScWrapCols() { if (iPos < aResPos.size()) { - if (pMatSource->IsEmptyCell(aResPos[iPos].first, aResPos[iPos].second)) - { - pResMat->PutEmpty(col, row); - } - else if (!pMatSource->IsStringOrEmpty(aResPos[iPos].first, aResPos[iPos].second)) - { - pResMat->PutDouble(pMatSource->GetDouble(aResPos[iPos].first, aResPos[iPos].second), col, row); - } - else - { - pResMat->PutString(pMatSource->GetString(aResPos[iPos].first, aResPos[iPos].second), col, row); - } + lcl_FillCell(pMatSource, pResMat, aResPos[iPos].first, aResPos[iPos].second, col, row); ++iPos; } else if (bDouble.has_value()) @@ -10030,18 +9954,7 @@ void ScInterpreter::ScWrapRows() { if (iPos < aResPos.size()) { - if (pMatSource->IsEmptyCell(aResPos[iPos].first, aResPos[iPos].second)) - { - pResMat->PutEmpty(col, row); - } - else if (!pMatSource->IsStringOrEmpty(aResPos[iPos].first, aResPos[iPos].second)) - { - pResMat->PutDouble(pMatSource->GetDouble(aResPos[iPos].first, aResPos[iPos].second), col, row); - } - else - { - pResMat->PutString(pMatSource->GetString(aResPos[iPos].first, aResPos[iPos].second), col, row); - } + lcl_FillCell(pMatSource, pResMat, aResPos[iPos].first, aResPos[iPos].second, col, row); ++iPos; } else if (bDouble.has_value())