fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / oox / source / drawingml / diagram / diagram.hxx
blob9ef921516c730ed5f39269212d9f5ff9dde4d651
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 <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"
33 #include <oox/token/tokens.hxx>
35 namespace com { namespace sun { namespace star {
36 namespace xml { namespace dom { class XDocument; } }
37 } } }
39 namespace oox { namespace drawingml {
41 namespace dgm {
43 /** A Connection
45 struct Connection
47 Connection() :
48 mnType( 0 ),
49 mnSourceOrder( 0 ),
50 mnDestOrder( 0 )
53 void dump();
55 sal_Int32 mnType;
56 OUString msModelId;
57 OUString msSourceId;
58 OUString msDestId;
59 OUString msParTransId;
60 OUString msPresId;
61 OUString msSibTransId;
62 sal_Int32 mnSourceOrder;
63 sal_Int32 mnDestOrder;
67 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 typedef std::map< OUString, css::uno::Reference<css::xml::dom::XDocument> > DiagramDomMap;
156 typedef css::uno::Sequence< css::uno::Sequence< css::uno::Any > > DiagramRelsMap;
158 class DiagramData
160 public:
161 ::std::vector<OUString> maExtDrawings;
162 typedef std::map< OUString, dgm::Point* > PointNameMap;
163 typedef std::map< OUString,
164 std::vector<dgm::Point*> > PointsNameMap;
165 typedef std::map< OUString, const dgm::Connection* > ConnectionNameMap;
166 typedef std::map< OUString,
167 std::vector<std::pair<OUString,sal_Int32> > > StringMap;
169 DiagramData();
170 FillPropertiesPtr & getFillProperties()
171 { return mpFillProperties; }
172 dgm::Connections & getConnections()
173 { return maConnections; }
174 dgm::Points & getPoints()
175 { return maPoints; }
176 ConnectionNameMap & getConnectionNameMap()
177 { return maConnectionNameMap; }
178 StringMap & getPresOfNameMap()
179 { return maPresOfNameMap; }
180 PointNameMap & getPointNameMap()
181 { return maPointNameMap; }
182 PointsNameMap & getPointsPresNameMap()
183 { return maPointsPresNameMap; }
184 ::std::vector<OUString> &getExtDrawings()
185 { return maExtDrawings; }
186 void dump();
187 private:
188 FillPropertiesPtr mpFillProperties;
189 dgm::Connections maConnections;
190 dgm::Points maPoints;
191 PointNameMap maPointNameMap;
192 PointsNameMap maPointsPresNameMap;
193 ConnectionNameMap maConnectionNameMap;
194 StringMap maPresOfNameMap;
197 typedef boost::shared_ptr< DiagramData > DiagramDataPtr;
199 class DiagramLayout
201 public:
202 void setDefStyle( const OUString & sDefStyle )
203 { msDefStyle = sDefStyle; }
204 void setMinVer( const OUString & sMinVer )
205 { msMinVer = sMinVer; }
206 void setUniqueId( const OUString & sUniqueId )
207 { msUniqueId = sUniqueId; }
208 const OUString & getUniqueId()
209 { return msUniqueId; }
210 void setTitle( const OUString & sTitle )
211 { msTitle = sTitle; }
212 void setDesc( const OUString & sDesc )
213 { msDesc = sDesc; }
215 LayoutNodePtr & getNode()
216 { return mpNode; }
217 const LayoutNodePtr & getNode() const
218 { return mpNode; }
219 DiagramDataPtr & getSampData()
220 { return mpSampData; }
221 const DiagramDataPtr & getSampData() const
222 { return mpSampData; }
223 DiagramDataPtr & getStyleData()
224 { return mpStyleData; }
225 const DiagramDataPtr & getStyleData() const
226 { return mpStyleData; }
228 private:
229 OUString msDefStyle;
230 OUString msMinVer;
231 OUString msUniqueId;
233 OUString msTitle;
234 OUString msDesc;
235 LayoutNodePtr mpNode;
236 DiagramDataPtr mpSampData;
237 DiagramDataPtr mpStyleData;
238 // TODO
239 // catLst
240 // clrData
243 typedef boost::shared_ptr< DiagramLayout > DiagramLayoutPtr;
245 struct DiagramStyle
247 ShapeStyleRef maFillStyle;
248 ShapeStyleRef maLineStyle;
249 ShapeStyleRef maEffectStyle;
250 ShapeStyleRef maTextStyle;
253 typedef std::map<OUString,DiagramStyle> DiagramQStyleMap;
255 struct DiagramColor
257 oox::drawingml::Color maFillColor;
258 oox::drawingml::Color maLineColor;
259 oox::drawingml::Color maEffectColor;
260 oox::drawingml::Color maTextFillColor;
261 oox::drawingml::Color maTextLineColor;
262 oox::drawingml::Color maTextEffectColor;
265 typedef std::map<OUString,DiagramColor> DiagramColorMap;
267 class Diagram
269 public:
270 void setData( const DiagramDataPtr & );
271 DiagramDataPtr getData() const
273 return mpData;
275 void setLayout( const DiagramLayoutPtr & );
276 DiagramLayoutPtr getLayout() const
278 return mpLayout;
281 DiagramQStyleMap& getStyles() { return maStyles; }
282 const DiagramQStyleMap& getStyles() const { return maStyles; }
283 DiagramColorMap& getColors() { return maColors; }
284 const DiagramColorMap& getColors() const { return maColors; }
285 DiagramDomMap & getDomMap() { return maMainDomMap; }
286 DiagramRelsMap & getDataRelsMap() { return maDataRelsMap; }
287 void addTo( const ShapePtr & pShape );
289 css::uno::Sequence<css::beans::PropertyValue> getDomsAsPropertyValues() const;
290 private:
291 void build( );
292 DiagramDataPtr mpData;
293 DiagramLayoutPtr mpLayout;
294 DiagramQStyleMap maStyles;
295 DiagramColorMap maColors;
296 std::map< OUString, ShapePtr > maShapeMap;
297 DiagramDomMap maMainDomMap;
298 DiagramRelsMap maDataRelsMap;
301 typedef boost::shared_ptr< Diagram > DiagramPtr;
305 #endif
307 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */