summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/conditio.cxx21
1 files changed, 15 insertions, 6 deletions
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 772a190b4f95..ae4a7e2d9ebd 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -526,12 +526,21 @@ void ScConditionEntry::UpdateReference( UpdateRefMode eUpdateRefMode,
{
bool bInsertTab = ( eUpdateRefMode == URM_INSDEL && nDz >= 1 );
bool bDeleteTab = ( eUpdateRefMode == URM_INSDEL && nDz <= -1 );
+ if(pCondFormat)
+ aSrcPos = pCondFormat->GetRange().Combine().aStart;
+ ScAddress aOldSrcPos = aSrcPos;
+ bool bChangedPos = false;
+ if(eUpdateRefMode == URM_INSDEL && rRange.In(aSrcPos))
+ {
+ aSrcPos.Move(nDx, nDy, nDz);
+ bChangedPos = aSrcPos != aOldSrcPos;
+ }
if (pFormula1)
{
bool bChanged1 = false;
if ( bInsertTab )
- lcl_CondUpdateInsertTab( *pFormula1, rRange.aStart.Tab(), aSrcPos.Tab(), bChanged1, nDz );
+ lcl_CondUpdateInsertTab( *pFormula1, rRange.aStart.Tab(), aOldSrcPos.Tab(), bChanged1, nDz );
else
{
ScCompiler aComp( mpDoc, aSrcPos, *pFormula1 );
@@ -541,19 +550,19 @@ void ScConditionEntry::UpdateReference( UpdateRefMode eUpdateRefMode,
else
{
bool bSizeChanged;
- aComp.UpdateReference( eUpdateRefMode, aSrcPos, rRange, nDx,
+ aComp.UpdateReference( eUpdateRefMode, aOldSrcPos, rRange, nDx,
nDy, nDz, bChanged1, bSizeChanged );
}
}
- if (bChanged1)
+ if (bChanged1 || bChangedPos)
DELETEZ(pFCell1); // is created again in IsValid
}
if (pFormula2)
{
bool bChanged2 = false;
if ( bInsertTab )
- lcl_CondUpdateInsertTab( *pFormula2, rRange.aStart.Tab(), aSrcPos.Tab(), bChanged2, nDz );
+ lcl_CondUpdateInsertTab( *pFormula2, rRange.aStart.Tab(), aOldSrcPos.Tab(), bChanged2, nDz );
else
{
ScCompiler aComp( mpDoc, aSrcPos, *pFormula2);
@@ -563,12 +572,12 @@ void ScConditionEntry::UpdateReference( UpdateRefMode eUpdateRefMode,
else
{
bool bSizeChanged;
- aComp.UpdateReference( eUpdateRefMode, aSrcPos, rRange, nDx,
+ aComp.UpdateReference( eUpdateRefMode, aOldSrcPos, rRange, nDx,
nDy, nDz, bChanged2, bSizeChanged );
}
}
- if (bChanged2)
+ if (bChanged2 || bChangedPos)
DELETEZ(pFCell2); // is created again in IsValid
}
}