[Libreoffice-commits] core.git: Branch 'private/swe/libreoffice-5-2+backports' - sc/source

Samuel Mehrbrodt Samuel.Mehrbrodt at cib.de
Tue Mar 13 11:35:03 UTC 2018


 sc/source/core/data/drwlayer.cxx |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

New commits:
commit c6666ab271faa26a7bca3c1ae3f2b59355be1523
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date:   Tue Mar 13 12:26:44 2018 +0100

    tdf#114552 Also reduce the anchor offset when shrinking images
    
    Else the image will get larger than its current cell.
    
    Follow-up for 4f29ce6a67b81e7f28e1c86d60ff15ec1d180661
    
    Change-Id: If2fb1087961a1b20f5a408ca3061956e96330e91

diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index cd9c8c70400a..df389893bd18 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -701,13 +701,13 @@ void ScDrawLayer::ResizeLastRectFromAnchor( SdrObject* pObj, ScDrawObjData& rDat
                 {
                     // To actually grow the image, we need to take the max
                     fWidthFactor = fHeightFactor = std::max(fWidthFactor, fHeightFactor);
-                    // But we don't want the image to become larger than the current cell
-                    fWidthFactor = fHeightFactor = std::min(fWidthFactor, fMaxFactor);
                 }
                 else // cell is growing smaller, take the min
                 {
                     fWidthFactor = fHeightFactor = std::min(fWidthFactor, fHeightFactor);
                 }
+                // We don't want the image to become larger than the current cell
+                fWidthFactor = fHeightFactor = std::min(fWidthFactor, fMaxFactor);
             }
 
             // When shrinking the cell, and the image still fits in the smaller cell, don't resize it at all
@@ -718,6 +718,13 @@ void ScDrawLayer::ResizeLastRectFromAnchor( SdrObject* pObj, ScDrawObjData& rDat
                     rtl::math::round(static_cast<double>(aRect.GetWidth()) * fWidthFactor));
                 aRect.setHeight(
                     rtl::math::round(static_cast<double>(aRect.GetHeight()) * fHeightFactor));
+
+                // Reduce offset also when shrinking
+                if (!bIsGrowingLarger)
+                {
+                    aRect.setX(rtl::math::round(static_cast<double>(aRect.getX()) * fWidthFactor));
+                    aRect.setY(rtl::math::round(static_cast<double>(aRect.getY()) * fHeightFactor));
+                }
             }
         }
     }


More information about the Libreoffice-commits mailing list