summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorAleksas Pantechovskis <alex.pantec@gmail.com>2016-03-30 23:05:19 +0300
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-03-31 19:35:13 +0000
commite3e0ac4d3d3d7f701618358ccbb3d667683c6b20 (patch)
treec902d54762b6226a93f000a64bc92a099e90ab2b /sc
parent50223ea6e212b60b7d33839c2753c5601fb50f95 (diff)
tdf#98893 Remove expensive calls to GetCellType + GetValue/... in calc
Change-Id: If8aa0158c60d5727d9bdd66aa351c50c987c3e5f Reviewed-on: https://gerrit.libreoffice.org/23662 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/view/spelleng.cxx19
-rw-r--r--sc/source/ui/view/viewfunc.cxx9
2 files changed, 18 insertions, 10 deletions
diff --git a/sc/source/ui/view/spelleng.cxx b/sc/source/ui/view/spelleng.cxx
index 871de86d2c0e..ffb20f53a761 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 f43695d3c971..2e26c66afa5e 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);