[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sc/source

Kohei Yoshida kohei.yoshida at collabora.com
Wed Mar 26 15:22:51 PDT 2014


 sc/source/core/tool/token.cxx |   26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

New commits:
commit 96ef8a7a03c7b098c71f7ce8540fb61d13eaa298
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Tue Mar 25 12:38:48 2014 -0400

    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 at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 5618ed38..ce6a644 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:


More information about the Libreoffice-commits mailing list