summaryrefslogtreecommitdiff
path: root/sc/source/core/data/colorscale.cxx
diff options
context:
space:
mode:
authorAleksas Pantechovskis <alex.pantec@gmail.com>2016-03-26 22:20:15 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-03-27 22:11:28 +0000
commit1cc2d4115e7e36f01dde759209802e2ac2477117 (patch)
tree197ee665feed118310cbbfb18a309eae9484fb9d /sc/source/core/data/colorscale.cxx
parent9605ed83182b2ef670c0a0c559bbe1e7a5d902aa (diff)
tdf#98893 Remove expensive calls to GetCellType + GetValue/... in calc
Conflicts: sc/source/core/tool/cellform.cxx Change-Id: Id949800f6e13e268df798d2f1868f26deff66191 Reviewed-on: https://gerrit.libreoffice.org/23543 Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sc/source/core/data/colorscale.cxx')
-rw-r--r--sc/source/core/data/colorscale.cxx54
1 files changed, 12 insertions, 42 deletions
diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx
index f5b4d527a06e..bdf306f42f05 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -413,21 +413,12 @@ std::vector<double>& ScColorFormat::getValues() const
for(SCROW nRow = nRowStart; nRow <= nRowEnd; ++nRow)
{
ScAddress aAddr(nCol, nRow, nTab);
- CellType eType = mpDoc->GetCellType(aAddr);
- if(eType == CELLTYPE_VALUE)
+ ScRefCellValue rCell(*mpDoc, aAddr);
+ if(rCell.hasNumeric())
{
- double aVal = mpDoc->GetValue(nCol, nRow, nTab);
+ double aVal = rCell.getValue();
rValues.push_back(aVal);
}
- else if(eType == CELLTYPE_FORMULA)
- {
- ScFormulaCell *pCell = mpDoc->GetFormulaCell(aAddr);
- if (pCell && pCell->IsValue())
- {
- double aVal = mpDoc->GetValue(nCol, nRow, nTab);
- rValues.push_back(aVal);
- }
- }
}
}
}
@@ -540,19 +531,12 @@ double ScColorScaleFormat::CalcValue(double nMin, double nMax, ScColorScaleEntri
Color* ScColorScaleFormat::GetColor( const ScAddress& rAddr ) const
{
- CellType eCellType = mpDoc->GetCellType(rAddr);
- if(eCellType != CELLTYPE_VALUE && eCellType != CELLTYPE_FORMULA)
+ ScRefCellValue rCell(*mpDoc, rAddr);
+ if(!rCell.hasNumeric())
return nullptr;
- if (eCellType == CELLTYPE_FORMULA)
- {
- ScFormulaCell *pCell = mpDoc->GetFormulaCell(rAddr);
- if (!pCell || !pCell->IsValue())
- return nullptr;
- }
-
// now we have for sure a value
- double nVal = mpDoc->GetValue(rAddr);
+ double nVal = rCell.getValue();
if (maColorScales.size() < 2)
return nullptr;
@@ -796,17 +780,10 @@ double ScDataBarFormat::getMax(double nMin, double nMax) const
ScDataBarInfo* ScDataBarFormat::GetDataBarInfo(const ScAddress& rAddr) const
{
- CellType eCellType = mpDoc->GetCellType(rAddr);
- if(eCellType != CELLTYPE_VALUE && eCellType != CELLTYPE_FORMULA)
+ ScRefCellValue rCell(*mpDoc, rAddr);
+ if(!rCell.hasNumeric())
return nullptr;
- if (eCellType == CELLTYPE_FORMULA)
- {
- ScFormulaCell *pCell = mpDoc->GetFormulaCell(rAddr);
- if (!pCell || !pCell->IsValue())
- return nullptr;
- }
-
// now we have for sure a value
double nValMin = getMinValue();
@@ -816,7 +793,7 @@ ScDataBarInfo* ScDataBarFormat::GetDataBarInfo(const ScAddress& rAddr) const
double nMinLength = mpFormatData->mnMinLength;
double nMaxLength = mpFormatData->mnMaxLength;
- double nValue = mpDoc->GetValue(rAddr);
+ double nValue = rCell.getValue();
ScDataBarInfo* pInfo = new ScDataBarInfo();
if(mpFormatData->meAxisPosition == databar::NONE)
@@ -982,19 +959,12 @@ const ScIconSetFormatData* ScIconSetFormat::GetIconSetData() const
ScIconSetInfo* ScIconSetFormat::GetIconSetInfo(const ScAddress& rAddr) const
{
- CellType eCellType = mpDoc->GetCellType(rAddr);
- if(eCellType != CELLTYPE_VALUE && eCellType != CELLTYPE_FORMULA)
+ ScRefCellValue rCell(*mpDoc, rAddr);
+ if(!rCell.hasNumeric())
return nullptr;
- if (eCellType == CELLTYPE_FORMULA)
- {
- ScFormulaCell *pCell = mpDoc->GetFormulaCell(rAddr);
- if (!pCell || !pCell->IsValue())
- return nullptr;
- }
-
// now we have for sure a value
- double nVal = mpDoc->GetValue(rAddr);
+ double nVal = rCell.getValue();
if (mpFormatData->m_Entries.size() < 2)
return nullptr;