[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - oox/source sd/qa
Grzegorz Araminowicz (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jul 11 07:36:12 UTC 2019
oox/source/drawingml/diagram/diagramlayoutatoms.cxx | 57 --------------------
sd/qa/unit/import-tests-smartart.cxx | 5 +
2 files changed, 5 insertions(+), 57 deletions(-)
New commits:
commit 8eafe9d63e6c265f6104fba3c21fc404a118621d
Author: Grzegorz Araminowicz <grzegorz.araminowicz at collabora.com>
AuthorDate: Thu Jul 4 16:16:47 2019 +0200
Commit: Grzegorz Araminowicz <grzegorz.araminowicz at collabora.com>
CommitDate: Thu Jul 11 09:35:25 2019 +0200
SmartArt: remove calculateHierChildOffsetScale() from org chart algorithm
Its purpose was to center subtree if sibling parent has no children.
It was not working correctly for complex charts causing shapes to overlap.
Without it chart is still readable (just sometimes not centered).
Remove it for now until more universal solution is found.
Change-Id: I397bd4264d6ce0fadf5c5fa1352f22e72d5d163a
Reviewed-on: https://gerrit.libreoffice.org/75092
Tested-by: Jenkins
Reviewed-by: Grzegorz Araminowicz <grzegorz.araminowicz at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/75392
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index 503f141a4fa7..eff192868c61 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -155,53 +155,6 @@ bool containsDataNodeType(const oox::drawingml::ShapePtr& pShape, sal_Int32 nTyp
return false;
}
-/**
- * Calculates the offset and scaling for pShape (laid out with the hierChild
- * algorithm) based on the siblings of pParent.
- */
-void calculateHierChildOffsetScale(const oox::drawingml::ShapePtr& pShape,
- const oox::drawingml::LayoutNode* pParent, sal_Int32& rXOffset,
- double& rWidthScale, sal_Int32 nLevel)
-{
- if (!pParent)
- return;
-
- auto pShapes = pParent->getNodeShapes().find(nLevel - 1);
- if (pShapes == pParent->getNodeShapes().end())
- return;
-
- const std::vector<oox::drawingml::ShapePtr>& rParents = pShapes->second;
- for (size_t nParent = 0; nParent < rParents.size(); ++nParent)
- {
- const oox::drawingml::ShapePtr& pParentShape = rParents[nParent];
- const std::vector<oox::drawingml::ShapePtr>& rChildren = pParentShape->getChildren();
- auto it = std::find_if(
- rChildren.begin(), rChildren.end(),
- [pShape](const oox::drawingml::ShapePtr& pChild) { return pChild == pShape; });
- if (it == rChildren.end())
- // This is not our parent.
- continue;
-
- if (nParent > 0)
- {
- if (rParents[nParent - 1]->getChildren().size() == 1)
- {
- // Previous sibling of our parent has no children: can use that
- // space, so shift to the left and scale up.
- rWidthScale += 1.0;
- rXOffset -= pShape->getSize().Width;
- }
- }
- if (nParent < rParents.size() - 1)
- {
- if (rParents[nParent + 1]->getChildren().size() == 1)
- // Next sibling of our parent has no children: can use that
- // space, so scale up.
- rWidthScale += 1.0;
- }
- }
-}
-
/// Sets the position and size of a connector inside a hierChild algorithm.
void setHierChildConnPosSize(const oox::drawingml::ShapePtr& pShape)
{
@@ -493,7 +446,7 @@ void AlgAtom::accept( LayoutAtomVisitor& rVisitor )
void AlgAtom::layoutShape( const ShapePtr& rShape,
const std::vector<Constraint>& rConstraints,
- sal_Int32 nShapeLevel )
+ sal_Int32 /*nShapeLevel*/ )
{
switch(mnType)
{
@@ -739,11 +692,6 @@ void AlgAtom::layoutShape( const ShapePtr& rShape,
std::swap(rChildren[1], rChildren[2]);
}
- sal_Int32 nXOffset = 0;
- double fWidthScale = 1.0;
- if (mnType == XML_hierChild)
- calculateHierChildOffsetScale(rShape, getLayoutNode().getParentLayoutNode(), nXOffset, fWidthScale, nShapeLevel);
-
awt::Size aChildSize = rShape->getSize();
if (nDir == XML_fromT)
{
@@ -752,11 +700,10 @@ void AlgAtom::layoutShape( const ShapePtr& rShape,
else
aChildSize.Width /= nCount;
aChildSize.Height *= fHeightScale;
- aChildSize.Width *= fWidthScale;
awt::Size aConnectorSize = aChildSize;
aConnectorSize.Width = 1;
- awt::Point aChildPos(nXOffset, 0);
+ awt::Point aChildPos(0, 0);
for (auto& pChild : rShape->getChildren())
{
pChild->setPosition(aChildPos);
diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx
index 1a5fe78decf4..e10d407ee359 100644
--- a/sd/qa/unit/import-tests-smartart.cxx
+++ b/sd/qa/unit/import-tests-smartart.cxx
@@ -699,7 +699,7 @@ void SdImportTestSmartArt::testOrgChart()
CPPUNIT_ASSERT(xEmployee2Shape.is());
awt::Point aEmployee2Pos = xEmployee2Shape->getPosition();
- awt::Size aEmployee2Size = xEmployee2Shape->getSize();
+ //awt::Size aEmployee2Size = xEmployee2Shape->getSize();
CPPUNIT_ASSERT_GREATER(aEmployeePos.X, aEmployee2Pos.X);
// Make sure that assistant is above employees.
@@ -742,7 +742,8 @@ void SdImportTestSmartArt::testOrgChart()
// 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);
+ //CPPUNIT_ASSERT_GREATER(aManagerSize.Width, aEmployeeSize.Width + aEmployee2Size.Width);
+ // currently disabled as causes problems in complex charts
// Without the accompanying fix in place, this test would have failed: an
// employee was exactly the third of the total height, without any spacing.
More information about the Libreoffice-commits
mailing list