- [Bug 1112114] LO-L3: [PPTX] SmartArt: Basic rendering of the Organizational Chart * bsc1112114.patch OBS-URL: https://build.opensuse.org/request/show/667825 OBS-URL: https://build.opensuse.org/package/show/LibreOffice:Factory/libreoffice?expand=0&rev=739
578 lines
21 KiB
Diff
578 lines
21 KiB
Diff
From bdbd61880eb0453aa43f70b978022b3842e5c263 Mon Sep 17 00:00:00 2001
|
|
From: Miklos Vajna <vmiklos@collabora.com>
|
|
Date: Fri, 21 Dec 2018 17:51:17 +0100
|
|
Subject: [PATCH] Related: tdf#117761 oox smartart: backport fixes related to org chart
|
|
|
|
This is a combination of 10 commits.
|
|
|
|
This is the 1st commit:
|
|
|
|
oox smartart, org chart: add initial hierChild/Root algorithms
|
|
|
|
hierChild is supposed to align and position its child layout nodes in a
|
|
linear path under the hierRoot layout node, so initially just use a
|
|
simple vertical layout algorithm.
|
|
|
|
(cherry picked from commit 3103f9f9461f6eabb61a70be73862ef4be98010e)
|
|
|
|
This is the commit #2:
|
|
|
|
oox smartart, org chart: handle multiple elements in hierChild
|
|
|
|
In case one manager has multiple employees, then we laid out only the
|
|
first one. Recognize non-assistant type as the node type (as a start) to
|
|
get the correct number of employees (when there are no assistants), and
|
|
also render employees on a horizontal (and not on a vertical) path.
|
|
|
|
With this, the 1 manager and multiple employees case looks reasonable.
|
|
|
|
(cherry picked from commit dcd378bf614c99d705312259a0a0a25b40d88e2b)
|
|
|
|
This is the commit #3:
|
|
|
|
oox smartart, org chart: fix font color when defined with quick styles
|
|
|
|
createStyleMatrixContext() assumed that <dgm:style> contains
|
|
<dgm:fontRef>, but it contains <a:fontRef> instead.
|
|
|
|
This resulted in a 0 mnThemedIdx, which meant that since commit
|
|
89206c472ecf18bfde6824cea8004921cd404365 (bnc#862510: PPTX import: Wrong
|
|
text color inside shape, 2014-12-21) we ignored the theme color in
|
|
oox::drawingml::Shape::createAndInsert().
|
|
|
|
(cherry picked from commit 5dfd5755c709e91d2903bd7be4582f7832e89780)
|
|
|
|
This is the commit #4:
|
|
|
|
oox smartart, org chart: fix vertical order of assistant nodes
|
|
|
|
It seems the manager -> assistant -> employees ordering is not part of
|
|
the file format. The order is stored twice in the file: the hierRoot
|
|
algorithm has 3 layout nodes as a children, and also the data model has
|
|
an order of the presentation nodes: both describe that employees go
|
|
before assistant nodes.
|
|
|
|
In contrast to that, PowerPoint orders XML_asst nodes before XML_node
|
|
ones, so teach the hierRoot algorithm about this.
|
|
|
|
This requires tracking the data model node type for each in-diagram
|
|
drawingML shape, so that layout can determine if a hierRoot algorithm
|
|
children has an assistant node or not.
|
|
|
|
(cherry picked from commit 22086e70c4f3bb41620ff81ecaf57fd2af6ccbce)
|
|
|
|
This is the commit #5:
|
|
|
|
oox smartart, org chart: handle multiple paragraphs on data node
|
|
|
|
This problem was similar to the one fixed in
|
|
cfa76f538a44d4396574ece59e8a3953c22c6eb7 (oox smartart, accent process:
|
|
handle multiple runs from a data point, 2018-11-21), but this there we
|
|
handled multiple runs and this handles multiple paragraphs.
|
|
|
|
It seems some smartart types allow multiple paragraphs in a diagram
|
|
node, others only allow multiple runs. Org chart is in the former
|
|
category.
|
|
|
|
(cherry picked from commit dfc97dd381ef516ca4a7e99b29f9da1033a380f4)
|
|
|
|
This is the commit #6:
|
|
|
|
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.
|
|
|
|
(cherry picked from commit 8638cc1b737195df16a160b148d2cd2c68131174)
|
|
|
|
This is the commit #7:
|
|
|
|
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.
|
|
|
|
(cherry picked from commit 3a655975e5ea43417885513d0752da3627dd25ed)
|
|
|
|
This is the commit #8:
|
|
|
|
oox smartart, org chart: implement support for hierBranch conditions
|
|
|
|
The relevant part of the layout is the <dgm:layoutNode
|
|
name="hierChild2"> element that has a <dgm:choose> with two branches:
|
|
|
|
<dgm:if name="Name34" func="var" arg="hierBranch" op="equ" val="std">
|
|
<dgm:if name="Name36" func="var" arg="hierBranch" op="equ" val="init">
|
|
|
|
The connectors were missing as we took the first branch
|
|
(ConditionAtom::getDecision() returned true if the arg was hierBranch),
|
|
even hierBranch on the parent layout node was set to "init".
|
|
|
|
With this, the correct number of connectors are created, previously all
|
|
employee connectors were missing. Their size / position is still
|
|
incorrect, though.
|
|
|
|
(cherry picked from commit ae34f471030869dfc0da1784597cae6f9131f8c5)
|
|
|
|
This is the commit #9:
|
|
|
|
oox smartart, org chart: fix shape type of connectors
|
|
|
|
PowerPoint renders these as bent connectors, not as arrow shapes.
|
|
|
|
Also add a bit of vertical spacing between the nodes, otherwise the
|
|
connectors have no way to be visible. Their position is still incorrect,
|
|
though.
|
|
|
|
(cherry picked from commit 1791e08e9f27453ac5563ef400c715e30c791133)
|
|
|
|
This is the commit #10:
|
|
|
|
oox smartart, org chart: fix position and size of connector shapes
|
|
|
|
Finally the bugdoc rendering result is reasonable and even looks like a
|
|
tree as it should.
|
|
|
|
(cherry picked from commit 2bfb9117b287a371066a157267614b9bdb367d71)
|
|
|
|
Change-Id: I4e7a729afd3d2c5af2e7f41903737bd56be406fa
|
|
---
|
|
|
|
diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
|
|
index e04a58beb..4a57121 100644
|
|
--- a/include/oox/drawingml/shape.hxx
|
|
+++ b/include/oox/drawingml/shape.hxx
|
|
@@ -222,6 +222,10 @@
|
|
|
|
sal_Int32 getZOrderOff() const { return mnZOrderOff; }
|
|
|
|
+ void setDataNodeType(sal_Int32 nDataNodeType) { mnDataNodeType = nDataNodeType; }
|
|
+
|
|
+ sal_Int32 getDataNodeType() const { return mnDataNodeType; }
|
|
+
|
|
protected:
|
|
|
|
css::uno::Reference< css::drawing::XShape > const &
|
|
@@ -341,6 +345,9 @@
|
|
|
|
/// Z-Order offset.
|
|
sal_Int32 mnZOrderOff = 0;
|
|
+
|
|
+ /// Type of data node for an in-diagram shape.
|
|
+ sal_Int32 mnDataNodeType = 0;
|
|
};
|
|
|
|
} }
|
|
diff --git a/oox/source/drawingml/diagram/datamodelcontext.cxx b/oox/source/drawingml/diagram/datamodelcontext.cxx
|
|
index 326b4f9..b98d0ee 100644
|
|
--- a/oox/source/drawingml/diagram/datamodelcontext.cxx
|
|
+++ b/oox/source/drawingml/diagram/datamodelcontext.cxx
|
|
@@ -111,7 +111,7 @@
|
|
mrPoint.mnDirection = rAttribs.getToken( XML_val, XML_norm );
|
|
break;
|
|
case DGM_TOKEN( hierBranch ):
|
|
- mrPoint.mnHierarchyBranch = rAttribs.getToken( XML_val, XML_std );
|
|
+ mrPoint.moHierarchyBranch = rAttribs.getToken( XML_val );
|
|
break;
|
|
case DGM_TOKEN( orgChart ):
|
|
mrPoint.mbOrgChartEnabled = rAttribs.getBool( XML_val, false );
|
|
diff --git a/oox/source/drawingml/diagram/diagram.hxx b/oox/source/drawingml/diagram/diagram.hxx
|
|
index 1a981a8..242ff09 100644
|
|
--- a/oox/source/drawingml/diagram/diagram.hxx
|
|
+++ b/oox/source/drawingml/diagram/diagram.hxx
|
|
@@ -73,7 +73,6 @@
|
|
mnMaxChildren(-1),
|
|
mnPreferredChildren(-1),
|
|
mnDirection(XML_norm),
|
|
- mnHierarchyBranch(XML_std),
|
|
mnResizeHandles(XML_rel),
|
|
mnCustomAngle(-1),
|
|
mnPercentageNeighbourWidth(-1),
|
|
@@ -118,7 +117,7 @@
|
|
sal_Int32 mnMaxChildren;
|
|
sal_Int32 mnPreferredChildren;
|
|
sal_Int32 mnDirection;
|
|
- sal_Int32 mnHierarchyBranch;
|
|
+ OptValue<sal_Int32> moHierarchyBranch;
|
|
sal_Int32 mnResizeHandles;
|
|
sal_Int32 mnCustomAngle;
|
|
sal_Int32 mnPercentageNeighbourWidth;
|
|
diff --git a/oox/source/drawingml/diagram/diagramfragmenthandler.cxx b/oox/source/drawingml/diagram/diagramfragmenthandler.cxx
|
|
index 836faa3..616f8eb 100644
|
|
--- a/oox/source/drawingml/diagram/diagramfragmenthandler.cxx
|
|
+++ b/oox/source/drawingml/diagram/diagramfragmenthandler.cxx
|
|
@@ -111,7 +111,7 @@
|
|
const AttributeList& rAttribs,
|
|
ShapeStyleRef& o_rStyle )
|
|
{
|
|
- o_rStyle.mnThemedIdx = (nElement == DGM_TOKEN(fontRef)) ?
|
|
+ o_rStyle.mnThemedIdx = (nElement == A_TOKEN(fontRef)) ?
|
|
rAttribs.getToken( XML_idx, XML_none ) : rAttribs.getInteger( XML_idx, 0 );
|
|
return new ColorContext( *this, o_rStyle.maPhClr );
|
|
}
|
|
diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
|
|
index 5024709..513dc99 100644
|
|
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
|
|
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
|
|
@@ -29,6 +29,7 @@
|
|
#include <drawingml/textparagraph.hxx>
|
|
#include <drawingml/textrun.hxx>
|
|
#include <drawingml/customshapeproperties.hxx>
|
|
+#include <tools/gen.hxx>
|
|
|
|
using namespace ::com::sun::star;
|
|
using namespace ::com::sun::star::uno;
|
|
@@ -72,31 +73,129 @@
|
|
if (!pNode)
|
|
return nType;
|
|
|
|
+ // This is cheaper than visiting the whole sub-tree.
|
|
+ if (pNode->getName().startsWith("hierChild"))
|
|
+ return oox::XML_bentConnector3;
|
|
+
|
|
for (const auto& pChild : pNode->getChildren())
|
|
{
|
|
auto pAlgAtom = dynamic_cast<oox::drawingml::AlgAtom*>(pChild.get());
|
|
if (!pAlgAtom)
|
|
continue;
|
|
|
|
- if (pAlgAtom->getType() != oox::XML_lin)
|
|
- continue;
|
|
-
|
|
- sal_Int32 nDir = oox::XML_fromL;
|
|
- if (pAlgAtom->getMap().count(oox::XML_linDir))
|
|
- nDir = pAlgAtom->getMap().find(oox::XML_linDir)->second;
|
|
-
|
|
- switch (nDir)
|
|
+ switch (pAlgAtom->getType())
|
|
{
|
|
- case oox::XML_fromL:
|
|
- nType = oox::XML_rightArrow;
|
|
+ case oox::XML_lin:
|
|
+ {
|
|
+ sal_Int32 nDir = oox::XML_fromL;
|
|
+ if (pAlgAtom->getMap().count(oox::XML_linDir))
|
|
+ nDir = pAlgAtom->getMap().find(oox::XML_linDir)->second;
|
|
+
|
|
+ switch (nDir)
|
|
+ {
|
|
+ case oox::XML_fromL:
|
|
+ nType = oox::XML_rightArrow;
|
|
+ break;
|
|
+ case oox::XML_fromR:
|
|
+ nType = oox::XML_leftArrow;
|
|
+ break;
|
|
+ }
|
|
break;
|
|
- case oox::XML_fromR:
|
|
- nType = oox::XML_leftArrow;
|
|
+ }
|
|
+ case oox::XML_hierChild:
|
|
+ {
|
|
+ // TODO <dgm:param type="connRout" val="..."/> should be able
|
|
+ // to customize this.
|
|
+ nType = oox::XML_bentConnector3;
|
|
break;
|
|
+ }
|
|
}
|
|
}
|
|
|
|
return nType;
|
|
+}
|
|
+
|
|
+/**
|
|
+ * Determines if pShape is (or contains) a presentation of a data node of type
|
|
+ * nType.
|
|
+ */
|
|
+bool containsDataNodeType(const oox::drawingml::ShapePtr& pShape, sal_Int32 nType)
|
|
+{
|
|
+ if (pShape->getDataNodeType() == nType)
|
|
+ return true;
|
|
+
|
|
+ for (const auto& pChild : pShape->getChildren())
|
|
+ {
|
|
+ if (containsDataNodeType(pChild, nType))
|
|
+ return true;
|
|
+ }
|
|
+
|
|
+ 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)
|
|
+{
|
|
+ if (!pParent)
|
|
+ return;
|
|
+
|
|
+ const std::vector<oox::drawingml::ShapePtr>& rParents = pParent->getNodeShapes();
|
|
+ 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)
|
|
+{
|
|
+ // Connect to the top center of the child.
|
|
+ awt::Point aShapePoint = pShape->getPosition();
|
|
+ awt::Size aShapeSize = pShape->getSize();
|
|
+ tools::Rectangle aRectangle(Point(aShapePoint.X, aShapePoint.Y),
|
|
+ Size(aShapeSize.Width, aShapeSize.Height));
|
|
+ Point aTo = aRectangle.TopCenter();
|
|
+
|
|
+ // Connect from the bottom center of the parent.
|
|
+ Point aFrom = aTo;
|
|
+ aFrom.setY(aFrom.getY() - aRectangle.getHeight() * 0.3);
|
|
+
|
|
+ tools::Rectangle aRect(aFrom, aTo);
|
|
+ aRect.Justify();
|
|
+ aShapePoint = awt::Point(aRect.Left(), aRect.Top());
|
|
+ aShapeSize = awt::Size(aRect.getWidth(), aRect.getHeight());
|
|
+ pShape->setPosition(aShapePoint);
|
|
+ pShape->setSize(aShapeSize);
|
|
}
|
|
}
|
|
|
|
@@ -284,8 +383,32 @@
|
|
case XML_var:
|
|
{
|
|
const dgm::Point* pPoint = getPresNode();
|
|
- if (pPoint && maCond.mnArg == XML_dir)
|
|
+ if (!pPoint)
|
|
+ break;
|
|
+
|
|
+ if (maCond.mnArg == XML_dir)
|
|
return compareResult(maCond.mnOp, pPoint->mnDirection, maCond.mnVal);
|
|
+ else if (maCond.mnArg == XML_hierBranch)
|
|
+ {
|
|
+ sal_Int32 nHierarchyBranch = pPoint->moHierarchyBranch.get(XML_std);
|
|
+ if (!pPoint->moHierarchyBranch.has())
|
|
+ {
|
|
+ // If <dgm:hierBranch> is missing in the current presentation
|
|
+ // point, ask the parent.
|
|
+ OUString aParent = navigate(mrLayoutNode, XML_presParOf, pPoint->msModelId,
|
|
+ /*bSourceToDestination*/ false);
|
|
+ DiagramData::PointNameMap& rPointNameMap
|
|
+ = mrLayoutNode.getDiagram().getData()->getPointNameMap();
|
|
+ auto it = rPointNameMap.find(aParent);
|
|
+ if (it != rPointNameMap.end())
|
|
+ {
|
|
+ const dgm::Point* pParent = it->second;
|
|
+ if (pParent->moHierarchyBranch.has())
|
|
+ nHierarchyBranch = pParent->moHierarchyBranch.get();
|
|
+ }
|
|
+ }
|
|
+ return compareResult(maCond.mnOp, nHierarchyBranch, maCond.mnVal);
|
|
+ }
|
|
break;
|
|
}
|
|
|
|
@@ -445,6 +568,12 @@
|
|
|
|
rShape->setSubType(nType);
|
|
rShape->getCustomShapeProperties()->setShapePresetType(nType);
|
|
+
|
|
+ if (nType == XML_bentConnector3)
|
|
+ {
|
|
+ setHierChildConnPosSize(rShape);
|
|
+ break;
|
|
+ }
|
|
}
|
|
|
|
// Parse constraints to adjust the size.
|
|
@@ -522,7 +651,81 @@
|
|
|
|
case XML_hierChild:
|
|
case XML_hierRoot:
|
|
+ {
|
|
+ // hierRoot is the manager -> employees vertical linear path,
|
|
+ // hierChild is the first employee -> last employee horizontal
|
|
+ // linear path.
|
|
+ const sal_Int32 nDir = mnType == XML_hierRoot ? XML_fromT : XML_fromL;
|
|
+ if (rShape->getChildren().empty() || rShape->getSize().Width == 0
|
|
+ || rShape->getSize().Height == 0)
|
|
+ break;
|
|
+
|
|
+ sal_Int32 nCount = rShape->getChildren().size();
|
|
+
|
|
+ if (mnType == XML_hierChild)
|
|
+ {
|
|
+ // Connectors should not influence the size of non-connect
|
|
+ // shapes.
|
|
+ nCount = std::count_if(
|
|
+ rShape->getChildren().begin(), rShape->getChildren().end(),
|
|
+ [](const ShapePtr& pShape) { return pShape->getSubType() != XML_conn; });
|
|
+ }
|
|
+
|
|
+ // A manager node's height should be independent from if it has
|
|
+ // assistants and employees, compensate for that.
|
|
+ bool bTop = mnType == XML_hierRoot && rShape->getInternalName() == "hierRoot1";
|
|
+
|
|
+ // Add spacing, so connectors have a chance to be visible.
|
|
+ double fSpace = (nCount > 1 || bTop) ? 0.3 : 0;
|
|
+
|
|
+ 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.
|
|
+ std::vector<ShapePtr>& rChildren = rShape->getChildren();
|
|
+ if (!containsDataNodeType(rChildren[1], XML_asst)
|
|
+ && containsDataNodeType(rChildren[2], XML_asst))
|
|
+ std::swap(rChildren[1], rChildren[2]);
|
|
+ }
|
|
+
|
|
+ sal_Int32 nXOffset = 0;
|
|
+ double fWidthScale = 1.0;
|
|
+ if (mnType == XML_hierChild)
|
|
+ calculateHierChildOffsetScale(rShape, pParent, nXOffset, fWidthScale);
|
|
+
|
|
+ awt::Size aChildSize = rShape->getSize();
|
|
+ if (nDir == XML_fromT)
|
|
+ {
|
|
+ aChildSize.Height /= (nCount + nCount * fSpace);
|
|
+ }
|
|
+ else
|
|
+ aChildSize.Width /= nCount;
|
|
+ aChildSize.Height *= fHeightScale;
|
|
+ aChildSize.Width *= fWidthScale;
|
|
+
|
|
+ awt::Point aChildPos(nXOffset, 0);
|
|
+ for (auto& pChild : rShape->getChildren())
|
|
+ {
|
|
+ pChild->setPosition(aChildPos);
|
|
+ pChild->setSize(aChildSize);
|
|
+ pChild->setChildSize(aChildSize);
|
|
+
|
|
+ if (mnType == XML_hierChild && pChild->getSubType() == XML_conn)
|
|
+ // Connectors should not influence the position of
|
|
+ // non-connect shapes.
|
|
+ continue;
|
|
+
|
|
+ if (nDir == XML_fromT)
|
|
+ aChildPos.Y += aChildSize.Height + aChildSize.Height * fSpace;
|
|
+ else
|
|
+ aChildPos.X += aChildSize.Width;
|
|
+ }
|
|
+
|
|
break;
|
|
+ }
|
|
|
|
case XML_lin:
|
|
{
|
|
@@ -896,6 +1099,7 @@
|
|
while( aVecIter != aVecEnd )
|
|
{
|
|
DiagramData::PointNameMap& rMap = mrDgm.getData()->getPointNameMap();
|
|
+ // pPresNode is the presentation node of the aDataNode2 data node.
|
|
DiagramData::PointNameMap::const_iterator aDataNode2 = rMap.find(aVecIter->first);
|
|
if (aDataNode2 == rMap.end())
|
|
{
|
|
@@ -903,6 +1107,8 @@
|
|
++aVecIter;
|
|
continue;
|
|
}
|
|
+
|
|
+ rShape->setDataNodeType(aDataNode2->second->mnType);
|
|
|
|
if( aVecIter->second == 0 )
|
|
{
|
|
@@ -941,16 +1147,19 @@
|
|
rShape->setTextBody(pTextBody);
|
|
}
|
|
|
|
- TextParagraph& rPara=pTextBody->addParagraph();
|
|
- if( aVecIter->second != -1 )
|
|
- rPara.getProperties().setLevel(aVecIter->second);
|
|
+ const TextParagraphVector& rSourceParagraphs
|
|
+ = aDataNode2->second->mpShape->getTextBody()->getParagraphs();
|
|
+ for (const auto& pSourceParagraph : rSourceParagraphs)
|
|
+ {
|
|
+ TextParagraph& rPara = pTextBody->addParagraph();
|
|
+ if (aVecIter->second != -1)
|
|
+ rPara.getProperties().setLevel(aVecIter->second);
|
|
|
|
- std::shared_ptr<TextParagraph> pSourceParagraph
|
|
- = aDataNode2->second->mpShape->getTextBody()->getParagraphs().front();
|
|
- for (const auto& pRun : pSourceParagraph->getRuns())
|
|
- rPara.addRun(pRun);
|
|
- rPara.getProperties().apply(
|
|
- aDataNode2->second->mpShape->getTextBody()->getParagraphs().front()->getProperties());
|
|
+ for (const auto& pRun : pSourceParagraph->getRuns())
|
|
+ rPara.addRun(pRun);
|
|
+ const TextBodyPtr& rBody = aDataNode2->second->mpShape->getTextBody();
|
|
+ rPara.getProperties().apply(rBody->getParagraphs().front()->getProperties());
|
|
+ }
|
|
}
|
|
|
|
++aVecIter;
|
|
diff --git a/oox/source/drawingml/diagram/layoutatomvisitors.cxx b/oox/source/drawingml/diagram/layoutatomvisitors.cxx
|
|
index 49a664c..e2d6c46 100644
|
|
--- a/oox/source/drawingml/diagram/layoutatomvisitors.cxx
|
|
+++ b/oox/source/drawingml/diagram/layoutatomvisitors.cxx
|
|
@@ -57,7 +57,8 @@
|
|
const std::vector<LayoutAtomPtr>& rChildren=rAtom.getChildren();
|
|
|
|
sal_Int32 nChildren=1;
|
|
- if( rAtom.iterator().mnPtType == XML_node )
|
|
+ // Approximate the non-assistant type with the node type.
|
|
+ if (rAtom.iterator().mnPtType == XML_node || rAtom.iterator().mnPtType == XML_nonAsst)
|
|
{
|
|
// count child data nodes - check all child Atoms for "name"
|
|
// attribute that is contained in diagram's
|
|
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
|
|
index 16bc511..55d1546 100644
|
|
--- a/oox/source/drawingml/shape.cxx
|
|
+++ b/oox/source/drawingml/shape.cxx
|
|
@@ -177,6 +177,7 @@
|
|
, maDiagramDoms( pSourceShape->maDiagramDoms )
|
|
, mnZOrder(pSourceShape->mnZOrder)
|
|
, mnZOrderOff(pSourceShape->mnZOrderOff)
|
|
+, mnDataNodeType(pSourceShape->mnDataNodeType)
|
|
{}
|
|
|
|
Shape::~Shape()
|