summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-01-17 11:22:28 +0100
committerMiklos Vajna <vmiklos@collabora.com>2019-01-17 12:47:30 +0100
commit3a655975e5ea43417885513d0752da3627dd25ed (patch)
tree4ec8633ed4ae012993942288a3125d80c0aa1680 /sd
parentd8886a051abcb5abf52038bf3e5bced9f10f28af (diff)
oox smartart, org chart: improve width of non-manager nodes
The default case is that all managers have assistants/employees, so nodes under a manager can only use the horizontal space under the manager to avoid overlapping. But in case the previous / next sibling of the manager have no child nodes (assistant/employee) then we can use that space to make the child nodes larger. This improves readability of the chart's text a lot and brings the layout closer to what PowerPoint does for the same input. Handle all this in the hierChild algorithm, i.e. the container for a list of assistants or a list of employees, which means "parent" in this context always refers to a manager node. Change-Id: Ib4125ea2a113339ab7bbcd78e43c5d204f442996 Reviewed-on: https://gerrit.libreoffice.org/66504 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/import-tests-smartart.cxx6
1 files changed, 6 insertions, 0 deletions
diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx
index 66fdfbc254cd..846a95ee6738 100644
--- a/sd/qa/unit/import-tests-smartart.cxx
+++ b/sd/qa/unit/import-tests-smartart.cxx
@@ -739,6 +739,7 @@ void SdImportTestSmartArt::testOrgChart()
CPPUNIT_ASSERT(xEmployeeShape.is());
awt::Point aEmployeePos = xEmployeeShape->getPosition();
+ awt::Size aEmployeeSize = xEmployeeShape->getSize();
CPPUNIT_ASSERT_EQUAL(aManagerPos.X, aEmployeePos.X);
@@ -760,6 +761,7 @@ void SdImportTestSmartArt::testOrgChart()
CPPUNIT_ASSERT(xEmployee2Shape.is());
awt::Point aEmployee2Pos = xEmployee2Shape->getPosition();
+ awt::Size aEmployee2Size = xEmployee2Shape->getSize();
CPPUNIT_ASSERT_GREATER(aEmployeePos.X, aEmployee2Pos.X);
// Make sure that assistant is above employees.
@@ -791,6 +793,10 @@ void SdImportTestSmartArt::testOrgChart()
// xManager2's height was 3 times larger than xManager's height.
CPPUNIT_ASSERT_EQUAL(aManagerSize.Height, aManager2Size.Height);
+ // Make sure the employee nodes use the free space on the right, since
+ // manager2 has no assistants / employees.
+ CPPUNIT_ASSERT_GREATER(aManagerSize.Width, aEmployeeSize.Width + aEmployee2Size.Width);
+
xDocShRef->DoClose();
}