diff options
author | Armin Le Grand (Allotropia) <Armin.Le.Grand@me.com> | 2022-03-30 11:48:08 +0200 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@me.com> | 2022-03-31 15:29:28 +0200 |
commit | ca6d879f765dad8471d42ec736b1f4235e5b8da4 (patch) | |
tree | 79201e4d7b626139e95dda12aeb219fcda9249ff /include/svx/diagram | |
parent | f99879edf4a4191daa98217f125e3d46d74a3031 (diff) |
Advanced Diagram support: Move class DiagramData to svx AFAP
Splitted and moved parts of DiagramData class to svx as peparation
to access from there. Done as pure virtual class so that no
incarnations will be possible, also made the constructor protected.
The derived class in oox hosts all functionality/data which
involves usage/modification of oox::Shape class. That way we get
closer to get the Diagram DataModel isloated/seperated.
Not-yet moved is the String/Text holding data, it's still in oox.
Moving that one will be next, that will allow to migrate quite
some more functionalty to svx.
Change-Id: I389dbf3ebf6171b8175cf30be7bbc8c20d9a38e1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132303
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Diffstat (limited to 'include/svx/diagram')
-rw-r--r-- | include/svx/diagram/datamodel.hxx | 71 |
1 files changed, 70 insertions, 1 deletions
diff --git a/include/svx/diagram/datamodel.hxx b/include/svx/diagram/datamodel.hxx index 9f47e30f8ef9..d76b5c25b163 100644 --- a/include/svx/diagram/datamodel.hxx +++ b/include/svx/diagram/datamodel.hxx @@ -22,13 +22,15 @@ #include <vector> #include <optional> +#include <map> #include <svx/svxdllapi.h> #include <rtl/ustring.hxx> +#include <rtl/ustrbuf.hxx> namespace svx::diagram { -enum TypeConstant { +enum SVXCORE_DLLPUBLIC TypeConstant { XML_none = 0, XML_type = 395, XML_asst = 680, @@ -114,6 +116,73 @@ struct SVXCORE_DLLPUBLIC Point typedef std::vector< Point > Points; +/** The collected Diagram ModelData + */ +class SVXCORE_DLLPUBLIC DiagramData +{ +public: + typedef std::map< OUString, Point* > PointNameMap; + typedef std::map< OUString, std::vector< Point* > > PointsNameMap; + typedef std::map< OUString, const Connection* > ConnectionNameMap; + + struct SourceIdAndDepth + { + OUString msSourceId; + sal_Int32 mnDepth = 0; + }; + + /// Tracks connections: destination id -> {destination order, details} map. + typedef std::map< OUString, std::map<sal_Int32, SourceIdAndDepth > > StringMap; + +protected: + // Make constructor protected to signal that this anyways pure virual class + // shall not be incarnated - target to use is oox::drawingml::DiagramData + DiagramData(); + +public: + virtual ~DiagramData(); + + // creates temporary processing data from model data + virtual void build(bool bClearOoxShapes) = 0; + + Connections& getConnections() { return maConnections; } + Points& getPoints() { return maPoints; } + StringMap& getPresOfNameMap() { return maPresOfNameMap; } + PointNameMap& getPointNameMap() { return maPointNameMap; } + PointsNameMap& getPointsPresNameMap() { return maPointsPresNameMap; } + ::std::vector<OUString>& getExtDrawings() { return maExtDrawings; } + const Point* getRootPoint() const; + + virtual void dump() const = 0; + + OUString getString() const; + virtual std::vector<std::pair<OUString, OUString>> getChildren(const OUString& rParentId) const = 0; + virtual OUString addNode(const OUString& rText) = 0; + bool removeNode(const OUString& rNodeId); + +protected: + virtual void getChildrenString(OUStringBuffer& rBuf, const Point* pPoint, sal_Int32 nLevel) const = 0; + void addConnection(TypeConstant nType, const OUString& sSourceId, const OUString& sDestId); + + // evtl. existing alternative imported visualization identifier + ::std::vector<OUString> maExtDrawings; + + // The model definition, the parts available in svx. + // See evtl. parts in oox::drawingml::DiagramData that may need t obe accessed + // - logic connections/associations + // - data point entries + Connections maConnections; + Points maPoints; + + // temporary processing data, deleted when using build() + PointNameMap maPointNameMap; + PointsNameMap maPointsPresNameMap; + ConnectionNameMap maConnectionNameMap; + StringMap maPresOfNameMap; +}; + +typedef std::shared_ptr< DiagramData > DiagramDataPtr; + } #endif |