[Libreoffice-commits] core.git: sc/source

Samuel Mehrbrodt Samuel.Mehrbrodt at cib.de
Thu Jan 25 07:41:23 UTC 2018


 sc/source/core/data/column4.cxx |   32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)

New commits:
commit cf847a7287148304afe98f0efe68cdf9617d4e44
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date:   Tue Jan 23 10:11:16 2018 +0100

    Updating images should not depend on unrelated condition
    
    Instead update them unconditionally as it is done with comments.
    
    The data range has been set beforehand (considering the option
    to include boundary columns with images only) so at this point
    the swapping should happen unconditionally.
    
    Follow-up for 3a2a430ae8e2c1647c18d8904477949f6e2e7941
    
    Change-Id: I1d75dd6e22db5cc28aa45f7b86dab013f3595199
    Reviewed-on: https://gerrit.libreoffice.org/48383
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>

diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index a99a78564c7f..14a5e89c2b54 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -1087,6 +1087,23 @@ void ScColumn::Swap( ScColumn& rOther, SCROW nRow1, SCROW nRow2, bool bPattern )
     maCellNotes.swap(nRow1, nRow2, rOther.maCellNotes, nRow1);
     maBroadcasters.swap(nRow1, nRow2, rOther.maBroadcasters, nRow1);
 
+    // Update draw object anchors
+    ScDrawLayer* pDrawLayer = GetDoc()->GetDrawLayer();
+    if (pDrawLayer)
+    {
+        for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow)
+        {
+            ScAddress aThisCellPos(GetCol(), nRow, GetTab());
+            ScAddress aOtherCellPos(rOther.GetCol(), nRow, GetTab());
+            std::vector<SdrObject*> pThisColObjects = pDrawLayer->GetObjectsAnchoredToCell(aThisCellPos);
+            std::vector<SdrObject*> pOtherColObjects = pDrawLayer->GetObjectsAnchoredToCell(aOtherCellPos);
+            if (!pThisColObjects.empty())
+                UpdateDrawObjectsForRow(pThisColObjects, rOther.GetCol(), nRow);
+            if (!pOtherColObjects.empty())
+                rOther.UpdateDrawObjectsForRow(pOtherColObjects, GetCol(), nRow);
+        }
+    }
+
     if (bPattern)
     {
         for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow)
@@ -1098,21 +1115,6 @@ void ScColumn::Swap( ScColumn& rOther, SCROW nRow1, SCROW nRow2, bool bPattern )
                 SetPattern(nRow, *pPat2);
                 rOther.SetPattern(nRow, *pPat1);
             }
-
-            // Update draw object anchors
-            ScDrawLayer* pDrawLayer = GetDoc()->GetDrawLayer();
-            if (pDrawLayer)
-            {
-                ScAddress aThisCellPos(GetCol(), nRow, GetTab());
-                ScAddress aOtherCellPos(rOther.GetCol(), nRow, GetTab());
-                std::vector<SdrObject*> pThisColObjects = pDrawLayer->GetObjectsAnchoredToCell(aThisCellPos);
-                std::vector<SdrObject*> pOtherColObjects = pDrawLayer->GetObjectsAnchoredToCell(aOtherCellPos);
-                if (!pThisColObjects.empty())
-                    UpdateDrawObjectsForRow(pThisColObjects, rOther.GetCol(), nRow);
-                if (!pOtherColObjects.empty())
-                    rOther.UpdateDrawObjectsForRow(pOtherColObjects, GetCol(), nRow);
-
-            }
         }
     }
 


More information about the Libreoffice-commits mailing list