summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-09-30 12:41:15 +0200
committerCaolán McNamara <caolanm@redhat.com>2020-09-30 21:14:07 +0200
commit90b4308f0a7a38ac2ffdcbbed8d4378daf2f45f1 (patch)
tree93b2d79211bead166112cd6f11e78bf496545c83 /sd
parent6eb7158e2b9049587f79e2225964ada1746bd83c (diff)
oox smartart: snake algo: make sure child shape height stays within parent
1) When applying double outside spacing, introduced with commit 0a29c928afa74123bca05dc089c751603d368467 (oox smartart, picture strip: fix lack of spacing around the picture list, 2019-02-26), make sure that is only applied in the direction of a signle row: i.e. the bugdoc case is left/right outer spacing, but no top/bottom spacing. 2) If a child shape has an aspect ratio request, make sure that it only decreases what would be allocated by default, so the children never leave the parent's rectangle. 3) Fix a mis-match between the first and second row, the unexpected small left padding in the second row was because code assumed that all child shapes have the same width; which is not true, when widths come from constraints. With this in place, we finally do a good rendering of the bugdoc, and child shapes are always within the bounds of the background. (cherry picked from commit 71303c5c23bdb385e9f12c0dbe5d2a0818b836ec) Change-Id: Ia2606dcd945402f7dfe17c6e2f261bfd98667022 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103697 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/import-tests-smartart.cxx8
1 files changed, 3 insertions, 5 deletions
diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx
index 13d3af8f0df2..cd59f646a5e4 100644
--- a/sd/qa/unit/import-tests-smartart.cxx
+++ b/sd/qa/unit/import-tests-smartart.cxx
@@ -1599,14 +1599,12 @@ void SdImportTestSmartArt::testSnakeRows()
m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/smartart-snake-rows.pptx"), PPTX);
uno::Reference<drawing::XShapes> xDiagram(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY);
+ // Collect position of the background and the real child shapes. First row and background has
+ // the same top position, unless some unexpected spacing happens, since this is a
+ // "left-to-right, then top-to-bottom" snake direction.
std::set<sal_Int32> aYPositions;
for (sal_Int32 nChild = 0; nChild < xDiagram->getCount(); ++nChild)
{
- if (nChild == 0)
- {
- // Ignore background shape, we check how many rows actual children use.
- continue;
- }
uno::Reference<drawing::XShape> xChild(xDiagram->getByIndex(nChild), uno::UNO_QUERY);
aYPositions.insert(xChild->getPosition().Y);
}