[Libreoffice-commits] core.git: oox/source sd/qa
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Jan 14 16:43:21 UTC 2019
oox/source/drawingml/diagram/diagramlayoutatoms.cxx | 10 ++++++++++
sd/qa/unit/data/pptx/smartart-org-chart.pptx |binary
sd/qa/unit/import-tests-smartart.cxx | 15 +++++++++++++++
3 files changed, 25 insertions(+)
New commits:
commit 8638cc1b737195df16a160b148d2cd2c68131174
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Jan 14 15:10:19 2019 +0100
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Mon Jan 14 17:43:00 2019 +0100
oox smartart, org chart: fix height of manager nodes without employees
Employees and/or assistants reduce the height of managers -- this effect
is wanted even if there are no employees/assistants.
Change-Id: I7bfcbf6819ee225aa2fbf21d4e064322912f8d5f
Reviewed-on: https://gerrit.libreoffice.org/66304
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 e768bebf362d..0e091da68b0e 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -552,6 +552,13 @@ void AlgAtom::layoutShape( const ShapePtr& rShape,
sal_Int32 nCount = rShape->getChildren().size();
+ // A manager node's height should be indepdenent from if it has
+ // assistants and employees, compensate for that.
+ bool bTop = mnType == XML_hierRoot && rShape->getInternalName() == "hierRoot1";
+ double fHeightScale = 1.0;
+ if (mnType == XML_hierRoot && nCount < 3 && bTop)
+ fHeightScale = fHeightScale * nCount / 3;
+
if (mnType == XML_hierRoot && nCount == 3)
{
// Order assistant nodes above employee nodes.
@@ -563,7 +570,10 @@ void AlgAtom::layoutShape( const ShapePtr& rShape,
awt::Size aChildSize = rShape->getSize();
if (nDir == XML_fromT)
+ {
aChildSize.Height /= nCount;
+ aChildSize.Height *= fHeightScale;
+ }
else
aChildSize.Width /= nCount;
diff --git a/sd/qa/unit/data/pptx/smartart-org-chart.pptx b/sd/qa/unit/data/pptx/smartart-org-chart.pptx
index df6e0521fdca..08c9a4fc916d 100644
Binary files a/sd/qa/unit/data/pptx/smartart-org-chart.pptx and b/sd/qa/unit/data/pptx/smartart-org-chart.pptx differ
diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx
index 5895289ad0ce..66fdfbc254cd 100644
--- a/sd/qa/unit/import-tests-smartart.cxx
+++ b/sd/qa/unit/import-tests-smartart.cxx
@@ -718,6 +718,7 @@ void SdImportTestSmartArt::testOrgChart()
CPPUNIT_ASSERT(xManagerShape.is());
awt::Point aManagerPos = xManagerShape->getPosition();
+ awt::Size aManagerSize = xManagerShape->getSize();
// Make sure that the manager has 2 employees.
// Without the accompanying fix in place, this test would have failed with
@@ -776,6 +777,20 @@ void SdImportTestSmartArt::testOrgChart()
// assistant shape was below the employee shape.
CPPUNIT_ASSERT_GREATER(aAssistantPos.Y, aEmployeePos.Y);
+ // Make sure the height of xManager and xManager2 is the same.
+ uno::Reference<text::XText> xManager2(
+ getChildShape(getChildShape(getChildShape(xGroup, 1), 0), 0), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xManager2.is());
+ CPPUNIT_ASSERT_EQUAL(OUString("Manager2"), xManager2->getString());
+
+ uno::Reference<drawing::XShape> xManager2Shape(xManager2, uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xManager2Shape.is());
+
+ awt::Size aManager2Size = xManager2Shape->getSize();
+ // Without the accompanying fix in place, this test would have failed:
+ // xManager2's height was 3 times larger than xManager's height.
+ CPPUNIT_ASSERT_EQUAL(aManagerSize.Height, aManager2Size.Height);
+
xDocShRef->DoClose();
}
More information about the Libreoffice-commits
mailing list