[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/inc sc/source
Kohei Yoshida
kohei.yoshida at gmail.com
Mon Jul 22 16:55:18 PDT 2013
sc/inc/refupdatecontext.hxx | 2 +-
sc/source/core/data/formulacell.cxx | 5 +++--
sc/source/core/data/refupdatecontext.cxx | 4 ++--
sc/source/core/tool/token.cxx | 12 +++++++++---
4 files changed, 15 insertions(+), 8 deletions(-)
New commits:
commit 0c5aed287731f2546fbc73e00786dff9c87a3fb1
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Mon Jul 22 19:55:09 2013 -0400
Flag cell state modified when a reference points to a different position.
This fixes testStreamValid() test failure.
Change-Id: Ife406957a723930efb419ba8c566485f4b089d97
diff --git a/sc/inc/refupdatecontext.hxx b/sc/inc/refupdatecontext.hxx
index 8067c3b..af47851 100644
--- a/sc/inc/refupdatecontext.hxx
+++ b/sc/inc/refupdatecontext.hxx
@@ -51,7 +51,7 @@ struct RefUpdateContext
struct RefUpdateResult
{
bool mbValueChanged;
- bool mbRangeSizeModified;
+ bool mbReferenceModified;
RefUpdateResult();
RefUpdateResult(const RefUpdateResult& r);
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index e57d5dd..a99041d 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -2274,11 +2274,12 @@ bool ScFormulaCell::UpdateReferenceOnShift(
{
// Update cell or range references.
sc::RefUpdateResult aRes = pCode->AdjustReferenceOnShift(rCxt, aOldPos);
- bRangeModified = aRes.mbRangeSizeModified;
+ bRangeModified = aRes.mbReferenceModified;
bValChanged = aRes.mbValueChanged;
}
- bCellStateChanged |= bValChanged;
+ if (bValChanged || bRangeModified)
+ bCellStateChanged = true;
if (bOnRefMove)
// Cell may reference itself, e.g. ocColumn, ocRow without parameter
diff --git a/sc/source/core/data/refupdatecontext.cxx b/sc/source/core/data/refupdatecontext.cxx
index f1ad64c..67e1242 100644
--- a/sc/source/core/data/refupdatecontext.cxx
+++ b/sc/source/core/data/refupdatecontext.cxx
@@ -24,9 +24,9 @@ bool RefUpdateContext::isDeleted() const
return (meMode == URM_INSDEL) && (mnColDelta < 0 || mnRowDelta < 0 || mnTabDelta < 0);
}
-RefUpdateResult::RefUpdateResult() : mbValueChanged(false), mbRangeSizeModified(false) {}
+RefUpdateResult::RefUpdateResult() : mbValueChanged(false), mbReferenceModified(false) {}
RefUpdateResult::RefUpdateResult(const RefUpdateResult& r) :
- mbValueChanged(r.mbValueChanged), mbRangeSizeModified(r.mbRangeSizeModified) {}
+ mbValueChanged(r.mbValueChanged), mbReferenceModified(r.mbReferenceModified) {}
}
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 4c8e595..64beedf 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -2392,7 +2392,10 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceOnShift( const sc::RefUpdateCon
}
if (rCxt.maRange.In(aAbs))
+ {
aAbs.Move(rCxt.mnColDelta, rCxt.mnRowDelta, rCxt.mnTabDelta);
+ aRes.mbReferenceModified = true;
+ }
rRef.SetAddress(aAbs, aNewPos);
}
@@ -2419,7 +2422,7 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceOnShift( const sc::RefUpdateCon
// The reference range has been shrunk.
rRef.SetRange(aAbs, aNewPos);
aRes.mbValueChanged = true;
- aRes.mbRangeSizeModified = true;
+ aRes.mbReferenceModified = true;
break;
}
}
@@ -2432,7 +2435,7 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceOnShift( const sc::RefUpdateCon
// The reference range has been expanded.
rRef.SetRange(aAbs, aNewPos);
aRes.mbValueChanged = true;
- aRes.mbRangeSizeModified = true;
+ aRes.mbReferenceModified = true;
break;
}
@@ -2441,13 +2444,16 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceOnShift( const sc::RefUpdateCon
// The reference range has been expanded on the edge.
rRef.SetRange(aAbs, aNewPos);
aRes.mbValueChanged = true;
- aRes.mbRangeSizeModified = true;
+ aRes.mbReferenceModified = true;
break;
}
}
if (rCxt.maRange.In(aAbs))
+ {
aAbs.Move(rCxt.mnColDelta, rCxt.mnRowDelta, rCxt.mnTabDelta);
+ aRes.mbReferenceModified = true;
+ }
else if (rCxt.maRange.Intersects(aAbs))
{
// Part of the referenced range is being shifted. This
More information about the Libreoffice-commits
mailing list