fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / oox / source / drawingml / diagram / diagram.hxx
blob93e810472c7e948971eac49242a19e8f2e631904
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 OOX_DRAWINGML_DIAGRAM_DIAGRAM_HXX
21 #define OOX_DRAWINGML_DIAGRAM_DIAGRAM_HXX
23 #include <map>
24 #include <vector>
26 #include <boost/shared_ptr.hpp>
27 #include <boost/enable_shared_from_this.hpp>
29 #include <rtl/ustring.hxx>
31 #include "oox/drawingml/shape.hxx"
32 #include "oox/drawingml/fillproperties.hxx"
34 namespace com { namespace sun { namespace star {
35 namespace xml { namespace dom { class XDocument; } }
36 } } }
38 namespace oox { namespace drawingml {
40 namespace dgm {
42 /** A Connection
44 struct Connection
46 Connection() :
47 mnType( 0 ),
48 mnSourceOrder( 0 ),
49 mnDestOrder( 0 )
52 void dump();
54 sal_Int32 mnType;
55 OUString msModelId;
56 OUString msSourceId;
57 OUString msDestId;
58 OUString msParTransId;
59 OUString msPresId;
60 OUString msSibTransId;
61 sal_Int32 mnSourceOrder;
62 sal_Int32 mnDestOrder;
66 typedef std::vector< Connection > Connections;
69 /** A point
71 struct Point
73 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),
94 mbOrgChartEnabled(false),
95 mbBulletEnabled(false),
96 mbCoherent3DOffset(false),
97 mbCustomHorizontalFlip(false),
98 mbCustomVerticalFlip(false),
99 mbCustomText(false),
100 mbIsPlaceholder(false)
102 void dump();
104 ShapePtr mpShape;
106 OUString msCnxId;
107 OUString msModelId;
108 OUString msColorTransformCategoryId;
109 OUString msColorTransformTypeId;
110 OUString msLayoutCategoryId;
111 OUString msLayoutTypeId;
112 OUString msPlaceholderText;
113 OUString msPresentationAssociationId;
114 OUString msPresentationLayoutName;
115 OUString msPresentationLayoutStyleLabel;
116 OUString msQuickStyleCategoryId;
117 OUString msQuickStyleTypeId;
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;
139 bool mbOrgChartEnabled;
140 bool mbBulletEnabled;
141 bool mbCoherent3DOffset;
142 bool mbCustomHorizontalFlip;
143 bool mbCustomVerticalFlip;
144 bool mbCustomText;
145 bool mbIsPlaceholder;
148 typedef std::vector< Point > Points;
152 class LayoutNode;
153 typedef boost::shared_ptr< LayoutNode > LayoutNodePtr;
155 ////////////////////
157 class DiagramData
159 public:
160 ::std::vector<OUString> maExtDrawings;
161 typedef std::map< OUString, dgm::Point* > PointNameMap;
162 typedef std::map< OUString,
163 std::vector<dgm::Point*> > PointsNameMap;
164 typedef std::map< OUString, const dgm::Connection* > ConnectionNameMap;
165 typedef std::map< OUString,
166 std::vector<std::pair<OUString,sal_Int32> > > StringMap;
168 DiagramData();
169 FillPropertiesPtr & getFillProperties()
170 { return mpFillProperties; }
171 dgm::Connections & getConnections()
172 { return maConnections; }
173 dgm::Points & getPoints()
174 { return maPoints; }
175 ConnectionNameMap & getConnectionNameMap()
176 { return maConnectionNameMap; }
177 StringMap & getPresOfNameMap()
178 { return maPresOfNameMap; }
179 PointNameMap & getPointNameMap()
180 { return maPointNameMap; }
181 PointsNameMap & getPointsPresNameMap()
182 { return maPointsPresNameMap; }
183 ::std::vector<OUString> &getExtDrawings()
184 { 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;
196 typedef boost::shared_ptr< DiagramData > DiagramDataPtr;
200 ////////////////////
202 class DiagramLayout
204 public:
205 void setDefStyle( const OUString & sDefStyle )
206 { msDefStyle = sDefStyle; }
207 void setMinVer( const OUString & sMinVer )
208 { msMinVer = sMinVer; }
209 void setUniqueId( const OUString & sUniqueId )
210 { msUniqueId = sUniqueId; }
211 const OUString & getUniqueId()
212 { return msUniqueId; }
213 void setTitle( const OUString & sTitle )
214 { msTitle = sTitle; }
215 void setDesc( const OUString & sDesc )
216 { msDesc = sDesc; }
218 LayoutNodePtr & getNode()
219 { return mpNode; }
220 const LayoutNodePtr & getNode() const
221 { return mpNode; }
222 DiagramDataPtr & getSampData()
223 { return mpSampData; }
224 const DiagramDataPtr & getSampData() const
225 { return mpSampData; }
226 DiagramDataPtr & getStyleData()
227 { return mpStyleData; }
228 const DiagramDataPtr & getStyleData() const
229 { return mpStyleData; }
231 private:
232 OUString msDefStyle;
233 OUString msMinVer;
234 OUString msUniqueId;
236 OUString msTitle;
237 OUString msDesc;
238 LayoutNodePtr mpNode;
239 DiagramDataPtr mpSampData;
240 DiagramDataPtr mpStyleData;
241 // TODO
242 // catLst
243 // clrData
246 typedef boost::shared_ptr< DiagramLayout > DiagramLayoutPtr;
248 ///////////////////////
250 struct DiagramStyle
252 ShapeStyleRef maFillStyle;
253 ShapeStyleRef maLineStyle;
254 ShapeStyleRef maEffectStyle;
255 ShapeStyleRef maTextStyle;
258 typedef std::map<OUString,DiagramStyle> DiagramQStyleMap;
260 struct DiagramColor
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;
270 typedef std::map<OUString,DiagramColor> DiagramColorMap;
272 ///////////////////////
274 class Diagram
276 public:
277 void setData( const DiagramDataPtr & );
278 DiagramDataPtr getData() const
280 return mpData;
282 void setLayout( const DiagramLayoutPtr & );
283 DiagramLayoutPtr getLayout() const
285 return mpLayout;
288 DiagramQStyleMap& getStyles() { return maStyles; }
289 const DiagramQStyleMap& getStyles() const { return maStyles; }
290 DiagramColorMap& getColors() { return maColors; }
291 const DiagramColorMap& getColors() const { return maColors; }
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< OUString, ShapePtr > maShapeMap;
304 typedef boost::shared_ptr< Diagram > DiagramPtr;
308 #endif
310 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */