summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-03-25 01:22:32 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-03-25 01:51:06 +0100
commitee98f0e691e3cf945725a9f1daa90542407e3358 (patch)
treea14ec7833b297bfbc0cedfeb37d27a5bc2cec7f5
parent62ab87f70b22b70b162b50973072565066f707cf (diff)
these two methods are identical copies, related tdf#93405
This already gives a 15% improvement as we now only query the cell twice instead of three times. Change-Id: I2e0533f05ace6773ad0710b2c586ca325aeae91b
-rw-r--r--sc/source/core/tool/cellform.cxx85
1 files changed, 2 insertions, 83 deletions
diff --git a/sc/source/core/tool/cellform.cxx b/sc/source/core/tool/cellform.cxx
index c5886765d07d..758d3f43a507 100644
--- a/sc/source/core/tool/cellform.cxx
+++ b/sc/source/core/tool/cellform.cxx
@@ -133,89 +133,8 @@ OUString ScCellFormat::GetString(
OUString aString;
*ppColor = nullptr;
- CellType eType = rDoc.GetCellType(rPos);
- switch (eType)
- {
- case CELLTYPE_STRING:
- {
- ScRefCellValue aCell(rDoc, rPos);
- rFormatter.GetOutputString(aCell.mpString->getString(), nFormat, aString, ppColor);
- }
- break;
- case CELLTYPE_EDIT:
- {
- ScRefCellValue aCell(rDoc, rPos);
- rFormatter.GetOutputString(aCell.getString(&rDoc), nFormat, aString, ppColor);
- }
- break;
- case CELLTYPE_VALUE:
- {
- double nValue = rDoc.GetValue(rPos);
- if (!bNullVals && nValue == 0.0) aString.clear();
- else
- {
- if (eForceTextFmt == ftCheck)
- {
- if (nFormat && rFormatter.IsTextFormat(nFormat)) eForceTextFmt = ftForce;
- }
- if (eForceTextFmt == ftForce)
- {
- OUString aTemp;
- rFormatter.GetOutputString(nValue, 0, aTemp, ppColor);
- rFormatter.GetOutputString(aTemp, nFormat, aString, ppColor);
- }
- else rFormatter.GetOutputString(nValue, nFormat, aString, ppColor);
- }
- }
- break;
- case CELLTYPE_FORMULA:
- {
- ScFormulaCell* pFCell = rDoc.GetFormulaCell(rPos);
- if (!pFCell)
- return aString;
- if (bFormula)
- {
- pFCell->GetFormula(aString);
- }
- else
- {
- // A macro started from the interpreter, which has
- // access to Formular Cells, becomes a CellText, even if
- // that triggers further interpretation, except if those
- // cells are already being interpreted.
- // IdleCalc generally doesn't trigger further interpretation,
- // as not to get Err522 (circular).
- if (pFCell->GetDocument()->IsInInterpreter() &&
- (!pFCell->GetDocument()->GetMacroInterpretLevel()
- || pFCell->IsRunning()))
- {
- aString = "...";
- }
- else
- {
- sal_uInt16 nErrCode = pFCell->GetErrCode();
-
- if (nErrCode != 0) aString = ScGlobal::GetErrorString(nErrCode);
- else if (pFCell->IsEmptyDisplayedAsString()) aString.clear();
- else if (pFCell->IsValue())
- {
- double fValue = pFCell->GetValue();
- if (!bNullVals && fValue == 0.0) aString.clear();
- else if (pFCell->IsHybridValueCell()) aString = pFCell->GetString().getString();
- else rFormatter.GetOutputString(fValue, nFormat, aString, ppColor);
- }
- else
- {
- rFormatter.GetOutputString(pFCell->GetString().getString(),
- nFormat, aString, ppColor);
- }
- }
- }
- }
- break;
- default:
- ;
- }
+ ScRefCellValue aCell(rDoc, rPos);
+ GetString(aCell, nFormat, aString, ppColor, rFormatter, &rDoc, bNullVals, bFormula, eForceTextFmt);
return aString;
}