Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / oox / source / drawingml / diagram / diagram.hxx
blob2e1429da37b08cbef1455dc3872a2c4db103ecda
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_OOX_SOURCE_DRAWINGML_DIAGRAM_DIAGRAM_HXX
21 #define INCLUDED_OOX_SOURCE_DRAWINGML_DIAGRAM_DIAGRAM_HXX
23 #include <map>
24 #include <memory>
25 #include <vector>
27 #include <rtl/ustring.hxx>
29 #include "oox/drawingml/shape.hxx"
30 #include "drawingml/fillproperties.hxx"
31 #include <oox/token/tokens.hxx>
33 namespace com { namespace sun { namespace star {
34 namespace xml { namespace dom { class XDocument; } }
35 } } }
37 namespace oox { namespace drawingml {
39 namespace dgm {
41 /** A Connection
43 struct Connection
45 Connection() :
46 mnType( 0 ),
47 mnSourceOrder( 0 ),
48 mnDestOrder( 0 )
51 void dump();
53 sal_Int32 mnType;
54 OUString msModelId;
55 OUString msSourceId;
56 OUString msDestId;
57 OUString msParTransId;
58 OUString msPresId;
59 OUString msSibTransId;
60 sal_Int32 mnSourceOrder;
61 sal_Int32 mnDestOrder;
65 typedef std::vector< Connection > Connections;
67 /** A point
69 struct Point
71 Point() :
72 mnType(0),
73 mnMaxChildren(-1),
74 mnPreferredChildren(-1),
75 mnDirection(XML_norm),
76 mnHierarchyBranch(XML_std),
77 mnResizeHandles(XML_rel),
78 mnCustomAngle(-1),
79 mnPercentageNeighbourWidth(-1),
80 mnPercentageNeighbourHeight(-1),
81 mnPercentageOwnWidth(-1),
82 mnPercentageOwnHeight(-1),
83 mnIncludeAngleScale(-1),
84 mnRadiusScale(-1),
85 mnWidthScale(-1),
86 mnHeightScale(-1),
87 mnWidthOverride(-1),
88 mnHeightOverride(-1),
89 mnLayoutStyleCount(-1),
90 mnLayoutStyleIndex(-1),
92 mbOrgChartEnabled(false),
93 mbBulletEnabled(false),
94 mbCoherent3DOffset(false),
95 mbCustomHorizontalFlip(false),
96 mbCustomVerticalFlip(false),
97 mbCustomText(false),
98 mbIsPlaceholder(false)
100 void dump();
102 ShapePtr mpShape;
104 OUString msCnxId;
105 OUString msModelId;
106 OUString msColorTransformCategoryId;
107 OUString msColorTransformTypeId;
108 OUString msLayoutCategoryId;
109 OUString msLayoutTypeId;
110 OUString msPlaceholderText;
111 OUString msPresentationAssociationId;
112 OUString msPresentationLayoutName;
113 OUString msPresentationLayoutStyleLabel;
114 OUString msQuickStyleCategoryId;
115 OUString msQuickStyleTypeId;
117 sal_Int32 mnType;
118 sal_Int32 mnMaxChildren;
119 sal_Int32 mnPreferredChildren;
120 sal_Int32 mnDirection;
121 sal_Int32 mnHierarchyBranch;
122 sal_Int32 mnResizeHandles;
123 sal_Int32 mnCustomAngle;
124 sal_Int32 mnPercentageNeighbourWidth;
125 sal_Int32 mnPercentageNeighbourHeight;
126 sal_Int32 mnPercentageOwnWidth;
127 sal_Int32 mnPercentageOwnHeight;
128 sal_Int32 mnIncludeAngleScale;
129 sal_Int32 mnRadiusScale;
130 sal_Int32 mnWidthScale;
131 sal_Int32 mnHeightScale;
132 sal_Int32 mnWidthOverride;
133 sal_Int32 mnHeightOverride;
134 sal_Int32 mnLayoutStyleCount;
135 sal_Int32 mnLayoutStyleIndex;
137 bool mbOrgChartEnabled;
138 bool mbBulletEnabled;
139 bool mbCoherent3DOffset;
140 bool mbCustomHorizontalFlip;
141 bool mbCustomVerticalFlip;
142 bool mbCustomText;
143 bool mbIsPlaceholder;
146 typedef std::vector< Point > Points;
150 class LayoutNode;
151 typedef std::shared_ptr< LayoutNode > LayoutNodePtr;
153 typedef std::map< OUString, css::uno::Reference<css::xml::dom::XDocument> > DiagramDomMap;
155 class DiagramData
157 public:
158 ::std::vector<OUString> maExtDrawings;
159 typedef std::map< OUString, dgm::Point* > PointNameMap;
160 typedef std::map< OUString,
161 std::vector<dgm::Point*> > PointsNameMap;
162 typedef std::map< OUString, const dgm::Connection* > ConnectionNameMap;
163 typedef std::map< OUString,
164 std::vector<std::pair<OUString,sal_Int32> > > StringMap;
166 DiagramData();
167 FillPropertiesPtr & getFillProperties()
168 { return mpFillProperties; }
169 dgm::Connections & getConnections()
170 { return maConnections; }
171 dgm::Points & getPoints()
172 { return maPoints; }
173 ConnectionNameMap & getConnectionNameMap()
174 { return maConnectionNameMap; }
175 StringMap & getPresOfNameMap()
176 { return maPresOfNameMap; }
177 PointNameMap & getPointNameMap()
178 { return maPointNameMap; }
179 PointsNameMap & getPointsPresNameMap()
180 { return maPointsPresNameMap; }
181 ::std::vector<OUString> &getExtDrawings()
182 { return maExtDrawings; }
183 void dump();
184 private:
185 FillPropertiesPtr mpFillProperties;
186 dgm::Connections maConnections;
187 dgm::Points maPoints;
188 PointNameMap maPointNameMap;
189 PointsNameMap maPointsPresNameMap;
190 ConnectionNameMap maConnectionNameMap;
191 StringMap maPresOfNameMap;
194 typedef std::shared_ptr< DiagramData > DiagramDataPtr;
196 class DiagramLayout
198 public:
199 void setDefStyle( const OUString & sDefStyle )
200 { msDefStyle = sDefStyle; }
201 void setMinVer( const OUString & sMinVer )
202 { msMinVer = sMinVer; }
203 void setUniqueId( const OUString & sUniqueId )
204 { msUniqueId = sUniqueId; }
205 void setTitle( const OUString & sTitle )
206 { msTitle = sTitle; }
207 void setDesc( const OUString & sDesc )
208 { msDesc = sDesc; }
209 LayoutNodePtr & getNode()
210 { return mpNode; }
211 const LayoutNodePtr & getNode() const
212 { return mpNode; }
213 DiagramDataPtr & getSampData()
214 { return mpSampData; }
215 const DiagramDataPtr & getSampData() const
216 { return mpSampData; }
217 DiagramDataPtr & getStyleData()
218 { return mpStyleData; }
219 const DiagramDataPtr & getStyleData() const
220 { return mpStyleData; }
222 private:
223 OUString msDefStyle;
224 OUString msMinVer;
225 OUString msUniqueId;
227 OUString msTitle;
228 OUString msDesc;
229 LayoutNodePtr mpNode;
230 DiagramDataPtr mpSampData;
231 DiagramDataPtr mpStyleData;
232 // TODO
233 // catLst
234 // clrData
237 typedef std::shared_ptr< DiagramLayout > DiagramLayoutPtr;
239 struct DiagramStyle
241 ShapeStyleRef maFillStyle;
242 ShapeStyleRef maLineStyle;
243 ShapeStyleRef maEffectStyle;
244 ShapeStyleRef maTextStyle;
247 typedef std::map<OUString,DiagramStyle> DiagramQStyleMap;
249 struct DiagramColor
251 oox::drawingml::Color maFillColor;
252 oox::drawingml::Color maLineColor;
253 oox::drawingml::Color maEffectColor;
254 oox::drawingml::Color maTextFillColor;
255 oox::drawingml::Color maTextLineColor;
256 oox::drawingml::Color maTextEffectColor;
259 typedef std::map<OUString,DiagramColor> DiagramColorMap;
261 class Diagram
263 public:
264 void setData( const DiagramDataPtr & );
265 const DiagramDataPtr& getData() const
267 return mpData;
269 void setLayout( const DiagramLayoutPtr & );
271 DiagramQStyleMap& getStyles() { return maStyles; }
272 const DiagramQStyleMap& getStyles() const { return maStyles; }
273 DiagramColorMap& getColors() { return maColors; }
274 const DiagramColorMap& getColors() const { return maColors; }
275 DiagramDomMap & getDomMap() { return maMainDomMap; }
276 css::uno::Sequence< css::uno::Sequence< css::uno::Any > > & getDataRelsMap() { return maDataRelsMap; }
277 void addTo( const ShapePtr & pShape );
279 css::uno::Sequence<css::beans::PropertyValue> getDomsAsPropertyValues() const;
280 private:
281 void build( );
282 DiagramDataPtr mpData;
283 DiagramLayoutPtr mpLayout;
284 DiagramQStyleMap maStyles;
285 DiagramColorMap maColors;
286 DiagramDomMap maMainDomMap;
287 css::uno::Sequence< css::uno::Sequence< css::uno::Any > > maDataRelsMap;
290 typedef std::shared_ptr< Diagram > DiagramPtr;
294 #endif
296 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */