LibreOffice Module chart2 (master) 1
ShapeFactory.hxx
Go to the documentation of this file.
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#pragma once
20
21#include "PropertyMapper.hxx"
23#include <com/sun/star/awt/Size.hpp>
24#include <com/sun/star/awt/Point.hpp>
25#include <com/sun/star/drawing/PointSequenceSequence.hpp>
26
27#include <rtl/ref.hxx>
28#include <rtl/ustring.hxx>
29#include <svx/unoshape.hxx>
31#include <svx/unopage.hxx>
32
33namespace chart { struct VLineProperties; }
34namespace com::sun::star::beans { class XPropertySet; }
35namespace com::sun::star::chart2 { class XFormattedString; }
36namespace com::sun::star::drawing { class XShape; }
37namespace com::sun::star::drawing { class XShapes; }
38namespace com::sun::star::drawing { struct HomogenMatrix; }
39namespace com::sun::star::drawing { struct PolyPolygonShape3D; }
40namespace com::sun::star::drawing { struct Position3D; }
41namespace com::sun::star::graphic { class XGraphic; }
42namespace com::sun::star::lang { class XMultiServiceFactory; }
43namespace com::sun::star::drawing { struct Direction3D; }
44
45namespace chart
46{
47class Stripe;
48
49// Be careful here not to clash with the SYMBOL_FOO #defines in
50// <vcl/vclenum.hxx>
67};
68
69
71{
72public:
73 enum class StackPosition { Top, Bottom };
74
75 ShapeFactory() = delete;
76
80 , const OUString& aName = OUString() );
81
84 const rtl::Reference<SvxDrawPage>& xTarget
85 , const OUString& aName = OUString() );
86
90 , const OUString& aName = OUString() );
91
94 , const css::drawing::Position3D& rPosition
95 , const css::drawing::Direction3D& rSize
96 , sal_Int32 nRotateZAngleHundredthDegree
97 , const css::uno::Reference< css::beans::XPropertySet >& xSourceProp
98 , const tPropertyNameMap& rPropertyNameMap
99 , bool bRounded = false);
100
103 , const css::drawing::Position3D& rPosition
104 , const css::drawing::Direction3D& rSize
105 , sal_Int32 nRotateZAngleHundredthDegree );
106
109 , const css::drawing::Position3D& rPosition
110 , const css::drawing::Direction3D& rSize
111 , double fTopHeight
112 , bool bRotateZ
113 , const css::uno::Reference< css::beans::XPropertySet >& xSourceProp
114 , const tPropertyNameMap& rPropertyNameMap);
115
118 , const css::drawing::Position3D& rPosition
119 , const css::drawing::Direction3D& rSize
120 , double fTopHeight, sal_Int32 nRotateZAngleHundredthDegree );
121
124 , double fUnitCircleStartAngleDegree, double fUnitCircleWidthAngleDegree
125 , double fUnitCircleInnerRadius, double fUnitCircleOuterRadius
126 , const css::drawing::Direction3D& rOffset
127 , const css::drawing::HomogenMatrix& rUnitCircleToScene );
128
131 , double fUnitCircleStartAngleDegree, double fUnitCircleWidthAngleDegree
132 , double fUnitCircleInnerRadius, double fUnitCircleOuterRadius
133 , const css::drawing::Direction3D& rOffset
134 , const css::drawing::HomogenMatrix& rUnitCircleToScene
135 , double fDepth );
136
139 , const Stripe& rStripe
140 , const css::uno::Reference< css::beans::XPropertySet >& xSourceProp
141 , const tPropertyNameMap& rPropertyNameMap
142 , bool bDoubleSided
143 , short nRotatedTexture = 0 //0 to 7 are the different possibilities
144 , bool bFlatNormals=true );
145
148 , const std::vector<std::vector<css::drawing::Position3D>>& rPolyPolygon
149 , double fDepth);
150
153 , const std::vector<std::vector<css::drawing::Position3D>>& rPolyPolygon);
154
157 , const css::drawing::Position3D& rPos
158 , const css::drawing::Direction3D& rSize
159 , sal_Int32 nStandardSymbol
160 , sal_Int32 nBorderColor
161 , sal_Int32 nFillColor );
162
165 , const css::drawing::Position3D& rPos
166 , const css::drawing::Direction3D& rSize
167 , const css::uno::Reference< css::graphic::XGraphic >& xGraphic );
168
171 , const css::drawing::PointSequenceSequence& rPoints
172 , const VLineProperties* pLineProperties = nullptr );
175 , const std::vector<std::vector<css::drawing::Position3D>>& rPoints
176 , const VLineProperties* pLineProperties = nullptr );
177
180 const css::awt::Size& rSize, const css::awt::Point& rPosition );
181
184 , const std::vector<std::vector<css::drawing::Position3D>>& rPoints
185 , const VLineProperties& rLineProperties );
186
189 , const css::drawing::Position3D& rPos
190 , const css::drawing::Direction3D& rSize );
191
194 , const css::awt::Size& rSize
195 , const css::awt::Point& rPosition );
196
199 , const OUString& rText
200 , const tNameSequence& rPropNames
201 , const tAnySequence& rPropValues
202 , const css::uno::Any& rATransformation
203 );
204
207 , const css::uno::Sequence< css::uno::Reference< css::chart2::XFormattedString > >& xFormattedString
208 , const tNameSequence& rPropNames
209 , const tAnySequence& rPropValues
210 , const css::uno::Any& rATransformation);
211
214 const css::awt::Size& rSize,
215 const css::awt::Point& rPosition,
216 css::uno::Sequence< css::uno::Reference< css::chart2::XFormattedString > >& xFormattedString,
217 const css::uno::Reference< css::beans::XPropertySet > & xTextProperties,
218 double nRotation, const OUString& aName, sal_Int32 nTextMaxWidth );
219
220 static rtl::Reference<SvxTableShape> createTable(rtl::Reference<SvxShapeGroupAnyD> const& xTarget, OUString const& rName = OUString());
221
225 , const css::awt::Size& rSize );
226
230 const css::awt::Size& rSize,
231 const css::awt::Point& rPosition,
232 const tNameSequence& rPropNames,
233 const tAnySequence& rPropValues,
235
238 const rtl::Reference<SvxShapeGroupAnyD>& xTarget );
239
242
243 static void setPageSize(const rtl::Reference<SvxShapeGroupAnyD>& xChartShapes,
244 const css::awt::Size& rSize);
245
248
249 static void makeShapeInvisible( const rtl::Reference< SvxShape >& rShape );
250
251 static void setShapeName( const rtl::Reference< SvxShape >& xShape
252 , const OUString& rName );
253
254 static OUString getShapeName( const css::uno::Reference< css::drawing::XShape >& xShape );
255
256 static css::uno::Any makeTransformation( const css::awt::Point& rScreenPosition2D, double fRotationAnglePi=0.0 );
257
258 static OUString getStackedString( const OUString& rString, bool bStacked );
259
260 static bool hasPolygonAnyLines( const std::vector<std::vector<css::drawing::Position3D>>& rPoly );
261 static bool isPolygonEmptyOrSinglePoint( const css::drawing::PolyPolygonShape3D& rPoly );
262 static bool isPolygonEmptyOrSinglePoint( const std::vector<std::vector<css::drawing::Position3D>>& rPoly );
263 static void closePolygon( css::drawing::PolyPolygonShape3D& rPoly );
264 static void closePolygon( std::vector<std::vector<css::drawing::Position3D>>& rPoly );
265
266 static css::awt::Size calculateNewSizeRespectingAspectRatio(
267 const css::awt::Size& rTargetSize
268 , const css::awt::Size& rSourceSizeWithCorrectAspectRatio );
269
270 static css::awt::Point calculateTopLeftPositionToCenterObject(
271 const css::awt::Point& rTargetAreaPosition
272 , const css::awt::Size& rTargetAreaSize
273 , const css::awt::Size& rObjectSize );
274
275 static ::basegfx::B2IRectangle getRectangleOfShape( SvxShape& rShape );
276
277 static css::awt::Size getSizeAfterRotation(
278 SvxShape& rShape, double fRotationAngleDegree );
279
280 static void removeSubShapes( const rtl::Reference<SvxShapeGroupAnyD>& xShapes );
281
282 static sal_Int32 getSymbolCount() { return Symbol_COUNT; }
283
284private:
287 , const css::drawing::Position3D& rPosition
288 , const css::drawing::Direction3D& rSize, sal_Int32 nRotateZAngleHundredthDegree
289 , bool bRounded );
290
293 , const css::drawing::Position3D& rPosition
294 , const css::drawing::Direction3D& rSize
295 , double fTopHeight, sal_Int32 nRotateZAngleHundredthDegree
296 , bool bCylinder);
297};
298
299} //namespace chart
300
301/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::chart::ChartAxisLabelPosition ePos
static rtl::Reference< SvxShapeCircle > createCircle2D(const rtl::Reference< SvxShapeGroupAnyD > &xTarget, const css::drawing::Position3D &rPos, const css::drawing::Direction3D &rSize)
static void setShapeName(const rtl::Reference< SvxShape > &xShape, const OUString &rName)
static rtl::Reference< SvxShapePolyPolygon > createPieSegment2D(const rtl::Reference< SvxShapeGroupAnyD > &xTarget, double fUnitCircleStartAngleDegree, double fUnitCircleWidthAngleDegree, double fUnitCircleInnerRadius, double fUnitCircleOuterRadius, const css::drawing::Direction3D &rOffset, const css::drawing::HomogenMatrix &rUnitCircleToScene)
static OUString getStackedString(const OUString &rString, bool bStacked)
static rtl::Reference< Svx3DPolygonObject > createLine3D(const rtl::Reference< SvxShapeGroupAnyD > &xTarget, const std::vector< std::vector< css::drawing::Position3D > > &rPoints, const VLineProperties &rLineProperties)
static rtl::Reference< Svx3DExtrudeObject > createArea3D(const rtl::Reference< SvxShapeGroupAnyD > &xTarget, const std::vector< std::vector< css::drawing::Position3D > > &rPolyPolygon, double fDepth)
static rtl::Reference< SvxTableShape > createTable(rtl::Reference< SvxShapeGroupAnyD > const &xTarget, OUString const &rName=OUString())
static rtl::Reference< SvxShapeGroupAnyD > getOrCreateChartRootShape(const rtl::Reference< SvxDrawPage > &xPage)
static rtl::Reference< Svx3DPolygonObject > createStripe(const rtl::Reference< SvxShapeGroupAnyD > &xTarget, const Stripe &rStripe, const css::uno::Reference< css::beans::XPropertySet > &xSourceProp, const tPropertyNameMap &rPropertyNameMap, bool bDoubleSided, short nRotatedTexture=0, bool bFlatNormals=true)
static void setPageSize(const rtl::Reference< SvxShapeGroupAnyD > &xChartShapes, const css::awt::Size &rSize)
static rtl::Reference< Svx3DLatheObject > impl_createConeOrCylinder(const rtl::Reference< SvxShapeGroupAnyD > &xTarget, const css::drawing::Position3D &rPosition, const css::drawing::Direction3D &rSize, double fTopHeight, sal_Int32 nRotateZAngleHundredthDegree, bool bCylinder)
static rtl::Reference< SvxShapeRect > createRectangle(const rtl::Reference< SvxShapeGroupAnyD > &xTarget, const css::awt::Size &rSize, const css::awt::Point &rPosition, const tNameSequence &rPropNames, const tAnySequence &rPropValues, StackPosition ePos=StackPosition::Top)
static rtl::Reference< Svx3DExtrudeObject > createPieSegment(const rtl::Reference< SvxShapeGroupAnyD > &xTarget, double fUnitCircleStartAngleDegree, double fUnitCircleWidthAngleDegree, double fUnitCircleInnerRadius, double fUnitCircleOuterRadius, const css::drawing::Direction3D &rOffset, const css::drawing::HomogenMatrix &rUnitCircleToScene, double fDepth)
static rtl::Reference< Svx3DSceneObject > createGroup3D(const rtl::Reference< SvxShapeGroupAnyD > &xTarget, const OUString &aName=OUString())
static rtl::Reference< SvxShapePolyPolygon > createLine(const rtl::Reference< SvxShapeGroupAnyD > &xTarget, const css::awt::Size &rSize, const css::awt::Point &rPosition)
static void makeShapeInvisible(const rtl::Reference< SvxShape > &rShape)
static css::awt::Size getSizeAfterRotation(SvxShape &rShape, double fRotationAngleDegree)
static rtl::Reference< SvxShapeRect > createInvisibleRectangle(const rtl::Reference< SvxShapeGroupAnyD > &xTarget, const css::awt::Size &rSize)
static rtl::Reference< SvxShapeText > createText(const rtl::Reference< SvxShapeGroupAnyD > &xTarget, const css::uno::Sequence< css::uno::Reference< css::chart2::XFormattedString > > &xFormattedString, const tNameSequence &rPropNames, const tAnySequence &rPropValues, const css::uno::Any &rATransformation)
static bool hasPolygonAnyLines(const std::vector< std::vector< css::drawing::Position3D > > &rPoly)
static rtl::Reference< SvxShapePolyPolygon > createArea2D(const rtl::Reference< SvxShapeGroupAnyD > &xTarget, const std::vector< std::vector< css::drawing::Position3D > > &rPolyPolygon)
static OUString getShapeName(const css::uno::Reference< css::drawing::XShape > &xShape)
static rtl::Reference< SvxShapeText > createText(const rtl::Reference< SvxShapeGroupAnyD > &xTarget2D, const OUString &rText, const tNameSequence &rPropNames, const tAnySequence &rPropValues, const css::uno::Any &rATransformation)
static rtl::Reference< Svx3DLatheObject > createCone(const rtl::Reference< SvxShapeGroupAnyD > &xTarget, const css::drawing::Position3D &rPosition, const css::drawing::Direction3D &rSize, double fTopHeight, sal_Int32 nRotateZAngleHundredthDegree)
static sal_Int32 getSymbolCount()
static void closePolygon(css::drawing::PolyPolygonShape3D &rPoly)
static bool isPolygonEmptyOrSinglePoint(const css::drawing::PolyPolygonShape3D &rPoly)
static rtl::Reference< SvxShapeText > createText(const rtl::Reference< SvxShapeGroupAnyD > &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)
static void removeSubShapes(const rtl::Reference< SvxShapeGroupAnyD > &xShapes)
static rtl::Reference< SvxShapePolyPolygon > createLine2D(const rtl::Reference< SvxShapeGroupAnyD > &xTarget, const css::drawing::PointSequenceSequence &rPoints, const VLineProperties *pLineProperties=nullptr)
static css::awt::Point calculateTopLeftPositionToCenterObject(const css::awt::Point &rTargetAreaPosition, const css::awt::Size &rTargetAreaSize, const css::awt::Size &rObjectSize)
static rtl::Reference< Svx3DExtrudeObject > impl_createCube(const rtl::Reference< SvxShapeGroupAnyD > &xTarget, const css::drawing::Position3D &rPosition, const css::drawing::Direction3D &rSize, sal_Int32 nRotateZAngleHundredthDegree, bool bRounded)
static rtl::Reference< Svx3DLatheObject > createCylinder(const rtl::Reference< SvxShapeGroupAnyD > &xTarget, const css::drawing::Position3D &rPosition, const css::drawing::Direction3D &rSize, sal_Int32 nRotateZAngleHundredthDegree)
static rtl::Reference< SvxGraphicObject > createGraphic2D(const rtl::Reference< SvxShapeGroupAnyD > &xTarget, const css::drawing::Position3D &rPos, const css::drawing::Direction3D &rSize, const css::uno::Reference< css::graphic::XGraphic > &xGraphic)
static rtl::Reference< SvxShapeGroup > createGroup2D(const rtl::Reference< SvxShapeGroupAnyD > &xTarget, const OUString &aName=OUString())
static rtl::Reference< Svx3DExtrudeObject > createCube(const rtl::Reference< SvxShapeGroupAnyD > &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)
::basegfx::B2IRectangle getRectangleOfShape(SvxShape &rShape)
static css::uno::Any makeTransformation(const css::awt::Point &rScreenPosition2D, double fRotationAnglePi=0.0)
static css::awt::Size calculateNewSizeRespectingAspectRatio(const css::awt::Size &rTargetSize, const css::awt::Size &rSourceSizeWithCorrectAspectRatio)
static rtl::Reference< Svx3DSceneObject > createPyramid(const rtl::Reference< SvxShapeGroupAnyD > &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)
static rtl::Reference< SvxShapeCircle > createCircle(const rtl::Reference< SvxShapeGroupAnyD > &xTarget, const css::awt::Size &rSize, const css::awt::Point &rPosition)
static rtl::Reference< SvxShapePolyPolygon > createSymbol2D(const rtl::Reference< SvxShapeGroupAnyD > &xTarget, const css::drawing::Position3D &rPos, const css::drawing::Direction3D &rSize, sal_Int32 nStandardSymbol, sal_Int32 nBorderColor, sal_Int32 nFillColor)
static rtl::Reference< SvxShapeGroupAnyD > getChartRootShape(const rtl::Reference< SvxDrawPage > &xPage)
A Stripe represents a 2 dimensional foursquare plane in a 3 dimensional room.
Definition: Stripe.hxx:34
@ Symbol_COUNT
@ Symbol_Star
@ Symbol_DownArrow
@ Symbol_Bowtie
@ Symbol_VerticalBar
@ Symbol_Asterisk
@ Symbol_HorizontalBar
@ Symbol_Diamond
@ Symbol_LeftArrow
@ Symbol_Sandglass
@ Symbol_Square
@ Symbol_Plus
@ Symbol_Circle
@ Symbol_RightArrow
@ Symbol_UpArrow
css::uno::Sequence< OUString > tNameSequence
std::unordered_map< OUString, OUString > tPropertyNameMap
css::uno::Sequence< css::uno::Any > tAnySequence
class SAL_NO_VTABLE XPropertySet