[Libreoffice-commits] core.git: sc/source

Pierre-Eric Pelloux-Prayer pierre-eric at lanedo.com
Mon Aug 19 09:08:58 PDT 2013


 sc/source/ui/docshell/externalrefmgr.cxx |   27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

New commits:
commit f243d07019ca205ef536b0d7b0e1fe4b84469f75
Author: Pierre-Eric Pelloux-Prayer <pierre-eric at lanedo.com>
Date:   Fri Aug 16 16:29:14 2013 +0200

    sc/externalrefmgr: reduce individual cell queries
    
    Change-Id: Ic0dda47f02cd392234876a8945e240bbc915fa6a
    Reviewed-on: https://gerrit.libreoffice.org/5453
    Reviewed-by: Petr Mladek <pmladek at suse.cz>
    Tested-by: Petr Mladek <pmladek at suse.cz>

diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index 8ab55db..f27f258 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.


More information about the Libreoffice-commits mailing list