fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / chart2 / source / view / inc / AbstractShapeFactory.hxx
blob020777dbb2bb1bd87734190e5edbdbdcdac05577
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/.
8 */
10 #ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_ABSTRACTSHAPEFACTORY_HXX
11 #define INCLUDED_CHART2_SOURCE_VIEW_INC_ABSTRACTSHAPEFACTORY_HXX
13 #include "PropertyMapper.hxx"
14 #include "VLineProperties.hxx"
15 #include "BaseGFXHelper.hxx"
16 #include <com/sun/star/awt/Size.hpp>
17 #include <com/sun/star/awt/Point.hpp>
18 #include <com/sun/star/beans/XPropertySet.hpp>
19 #include <com/sun/star/chart2/XFormattedString.hpp>
20 #include <com/sun/star/drawing/Direction3D.hpp>
21 #include <com/sun/star/drawing/HomogenMatrix.hpp>
22 #include <com/sun/star/drawing/PointSequenceSequence.hpp>
23 #include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
24 #include <com/sun/star/drawing/Position3D.hpp>
25 #include <com/sun/star/drawing/XDrawPage.hpp>
26 #include <com/sun/star/drawing/XShapes2.hpp>
27 #include <com/sun/star/graphic/XGraphic.hpp>
28 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
30 #include <rtl/ustring.hxx>
32 class OpenGLWindow;
34 namespace chart {
36 // Be careful here not to clash with the SYMBOL_FOO #defines in
37 // <rsc/rsc-vcl-shared-types.hxx>
38 enum SymbolEnum { Symbol_Square=0
39 , Symbol_Diamond
40 , Symbol_DownArrow
41 , Symbol_UpArrow
42 , Symbol_RightArrow
43 , Symbol_LeftArrow
44 , Symbol_Bowtie
45 , Symbol_Sandglass
46 , Symbol_Circle
47 , Symbol_Star
48 , Symbol_X
49 , Symbol_Plus
50 , Symbol_Asterisk
51 , Symbol_HorizontalBar
52 , Symbol_VerticalBar
53 , Symbol_COUNT
56 class Stripe;
58 class AbstractShapeFactory
60 protected:
62 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>
63 m_xShapeFactory;
64 public:
66 enum StackPosition { Top, Bottom };
67 void setShapeFactory(com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory> xFactory)
68 { m_xShapeFactory = xFactory; }
70 static AbstractShapeFactory* getOrCreateShapeFactory(::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory> xFactory);
72 virtual ~AbstractShapeFactory() {};
74 virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
75 createGroup2D(
76 const ::com::sun::star::uno::Reference<
77 ::com::sun::star::drawing::XShapes >& xTarget
78 , const OUString& aName = OUString() ) = 0;
80 virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
81 createGroup3D(
82 const ::com::sun::star::uno::Reference<
83 ::com::sun::star::drawing::XShapes >& xTarget
84 , const OUString& aName = OUString() ) = 0;
86 virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
87 createCube( const ::com::sun::star::uno::Reference<
88 ::com::sun::star::drawing::XShapes >& xTarget
89 , const ::com::sun::star::drawing::Position3D& rPosition
90 , const ::com::sun::star::drawing::Direction3D& rSize
91 , sal_Int32 nRotateZAngleHundredthDegree
92 , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSourceProp
93 , const tPropertyNameMap& rPropertyNameMap
94 , bool bRounded = false) = 0;
96 virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
97 createCylinder( const ::com::sun::star::uno::Reference<
98 ::com::sun::star::drawing::XShapes >& xTarget
99 , const ::com::sun::star::drawing::Position3D& rPosition
100 , const ::com::sun::star::drawing::Direction3D& rSize
101 , sal_Int32 nRotateZAngleHundredthDegree ) = 0;
103 virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
104 createPyramid( const ::com::sun::star::uno::Reference<
105 ::com::sun::star::drawing::XShapes >& xTarget
106 , const ::com::sun::star::drawing::Position3D& rPosition
107 , const ::com::sun::star::drawing::Direction3D& rSize
108 , double fTopHeight
109 , bool bRotateZ
110 , const ::com::sun::star::uno::Reference<
111 ::com::sun::star::beans::XPropertySet >& xSourceProp
112 , const tPropertyNameMap& rPropertyNameMap) = 0;
114 virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
115 createCone( const ::com::sun::star::uno::Reference<
116 ::com::sun::star::drawing::XShapes >& xTarget
117 , const ::com::sun::star::drawing::Position3D& rPosition
118 , const ::com::sun::star::drawing::Direction3D& rSize
119 , double fTopHeight, sal_Int32 nRotateZAngleHundredthDegree ) = 0;
121 virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
122 createPieSegment2D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
123 , double fUnitCircleStartAngleDegree, double fUnitCircleWidthAngleDegree
124 , double fUnitCircleInnerRadius, double fUnitCircleOuterRadius
125 , const ::com::sun::star::drawing::Direction3D& rOffset
126 , const ::com::sun::star::drawing::HomogenMatrix& rUnitCircleToScene ) = 0;
128 virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
129 createPieSegment( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
130 , double fUnitCircleStartAngleDegree, double fUnitCircleWidthAngleDegree
131 , double fUnitCircleInnerRadius, double fUnitCircleOuterRadius
132 , const ::com::sun::star::drawing::Direction3D& rOffset
133 , const ::com::sun::star::drawing::HomogenMatrix& rUnitCircleToScene
134 , double fDepth ) = 0;
136 virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
137 createStripe( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
138 , const Stripe& rStripe
139 , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSourceProp
140 , const tPropertyNameMap& rPropertyNameMap
141 , bool bDoubleSided = true
142 , short nRotatedTexture = 0 //0 to 7 are the different possibilities
143 , bool bFlatNormals=true ) = 0;
145 virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
146 createArea3D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
147 , const ::com::sun::star::drawing::PolyPolygonShape3D& rPolyPolygon
148 , double fDepth) = 0;
150 virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
151 createArea2D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
152 , const ::com::sun::star::drawing::PolyPolygonShape3D& rPolyPolygon) = 0;
154 static sal_Int32 getSymbolCount() { return Symbol_COUNT; }
156 virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
157 createSymbol2D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
158 , const ::com::sun::star::drawing::Position3D& rPos
159 , const ::com::sun::star::drawing::Direction3D& rSize
160 , sal_Int32 nStandardSymbol
161 , sal_Int32 nBorderColor=0
162 , sal_Int32 nFillColor=0 ) = 0;
164 virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
165 createGraphic2D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
166 , const ::com::sun::star::drawing::Position3D& rPos
167 , const ::com::sun::star::drawing::Direction3D& rSize
168 , const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& xGraphic ) = 0;
170 virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
171 createLine2D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
172 , const ::com::sun::star::drawing::PointSequenceSequence& rPoints
173 , const VLineProperties* pLineProperties = NULL ) = 0;
175 virtual com::sun::star::uno::Reference< com::sun::star::drawing::XShape >
176 createLine ( const ::com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& xTarget,
177 const com::sun::star::awt::Size& rSize, const com::sun::star::awt::Point& rPosition ) = 0;
179 virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
180 createLine3D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
181 , const ::com::sun::star::drawing::PolyPolygonShape3D& rPoints
182 , const VLineProperties& rLineProperties ) = 0;
184 virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
185 createCircle2D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
186 , const ::com::sun::star::drawing::Position3D& rPos
187 , const ::com::sun::star::drawing::Direction3D& rSize ) = 0;
189 virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
190 createCircle( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
191 , const ::com::sun::star::awt::Size& rSize
192 , const ::com::sun::star::awt::Point& rPosition ) = 0;
194 virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
195 createText( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget2D
196 , const OUString& rText
197 , const tNameSequence& rPropNames
198 , const tAnySequence& rPropValues
199 , const ::com::sun::star::uno::Any& rATransformation
200 ) = 0;
202 virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
203 createText( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget2D,
204 const com::sun::star::awt::Size& rSize,
205 const com::sun::star::awt::Point& rPosition,
206 com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::chart2::XFormattedString > >& xFormattedString,
207 const com::sun::star::uno::Reference<
208 com::sun::star::beans::XPropertySet > & xTextProperties,
209 double nRotation, const OUString& aName ) = 0;
211 virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
212 createInvisibleRectangle(
213 const ::com::sun::star::uno::Reference<
214 ::com::sun::star::drawing::XShapes >& xTarget
215 , const ::com::sun::star::awt::Size& rSize ) = 0;
217 virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
218 createRectangle(
219 const com::sun::star::uno::Reference<
220 com::sun::star::drawing::XShapes >& xTarget,
221 const com::sun::star::awt::Size& rSize,
222 const com::sun::star::awt::Point& rPosition,
223 const tNameSequence& rPropNames,
224 const tAnySequence& rPropValues,
225 StackPosition ePos = Top ) = 0;
227 virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
228 createRectangle(
229 const ::com::sun::star::uno::Reference<
230 ::com::sun::star::drawing::XShapes >& xTarget ) = 0;
232 virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
233 getOrCreateChartRootShape( const ::com::sun::star::uno::Reference<
234 ::com::sun::star::drawing::XDrawPage>& xPage ) = 0;
236 virtual void setPageSize( com::sun::star::uno::Reference < com::sun::star::drawing::XShapes > xChartShapes, const com::sun::star::awt::Size& rSize ) = 0;
239 * Only necessary for stateless implementations
241 virtual void render(com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > xRootShape, bool bInitOpenGL = true) = 0;
243 virtual bool preRender(com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > xRootShape, OpenGLWindow* pWindow) = 0;
244 virtual void postRender(OpenGLWindow* pWindow) = 0;
246 virtual void clearPage(com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > xRootShape) = 0;
248 static ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
249 getChartRootShape( const ::com::sun::star::uno::Reference<
250 ::com::sun::star::drawing::XDrawPage>& xPage );
252 static void makeShapeInvisible( const ::com::sun::star::uno::Reference<
253 ::com::sun::star::drawing::XShape >& xShape );
255 static void setShapeName( const ::com::sun::star::uno::Reference<
256 ::com::sun::star::drawing::XShape >& xShape
257 , const OUString& rName );
259 static OUString getShapeName( const ::com::sun::star::uno::Reference<
260 ::com::sun::star::drawing::XShape >& xShape );
262 static ::com::sun::star::uno::Any makeTransformation( const ::com::sun::star::awt::Point& rScreenPosition2D, double fRotationAnglePi=0.0 );
264 static OUString getStackedString( const OUString& rString, bool bStacked=true );
266 static bool hasPolygonAnyLines( ::com::sun::star::drawing::PolyPolygonShape3D& rPoly );
267 static bool isPolygonEmptyOrSinglePoint( ::com::sun::star::drawing::PolyPolygonShape3D& rPoly );
268 static void closePolygon( ::com::sun::star::drawing::PolyPolygonShape3D& rPoly );
270 static ::com::sun::star::awt::Size calculateNewSizeRespectingAspectRatio(
271 const ::com::sun::star::awt::Size& rTargetSize
272 , const ::com::sun::star::awt::Size& rSourceSizeWithCorrectAspectRatio );
274 static ::com::sun::star::awt::Point calculateTopLeftPositionToCenterObject(
275 const ::com::sun::star::awt::Point& rTargetAreaPosition
276 , const ::com::sun::star::awt::Size& rTargetAreaSize
277 , const ::com::sun::star::awt::Size& rObjectSize );
279 static ::basegfx::B2IRectangle getRectangleOfShape(
280 const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape );
282 static ::com::sun::star::awt::Size getSizeAfterRotation(
283 const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape, double fRotationAngleDegree );
285 static void removeSubShapes( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xShapes );
291 #endif
293 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */