[Libreoffice-commits] core.git: oox/source
Grzegorz Araminowicz (via logerrit)
logerrit at kemper.freedesktop.org
Thu May 30 13:00:12 UTC 2019
oox/source/drawingml/diagram/diagramlayoutatoms.cxx | 20 ++------------------
oox/source/drawingml/diagram/layoutatomvisitors.cxx | 6 +++++-
2 files changed, 7 insertions(+), 19 deletions(-)
New commits:
commit 0873151dd02d83122d5f6f471890410ace5e6ddb
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: Thu May 30 14:58:55 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>
diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index 675806767191..1b1aadf77db7 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -469,24 +469,8 @@ sal_Int32 AlgAtom::getConnectorType()
}
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:
@@ -768,7 +752,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 d7d89d2968d0..c6532243ec6c 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