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

Aleksas Pantechovskis alex.pantec at gmail.com
Thu Mar 31 19:35:33 UTC 2016


 sc/source/ui/view/spelleng.cxx |   19 +++++++++++++------
 sc/source/ui/view/viewfunc.cxx |    9 +++++----
 2 files changed, 18 insertions(+), 10 deletions(-)

New commits:
commit e3e0ac4d3d3d7f701618358ccbb3d667683c6b20
Author: Aleksas Pantechovskis <alex.pantec at gmail.com>
Date:   Wed Mar 30 23:05:19 2016 +0300

    tdf#98893 Remove expensive calls to GetCellType + GetValue/... in calc
    
    Change-Id: If8aa0158c60d5727d9bdd66aa351c50c987c3e5f
    Reviewed-on: https://gerrit.libreoffice.org/23662
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sc/source/ui/view/spelleng.cxx b/sc/source/ui/view/spelleng.cxx
index 871de86..ffb20f5 100644
--- a/sc/source/ui/view/spelleng.cxx
+++ b/sc/source/ui/view/spelleng.cxx
@@ -34,6 +34,8 @@
 #include "spelldialog.hxx"
 #include "tabvwsh.hxx"
 #include "docsh.hxx"
+#include "cellvalue.hxx"
+#include "cellform.hxx"
 #include "formulacell.hxx"
 #include "patattr.hxx"
 #include "waitoff.hxx"
@@ -247,19 +249,24 @@ void ScConversionEngineBase::FillFromCell( SCCOL nCol, SCROW nRow, SCTAB nTab )
 {
     ScAddress aPos(nCol, nRow, nTab);
 
-    switch (mrDoc.GetCellType(aPos))
+    ScRefCellValue aCell(mrDoc, aPos);
+    switch (aCell.meType)
     {
         case CELLTYPE_STRING:
         {
-            OUString aText = mrDoc.GetString(aPos);
-            SetText( aText );
+            SvNumberFormatter* pFormatter = mrDoc.GetFormatTable();
+            sal_uLong nNumFmt = mrDoc.GetNumberFormat(aPos);
+            OUString aText;
+            Color* pColor;
+            ScCellFormat::GetString(aCell, nNumFmt, aText, &pColor, *pFormatter, &mrDoc);
+
+            SetText(aText);
         }
         break;
         case CELLTYPE_EDIT:
         {
-            const EditTextObject* pNewEditObj = mrDoc.GetEditText(aPos);
-            if (pNewEditObj)
-                SetText(*pNewEditObj);
+            const EditTextObject* pNewEditObj = aCell.mpEditText;
+            SetText(*pNewEditObj);
         }
         break;
         default:
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index f43695d..2e26c66 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -1189,13 +1189,14 @@ void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr, bool bCursor
         EditTextObject* pOldEditData = nullptr;
         EditTextObject* pNewEditData = nullptr;
         ScAddress aPos(nCol, nRow, nTab);
-        if (rDoc.GetCellType(aPos) == CELLTYPE_EDIT)
+        ScRefCellValue aCell(rDoc, aPos);
+        if (aCell.meType == CELLTYPE_EDIT)
         {
-            const EditTextObject* pEditObj = rDoc.GetEditText(aPos);
-            pOldEditData = pEditObj ? pEditObj->Clone() : nullptr;
+            const EditTextObject* pEditObj = aCell.mpEditText;
+            pOldEditData = pEditObj->Clone();
             rDoc.RemoveEditTextCharAttribs(aPos, rAttr);
             pEditObj = rDoc.GetEditText(aPos);
-            pNewEditData = pEditObj ? pEditObj->Clone() : nullptr;
+            pNewEditData = pEditObj->Clone();
         }
 
         aChangeRanges.Append(aPos);


More information about the Libreoffice-commits mailing list