summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-09-30 12:41:15 +0200
committerMiklos Vajna <vmiklos@collabora.com>2020-09-30 17:26:00 +0200
commit39792891f4e4c1331f7e532e1645166412016e30 (patch)
treeac081785c3b284927a7c76ced81002ede6b77fcb /sd
parent2f00ae052c7f76329f341c8e5d56da3c940885a6 (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/+/103703 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.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 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<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);
}