diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2020-05-26 16:16:27 +0200 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2020-05-29 17:20:14 +0200 |
commit | 80493ba382647b51e56fc3a5aa3445b0bd17fc0c (patch) | |
tree | a0c974c8b71ddc1bb825e8d2bcf77482b7968eb8 /sd | |
parent | 50d004fc8fe2c44516c52d22b40a221e8e3b587d (diff) |
oox smartart import: fix aspect ratio of shape with composite algo
The layout node has alg=composite, then a parTx and a desTx child layout
nodes. No matter what order is used (parent first, child first), the
result will be wrong, as the constraints refer to each other. I did not
spot any description in ISO 29500-1 that would describe what is the
expected behavior.
Researching this, found "One other consideration when specifying
composite constraints is that the constraints must be specified in the
same order as the nested layout nodes." at
<http://web.archive.org/web/20111015151600/http://msdn.microsoft.com/en-us/magazine/cc163470.aspx>,
which suggests to handle constraints for each shape in a parent -> child
order, but keep a shared state when iterating over the children which
gives us:
- parent node, all direct constraints
- for each child node:
- child's constraints from parent
- child's own constraints
This way the desTx top value can depend on the parTx's height, and it's
supported to define parTx's height only in the parTx layout node, not in
the composite parent.
And after all, it matches what PowerPoint does, so the column headings
in the bugdoc have a 4:10 height:width aspect ratio.
(cherry picked from commit 414586649582e182b2603702f4f586f4beeed8a9)
Change-Id: Ideb76c1ddd1ffff8d2a217cddf81106d1bb97eb9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95016
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/data/pptx/fill-color-list.pptx | bin | 41044 -> 42946 bytes | |||
-rw-r--r-- | sd/qa/unit/import-tests-smartart.cxx | 10 |
2 files changed, 10 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/fill-color-list.pptx b/sd/qa/unit/data/pptx/fill-color-list.pptx Binary files differindex 341233ad5f78..c88434952631 100644 --- a/sd/qa/unit/data/pptx/fill-color-list.pptx +++ b/sd/qa/unit/data/pptx/fill-color-list.pptx diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx index 273056c868d7..327645fddc3f 100644 --- a/sd/qa/unit/import-tests-smartart.cxx +++ b/sd/qa/unit/import-tests-smartart.cxx @@ -1470,6 +1470,16 @@ void SdImportTestSmartArt::testFillColorList() // - Actual : 16225862 (0xf79646) // i.e. the background of the "A" shape was orange-ish, rather than red-ish. CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0xC0504D), nFillColor); + + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 2239 + // - Actual : 5199 + // i.e. the "A" shape's height/width aspect ratio was not 0.4 but rather close to 1.0, even if + // ppt/diagrams/layout1.xml's <dgm:constr type="h" refType="w" op="lte" fact="0.4"/> requested + // 0.4. + awt::Size aActualSize = xShape->getSize(); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2239), aActualSize.Height); + xDocShRef->DoClose(); } |