diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-03-25 12:38:48 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-03-25 12:41:57 -0400 |
commit | 8582db191b5c88c72e5b16c89a024f897a95a6f1 (patch) | |
tree | be2f6969c3f683b046ea5f4f2630d9e4a48425b5 | |
parent | a603ddf9adef4373940936f785e918a8c0ea560b (diff) |
fdo#76402: Handle range reference expansion in named ranges.
Change-Id: I8314260fc7588f0a0230ab63cc600fa887a8479d
-rw-r--r-- | sc/source/core/tool/token.cxx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index 75f8bc0d9587..794782796f56 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -2939,6 +2939,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; @@ -2994,6 +3007,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: |