summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorPierre-Eric Pelloux-Prayer <pierre-eric@lanedo.com>2013-08-16 16:29:14 +0200
committerPetr Mladek <pmladek@suse.cz>2013-08-19 16:08:34 +0000
commitf243d07019ca205ef536b0d7b0e1fe4b84469f75 (patch)
tree0c0bde1f7bf6880d9d7219c5463101f46a510479 /sc
parente5d9477e87837fb771cf6dcb3bde872873bc50a8 (diff)
sc/externalrefmgr: reduce individual cell queries
Change-Id: Ic0dda47f02cd392234876a8945e240bbc915fa6a Reviewed-on: https://gerrit.libreoffice.org/5453 Reviewed-by: Petr Mladek <pmladek@suse.cz> Tested-by: Petr Mladek <pmladek@suse.cz>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/docshell/externalrefmgr.cxx27
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.