[Libreoffice-commits] core.git: oox/source sd/qa

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Mon Aug 3 13:19:51 UTC 2020


 oox/source/drawingml/diagram/diagramlayoutatoms.cxx |   12 ++++++++++++
 sd/qa/unit/import-tests-smartart.cxx                |    6 ++++++
 2 files changed, 18 insertions(+)

New commits:
commit b7481a026348c3417fa13a440312521dccee9ec8
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Aug 3 11:18:49 2020 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Mon Aug 3 15:19:15 2020 +0200

    oox smartart, linear layout: limit height of children to parent size
    
    Constraints are OK to request more, but it seems PowerPoint doesn't
    allow leaving the parent, which simplifies the layout as well.
    
    Change-Id: Id67a8740f1eff506e4beae0c797ad50e0218dfe6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99993
    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 a48ffe3e4682..89fc12546165 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -926,9 +926,21 @@ void AlgAtom::layoutShape(const ShapePtr& rShape, const std::vector<Constraint>&
 
                 LayoutProperty& rProperty = aProperties[rConstraint.msForName];
                 if (rConstraint.mnType == XML_w)
+                {
                     rProperty[XML_w] = rShape->getSize().Width * rConstraint.mfFactor;
+                    if (rProperty[XML_w] > rShape->getSize().Width)
+                    {
+                        rProperty[XML_w] = rShape->getSize().Width;
+                    }
+                }
                 if (rConstraint.mnType == XML_h)
+                {
                     rProperty[XML_h] = rShape->getSize().Height * rConstraint.mfFactor;
+                    if (rProperty[XML_h] > rShape->getSize().Height)
+                    {
+                        rProperty[XML_h] = rShape->getSize().Height;
+                    }
+                }
 
                 // TODO: get values from differently named constraints as well
                 if (rConstraint.msForName == "sp" || rConstraint.msForName == "space" || rConstraint.msForName == "sibTrans")
diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx
index 52909c1d5922..1c9fc9e520b2 100644
--- a/sd/qa/unit/import-tests-smartart.cxx
+++ b/sd/qa/unit/import-tests-smartart.cxx
@@ -1554,6 +1554,12 @@ void SdImportTestSmartArt::testLinearRule()
     sal_Int32 nArrowLeft = xShape->getPosition().X;
     CPPUNIT_ASSERT_EQUAL(nGroupLeft, nArrowLeft);
 
+    // Without the accompanying fix in place, this test would have failed with:
+    // - Expected less or equal than: 10092
+    // - Actual  : 20183
+    // i.e. the arrow height was larger than the canvas given to the smartart on slide 1.
+    CPPUNIT_ASSERT_LESSEQUAL(static_cast<sal_Int32>(10092), xShape->getSize().Height);
+
     xDocShRef->DoClose();
 }
 


More information about the Libreoffice-commits mailing list