summaryrefslogtreecommitdiff
path: root/sc/source/core/tool
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-03-25 12:38:48 -0400
committerEike Rathke <erack@redhat.com>2014-03-26 22:22:21 +0000
commit96ef8a7a03c7b098c71f7ce8540fb61d13eaa298 (patch)
treea2083037535005877db22f1075a7bd4ecad7a2fe /sc/source/core/tool
parente9451c72d4e221c993e1af30652c62a538d033d8 (diff)
fdo#76402: Handle range reference expansion in named ranges.
Change-Id: I8314260fc7588f0a0230ab63cc600fa887a8479d (cherry picked from commit 8582db191b5c88c72e5b16c89a024f897a95a6f1) Reviewed-on: https://gerrit.libreoffice.org/8751 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc/source/core/tool')
-rw-r--r--sc/source/core/tool/token.cxx26
1 files changed, 26 insertions, 0 deletions
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 5618ed38dd89..ce6a6443a855 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -2949,6 +2949,19 @@ bool adjustDoubleRefInName(
ScComplexRefData& rRef, const sc::RefUpdateContext& rCxt, const ScAddress& rPos )
{
bool bRefChanged = false;
+ if (rCxt.mnRowDelta > 0 && rCxt.mrDoc.IsExpandRefs() && !rRef.Ref1.IsRowRel() && !rRef.Ref2.IsRowRel())
+ {
+ // Check and see if we should expand the range at the top.
+ ScRange aSelectedRange = getSelectedRange(rCxt);
+ ScRange aAbs = rRef.toAbs(rPos);
+ if (aSelectedRange.Intersects(aAbs))
+ {
+ // Selection intersects the referenced range. Only expand the
+ // bottom position.
+ rRef.Ref2.IncRow(rCxt.mnRowDelta);
+ return true;
+ }
+ }
if (adjustSingleRefInName(rRef.Ref1, rCxt, rPos))
bRefChanged = true;
@@ -3007,6 +3020,19 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceInName(
aRes.mbReferenceModified = true;
}
}
+ else if (rCxt.mnRowDelta > 0 && rCxt.mrDoc.IsExpandRefs())
+ {
+ // Check if we could expand range reference by the bottom
+ // edge. For named expressions, we only expand absolute
+ // references.
+ if (!rRef.Ref1.IsRowRel() && !rRef.Ref2.IsRowRel() && aAbs.aEnd.Row()+1 == rCxt.maRange.aStart.Row())
+ {
+ // Expand by the bottom edge.
+ rRef.Ref2.IncRow(rCxt.mnRowDelta);
+ aRes.mbReferenceModified = true;
+ }
+
+ }
}
break;
default: