27#include <oox/token/namespaces.hxx>
28#include <oox/token/tokens.hxx>
41 :
public LayoutNodeContext
44 IfContext( ContextHandler2Helper
const & rParent,
45 const AttributeList& rAttribs,
47 : LayoutNodeContext( rParent, rAttribs, pAtom )
52 :
public ContextHandler2
55 AlgorithmContext( ContextHandler2Helper
const & rParent,
const AttributeList& rAttribs,
const AlgAtomPtr & pNode )
56 : ContextHandler2( rParent )
60 mnRevision = rAttribs.getInteger( XML_rev, 0 );
61 pNode->setType(rAttribs.getToken(XML_type, 0));
65 onCreateContext( ::sal_Int32 aElement,
66 const AttributeList& rAttribs )
override
70 case DGM_TOKEN( param ):
72 sal_Int32
nType = rAttribs.getToken(XML_type, 0);
76 mpNode->setAspectRatio(rAttribs.getDouble(XML_val, 0));
79 const sal_Int32 nValTok = rAttribs.getToken(XML_val, 0);
80 mpNode->addParam(nType, nValTok > 0 ? nValTok
81 : rAttribs.getInteger(XML_val, 0));
99 :
public ContextHandler2
102 ChooseContext( ContextHandler2Helper
const & rParent,
const AttributeList& rAttribs,
LayoutAtomPtr pNode )
103 : ContextHandler2( rParent )
104 ,
mpNode(std::move( pNode ))
106 msName = rAttribs.getStringDefaulted( XML_name );
110 onCreateContext( ::sal_Int32 aElement,
111 const AttributeList& rAttribs )
override
115 case DGM_TOKEN(
if ):
118 ConditionAtomPtr pNode = std::make_shared<ConditionAtom>(
mpNode->getLayoutNode(),
false, rAttribs.getFastAttributeList());
120 return new IfContext( *
this, rAttribs, pNode );
122 case DGM_TOKEN(
else ):
125 ConditionAtomPtr pNode = std::make_shared<ConditionAtom>(
mpNode->getLayoutNode(),
true, rAttribs.getFastAttributeList());
127 return new IfContext( *
this, rAttribs, pNode );
141 :
public LayoutNodeContext
144 ForEachContext( ContextHandler2Helper
const & rParent,
const AttributeList& rAttribs,
const ForEachAtomPtr& pAtom )
145 : LayoutNodeContext( rParent, rAttribs, pAtom )
147 pAtom->setRef(rAttribs.getStringDefaulted(XML_ref));
148 pAtom->iterator().loadFromXAttr( rAttribs.getFastAttributeList() );
150 LayoutAtomMap& rLayoutAtomMap = pAtom->getLayoutNode().getDiagram().getLayout()->getLayoutAtomMap();
151 rLayoutAtomMap[pAtom->getName()] = pAtom;
156class LayoutVariablePropertySetContext
157 :
public ContextHandler2
160 LayoutVariablePropertySetContext( ContextHandler2Helper
const & rParent,
LayoutNode::VarMap & aVar )
161 : ContextHandler2( rParent )
166 virtual ContextHandlerRef onCreateContext( ::sal_Int32 aElement,
const AttributeList& rAttribs )
override
168 mVariables[ getBaseToken(aElement) ] = rAttribs.getStringDefaulted( XML_val );
184 assert( pAtom &&
"Node must NOT be NULL" );
198 case DGM_TOKEN( layoutNode ):
205 pNode->setChildOrder(rAttribs.
getToken(XML_chOrder, XML_b));
211 auto pLayoutNode =
dynamic_cast<LayoutNode*
>(pAtom.get());
224 case DGM_TOKEN( shape ):
230 pShape = std::make_shared<Shape>(
"com.sun.star.drawing.CustomShape");
231 if (!rAttribs.
getBool(XML_hideGeom,
false))
234 pShape->setSubType(
nType );
235 pShape->getCustomShapeProperties()->setShapePresetType(
nType );
240 pShape = std::make_shared<Shape>(
"com.sun.star.drawing.GroupShape");
245 pShape->setZOrderOff(rAttribs.
getInteger(XML_zOrderOff, 0));
251 case DGM_TOKEN( extLst ):
253 case DGM_TOKEN( alg ):
258 return new AlgorithmContext( *
this, rAttribs, pAtom );
260 case DGM_TOKEN( choose ):
265 return new ChooseContext( *
this, rAttribs, pAtom );
267 case DGM_TOKEN( forEach ):
272 return new ForEachContext( *
this, rAttribs, pAtom );
274 case DGM_TOKEN( constrLst ):
277 case DGM_TOKEN( presOf ):
285 case DGM_TOKEN( ruleLst ):
288 case DGM_TOKEN( varLst ):
293 return new LayoutVariablePropertySetContext( *
this, pNode->variables() );
297 SAL_WARN(
"oox",
"OOX: encountered a varLst in a non layoutNode context" );
Provides access to attribute values of an element.
OUString getStringDefaulted(sal_Int32 nAttrToken) const
Returns the string value of the specified attribute, returns an empty string if attribute not present...
bool hasAttribute(sal_Int32 nAttrToken) const
Returns true, if the specified attribute is present.
std::optional< sal_Int32 > getInteger(sal_Int32 nAttrToken) const
Returns the 32-bit signed integer value of the specified attribute (decimal).
const css::uno::Reference< css::xml::sax::XFastAttributeList > & getFastAttributeList() const
Returns the wrapped com.sun.star.xml.sax.XFastAttributeList object.
std::optional< bool > getBool(sal_Int32 nAttrToken) const
Returns the boolean value of the specified attribute.
std::optional< sal_Int32 > getToken(sal_Int32 nAttrToken) const
Returns the token identifier of the value of the specified attribute.
static void connect(const LayoutAtomPtr &pParent, const LayoutAtomPtr &pChild)
LayoutNodeContext(::oox::core::ContextHandler2Helper const &rParent, const ::oox::AttributeList &rAttributes, const LayoutAtomPtr &pNode)
virtual ~LayoutNodeContext() override
virtual ::oox::core::ContextHandlerRef onCreateContext(::sal_Int32 Element, const ::oox::AttributeList &rAttribs) override
void setChildOrder(sal_Int32 nOrder)
std::map< sal_Int32, OUString > VarMap
Handles one <dgm:ruleLst> element.
LayoutNode::VarMap & mVariables
#define SAL_WARN(area, stream)
::rtl::Reference< ContextHandler > ContextHandlerRef
std::shared_ptr< ShapeAtom > ShapeAtomPtr
std::shared_ptr< ConditionAtom > ConditionAtomPtr
std::shared_ptr< Shape > ShapePtr
std::shared_ptr< AlgAtom > AlgAtomPtr
std::map< OUString, LayoutAtomPtr > LayoutAtomMap
std::shared_ptr< LayoutAtom > LayoutAtomPtr
std::shared_ptr< LayoutNode > LayoutNodePtr
const sal_Int32 PER_DEGREE
std::shared_ptr< ForEachAtom > ForEachAtomPtr
void loadFromXAttr(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttributes)