Line data Source code
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 :
20 : #ifndef INCLUDED_SVX_LATHE3D_HXX
21 : #define INCLUDED_SVX_LATHE3D_HXX
22 :
23 : #include <svx/obj3d.hxx>
24 : #include <svx/svxdllapi.h>
25 :
26 : /*************************************************************************
27 : |*
28 : |* Create a 3D rotation object from a passed 2D polygon
29 : |*
30 : |* The aPolyPoly3D is rotated around its axis in nHSegments steps.
31 : |* nVSegments contains the number of lines of aPolyPoly3D and therefore
32 : |* is effectively a vertical segmentation.
33 : |*
34 : \************************************************************************/
35 :
36 504 : class SVX_DLLPUBLIC E3dLatheObj : public E3dCompoundObject
37 : {
38 : private:
39 : // Part codes for Wireframe generation: standard oder cover surface
40 : enum { LATHE_PART_STD = 1, LATHE_PART_COVER = 2 };
41 : basegfx::B2DPolyPolygon maPolyPoly2D;
42 :
43 : protected:
44 : virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() SAL_OVERRIDE;
45 : virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties() SAL_OVERRIDE;
46 : void SetDefaultAttributes(E3dDefaultAttributes& rDefault);
47 :
48 : public:
49 : TYPEINFO_OVERRIDE();
50 : E3dLatheObj(E3dDefaultAttributes& rDefault, const basegfx::B2DPolyPolygon& rPoly2D);
51 : E3dLatheObj();
52 :
53 : // HorizontalSegments:
54 564 : sal_uInt32 GetHorizontalSegments() const
55 564 : { return static_cast<const SfxUInt32Item&>(GetObjectItemSet().Get(SDRATTR_3DOBJ_HORZ_SEGS)).GetValue(); }
56 :
57 : // VerticalSegments:
58 1068 : sal_uInt32 GetVerticalSegments() const
59 1068 : { return static_cast<const SfxUInt32Item&>(GetObjectItemSet().Get(SDRATTR_3DOBJ_VERT_SEGS)).GetValue(); }
60 :
61 : // PercentDiagonal: 0..100, before 0.0..0.5
62 564 : sal_uInt16 GetPercentDiagonal() const
63 564 : { return static_cast<const SfxUInt16Item&>(GetObjectItemSet().Get(SDRATTR_3DOBJ_PERCENT_DIAGONAL)).GetValue(); }
64 :
65 : // BackScale: 0..100, before 0.0..1.0
66 564 : sal_uInt16 GetBackScale() const
67 564 : { return static_cast<const SfxUInt16Item&>(GetObjectItemSet().Get(SDRATTR_3DOBJ_BACKSCALE)).GetValue(); }
68 :
69 : // EndAngle: 0..10000
70 564 : sal_uInt32 GetEndAngle() const
71 564 : { return static_cast<const SfxUInt32Item&>(GetObjectItemSet().Get(SDRATTR_3DOBJ_END_ANGLE)).GetValue(); }
72 :
73 : // #107245# GetSmoothNormals() for bLatheSmoothed
74 564 : bool GetSmoothNormals() const
75 564 : { return static_cast<const Svx3DSmoothNormalsItem&>(GetObjectItemSet().Get(SDRATTR_3DOBJ_SMOOTH_NORMALS)).GetValue(); }
76 :
77 : // #107245# GetSmoothLids() for bLatheSmoothFrontBack
78 564 : bool GetSmoothLids() const
79 564 : { return static_cast<const Svx3DSmoothLidsItem&>(GetObjectItemSet().Get(SDRATTR_3DOBJ_SMOOTH_LIDS)).GetValue(); }
80 :
81 : // #107245# GetCharacterMode() for bLatheCharacterMode
82 564 : bool GetCharacterMode() const
83 564 : { return static_cast<const Svx3DCharacterModeItem&>(GetObjectItemSet().Get(SDRATTR_3DOBJ_CHARACTER_MODE)).GetValue(); }
84 :
85 : // #107245# GetCloseFront() for bLatheCloseFront
86 564 : bool GetCloseFront() const
87 564 : { return static_cast<const Svx3DCloseFrontItem&>(GetObjectItemSet().Get(SDRATTR_3DOBJ_CLOSE_FRONT)).GetValue(); }
88 :
89 : // #107245# GetCloseBack() for bLatheCloseBack
90 564 : bool GetCloseBack() const
91 564 : { return static_cast<const Svx3DCloseBackItem&>(GetObjectItemSet().Get(SDRATTR_3DOBJ_CLOSE_BACK)).GetValue(); }
92 :
93 : virtual sal_uInt16 GetObjIdentifier() const SAL_OVERRIDE;
94 :
95 : virtual E3dLatheObj* Clone() const SAL_OVERRIDE;
96 :
97 : virtual SdrObject* DoConvertToPolyObj(bool bBezier, bool bAddText) const SAL_OVERRIDE;
98 :
99 : // TakeObjName...() is for the display in the UI, for example "3 frames selected".
100 : virtual OUString TakeObjNameSingul() const SAL_OVERRIDE;
101 : virtual OUString TakeObjNamePlural() const SAL_OVERRIDE;
102 :
103 : // set/get local parameters with geometry recreation
104 : void SetPolyPoly2D(const basegfx::B2DPolyPolygon& rNew);
105 564 : const basegfx::B2DPolyPolygon& GetPolyPoly2D() const { return maPolyPoly2D; }
106 :
107 : // break up
108 : virtual bool IsBreakObjPossible() SAL_OVERRIDE;
109 : virtual SdrAttrObj* GetBreakObj() SAL_OVERRIDE;
110 : };
111 :
112 : #endif // INCLUDED_SVX_LATHE3D_HXX
113 :
114 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|