summaryrefslogtreecommitdiff
path: root/sc/source/core/data/formulacell.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/core/data/formulacell.cxx')
-rw-r--r--sc/source/core/data/formulacell.cxx36
1 files changed, 22 insertions, 14 deletions
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 14ccad41bca4..75f01d2e11dd 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -503,6 +503,7 @@ ScFormulaCell::ScFormulaCell( ScDocument* pDoc, const ScAddress& rPos ) :
bTableOpDirty(false),
bNeedListening(false),
mbNeedsNumberFormat(false),
+ mbPostponedDirty(false),
aPos(rPos)
{
}
@@ -531,6 +532,7 @@ ScFormulaCell::ScFormulaCell( ScDocument* pDoc, const ScAddress& rPos,
bTableOpDirty( false ),
bNeedListening( false ),
mbNeedsNumberFormat( false ),
+ mbPostponedDirty(false),
aPos( rPos )
{
Compile( rFormula, true, eGrammar ); // bNoListening, Insert does that
@@ -562,6 +564,7 @@ ScFormulaCell::ScFormulaCell(
bTableOpDirty( false ),
bNeedListening( false ),
mbNeedsNumberFormat( false ),
+ mbPostponedDirty(false),
aPos( rPos )
{
assert(pArray); // Never pass a NULL pointer here.
@@ -610,6 +613,7 @@ ScFormulaCell::ScFormulaCell(
bTableOpDirty( false ),
bNeedListening( false ),
mbNeedsNumberFormat( false ),
+ mbPostponedDirty(false),
aPos( rPos )
{
// RPN array generation
@@ -657,6 +661,7 @@ ScFormulaCell::ScFormulaCell(
bTableOpDirty( false ),
bNeedListening( false ),
mbNeedsNumberFormat( false ),
+ mbPostponedDirty(false),
aPos( rPos )
{
if (bSubTotal)
@@ -685,6 +690,7 @@ ScFormulaCell::ScFormulaCell( const ScFormulaCell& rCell, ScDocument& rDoc, cons
bTableOpDirty( false ),
bNeedListening( false ),
mbNeedsNumberFormat( false ),
+ mbPostponedDirty(false),
aPos( rPos )
{
pCode = rCell.pCode->Clone();
@@ -891,7 +897,7 @@ void ScFormulaCell::GetResultDimensions( SCSIZE& rCols, SCSIZE& rRows )
}
bool ScFormulaCell::GetDirty() const { return bDirty; }
-void ScFormulaCell::ResetDirty() { bDirty = false; }
+void ScFormulaCell::ResetDirty() { bDirty = bTableOpDirty = mbPostponedDirty = false; }
bool ScFormulaCell::NeedsListening() const { return bNeedListening; }
void ScFormulaCell::SetNeedsListening( bool bVar ) { bNeedListening = bVar; }
void ScFormulaCell::SetNeedNumberFormat( bool bVal ) { mbNeedsNumberFormat = bVal; }
@@ -1290,8 +1296,7 @@ void ScFormulaCell::Interpret()
// If one cell didn't converge, all cells of this
// circular dependency don't, no matter whether
// single cells did.
- pIterCell->bDirty = false;
- pIterCell->bTableOpDirty = false;
+ pIterCell->ResetDirty();
pIterCell->aResult.SetResultError( errNoConvergence);
pIterCell->bChanged = true;
}
@@ -1448,8 +1453,7 @@ void ScFormulaCell::InterpretTail( ScInterpretTailParameter eTailParam )
if( p->GetError() && p->GetError() != errCircularReference)
{
- bDirty = false;
- bTableOpDirty = false;
+ ResetDirty();
bChanged = true;
}
if (eTailParam == SCITP_FROM_ITERATION && IsDirtyOrInTableOpDirty())
@@ -1472,8 +1476,7 @@ void ScFormulaCell::InterpretTail( ScInterpretTailParameter eTailParam )
if (nSeenInIteration > 1 ||
pDocument->GetDocOptions().GetIterCount() == 1)
{
- bDirty = false;
- bTableOpDirty = false;
+ ResetDirty();
}
}
}
@@ -1574,8 +1577,7 @@ void ScFormulaCell::InterpretTail( ScInterpretTailParameter eTailParam )
}
if (eTailParam == SCITP_NORMAL)
{
- bDirty = false;
- bTableOpDirty = false;
+ ResetDirty();
}
if( aResult.GetMatrix() )
{
@@ -1654,8 +1656,7 @@ void ScFormulaCell::InterpretTail( ScInterpretTailParameter eTailParam )
{
// Cells with compiler errors should not be marked dirty forever
OSL_ENSURE( pCode->GetCodeError(), "no RPN code und no errors ?!?!" );
- bDirty = false;
- bTableOpDirty = false;
+ ResetDirty();
}
}
@@ -1757,7 +1758,7 @@ void ScFormulaCell::SetDirty( bool bDirtyFlag )
// by Scenario and Copy Block From Clip.
// If unconditional required Formula tracking is set before SetDirty
// bDirty = false, eg in CompileTokenArray
- if ( !bDirty || !pDocument->IsInFormulaTree( this ) )
+ if ( !bDirty || mbPostponedDirty || !pDocument->IsInFormulaTree( this ) )
{
if( bDirtyFlag )
SetDirtyVar();
@@ -1774,6 +1775,7 @@ void ScFormulaCell::SetDirty( bool bDirtyFlag )
void ScFormulaCell::SetDirtyVar()
{
bDirty = true;
+ mbPostponedDirty = false;
if (mxGroup && mxGroup->meCalcState == sc::GroupCalcRunning)
mxGroup->meCalcState = sc::GroupCalcEnabled;
@@ -2566,8 +2568,9 @@ bool ScFormulaCell::UpdateReferenceOnShift(
if (bNeedDirty && !bHasRelName)
{ // Cut off references, invalid or similar?
- sc::AutoCalcSwitch(*pDocument, false);
- SetDirty();
+ // Postpone SetDirty() until all listeners have been re-established in
+ // Inserts/Deletes.
+ mbPostponedDirty = true;
}
return bCellStateChanged;
@@ -3862,4 +3865,9 @@ const ScTokenArray* ScFormulaCell::GetSharedCode() const
return mxGroup ? mxGroup->mpCode : NULL;
}
+bool ScFormulaCell::IsPostponedDirty() const
+{
+ return mbPostponedDirty;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */