1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_SHAPEFACTORY_HXX
#define INCLUDED_CHART2_SOURCE_VIEW_INC_SHAPEFACTORY_HXX
#include "PropertyMapper.hxx"
#include <basegfx/range/b2irectangle.hxx>
#include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/awt/Point.hpp>
#include <com/sun/star/drawing/PointSequenceSequence.hpp>
#include <rtl/ustring.hxx>
namespace chart { struct VLineProperties; }
namespace com::sun::star::beans { class XPropertySet; }
namespace com::sun::star::chart2 { class XFormattedString; }
namespace com::sun::star::drawing { class XDrawPage; }
namespace com::sun::star::drawing { class XShape; }
namespace com::sun::star::drawing { class XShapes; }
namespace com::sun::star::drawing { struct HomogenMatrix; }
namespace com::sun::star::drawing { struct PolyPolygonShape3D; }
namespace com::sun::star::drawing { struct Position3D; }
namespace com::sun::star::graphic { class XGraphic; }
namespace com::sun::star::lang { class XMultiServiceFactory; }
namespace com::sun::star::drawing { struct Direction3D; }
namespace chart
{
class Stripe;
// Be careful here not to clash with the SYMBOL_FOO #defines in
// <vcl/vclenum.hxx>
enum SymbolEnum { Symbol_Square=0
, Symbol_Diamond
, Symbol_DownArrow
, Symbol_UpArrow
, Symbol_RightArrow
, Symbol_LeftArrow
, Symbol_Bowtie
, Symbol_Sandglass
, Symbol_Circle
, Symbol_Star
, Symbol_X
, Symbol_Plus
, Symbol_Asterisk
, Symbol_HorizontalBar
, Symbol_VerticalBar
, Symbol_COUNT
};
class ShapeFactory
{
css::uno::Reference< css::lang::XMultiServiceFactory> m_xShapeFactory;
ShapeFactory(css::uno::Reference< css::lang::XMultiServiceFactory> const & xFactory)
{m_xShapeFactory = xFactory;}
public:
enum class StackPosition { Top, Bottom };
static ShapeFactory* getOrCreateShapeFactory(const css::uno::Reference< css::lang::XMultiServiceFactory>& xFactory);
ShapeFactory() = delete;
css::uno::Reference< css::drawing::XShapes >
createGroup2D(
const css::uno::Reference< css::drawing::XShapes >& xTarget
, const OUString& aName = OUString() );
css::uno::Reference< css::drawing::XShapes >
createGroup3D(
const css::uno::Reference< css::drawing::XShapes >& xTarget
, const OUString& aName = OUString() );
css::uno::Reference< css::drawing::XShape >
createCube( const css::uno::Reference< css::drawing::XShapes >& xTarget
, const css::drawing::Position3D& rPosition
, const css::drawing::Direction3D& rSize
, sal_Int32 nRotateZAngleHundredthDegree
, const css::uno::Reference< css::beans::XPropertySet >& xSourceProp
, const tPropertyNameMap& rPropertyNameMap
, bool bRounded = false);
css::uno::Reference< css::drawing::XShape >
createCylinder( const css::uno::Reference< css::drawing::XShapes >& xTarget
, const css::drawing::Position3D& rPosition
, const css::drawing::Direction3D& rSize
, sal_Int32 nRotateZAngleHundredthDegree );
css::uno::Reference< css::drawing::XShape >
createPyramid( const css::uno::Reference< css::drawing::XShapes >& xTarget
, const css::drawing::Position3D& rPosition
, const css::drawing::Direction3D& rSize
, double fTopHeight
, bool bRotateZ
, const css::uno::Reference< css::beans::XPropertySet >& xSourceProp
, const tPropertyNameMap& rPropertyNameMap);
css::uno::Reference< css::drawing::XShape >
createCone( const css::uno::Reference< css::drawing::XShapes >& xTarget
, const css::drawing::Position3D& rPosition
, const css::drawing::Direction3D& rSize
, double fTopHeight, sal_Int32 nRotateZAngleHundredthDegree );
css::uno::Reference< css::drawing::XShape >
createPieSegment2D( const css::uno::Reference< css::drawing::XShapes >& xTarget
, double fUnitCircleStartAngleDegree, double fUnitCircleWidthAngleDegree
, double fUnitCircleInnerRadius, double fUnitCircleOuterRadius
, const css::drawing::Direction3D& rOffset
, const css::drawing::HomogenMatrix& rUnitCircleToScene );
css::uno::Reference< css::drawing::XShape >
createPieSegment( const css::uno::Reference< css::drawing::XShapes >& xTarget
, double fUnitCircleStartAngleDegree, double fUnitCircleWidthAngleDegree
, double fUnitCircleInnerRadius, double fUnitCircleOuterRadius
, const css::drawing::Direction3D& rOffset
, const css::drawing::HomogenMatrix& rUnitCircleToScene
, double fDepth );
css::uno::Reference< css::drawing::XShape >
createStripe( const css::uno::Reference< css::drawing::XShapes >& xTarget
, const Stripe& rStripe
, const css::uno::Reference< css::beans::XPropertySet >& xSourceProp
, const tPropertyNameMap& rPropertyNameMap
, bool bDoubleSided
, short nRotatedTexture = 0 //0 to 7 are the different possibilities
, bool bFlatNormals=true );
css::uno::Reference< css::drawing::XShape >
createArea3D( const css::uno::Reference< css::drawing::XShapes >& xTarget
, const css::drawing::PolyPolygonShape3D& rPolyPolygon
, double fDepth);
css::uno::Reference< css::drawing::XShape >
createArea2D( const css::uno::Reference< css::drawing::XShapes >& xTarget
, const css::drawing::PolyPolygonShape3D& rPolyPolygon);
css::uno::Reference< css::drawing::XShape >
createSymbol2D( const css::uno::Reference< css::drawing::XShapes >& xTarget
, const css::drawing::Position3D& rPos
, const css::drawing::Direction3D& rSize
, sal_Int32 nStandardSymbol
, sal_Int32 nBorderColor
, sal_Int32 nFillColor );
css::uno::Reference< css::drawing::XShape >
createGraphic2D( const css::uno::Reference< css::drawing::XShapes >& xTarget
, const css::drawing::Position3D& rPos
, const css::drawing::Direction3D& rSize
, const css::uno::Reference< css::graphic::XGraphic >& xGraphic );
css::uno::Reference< css::drawing::XShape >
createLine2D( const css::uno::Reference< css::drawing::XShapes >& xTarget
, const css::drawing::PointSequenceSequence& rPoints
, const VLineProperties* pLineProperties = nullptr );
css::uno::Reference< css::drawing::XShape >
createLine ( const css::uno::Reference< css::drawing::XShapes >& xTarget,
const css::awt::Size& rSize, const css::awt::Point& rPosition );
css::uno::Reference< css::drawing::XShape >
createLine3D( const css::uno::Reference< css::drawing::XShapes >& xTarget
, const css::drawing::PolyPolygonShape3D& rPoints
, const VLineProperties& rLineProperties );
css::uno::Reference< css::drawing::XShape >
createCircle2D( const css::uno::Reference< css::drawing::XShapes >& xTarget
, const css::drawing::Position3D& rPos
, const css::drawing::Direction3D& rSize );
css::uno::Reference< css::drawing::XShape >
createCircle( const css::uno::Reference< css::drawing::XShapes >& xTarget
, const css::awt::Size& rSize
, const css::awt::Point& rPosition );
css::uno::Reference< css::drawing::XShape >
createText( const css::uno::Reference< css::drawing::XShapes >& xTarget2D
, const OUString& rText
, const tNameSequence& rPropNames
, const tAnySequence& rPropValues
, const css::uno::Any& rATransformation
);
/** This method creates a text shape made up by a set of paragraphs.
* For each paragraph the related text style is passed to the method.
*
* @param xTarget
* where to append the new created text shape.
*
* @param rTextParagraphs
* the set of paragraphs which made up the text shape.
*
* @param rParaPropNames
* a collection of lists of text property names:
* there must be a list of text property names for each paragraph.
*
* @param rParaPropValues
* a collection of lists of text property values:
* there must be a list of text property values for each paragraph.
*
* @param rPropNames
* a list of text property names to be applied to the whole text shape.
*
* @param rPropValues
* a list of text property values to be applied to the whole text shape.
*
* @param rATransformation
* a transformation to be applied to the text shape as final step.
*
*/
css::uno::Reference< css::drawing::XShape >
createText( const css::uno::Reference< css::drawing::XShapes >& xTarget
, const css::uno::Sequence< OUString >& rTextParagraphs
, const css::uno::Sequence< tNameSequence >& rParaPropNames
, const css::uno::Sequence< tAnySequence >& rParaPropValues
, const tNameSequence& rPropNames
, const tAnySequence& rPropValues
, const css::uno::Any& rATransformation );
css::uno::Reference< css::drawing::XShape >
createText(const css::uno::Reference< css::drawing::XShapes >& xTarget
, css::uno::Sequence< css::uno::Reference< css::chart2::XFormattedString > >& xFormattedString
, const tNameSequence& rPropNames
, const tAnySequence& rPropValues
, const css::uno::Any& rATransformation);
css::uno::Reference< css::drawing::XShape >
createText( const css::uno::Reference< css::drawing::XShapes >& xTarget2D,
const css::awt::Size& rSize,
const css::awt::Point& rPosition,
css::uno::Sequence< css::uno::Reference< css::chart2::XFormattedString > >& xFormattedString,
const css::uno::Reference< css::beans::XPropertySet > & xTextProperties,
double nRotation, const OUString& aName, sal_Int32 nTextMaxWidth );
css::uno::Reference< css::drawing::XShape >
createInvisibleRectangle(
const css::uno::Reference< css::drawing::XShapes >& xTarget
, const css::awt::Size& rSize );
css::uno::Reference< css::drawing::XShape >
createRectangle(
const css::uno::Reference< css::drawing::XShapes >& xTarget,
const css::awt::Size& rSize,
const css::awt::Point& rPosition,
const tNameSequence& rPropNames,
const tAnySequence& rPropValues,
StackPosition ePos = StackPosition::Top );
css::uno::Reference< css::drawing::XShape >
createRectangle(
const css::uno::Reference< css::drawing::XShapes >& xTarget );
css::uno::Reference< css::drawing::XShapes >
getOrCreateChartRootShape( const css::uno::Reference<
css::drawing::XDrawPage>& xPage );
static void setPageSize(const css::uno::Reference<css::drawing::XShapes>& xChartShapes,
const css::awt::Size& rSize);
static css::uno::Reference< css::drawing::XShapes >
getChartRootShape( const css::uno::Reference< css::drawing::XDrawPage>& xPage );
static void makeShapeInvisible( const css::uno::Reference< css::drawing::XShape >& xShape );
static void setShapeName( const css::uno::Reference< css::drawing::XShape >& xShape
, const OUString& rName );
static OUString getShapeName( const css::uno::Reference< css::drawing::XShape >& xShape );
static css::uno::Any makeTransformation( const css::awt::Point& rScreenPosition2D, double fRotationAnglePi=0.0 );
static OUString getStackedString( const OUString& rString, bool bStacked );
static bool hasPolygonAnyLines( css::drawing::PolyPolygonShape3D& rPoly );
static bool isPolygonEmptyOrSinglePoint( css::drawing::PolyPolygonShape3D& rPoly );
static void closePolygon( css::drawing::PolyPolygonShape3D& rPoly );
static css::awt::Size calculateNewSizeRespectingAspectRatio(
const css::awt::Size& rTargetSize
, const css::awt::Size& rSourceSizeWithCorrectAspectRatio );
static css::awt::Point calculateTopLeftPositionToCenterObject(
const css::awt::Point& rTargetAreaPosition
, const css::awt::Size& rTargetAreaSize
, const css::awt::Size& rObjectSize );
static ::basegfx::B2IRectangle getRectangleOfShape(
const css::uno::Reference< css::drawing::XShape >& xShape );
static css::awt::Size getSizeAfterRotation(
const css::uno::Reference< css::drawing::XShape >& xShape, double fRotationAngleDegree );
static void removeSubShapes( const css::uno::Reference< css::drawing::XShapes >& xShapes );
static sal_Int32 getSymbolCount() { return Symbol_COUNT; }
private:
css::uno::Reference< css::drawing::XShape >
impl_createCube( const css::uno::Reference< css::drawing::XShapes >& xTarget
, const css::drawing::Position3D& rPosition
, const css::drawing::Direction3D& rSize, sal_Int32 nRotateZAngleHundredthDegree
, bool bRounded );
css::uno::Reference< css::drawing::XShape >
impl_createConeOrCylinder( const css::uno::Reference< css::drawing::XShapes >& xTarget
, const css::drawing::Position3D& rPosition
, const css::drawing::Direction3D& rSize
, double fTopHeight, sal_Int32 nRotateZAngleHundredthDegree
, bool bCylinder);
};
} //namespace chart
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|