summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2018-07-18 22:04:09 +0200
committerEike Rathke <erack@redhat.com>2018-07-18 23:21:26 +0200
commita014a9bcf071229eef93c307c705a4c639635bd5 (patch)
tree1ac278dc5f7816ee7190712e04902cdc025030bf
parent5bfdbc664072dbf2731365b237b60eba2b3e03fb (diff)
Do not force all string results to be recalculated if no style set
Results are forced to recalculate for cells with General format in case they need to inherit a format that then can be set. However, a General format will never lead to some other format being set for any string results and almost all string result cells will have General format because the string is already what is being displayed. So for formula cells with a string result available do not allow to use ScFormulaCell::SetNeedNumberFormat() forcing the need to recalculate. This popped up during intercepting for tdf#118735 when the formula cell containing a WEBSERVICE() call is set dirty, through CompileXMLHandler::operator()(...) if (pCell->NeedsNumberFormat()) pCell->SetDirtyVar(); Which again, as WEBSERVICE() has to be recalculated to populate the link manager, made it necessary to add that to ScRecalcMode::ONLOAD_LENIENT (which it should already had been before (when that was ONLOAD), but no harm in this case). Change-Id: I0dc2cdfe35c56d9843f0edd24a6d14e3de79f7ef Reviewed-on: https://gerrit.libreoffice.org/57700 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
-rw-r--r--formula/source/core/api/FormulaCompiler.cxx1
-rw-r--r--sc/source/filter/xml/xmlcelli.cxx12
2 files changed, 10 insertions, 3 deletions
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 5d4c3e76ec5b..d11bd25a08d1 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -1436,6 +1436,7 @@ void FormulaCompiler::Factor()
case ocDde:
case ocMacro:
case ocExternal:
+ case ocWebservice:
pArr->AddRecalcMode( ScRecalcMode::ONLOAD_LENIENT );
break;
// If the referred cell is moved the value changes.
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 32a0cb1e6392..c9899457f23c 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -1009,6 +1009,8 @@ void ScXMLTableRowCellContext::SetFormulaCell(ScFormulaCell* pFCell) const
{
if(pFCell)
{
+ bool bMayForceNumberformat = true;
+
if(mbErrorValue)
{
// don't do anything here
@@ -1021,6 +1023,9 @@ void ScXMLTableRowCellContext::SetFormulaCell(ScFormulaCell* pFCell) const
ScDocument* pDoc = rXMLImport.GetDocument();
pFCell->SetHybridString(pDoc->GetSharedStringPool().intern(*maStringValue));
pFCell->ResetDirty();
+ // A General format doesn't force any other format for a string
+ // result, don't attempt to recalculate this later.
+ bMayForceNumberformat = false;
}
}
else if (rtl::math::isFinite(fValue))
@@ -1035,6 +1040,10 @@ void ScXMLTableRowCellContext::SetFormulaCell(ScFormulaCell* pFCell) const
else
pFCell->ResetDirty();
}
+
+ if (bMayForceNumberformat)
+ // Re-calculate to get number format only when style is not set.
+ pFCell->SetNeedNumberFormat(!mbHasStyle);
}
}
@@ -1398,9 +1407,6 @@ void ScXMLTableRowCellContext::PutFormulaCell( const ScAddress& rCellPos )
ScFormulaCell* pNewCell = new ScFormulaCell(pDoc, rCellPos, pCode, eGrammar, ScMatrixMode::NONE);
SetFormulaCell(pNewCell);
rDoc.setFormulaCell(rCellPos, pNewCell);
-
- // Re-calculate to get number format only when style is not set.
- pNewCell->SetNeedNumberFormat(!mbHasStyle);
}
}