diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2020-07-24 15:52:10 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2020-07-24 17:44:37 +0200 |
commit | 6ca5412bac9e3da5cd20f315fc853c7733f10858 (patch) | |
tree | 0c79c4c9ae97511fb46e468379d01255f9c8205b /oox/source/drawingml/diagram/diagramlayoutatoms.hxx | |
parent | f19dd5a6d3b65556f6dfb8ee0e52333e422733f0 (diff) |
oox smartart: start parsing rule lists
I have a linear algorithm where some elements should be scaled down, but
not all of them. These requirements are described using rules. This
commit just adds the parsing for them, so that later
AlgAtom::layoutShape() can create an improved layout, taking rules into
account.
Change-Id: I5f0f9ffcaff75a804796851e48a9ce10583ec362
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99377
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'oox/source/drawingml/diagram/diagramlayoutatoms.hxx')
-rw-r--r-- | oox/source/drawingml/diagram/diagramlayoutatoms.hxx | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.hxx b/oox/source/drawingml/diagram/diagramlayoutatoms.hxx index 65bfe5975a67..cb34f7a005f1 100644 --- a/oox/source/drawingml/diagram/diagramlayoutatoms.hxx +++ b/oox/source/drawingml/diagram/diagramlayoutatoms.hxx @@ -62,6 +62,7 @@ struct ConditionAttr sal_Int32 mnVal; }; +/// Constraints allow you to specify an ideal (or starting point) size for each shape. struct Constraint { sal_Int32 mnFor; @@ -77,6 +78,12 @@ struct Constraint sal_Int32 mnOperator; }; +/// Rules allow you to specify what to do when constraints can't be fully satisfied. +struct Rule +{ + OUString msForName; +}; + typedef std::map<sal_Int32, sal_Int32> LayoutProperty; typedef std::map<OUString, LayoutProperty> LayoutPropertyMap; @@ -145,6 +152,20 @@ private: Constraint maConstraint; }; +/// Represents one <dgm:rule> element. +class RuleAtom + : public LayoutAtom +{ +public: + RuleAtom(LayoutNode& rLayoutNode) : LayoutAtom(rLayoutNode) {} + virtual void accept( LayoutAtomVisitor& ) override; + Rule& getRule() + { return maRule; } + void parseRule(std::vector<Rule>& rRules) const; +private: + Rule maRule; +}; + class AlgAtom : public LayoutAtom { @@ -161,7 +182,8 @@ public: { maMap[nType]=nVal; } sal_Int32 getVerticalShapesCount(const ShapePtr& rShape); void layoutShape( const ShapePtr& rShape, - const std::vector<Constraint>& rConstraints ); + const std::vector<Constraint>& rConstraints, + const std::vector<Rule>& rRules ); void setAspectRatio(double fAspectRatio) { mfAspectRatio = fAspectRatio; } |