summaryrefslogtreecommitdiff
path: root/oox/source
diff options
context:
space:
mode:
Diffstat (limited to 'oox/source')
-rw-r--r--oox/source/drawingml/diagram/diagram.hxx10
-rw-r--r--oox/source/drawingml/diagram/diagramlayoutatoms.cxx14
-rw-r--r--oox/source/drawingml/diagram/diagramlayoutatoms.hxx6
-rw-r--r--oox/source/drawingml/diagram/layoutatomvisitors.cxx14
-rw-r--r--oox/source/drawingml/diagram/layoutnodecontext.cxx5
5 files changed, 48 insertions, 1 deletions
diff --git a/oox/source/drawingml/diagram/diagram.hxx b/oox/source/drawingml/diagram/diagram.hxx
index 91cb0f39fd2c..cf12dce576a7 100644
--- a/oox/source/drawingml/diagram/diagram.hxx
+++ b/oox/source/drawingml/diagram/diagram.hxx
@@ -149,6 +149,8 @@ typedef std::vector< Point > Points;
class Diagram;
class LayoutNode;
typedef std::shared_ptr< LayoutNode > LayoutNodePtr;
+class LayoutAtom;
+typedef std::shared_ptr<LayoutAtom> LayoutAtomPtr;
typedef std::map< OUString, css::uno::Reference<css::xml::dom::XDocument> > DiagramDomMap;
@@ -205,6 +207,8 @@ private:
typedef std::shared_ptr< DiagramData > DiagramDataPtr;
+typedef std::map<OUString, LayoutAtomPtr> LayoutAtomMap;
+
class DiagramLayout
{
public:
@@ -233,6 +237,8 @@ public:
{ return mpStyleData; }
const DiagramDataPtr & getStyleData() const
{ return mpStyleData; }
+ LayoutAtomMap & getLayoutAtomMap()
+ { return maLayoutAtomMap; }
private:
const Diagram& mrDgm;
@@ -248,6 +254,8 @@ private:
// TODO
// catLst
// clrData
+
+ LayoutAtomMap maLayoutAtomMap;
};
typedef std::shared_ptr< DiagramLayout > DiagramLayoutPtr;
@@ -283,6 +291,8 @@ public:
{ return mpData; }
void setLayout( const DiagramLayoutPtr & pLayout )
{ mpLayout = pLayout; }
+ const DiagramLayoutPtr& getLayout() const
+ { return mpLayout; }
DiagramQStyleMap& getStyles() { return maStyles; }
const DiagramQStyleMap& getStyles() const { return maStyles; }
diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index f9c443c5d626..6497e3ba22cf 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -229,6 +229,20 @@ void ForEachAtom::accept( LayoutAtomVisitor& rVisitor )
rVisitor.visit(*this);
}
+LayoutAtomPtr ForEachAtom::getRefAtom()
+{
+ if (!msRef.isEmpty())
+ {
+ const LayoutAtomMap& rLayoutAtomMap = getLayoutNode().getDiagram().getLayout()->getLayoutAtomMap();
+ LayoutAtomMap::const_iterator pRefAtom = rLayoutAtomMap.find(msRef);
+ if (pRefAtom != rLayoutAtomMap.end())
+ return pRefAtom->second;
+ else
+ SAL_WARN("oox.drawingml", "ForEach reference \"" << msRef << "\" not found");
+ }
+ return LayoutAtomPtr();
+}
+
void ChooseAtom::accept( LayoutAtomVisitor& rVisitor )
{
rVisitor.visit(*this);
diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.hxx b/oox/source/drawingml/diagram/diagramlayoutatoms.hxx
index 8a11ed5cbac8..9fff33686dd6 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.hxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.hxx
@@ -188,10 +188,16 @@ public:
IteratorAttr & iterator()
{ return maIter; }
+ void setRef(const OUString& rsRef)
+ { msRef = rsRef; }
+ const OUString& getRef() const
+ { return msRef; }
virtual void accept( LayoutAtomVisitor& ) override;
+ LayoutAtomPtr getRefAtom();
private:
IteratorAttr maIter;
+ OUString msRef;
};
typedef std::shared_ptr< ForEachAtom > ForEachAtomPtr;
diff --git a/oox/source/drawingml/diagram/layoutatomvisitors.cxx b/oox/source/drawingml/diagram/layoutatomvisitors.cxx
index cd7b82aa9efd..5d6f0065241d 100644
--- a/oox/source/drawingml/diagram/layoutatomvisitors.cxx
+++ b/oox/source/drawingml/diagram/layoutatomvisitors.cxx
@@ -48,6 +48,13 @@ void ShapeCreationVisitor::visit(AlgAtom& rAtom)
void ShapeCreationVisitor::visit(ForEachAtom& rAtom)
{
+ if (!rAtom.getRef().isEmpty())
+ {
+ if (LayoutAtomPtr pRefAtom = rAtom.getRefAtom())
+ pRefAtom->accept(*this);
+ return;
+ }
+
if (rAtom.iterator().mbHideLastTrans && rAtom.iterator().mnAxis == XML_followSib)
{
// If last transition is hidden and the axis is the follow sibling,
@@ -276,6 +283,13 @@ void ShapeLayoutingVisitor::visit(AlgAtom& rAtom)
void ShapeLayoutingVisitor::visit(ForEachAtom& rAtom)
{
+ if (!rAtom.getRef().isEmpty())
+ {
+ if (LayoutAtomPtr pRefAtom = rAtom.getRefAtom())
+ pRefAtom->accept(*this);
+ return;
+ }
+
defaultVisit(rAtom);
}
diff --git a/oox/source/drawingml/diagram/layoutnodecontext.cxx b/oox/source/drawingml/diagram/layoutnodecontext.cxx
index e984862c44b4..8e3e3c2f6eb4 100644
--- a/oox/source/drawingml/diagram/layoutnodecontext.cxx
+++ b/oox/source/drawingml/diagram/layoutnodecontext.cxx
@@ -141,8 +141,11 @@ public:
ForEachContext( ContextHandler2Helper const & rParent, const AttributeList& rAttribs, const ForEachAtomPtr& pAtom )
: LayoutNodeContext( rParent, rAttribs, pAtom )
{
- rAttribs.getString( XML_ref );
+ pAtom->setRef(rAttribs.getString(XML_ref).get());
pAtom->iterator().loadFromXAttr( rAttribs.getFastAttributeList() );
+
+ LayoutAtomMap& rLayoutAtomMap = pAtom->getLayoutNode().getDiagram().getLayout()->getLayoutAtomMap();
+ rLayoutAtomMap[pAtom->getName()] = pAtom;
}
};