diff options
-rw-r--r-- | sc/source/ui/docshell/externalrefmgr.cxx | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx index 8ab55db2a17d..f27f25809cf8 100644 --- a/sc/source/ui/docshell/externalrefmgr.cxx +++ b/sc/source/ui/docshell/externalrefmgr.cxx @@ -764,21 +764,30 @@ void ScExternalRefCache::setCellRangeData(sal_uInt16 nFileId, const ScRange& rRa if (!pTabData.get()) pTabData.reset(new Table); + const ScMatrixRef& pMat = itrData->mpRangeData; for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow) { + const SCSIZE nR = nRow - nRow1; for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol) { - SCSIZE nC = nCol - nCol1, nR = nRow - nRow1; + const SCSIZE nC = nCol - nCol1; + + ScMatrixValue value = pMat->Get(nC, nR); + TokenRef pToken; - const ScMatrixRef& pMat = itrData->mpRangeData; - if (pMat->IsEmpty(nC, nR)) - // Don't cache empty cells. - continue; - if (pMat->IsValue(nC, nR)) - pToken.reset(new formula::FormulaDoubleToken(pMat->GetDouble(nC, nR))); - else if (pMat->IsString(nC, nR)) - pToken.reset(new formula::FormulaStringToken(pMat->GetString(nC, nR))); + switch (value.nType) { + case SC_MATVAL_VALUE: + case SC_MATVAL_BOOLEAN: + pToken.reset(new formula::FormulaDoubleToken(value.fVal)); + break; + case SC_MATVAL_STRING: + pToken.reset(new formula::FormulaStringToken(value.aStr)); + break; + default: + // Don't cache empty cells. + break; + } if (pToken) // Don't mark this cell 'cached' here, for better performance. |