Branch data Line data Source code
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 OOX_DRAWINGML_DIAGRAM_DIAGRAM_HXX
21 : : #define OOX_DRAWINGML_DIAGRAM_DIAGRAM_HXX
22 : :
23 : : #include <map>
24 : : #include <vector>
25 : :
26 : : #include <boost/shared_ptr.hpp>
27 : : #include <boost/enable_shared_from_this.hpp>
28 : :
29 : : #include <rtl/ustring.hxx>
30 : :
31 : : #include "oox/drawingml/shape.hxx"
32 : : #include "oox/drawingml/fillproperties.hxx"
33 : :
34 : : namespace com { namespace sun { namespace star {
35 : : namespace xml { namespace dom { class XDocument; } }
36 : : } } }
37 : :
38 : : namespace oox { namespace drawingml {
39 : :
40 : : namespace dgm {
41 : :
42 : : /** A Connection
43 : : */
44 : 216 : struct Connection
45 : : {
46 : 42 : Connection() :
47 : : mnType( 0 ),
48 : : mnSourceOrder( 0 ),
49 : 42 : mnDestOrder( 0 )
50 : 42 : {}
51 : :
52 : : void dump();
53 : :
54 : : sal_Int32 mnType;
55 : : ::rtl::OUString msModelId;
56 : : ::rtl::OUString msSourceId;
57 : : ::rtl::OUString msDestId;
58 : : ::rtl::OUString msParTransId;
59 : : ::rtl::OUString msPresId;
60 : : ::rtl::OUString msSibTransId;
61 : : sal_Int32 mnSourceOrder;
62 : : sal_Int32 mnDestOrder;
63 : :
64 : : };
65 : :
66 : : typedef std::vector< Connection > Connections;
67 : :
68 : :
69 : : /** A point
70 : : */
71 : 348 : struct Point
72 : : {
73 : 54 : Point() :
74 : : mnType(0),
75 : : mnMaxChildren(-1),
76 : : mnPreferredChildren(-1),
77 : : mnDirection(XML_norm),
78 : : mnHierarchyBranch(XML_std),
79 : : mnResizeHandles(XML_rel),
80 : : mnCustomAngle(-1),
81 : : mnPercentageNeighbourWidth(-1),
82 : : mnPercentageNeighbourHeight(-1),
83 : : mnPercentageOwnWidth(-1),
84 : : mnPercentageOwnHeight(-1),
85 : : mnIncludeAngleScale(-1),
86 : : mnRadiusScale(-1),
87 : : mnWidthScale(-1),
88 : : mnHeightScale(-1),
89 : : mnWidthOverride(-1),
90 : : mnHeightOverride(-1),
91 : : mnLayoutStyleCount(-1),
92 : : mnLayoutStyleIndex(-1),
93 : :
94 : : mbOrgChartEnabled(false),
95 : : mbBulletEnabled(false),
96 : : mbCoherent3DOffset(false),
97 : : mbCustomHorizontalFlip(false),
98 : : mbCustomVerticalFlip(false),
99 : : mbCustomText(false),
100 : 54 : mbIsPlaceholder(false)
101 : 54 : {}
102 : : void dump();
103 : :
104 : : ShapePtr mpShape;
105 : :
106 : : rtl::OUString msCnxId;
107 : : rtl::OUString msModelId;
108 : : rtl::OUString msColorTransformCategoryId;
109 : : rtl::OUString msColorTransformTypeId;
110 : : rtl::OUString msLayoutCategoryId;
111 : : rtl::OUString msLayoutTypeId;
112 : : rtl::OUString msPlaceholderText;
113 : : rtl::OUString msPresentationAssociationId;
114 : : rtl::OUString msPresentationLayoutName;
115 : : rtl::OUString msPresentationLayoutStyleLabel;
116 : : rtl::OUString msQuickStyleCategoryId;
117 : : rtl::OUString msQuickStyleTypeId;
118 : :
119 : : sal_Int32 mnType;
120 : : sal_Int32 mnMaxChildren;
121 : : sal_Int32 mnPreferredChildren;
122 : : sal_Int32 mnDirection;
123 : : sal_Int32 mnHierarchyBranch;
124 : : sal_Int32 mnResizeHandles;
125 : : sal_Int32 mnCustomAngle;
126 : : sal_Int32 mnPercentageNeighbourWidth;
127 : : sal_Int32 mnPercentageNeighbourHeight;
128 : : sal_Int32 mnPercentageOwnWidth;
129 : : sal_Int32 mnPercentageOwnHeight;
130 : : sal_Int32 mnIncludeAngleScale;
131 : : sal_Int32 mnRadiusScale;
132 : : sal_Int32 mnWidthScale;
133 : : sal_Int32 mnHeightScale;
134 : : sal_Int32 mnWidthOverride;
135 : : sal_Int32 mnHeightOverride;
136 : : sal_Int32 mnLayoutStyleCount;
137 : : sal_Int32 mnLayoutStyleIndex;
138 : :
139 : : bool mbOrgChartEnabled;
140 : : bool mbBulletEnabled;
141 : : bool mbCoherent3DOffset;
142 : : bool mbCustomHorizontalFlip;
143 : : bool mbCustomVerticalFlip;
144 : : bool mbCustomText;
145 : : bool mbIsPlaceholder;
146 : : };
147 : :
148 : : typedef std::vector< Point > Points;
149 : :
150 : : }
151 : :
152 : : class LayoutNode;
153 : : typedef boost::shared_ptr< LayoutNode > LayoutNodePtr;
154 : :
155 : : ////////////////////
156 : :
157 [ + - ]: 3 : class DiagramData
158 : : {
159 : : public:
160 : : ::std::vector<rtl::OUString> maExtDrawings;
161 : : typedef std::map< rtl::OUString, dgm::Point* > PointNameMap;
162 : : typedef std::map< rtl::OUString,
163 : : std::vector<dgm::Point*> > PointsNameMap;
164 : : typedef std::map< rtl::OUString, const dgm::Connection* > ConnectionNameMap;
165 : : typedef std::map< rtl::OUString,
166 : : std::vector<std::pair<rtl::OUString,sal_Int32> > > StringMap;
167 : :
168 : : DiagramData();
169 : 0 : FillPropertiesPtr & getFillProperties()
170 : 0 : { return mpFillProperties; }
171 : 21 : dgm::Connections & getConnections()
172 : 21 : { return maConnections; }
173 : 9 : dgm::Points & getPoints()
174 : 9 : { return maPoints; }
175 : 42 : ConnectionNameMap & getConnectionNameMap()
176 : 42 : { return maConnectionNameMap; }
177 : 18 : StringMap & getPresOfNameMap()
178 : 18 : { return maPresOfNameMap; }
179 : 54 : PointNameMap & getPointNameMap()
180 : 54 : { return maPointNameMap; }
181 : 24 : PointsNameMap & getPointsPresNameMap()
182 : 24 : { return maPointsPresNameMap; }
183 : 12 : ::std::vector<rtl::OUString> &getExtDrawings()
184 : 12 : { return maExtDrawings; }
185 : : void dump();
186 : : private:
187 : : FillPropertiesPtr mpFillProperties;
188 : : dgm::Connections maConnections;
189 : : dgm::Points maPoints;
190 : : PointNameMap maPointNameMap;
191 : : PointsNameMap maPointsPresNameMap;
192 : : ConnectionNameMap maConnectionNameMap;
193 : : StringMap maPresOfNameMap;
194 : : };
195 : :
196 : : typedef boost::shared_ptr< DiagramData > DiagramDataPtr;
197 : :
198 : :
199 : :
200 : : ////////////////////
201 : :
202 [ + - ][ + - ]: 6 : class DiagramLayout
[ + - ][ + - ]
[ + - ][ + - ]
203 : : {
204 : : public:
205 : 0 : void setDefStyle( const ::rtl::OUString & sDefStyle )
206 : 0 : { msDefStyle = sDefStyle; }
207 : 0 : void setMinVer( const ::rtl::OUString & sMinVer )
208 : 0 : { msMinVer = sMinVer; }
209 : 0 : void setUniqueId( const ::rtl::OUString & sUniqueId )
210 : 0 : { msUniqueId = sUniqueId; }
211 : : const ::rtl::OUString & getUniqueId()
212 : : { return msUniqueId; }
213 : 0 : void setTitle( const ::rtl::OUString & sTitle )
214 : 0 : { msTitle = sTitle; }
215 : 0 : void setDesc( const ::rtl::OUString & sDesc )
216 : 0 : { msDesc = sDesc; }
217 : :
218 : 3 : LayoutNodePtr & getNode()
219 : 3 : { return mpNode; }
220 : : const LayoutNodePtr & getNode() const
221 : : { return mpNode; }
222 : 0 : DiagramDataPtr & getSampData()
223 : 0 : { return mpSampData; }
224 : : const DiagramDataPtr & getSampData() const
225 : : { return mpSampData; }
226 : 0 : DiagramDataPtr & getStyleData()
227 : 0 : { return mpStyleData; }
228 : : const DiagramDataPtr & getStyleData() const
229 : : { return mpStyleData; }
230 : :
231 : : private:
232 : : ::rtl::OUString msDefStyle;
233 : : ::rtl::OUString msMinVer;
234 : : ::rtl::OUString msUniqueId;
235 : :
236 : : ::rtl::OUString msTitle;
237 : : ::rtl::OUString msDesc;
238 : : LayoutNodePtr mpNode;
239 : : DiagramDataPtr mpSampData;
240 : : DiagramDataPtr mpStyleData;
241 : : // TODO
242 : : // catLst
243 : : // clrData
244 : : };
245 : :
246 : : typedef boost::shared_ptr< DiagramLayout > DiagramLayoutPtr;
247 : :
248 : : ///////////////////////
249 : :
250 [ # # # ]: 0 : struct DiagramStyle
[ # # # ]
[ # # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
251 : : {
252 : : ShapeStyleRef maFillStyle;
253 : : ShapeStyleRef maLineStyle;
254 : : ShapeStyleRef maEffectStyle;
255 : : ShapeStyleRef maTextStyle;
256 : : };
257 : :
258 : : typedef std::map<rtl::OUString,DiagramStyle> DiagramQStyleMap;
259 : :
260 [ # # # ]: 0 : struct DiagramColor
[ # # # ]
[ # # # ]
[ # # # ]
[ # # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
261 : : {
262 : : oox::drawingml::Color maFillColor;
263 : : oox::drawingml::Color maLineColor;
264 : : oox::drawingml::Color maEffectColor;
265 : : oox::drawingml::Color maTextFillColor;
266 : : oox::drawingml::Color maTextLineColor;
267 : : oox::drawingml::Color maTextEffectColor;
268 : : };
269 : :
270 : : typedef std::map<rtl::OUString,DiagramColor> DiagramColorMap;
271 : :
272 : : ///////////////////////
273 : :
274 [ + - ][ + - ]: 6 : class Diagram
[ + - ][ + - ]
[ + - ]
275 : : {
276 : : public:
277 : : void setData( const DiagramDataPtr & );
278 : 162 : DiagramDataPtr getData() const
279 : : {
280 : 162 : return mpData;
281 : : }
282 : : void setLayout( const DiagramLayoutPtr & );
283 : : DiagramLayoutPtr getLayout() const
284 : : {
285 : : return mpLayout;
286 : : }
287 : :
288 : 0 : DiagramQStyleMap& getStyles() { return maStyles; }
289 : 0 : const DiagramQStyleMap& getStyles() const { return maStyles; }
290 : 0 : DiagramColorMap& getColors() { return maColors; }
291 : 0 : const DiagramColorMap& getColors() const { return maColors; }
292 : :
293 : : void addTo( const ShapePtr & pShape );
294 : : private:
295 : : void build( );
296 : : DiagramDataPtr mpData;
297 : : DiagramLayoutPtr mpLayout;
298 : : DiagramQStyleMap maStyles;
299 : : DiagramColorMap maColors;
300 : : std::map< ::rtl::OUString, ShapePtr > maShapeMap;
301 : : };
302 : :
303 : :
304 : : typedef boost::shared_ptr< Diagram > DiagramPtr;
305 : :
306 : : } }
307 : :
308 : : #endif
309 : :
310 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|