Ported calc-formula-matrix-no-autocalc.diff from ooo-build.
This patch allows formula to be recalculated if it's during matrix calculation even if the auto recalc flag is OFF. This is needed when calculating a formula whose result is a matrix which previously only calculated the top-left cell when the auto recalc was OFF.
This commit is contained in:
@@ -538,6 +538,8 @@ public:
|
||||
|
||||
/** Determines whether or not the result string contains more than one paragraph */
|
||||
bool IsMultilineResult();
|
||||
|
||||
void MaybeInterpret();
|
||||
};
|
||||
|
||||
// Iterator fuer Referenzen in einer Formelzelle
|
||||
|
||||
@@ -899,8 +899,7 @@ void ScFormulaCell::GetFormula( String& rFormula, const FormulaGrammar::Grammar
|
||||
|
||||
void ScFormulaCell::GetResultDimensions( SCSIZE& rCols, SCSIZE& rRows )
|
||||
{
|
||||
if (IsDirtyOrInTableOpDirty() && pDocument->GetAutoCalc())
|
||||
Interpret();
|
||||
MaybeInterpret();
|
||||
|
||||
const ScMatrix* pMat = NULL;
|
||||
if (!pCode->GetCodeError() && aResult.GetType() == svMatrixCell &&
|
||||
@@ -1969,6 +1968,15 @@ bool ScFormulaCell::IsMultilineResult()
|
||||
return false;
|
||||
}
|
||||
|
||||
void ScFormulaCell::MaybeInterpret()
|
||||
{
|
||||
if (!IsDirtyOrInTableOpDirty())
|
||||
return;
|
||||
|
||||
if (pDocument->GetAutoCalc() || (cMatrixFlag != MM_NONE))
|
||||
Interpret();
|
||||
}
|
||||
|
||||
EditTextObject* ScFormulaCell::CreateURLObject()
|
||||
{
|
||||
String aCellText;
|
||||
|
||||
@@ -489,29 +489,25 @@ bool lcl_isReference(const FormulaToken& rToken)
|
||||
|
||||
BOOL ScFormulaCell::IsEmpty()
|
||||
{
|
||||
if (IsDirtyOrInTableOpDirty() && pDocument->GetAutoCalc())
|
||||
Interpret();
|
||||
MaybeInterpret();
|
||||
return aResult.GetCellResultType() == formula::svEmptyCell;
|
||||
}
|
||||
|
||||
BOOL ScFormulaCell::IsEmptyDisplayedAsString()
|
||||
{
|
||||
if (IsDirtyOrInTableOpDirty() && pDocument->GetAutoCalc())
|
||||
Interpret();
|
||||
MaybeInterpret();
|
||||
return aResult.IsEmptyDisplayedAsString();
|
||||
}
|
||||
|
||||
BOOL ScFormulaCell::IsValue()
|
||||
{
|
||||
if (IsDirtyOrInTableOpDirty() && pDocument->GetAutoCalc())
|
||||
Interpret();
|
||||
MaybeInterpret();
|
||||
return aResult.IsValue();
|
||||
}
|
||||
|
||||
double ScFormulaCell::GetValue()
|
||||
{
|
||||
if (IsDirtyOrInTableOpDirty() && pDocument->GetAutoCalc())
|
||||
Interpret();
|
||||
MaybeInterpret();
|
||||
if ((!pCode->GetCodeError() || pCode->GetCodeError() == errDoubleRef) &&
|
||||
!aResult.GetResultError())
|
||||
return aResult.GetDouble();
|
||||
@@ -521,16 +517,13 @@ double ScFormulaCell::GetValue()
|
||||
double ScFormulaCell::GetValueAlways()
|
||||
{
|
||||
// for goal seek: return result value even if error code is set
|
||||
|
||||
if (IsDirtyOrInTableOpDirty() && pDocument->GetAutoCalc())
|
||||
Interpret();
|
||||
MaybeInterpret();
|
||||
return aResult.GetDouble();
|
||||
}
|
||||
|
||||
void ScFormulaCell::GetString( String& rString )
|
||||
{
|
||||
if (IsDirtyOrInTableOpDirty() && pDocument->GetAutoCalc())
|
||||
Interpret();
|
||||
MaybeInterpret();
|
||||
if ((!pCode->GetCodeError() || pCode->GetCodeError() == errDoubleRef) &&
|
||||
!aResult.GetResultError())
|
||||
rString = aResult.GetString();
|
||||
@@ -722,8 +715,8 @@ USHORT ScFormulaCell::GetMatrixEdge( ScAddress& rOrgPos )
|
||||
|
||||
USHORT ScFormulaCell::GetErrCode()
|
||||
{
|
||||
if (IsDirtyOrInTableOpDirty() && pDocument->GetAutoCalc())
|
||||
Interpret();
|
||||
MaybeInterpret();
|
||||
|
||||
/* FIXME: If ScTokenArray::SetCodeError() was really only for code errors
|
||||
* and not also abused for signaling other error conditions we could bail
|
||||
* out even before attempting to interpret broken code. */
|
||||
|
||||
Reference in New Issue
Block a user