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/helper/helper.hxx>
31 #include <oox/token/tokens.hxx>
33 
34 namespace oox::drawingml {
35 
36 namespace dgm {
37 
40 struct Connection
41 {
43  mnType( 0 ),
44  mnSourceOrder( 0 ),
45  mnDestOrder( 0 )
46  {}
47 
48  void dump() const;
49 
50  sal_Int32 mnType;
51  OUString msModelId;
52  OUString msSourceId;
53  OUString msDestId;
54  OUString msParTransId;
55  OUString msPresId;
56  OUString msSibTransId;
57  sal_Int32 mnSourceOrder;
58  sal_Int32 mnDestOrder;
59 
60 };
61 
62 typedef std::vector< Connection > Connections;
63 
66 struct Point
67 {
68  Point() :
69  mnType(0),
70  mnMaxChildren(-1),
72  mnDirection(XML_norm),
73  mnResizeHandles(XML_rel),
74  mnCustomAngle(-1),
80  mnRadiusScale(-1),
81  mnWidthScale(-1),
82  mnHeightScale(-1),
83  mnWidthOverride(-1),
84  mnHeightOverride(-1),
87 
88  mbOrgChartEnabled(false),
89  mbBulletEnabled(false),
90  mbCoherent3DOffset(false),
92  mbCustomVerticalFlip(false),
93  mbCustomText(false),
94  mbIsPlaceholder(false)
95  {}
96  void dump() const;
97 
99 
100  OUString msCnxId;
101  OUString msModelId;
105  OUString msLayoutTypeId;
112 
113  sal_Int32 mnType;
114  sal_Int32 mnMaxChildren;
116  sal_Int32 mnDirection;
118  sal_Int32 mnResizeHandles;
119  sal_Int32 mnCustomAngle;
125  sal_Int32 mnRadiusScale;
126  sal_Int32 mnWidthScale;
127  sal_Int32 mnHeightScale;
128  sal_Int32 mnWidthOverride;
129  sal_Int32 mnHeightOverride;
132 
140 };
141 
142 typedef std::vector< Point > Points;
143 
144 }
145 
147 {
148 public:
149  typedef std::map< OUString, dgm::Point* > PointNameMap;
150  typedef std::map< OUString,
151  std::vector<dgm::Point*> > PointsNameMap;
152  typedef std::map< OUString, const dgm::Connection* > ConnectionNameMap;
154  {
155  OUString msSourceId;
156  sal_Int32 mnDepth = 0;
157  };
159  typedef std::map< OUString,
160  std::map<sal_Int32, SourceIdAndDepth > > StringMap;
161 
162  DiagramData();
163  virtual ~DiagramData() {}
164  void build();
166  { return mpFillProperties; }
168  { return maConnections; }
170  { return maPoints; }
171  StringMap & getPresOfNameMap()
172  { return maPresOfNameMap; }
173  PointNameMap & getPointNameMap()
174  { return maPointNameMap; }
175  PointsNameMap & getPointsPresNameMap()
176  { return maPointsPresNameMap; }
177  ::std::vector<OUString> &getExtDrawings()
178  { return maExtDrawings; }
179  const dgm::Point* getRootPoint() const;
180  void dump() const;
181  OUString getString() const override;
182  std::vector<std::pair<OUString, OUString>> getChildren(const OUString& rParentId) const override;
183  OUString addNode(const OUString& rText) override;
184  bool removeNode(const OUString& rNodeId) override;
185 
186 private:
187  void getChildrenString(OUStringBuffer& rBuf, const dgm::Point* pPoint, sal_Int32 nLevel) const;
188  void addConnection(sal_Int32 nType, const OUString& sSourceId, const OUString& sDestId);
189 
190  ::std::vector<OUString> maExtDrawings;
194  PointNameMap maPointNameMap;
195  PointsNameMap maPointsPresNameMap;
196  ConnectionNameMap maConnectionNameMap;
197  StringMap maPresOfNameMap;
198 };
199 
200 typedef std::shared_ptr< DiagramData > DiagramDataPtr;
201 
202 }
203 
204 #endif
205 
206 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
StringMap & getPresOfNameMap()
Definition: datamodel.hxx:171
std::shared_ptr< FillProperties > FillPropertiesPtr
std::shared_ptr< DiagramData > DiagramDataPtr
Definition: datamodel.hxx:200
FillPropertiesPtr & getFillProperties()
Definition: datamodel.hxx:165
OUString getString() const override
Definition: datamodel.cxx:115
dgm::Points & getPoints()
Definition: datamodel.hxx:169
sal_Int32 mnPercentageNeighbourHeight
Definition: datamodel.hxx:121
std::map< OUString, const dgm::Connection * > ConnectionNameMap
Definition: datamodel.hxx:152
ConnectionNameMap maConnectionNameMap
Definition: datamodel.hxx:196
OUString msPresentationAssociationId
Definition: datamodel.hxx:107
::std::vector< OUString > maExtDrawings
Definition: datamodel.hxx:190
std::map< OUString, dgm::Point * > PointNameMap
Definition: datamodel.hxx:149
bool removeNode(const OUString &rNodeId) override
Definition: datamodel.cxx:220
dgm::Connections maConnections
Definition: datamodel.hxx:192
sal_Int32 mnPercentageNeighbourWidth
Definition: datamodel.hxx:120
std::map< OUString, std::vector< dgm::Point * > > PointsNameMap
Definition: datamodel.hxx:151
::std::vector< OUString > & getExtDrawings()
Definition: datamodel.hxx:177
OUString addNode(const OUString &rText) override
Definition: datamodel.cxx:161
FillPropertiesPtr mpFillProperties
Definition: datamodel.hxx:191
std::vector< Point > Points
Definition: datamodel.hxx:142
dgm::Connections & getConnections()
Definition: datamodel.hxx:167
const dgm::Point * getRootPoint() const
Definition: datamodel.cxx:64
PointsNameMap & getPointsPresNameMap()
Definition: datamodel.hxx:175
std::vector< Connection > Connections
Definition: datamodel.hxx:62
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:160
PointsNameMap maPointsPresNameMap
Definition: datamodel.hxx:195
PointNameMap & getPointNameMap()
Definition: datamodel.hxx:173
OUString msPresentationLayoutStyleLabel
Definition: datamodel.hxx:109
void addConnection(sal_Int32 nType, const OUString &sSourceId, const OUString &sDestId)
Definition: datamodel.cxx:147
OptValue< sal_Int32 > moHierarchyBranch
Definition: datamodel.hxx:117