diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2018-03-13 12:26:44 +0100 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2018-03-13 14:16:14 +0100 |
commit | 6ae7b9d40ca24c9c9fbad6346a4dd9112894dc49 (patch) | |
tree | 6c342494c9d4ad92fe1bfa7cd974769a2da529a0 | |
parent | 6ab9f0cfcd28124caf8e02219a39c753bce7d1ea (diff) |
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
Reviewed-on: https://gerrit.libreoffice.org/51209
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
-rw-r--r-- | sc/source/core/data/drwlayer.cxx | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index 3cadfdb55979..2e08f6b6e338 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -689,13 +689,13 @@ void ScDrawLayer::ResizeLastRectFromAnchor(const SdrObject* pObj, ScDrawObjData& { // 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 @@ -706,6 +706,13 @@ void ScDrawLayer::ResizeLastRectFromAnchor(const SdrObject* pObj, ScDrawObjData& 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)); + } } } } |