[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - 2 commits - sc/source
Eike Rathke
erack at redhat.com
Thu Jun 11 10:22:20 PDT 2015
sc/source/core/data/formulacell.cxx | 6 +
sc/source/core/tool/token.cxx | 111 +++++++++++++++++++-----------------
2 files changed, 63 insertions(+), 54 deletions(-)
New commits:
commit 8accb2406fb9e8a32aa790c45a97f3a45ef4d906
Author: Eike Rathke <erack at redhat.com>
Date: Thu Jun 11 18:45:10 2015 +0200
recompile TableRef formulas only after position was updated, tdf#91842
Change-Id: Ibdcfdd6175e6ccb8aded02d59b1b21e92a0fc120
(cherry picked from commit 6d7dcb81a25bb8896adad352a9e7151a41e18245)
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 33499ba..85b0f83 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -881,8 +881,10 @@ ScFormulaCell::ScFormulaCell( const ScFormulaCell& rCell, ScDocument& rDoc, cons
if ( !bCompileLater && bClipMode )
{
// Merging ranges needs the actual positions after UpdateReference.
- // ColRowNames need new lookup after positions are adjusted.
- bCompileLater = pCode->HasOpCode( ocRange) || pCode->HasOpCode( ocColRowName);
+ // ColRowNames and TableRefs need new lookup after positions are
+ // adjusted.
+ bCompileLater = pCode->HasOpCode( ocRange) || pCode->HasOpCode( ocColRowName) ||
+ pCode->HasOpCode( ocTableRef);
}
if ( !bCompileLater )
{
commit 3b751dee4f3447236f0c71b66063697560047de1
Author: Eike Rathke <erack at redhat.com>
Date: Thu Jun 11 18:17:18 2015 +0200
adjust also RPN reference tokens, tdf#91842 and probably others
Similar to beb5879f8fea231a037acf010812df2dffbe302d it is not sufficient
to adjust only the parsed tokens, generated RPN tokens need to be
adjusted as well.
Quite likely also other Adjust...() functions have to handle this, need
to investigate.
Change-Id: I5de4e2238703b3ce134f7d46a87bd7a4fb940cff
(cherry picked from commit 47f002cbbf9593ab0097e178732e51b365b42732)
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 4e20d93..a30112e 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -2895,64 +2895,71 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceOnMove(
bool b3DFlag = rOldPos.Tab() != rNewPos.Tab() || rCxt.mnTabDelta;
- FormulaToken** p = pCode;
- FormulaToken** pEnd = p + static_cast<size_t>(nLen);
- for (; p != pEnd; ++p)
+ TokenPointers aPtrs( pCode, nLen, pRPN, nRPN);
+ for (size_t j=0; j<2; ++j)
{
- switch ((*p)->GetType())
+ FormulaToken** p = aPtrs.maPointerRange[j].mpStart;
+ FormulaToken** pEnd = aPtrs.maPointerRange[j].mpStop;
+ for (; p != pEnd; ++p)
{
- case svSingleRef:
- {
- formula::FormulaToken* pToken = *p;
- ScSingleRefData& rRef = *pToken->GetSingleRef();
- ScAddress aAbs = rRef.toAbs(rOldPos);
- if (aOldRange.In(aAbs))
- {
- aAbs.Move(rCxt.mnColDelta, rCxt.mnRowDelta, rCxt.mnTabDelta);
- aRes.mbReferenceModified = true;
- }
+ if (TokenPointers::skipToken(j,p))
+ continue;
- rRef.SetAddress(aAbs, rNewPos);
- if (b3DFlag)
- rRef.SetFlag3D(b3DFlag);
- }
- break;
- case svDoubleRef:
+ switch ((*p)->GetType())
{
- formula::FormulaToken* pToken = *p;
- ScComplexRefData& rRef = *pToken->GetDoubleRef();
- ScRange aAbs = rRef.toAbs(rOldPos);
- if (aOldRange.In(aAbs))
- {
- aAbs.Move(rCxt.mnColDelta, rCxt.mnRowDelta, rCxt.mnTabDelta);
- aRes.mbReferenceModified = true;
- }
+ case svSingleRef:
+ {
+ formula::FormulaToken* pToken = *p;
+ ScSingleRefData& rRef = *pToken->GetSingleRef();
+ ScAddress aAbs = rRef.toAbs(rOldPos);
+ if (aOldRange.In(aAbs))
+ {
+ aAbs.Move(rCxt.mnColDelta, rCxt.mnRowDelta, rCxt.mnTabDelta);
+ aRes.mbReferenceModified = true;
+ }
- rRef.SetRange(aAbs, rNewPos);
- if (b3DFlag)
- rRef.Ref1.SetFlag3D(true);
- }
- break;
- case svIndex:
- {
- switch ((*p)->GetOpCode())
- {
- case ocName:
- if (isNameModified(rCxt.maUpdatedNames, rOldPos.Tab(), **p))
- aRes.mbNameModified = true;
- break;
- case ocDBArea:
- case ocTableRef:
- if (isDBDataModified(rCxt.mrDoc, **p))
- aRes.mbNameModified = true;
- break;
- default:
- ; // nothing
- }
+ rRef.SetAddress(aAbs, rNewPos);
+ if (b3DFlag)
+ rRef.SetFlag3D(b3DFlag);
+ }
+ break;
+ case svDoubleRef:
+ {
+ formula::FormulaToken* pToken = *p;
+ ScComplexRefData& rRef = *pToken->GetDoubleRef();
+ ScRange aAbs = rRef.toAbs(rOldPos);
+ if (aOldRange.In(aAbs))
+ {
+ aAbs.Move(rCxt.mnColDelta, rCxt.mnRowDelta, rCxt.mnTabDelta);
+ aRes.mbReferenceModified = true;
+ }
+
+ rRef.SetRange(aAbs, rNewPos);
+ if (b3DFlag)
+ rRef.Ref1.SetFlag3D(true);
+ }
+ break;
+ case svIndex:
+ {
+ switch ((*p)->GetOpCode())
+ {
+ case ocName:
+ if (isNameModified(rCxt.maUpdatedNames, rOldPos.Tab(), **p))
+ aRes.mbNameModified = true;
+ break;
+ case ocDBArea:
+ case ocTableRef:
+ if (isDBDataModified(rCxt.mrDoc, **p))
+ aRes.mbNameModified = true;
+ break;
+ default:
+ ; // nothing
+ }
+ }
+ break;
+ default:
+ ;
}
- break;
- default:
- ;
}
}
More information about the Libreoffice-commits
mailing list