[Libreoffice-commits] core.git: oox/source sd/qa
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Feb 18 14:50:27 UTC 2019
oox/source/drawingml/diagram/diagramlayoutatoms.cxx | 4 ++--
sd/qa/unit/import-tests-smartart.cxx | 4 ++++
2 files changed, 6 insertions(+), 2 deletions(-)
New commits:
commit 5b2e38e0cfc7006d6982f741cf158a8a98dc8630
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Feb 18 14:24:16 2019 +0100
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Mon Feb 18 15:50:04 2019 +0100
oox smartart, cycle matrix: fix too large height in composite algo
The user-level problem was that the height of the entire smartart was
too large. The reason for this was that:
- composite algorithm gets the constraint height should be 77% of width,
this means 6096000 -> 4693920 EMUs
- at the same time the parent container is already smaller, 4064000 EMUs
- a few lines later we already limit the max height with std::min(), but
in the meantime an incorrect y position is calculated, exactly due to
the lack of early limited height
Solve the problem by making sure composite algorithm never works with a
height (even when using it to calculate vertical center) that exceeds
the height of the parent.
Change-Id: Iba29ed8b6e376bf379c40f1cddfce3ae45beff0a
Reviewed-on: https://gerrit.libreoffice.org/67970
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
Tested-by: Jenkins
diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index b3063762cd7a..dc526803f8fe 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -533,9 +533,9 @@ void AlgAtom::layoutShape( const ShapePtr& rShape,
LayoutProperty::const_iterator it, it2;
if ( (it = rProp.find(XML_w)) != rProp.end() )
- aSize.Width = it->second;
+ aSize.Width = std::min(it->second, rShape->getSize().Width);
if ( (it = rProp.find(XML_h)) != rProp.end() )
- aSize.Height = it->second;
+ aSize.Height = std::min(it->second, rShape->getSize().Height);
if ( (it = rProp.find(XML_l)) != rProp.end() )
aPos.X = it->second;
diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx
index 221f7390c5a3..9acf64ebe306 100644
--- a/sd/qa/unit/import-tests-smartart.cxx
+++ b/sd/qa/unit/import-tests-smartart.cxx
@@ -821,6 +821,10 @@ void SdImportTestSmartArt::testCycleMatrix()
uno::Reference<drawing::XShape> xGroup(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY);
CPPUNIT_ASSERT(xGroup.is());
+ // Without the accompanying fix in place, this test would have failed: the height was 12162,
+ // which is not the mm100 equivalent of the 4064000 EMU in the input file.
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(11287), xGroup->getSize().Height);
+
uno::Reference<text::XText> xA1(getChildShape(getChildShape(xGroup, 1), 0), uno::UNO_QUERY);
CPPUNIT_ASSERT(xA1.is());
CPPUNIT_ASSERT_EQUAL(OUString("A1"), xA1->getString());
More information about the Libreoffice-commits
mailing list