[Libreoffice-commits] core.git: 2 commits - sc/source
Eike Rathke
erack at redhat.com
Thu Jun 11 09:51:58 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 6d7dcb81a25bb8896adad352a9e7151a41e18245
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
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 6352dce..4af29d6 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -887,8 +887,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 47f002cbbf9593ab0097e178732e51b365b42732
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
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 457f1bd..f814352 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