[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.2' - 2 commits - sc/source

Kohei Yoshida kohei.yoshida at collabora.com
Sun Oct 19 06:08:41 PDT 2014


 sc/source/core/data/table2.cxx |    7 +-----
 sc/source/core/tool/token.cxx  |   47 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 5 deletions(-)

New commits:
commit 701ea5c08efd63bbea82a43e49405a911f7419c8
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Sat Oct 18 20:22:53 2014 -0400

    fdo#82047: Correctly adjust references in range names on row deletion.
    
    Change-Id: Iac924b0b6932863f7f9cc088f996e0b07c340d2c
    (cherry picked from commit 281847613bd3ae472523822f4be9c21cc353867e)

diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 73d284a..7208d9d 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -3164,6 +3164,53 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceInName(
                     if (adjustDoubleRefInName(rRef, rCxt, rPos))
                         aRes.mbReferenceModified = true;
                 }
+                else if (rCxt.mnRowDelta < 0)
+                {
+                    // row(s) deleted.
+                    if (rRef.Ref1.IsRowRel() || rRef.Ref2.IsRowRel())
+                        // Don't modify relative references in names.
+                        break;
+
+                    if (aAbs.aStart.Col() < rCxt.maRange.aStart.Col() || rCxt.maRange.aEnd.Col() < aAbs.aEnd.Col())
+                        // column range of the reference is not entirely in the deleted column range.
+                        break;
+
+                    ScRange aDeleted = rCxt.maRange;
+                    aDeleted.aStart.IncRow(rCxt.mnRowDelta);
+                    aDeleted.aEnd.SetRow(aDeleted.aStart.Row()-rCxt.mnRowDelta-1);
+
+                    if (aAbs.aEnd.Row() < aDeleted.aStart.Row() || aDeleted.aEnd.Row() < aAbs.aStart.Row())
+                        // reference range doesn't intersect with the deleted range.
+                        break;
+
+                    if (aDeleted.aStart.Row() <= aAbs.aStart.Row() && aAbs.aEnd.Row() <= aDeleted.aEnd.Row())
+                    {
+                        // This reference is entirely deleted.
+                        rRef.Ref1.SetRowDeleted(true);
+                        rRef.Ref2.SetRowDeleted(true);
+                        aRes.mbReferenceModified = true;
+                        break;
+                    }
+
+                    if (aAbs.aStart.Row() < aDeleted.aStart.Row())
+                    {
+                        if (aDeleted.aEnd.Row() < aAbs.aEnd.Row())
+                            // Deleted in the middle.  Make the reference shorter.
+                            rRef.Ref2.IncRow(rCxt.mnRowDelta);
+                        else
+                            // Deleted at tail end.  Cut off the lower part.
+                            rRef.Ref2.SetAbsRow(aDeleted.aStart.Row()-1);
+                    }
+                    else
+                    {
+                        // Deleted at the top.  Cut the top off and shift up.
+                        rRef.Ref1.SetAbsRow(aDeleted.aEnd.Row()+1);
+                        rRef.Ref1.IncRow(rCxt.mnRowDelta);
+                        rRef.Ref2.IncRow(rCxt.mnRowDelta);
+                    }
+
+                    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())
commit 5ff49c8461d91fd04a321051f27335b4fe8c0970
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Fri Oct 17 21:48:31 2014 -0400

    fdo#80284: Avoid broadcasting during cell delete & shift.
    
    Broadcasting it here and marking formula cells dirty prevents them
    from being entered into the formula tree at the end.  They get marked
    "postponed dirty" during reference update, and are supposed to be
    set dirty at the end.
    
    Change-Id: I65977300ee4ee26b6166d170acd2145abcbbf288
    (cherry picked from commit 7fef943114b9184e69c8c714bf158116b8d9caf7)

diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 56a2768..101eb18 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -389,11 +389,8 @@ void ScTable::DeleteCol(
         }
     }
 
-    {   // scope for bulk broadcast
-        ScBulkBroadcast aBulkBroadcast( pDocument->GetBASM());
-        for (SCSIZE i = 0; i < nSize; i++)
-            aCol[nStartCol + i].DeleteArea(nStartRow, nEndRow, IDF_ALL);
-    }
+    for (SCSIZE i = 0; i < nSize; i++)
+        aCol[nStartCol + i].DeleteArea(nStartRow, nEndRow, IDF_ALL, false);
 
     if ((nStartRow == 0) && (nEndRow == MAXROW))
     {


More information about the Libreoffice-commits mailing list