From 39792891f4e4c1331f7e532e1645166412016e30 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Wed, 30 Sep 2020 12:41:15 +0200 Subject: 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/+/103703 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna --- sd/qa/unit/import-tests-smartart.cxx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'sd') diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx index 20c679a0bc33..6af86e6a5343 100644 --- a/sd/qa/unit/import-tests-smartart.cxx +++ b/sd/qa/unit/import-tests-smartart.cxx @@ -1581,14 +1581,12 @@ void SdImportTestSmartArt::testSnakeRows() m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/smartart-snake-rows.pptx"), PPTX); uno::Reference 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 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 xChild(xDiagram->getByIndex(nChild), uno::UNO_QUERY); aYPositions.insert(xChild->getPosition().Y); } -- cgit