[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/qa sc/source
Kohei Yoshida
kohei.yoshida at gmail.com
Wed Jul 31 18:08:17 PDT 2013
sc/qa/extras/macros-test.cxx | 2 --
sc/source/core/tool/token.cxx | 38 ++++++++++++++++++++++++++++++++++----
2 files changed, 34 insertions(+), 6 deletions(-)
New commits:
commit 2f8f96f516a09b649e8c6ebef8ad0189737f5538
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Wed Jul 31 21:10:50 2013 -0400
Fix reference update on range references in named expressions.
This fixes the macro test failure.
Change-Id: I8ddaaaa49d1faf36cc37212895c21023a4ab6135
diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx
index 9bc3a0f..023f627 100644
--- a/sc/qa/extras/macros-test.cxx
+++ b/sc/qa/extras/macros-test.cxx
@@ -198,12 +198,10 @@ void ScMacrosTest::testVba()
OUString("Shapes."),
OUString("vnd.sun.Star.script:VBAProject.testMacros.test?language=Basic&location=document")
},
-#if 0 // TODO : fix this
{
OUString("Ranges."),
OUString("vnd.sun.Star.script:VBAProject.testMacros.test?language=Basic&location=document")
},
-#endif
{
OUString("CheckOptionToggleValue."),
OUString("vnd.sun.Star.script:VBAProject.testMacros.test?language=Basic&location=document")
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 83094d2..4703cde 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -2598,6 +2598,20 @@ bool adjustSingleRefInName(
return bChanged;
}
+bool adjustDoubleRefInName(
+ ScComplexRefData& rRef, const sc::RefUpdateContext& rCxt, const ScAddress& rPos )
+{
+ bool bRefChanged = false;
+
+ if (adjustSingleRefInName(rRef.Ref1, rCxt, rPos))
+ bRefChanged = true;
+
+ if (adjustSingleRefInName(rRef.Ref2, rCxt, rPos))
+ bRefChanged = true;
+
+ return bRefChanged;
+}
+
}
sc::RefUpdateResult ScTokenArray::AdjustReferenceInName(
@@ -2623,10 +2637,26 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceInName(
{
ScToken* pToken = static_cast<ScToken*>(*p);
ScComplexRefData& rRef = pToken->GetDoubleRef();
- if (adjustSingleRefInName(rRef.Ref1, rCxt, rPos))
- aRes.mbReferenceModified = true;
- if (adjustSingleRefInName(rRef.Ref2, rCxt, rPos))
- aRes.mbReferenceModified = true;
+ ScRange aAbs = rRef.toAbs(rPos);
+ if (rCxt.maRange.In(aAbs))
+ {
+ // This range is entirely within the shifted region.
+ if (adjustDoubleRefInName(rRef, rCxt, rPos))
+ aRes.mbReferenceModified = true;
+ }
+ else if (rCxt.maRange.Intersects(aAbs))
+ {
+ if (rCxt.mnColDelta && rCxt.maRange.aStart.Row() <= aAbs.aStart.Row() && aAbs.aEnd.Row() <= rCxt.maRange.aEnd.Row())
+ {
+ if (adjustDoubleRefInName(rRef, rCxt, rPos))
+ aRes.mbReferenceModified = true;
+ }
+ if (rCxt.mnRowDelta && rCxt.maRange.aStart.Col() <= aAbs.aStart.Col() && aAbs.aEnd.Col() <= rCxt.maRange.aEnd.Col())
+ {
+ if (adjustDoubleRefInName(rRef, rCxt, rPos))
+ aRes.mbReferenceModified = true;
+ }
+ }
}
break;
default:
More information about the Libreoffice-commits
mailing list