[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - oox/source
Grzegorz Araminowicz (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jun 3 12:16:24 UTC 2019
oox/source/drawingml/diagram/diagramlayoutatoms.cxx | 22 ++------------------
oox/source/drawingml/diagram/layoutatomvisitors.cxx | 6 ++++-
2 files changed, 8 insertions(+), 20 deletions(-)
New commits:
commit 83d101158ef3726d005ae7bd47437ab22ad2a036
Author: Grzegorz Araminowicz <grzegorz.araminowicz at collabora.com>
AuthorDate: Tue May 28 17:37:19 2019 +0200
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Mon Jun 3 14:15:38 2019 +0200
SmartArt: keep parent constraints instead of merging every time
currently for every node we were additionaly loading constraints from
parent node, merging them and then deleting
it makes more sense just to keep already loaded constraints from parent node
Change-Id: I3fcd669547f24eeeac0b77876950ff7436bd5cb3
Reviewed-on: https://gerrit.libreoffice.org/73116
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/73258
diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index 808960093f29..e27c573b3d28 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -499,24 +499,8 @@ void AlgAtom::accept( LayoutAtomVisitor& rVisitor )
}
void AlgAtom::layoutShape( const ShapePtr& rShape,
- const std::vector<Constraint>& rOwnConstraints )
+ const std::vector<Constraint>& rConstraints )
{
- // Algorithm result may depend on the parent constraints as well.
- std::vector<Constraint> aMergedConstraints;
- const LayoutNode* pParent = getLayoutNode().getParentLayoutNode();
- if (pParent)
- {
- for (const auto& pChild : pParent->getChildren())
- {
- auto pConstraintAtom = dynamic_cast<ConstraintAtom*>(pChild.get());
- if (pConstraintAtom)
- pConstraintAtom->parseConstraint(aMergedConstraints, /*bRequireForName=*/true);
- }
- }
- aMergedConstraints.insert(aMergedConstraints.end(), rOwnConstraints.begin(),
- rOwnConstraints.end());
- const std::vector<Constraint>& rConstraints = aMergedConstraints;
-
switch(mnType)
{
case XML_composite:
@@ -629,7 +613,7 @@ void AlgAtom::layoutShape( const ShapePtr& rShape,
{
// There is no shape type "conn", replace it by an arrow based
// on the direction of the parent linear layout.
- sal_Int32 nType = getConnectorType(pParent);
+ sal_Int32 nType = getConnectorType(getLayoutNode().getParentLayoutNode());
rShape->setSubType(nType);
rShape->getCustomShapeProperties()->setShapePresetType(nType);
@@ -759,7 +743,7 @@ void AlgAtom::layoutShape( const ShapePtr& rShape,
sal_Int32 nXOffset = 0;
double fWidthScale = 1.0;
if (mnType == XML_hierChild)
- calculateHierChildOffsetScale(rShape, pParent, nXOffset, fWidthScale);
+ calculateHierChildOffsetScale(rShape, getLayoutNode().getParentLayoutNode(), nXOffset, fWidthScale);
awt::Size aChildSize = rShape->getSize();
if (nDir == XML_fromT)
diff --git a/oox/source/drawingml/diagram/layoutatomvisitors.cxx b/oox/source/drawingml/diagram/layoutatomvisitors.cxx
index 602130b6b3e3..4e1a3689e3e4 100644
--- a/oox/source/drawingml/diagram/layoutatomvisitors.cxx
+++ b/oox/source/drawingml/diagram/layoutatomvisitors.cxx
@@ -291,14 +291,18 @@ void ShapeLayoutingVisitor::visit(LayoutNode& rAtom)
if (meLookFor != LAYOUT_NODE)
return;
+ size_t nParentConstraintsNumber = maConstraints.size();
+
// process alg atoms first, nested layout nodes afterwards
meLookFor = CONSTRAINT;
defaultVisit(rAtom);
meLookFor = ALGORITHM;
defaultVisit(rAtom);
- maConstraints.clear();
meLookFor = LAYOUT_NODE;
defaultVisit(rAtom);
+
+ // delete added constraints, keep parent constraints
+ maConstraints.erase(maConstraints.begin() + nParentConstraintsNumber, maConstraints.end());
}
void ShapeLayoutingVisitor::visit(ShapeAtom& /*rAtom*/)
More information about the Libreoffice-commits
mailing list