LibreOffice Module oox (master)  1
datamodel.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #ifndef INCLUDED_OOX_SOURCE_DRAWINGML_DIAGRAM_DATAMODEL_HXX
21 #define INCLUDED_OOX_SOURCE_DRAWINGML_DIAGRAM_DATAMODEL_HXX
22 
23 #include <map>
24 #include <memory>
25 #include <vector>
26 
27 #include <rtl/ustring.hxx>
28 
30 #include <oox/token/tokens.hxx>
32 
33 namespace oox::drawingml {
34 
35 namespace dgm {
36 
39 struct Connection
40 {
42  mnType( 0 ),
43  mnSourceOrder( 0 ),
44  mnDestOrder( 0 )
45  {}
46 
47  void dump() const;
48 
49  sal_Int32 mnType;
50  OUString msModelId;
51  OUString msSourceId;
52  OUString msDestId;
53  OUString msParTransId;
54  OUString msPresId;
55  OUString msSibTransId;
56  sal_Int32 mnSourceOrder;
57  sal_Int32 mnDestOrder;
58 
59 };
60 
61 typedef std::vector< Connection > Connections;
62 
65 struct Point
66 {
67  Point() :
68  mnType(0),
69  mnMaxChildren(-1),
71  mnDirection(XML_norm),
72  mnResizeHandles(XML_rel),
73  mnCustomAngle(-1),
79  mnRadiusScale(-1),
80  mnWidthScale(-1),
81  mnHeightScale(-1),
82  mnWidthOverride(-1),
83  mnHeightOverride(-1),
86 
87  mbOrgChartEnabled(false),
88  mbBulletEnabled(false),
89  mbCoherent3DOffset(false),
91  mbCustomVerticalFlip(false),
92  mbCustomText(false),
93  mbIsPlaceholder(false)
94  {}
95  void dump() const;
96 
98 
99  OUString msCnxId;
100  OUString msModelId;
104  OUString msLayoutTypeId;
111 
112  sal_Int32 mnType;
113  sal_Int32 mnMaxChildren;
115  sal_Int32 mnDirection;
117  sal_Int32 mnResizeHandles;
118  sal_Int32 mnCustomAngle;
124  sal_Int32 mnRadiusScale;
125  sal_Int32 mnWidthScale;
126  sal_Int32 mnHeightScale;
127  sal_Int32 mnWidthOverride;
128  sal_Int32 mnHeightOverride;
131 
139 };
140 
141 typedef std::vector< Point > Points;
142 
143 }
144 
146 {
147 public:
148  typedef std::map< OUString, dgm::Point* > PointNameMap;
149  typedef std::map< OUString,
150  std::vector<dgm::Point*> > PointsNameMap;
151  typedef std::map< OUString, const dgm::Connection* > ConnectionNameMap;
153  {
154  OUString msSourceId;
155  sal_Int32 mnDepth = 0;
156  };
158  typedef std::map< OUString,
159  std::map<sal_Int32, SourceIdAndDepth > > StringMap;
160 
161  DiagramData();
162  virtual ~DiagramData() {}
163  void build();
165  { return mpFillProperties; }
167  { return maConnections; }
169  { return maPoints; }
170  StringMap & getPresOfNameMap()
171  { return maPresOfNameMap; }
172  PointNameMap & getPointNameMap()
173  { return maPointNameMap; }
174  PointsNameMap & getPointsPresNameMap()
175  { return maPointsPresNameMap; }
176  ::std::vector<OUString> &getExtDrawings()
177  { return maExtDrawings; }
178  const dgm::Point* getRootPoint() const;
179  void dump() const;
180  OUString getString() const override;
181  std::vector<std::pair<OUString, OUString>> getChildren(const OUString& rParentId) const override;
182  OUString addNode(const OUString& rText) override;
183  bool removeNode(const OUString& rNodeId) override;
184 
185 private:
186  void getChildrenString(OUStringBuffer& rBuf, const dgm::Point* pPoint, sal_Int32 nLevel) const;
187  void addConnection(sal_Int32 nType, const OUString& sSourceId, const OUString& sDestId);
188 
189  ::std::vector<OUString> maExtDrawings;
193  PointNameMap maPointNameMap;
194  PointsNameMap maPointsPresNameMap;
195  ConnectionNameMap maConnectionNameMap;
196  StringMap maPresOfNameMap;
197 };
198 
199 typedef std::shared_ptr< DiagramData > DiagramDataPtr;
200 
201 }
202 
203 #endif
204 
205 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
StringMap & getPresOfNameMap()
Definition: datamodel.hxx:170
std::shared_ptr< FillProperties > FillPropertiesPtr
std::shared_ptr< DiagramData > DiagramDataPtr
Definition: datamodel.hxx:199
FillPropertiesPtr & getFillProperties()
Definition: datamodel.hxx:164
OUString getString() const override
Definition: datamodel.cxx:115
dgm::Points & getPoints()
Definition: datamodel.hxx:168
sal_Int32 mnPercentageNeighbourHeight
Definition: datamodel.hxx:120
std::map< OUString, const dgm::Connection * > ConnectionNameMap
Definition: datamodel.hxx:151
ConnectionNameMap maConnectionNameMap
Definition: datamodel.hxx:195
OUString msPresentationAssociationId
Definition: datamodel.hxx:106
::std::vector< OUString > maExtDrawings
Definition: datamodel.hxx:189
std::map< OUString, dgm::Point * > PointNameMap
Definition: datamodel.hxx:148
bool removeNode(const OUString &rNodeId) override
Definition: datamodel.cxx:220
dgm::Connections maConnections
Definition: datamodel.hxx:191
sal_Int32 mnPercentageNeighbourWidth
Definition: datamodel.hxx:119
std::map< OUString, std::vector< dgm::Point * > > PointsNameMap
Definition: datamodel.hxx:150
::std::vector< OUString > & getExtDrawings()
Definition: datamodel.hxx:176
OUString addNode(const OUString &rText) override
Definition: datamodel.cxx:161
FillPropertiesPtr mpFillProperties
Definition: datamodel.hxx:190
std::vector< Point > Points
Definition: datamodel.hxx:141
dgm::Connections & getConnections()
Definition: datamodel.hxx:166
const dgm::Point * getRootPoint() const
Definition: datamodel.cxx:64
PointsNameMap & getPointsPresNameMap()
Definition: datamodel.hxx:174
std::vector< Connection > Connections
Definition: datamodel.hxx:61
std::shared_ptr< Shape > ShapePtr
std::vector< std::pair< OUString, OUString > > getChildren(const OUString &rParentId) const override
Definition: datamodel.cxx:123
void getChildrenString(OUStringBuffer &rBuf, const dgm::Point *pPoint, sal_Int32 nLevel) const
Definition: datamodel.cxx:85
std::map< OUString, std::map< sal_Int32, SourceIdAndDepth > > StringMap
Tracks connections: destination id -> {destination order, details} map.
Definition: datamodel.hxx:159
PointsNameMap maPointsPresNameMap
Definition: datamodel.hxx:194
PointNameMap & getPointNameMap()
Definition: datamodel.hxx:172
OUString msPresentationLayoutStyleLabel
Definition: datamodel.hxx:108
void addConnection(sal_Int32 nType, const OUString &sSourceId, const OUString &sDestId)
Definition: datamodel.cxx:147
OptValue< sal_Int32 > moHierarchyBranch
Definition: datamodel.hxx:116