summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2015-07-07 11:56:05 +0200
committerEike Rathke <erack@redhat.com>2015-07-07 12:40:34 +0200
commit369ee0b1faf79f1bd23c75ee04dd0dcc5bf283af (patch)
tree4f942c8d9e285a57e46240bfd697b61b277119fe
parentad3d2b6c2e88d191d76f90eb5be927f7ca76c670 (diff)
introduce ScTokenArray::AdjustReferenceOnCopy(), tdf#92468
Change-Id: I0a7ac0d9d10e96223cd5f095a771aa6f9d271417
-rw-r--r--sc/inc/tokenarray.hxx6
-rw-r--r--sc/source/core/tool/token.cxx28
2 files changed, 34 insertions, 0 deletions
diff --git a/sc/inc/tokenarray.hxx b/sc/inc/tokenarray.hxx
index 0d3fa0245f50..8ed86971beec 100644
--- a/sc/inc/tokenarray.hxx
+++ b/sc/inc/tokenarray.hxx
@@ -217,6 +217,12 @@ public:
void AdjustReferenceOnMovedOriginIfOtherSheet( const ScAddress& rOldPos, const ScAddress& rNewPos );
/**
+ * Adjust internal range references on base position change to justify /
+ * put in order the relative references.
+ */
+ void AdjustReferenceOnCopy( const ScAddress& rNewPos );
+
+ /**
* Clear sheet deleted flag from internal reference tokens if the sheet
* index falls within specified range. Note that when a reference is on a
* sheet that's been deleted, its referenced sheet index retains the
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 4ada5014a17b..95e951e3236d 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -3951,6 +3951,34 @@ void ScTokenArray::AdjustReferenceOnMovedOriginIfOtherSheet( const ScAddress& rO
}
}
+void ScTokenArray::AdjustReferenceOnCopy( const ScAddress& rNewPos )
+{
+ TokenPointers aPtrs( pCode, nLen, pRPN, nRPN, false);
+ for (size_t j=0; j<2; ++j)
+ {
+ FormulaToken** pp = aPtrs.maPointerRange[j].mpStart;
+ FormulaToken** pEnd = aPtrs.maPointerRange[j].mpStop;
+ for (; pp != pEnd; ++pp)
+ {
+ FormulaToken* p = aPtrs.getHandledToken(j,pp);
+ if (!p)
+ continue;
+
+ switch (p->GetType())
+ {
+ case svDoubleRef:
+ {
+ ScComplexRefData& rRef = *p->GetDoubleRef();
+ rRef.PutInOrder( rNewPos);
+ }
+ break;
+ default:
+ ;
+ }
+ }
+ }
+}
+
namespace {
void clearTabDeletedFlag( ScSingleRefData& rRef, const ScAddress& rPos, SCTAB nStartTab, SCTAB nEndTab )