xref: /trunk/main/svx/inc/svx/lathe3d.hxx (revision a5258243)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _E3D_LATHE3D_HXX
29 #define _E3D_LATHE3D_HXX
30 
31 #include <svx/obj3d.hxx>
32 #include "svx/svxdllapi.h"
33 
34 /*************************************************************************
35 |*
36 |* 3D-Rotationsobjekt aus uebergebenem 2D-Polygon erzeugen
37 |*
38 |* Das aPolyPoly3D wird in nHSegments-Schritten um die Achse rotiert.
39 |* nVSegments gibt die Anzahl der Linien von aPolyPoly3D an und stellt damit
40 |* quasi eine vertikale Segmentierung dar.
41 |*
42 \************************************************************************/
43 
44 class SVX_DLLPUBLIC E3dLatheObj : public E3dCompoundObject
45 {
46 private:
47 	// Partcodes fuer Wireframe-Generierung: Standard oder Deckelflaeche
48 	enum { LATHE_PART_STD = 1, LATHE_PART_COVER = 2 };
49 	basegfx::B2DPolyPolygon	maPolyPoly2D;
50 
51  protected:
52 	virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
53 	virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
54 	void SetDefaultAttributes(E3dDefaultAttributes& rDefault);
55 
56  public:
57 	TYPEINFO();
58 	E3dLatheObj(E3dDefaultAttributes& rDefault, const basegfx::B2DPolyPolygon rPoly2D);
59 	E3dLatheObj();
60 
61 	// HorizontalSegments:
62 	sal_uInt32 GetHorizontalSegments() const
63 		{ return ((const Svx3DHorizontalSegmentsItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_HORZ_SEGS)).GetValue(); }
64 
65 	// VerticalSegments:
66 	sal_uInt32 GetVerticalSegments() const
67 		{ return ((const Svx3DVerticalSegmentsItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_VERT_SEGS)).GetValue(); }
68 
69 	// PercentDiagonal: 0..100, before 0.0..0.5
70 	sal_uInt16 GetPercentDiagonal() const
71 		{ return ((const Svx3DPercentDiagonalItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_PERCENT_DIAGONAL)).GetValue(); }
72 
73 	// BackScale: 0..100, before 0.0..1.0
74 	sal_uInt16 GetBackScale() const
75 		{ return ((const Svx3DBackscaleItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_BACKSCALE)).GetValue(); }
76 
77 	// EndAngle: 0..10000
78 	sal_uInt32 GetEndAngle() const
79 		{ return ((const Svx3DEndAngleItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_END_ANGLE)).GetValue(); }
80 
81 	// #107245# GetSmoothNormals() for bLatheSmoothed
82 	sal_Bool GetSmoothNormals() const
83 		{ return ((const Svx3DSmoothNormalsItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_SMOOTH_NORMALS)).GetValue(); }
84 
85 	// #107245# GetSmoothLids() for bLatheSmoothFrontBack
86 	sal_Bool GetSmoothLids() const
87 		{ return ((const Svx3DSmoothLidsItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_SMOOTH_LIDS)).GetValue(); }
88 
89 	// #107245# GetCharacterMode() for bLatheCharacterMode
90 	sal_Bool GetCharacterMode() const
91 		{ return ((const Svx3DCharacterModeItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_CHARACTER_MODE)).GetValue(); }
92 
93 	// #107245# GetCloseFront() for bLatheCloseFront
94 	sal_Bool GetCloseFront() const
95 		{ return ((const Svx3DCloseFrontItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_CLOSE_FRONT)).GetValue(); }
96 
97 	// #107245# GetCloseBack() for bLatheCloseBack
98 	sal_Bool GetCloseBack() const
99 		{ return ((const Svx3DCloseBackItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_CLOSE_BACK)).GetValue(); }
100 
101 	virtual sal_uInt16 GetObjIdentifier() const;
102 	void    ReSegment(sal_uInt32 nHSegs, sal_uInt32 nVSegs);
103 
104 	virtual void operator=(const SdrObject&);
105 
106 	virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier, bool bAddText) const;
107 
108 	// TakeObjName...() ist fuer die Anzeige in der UI, z.B. "3 Rahmen selektiert".
109 	virtual void TakeObjNameSingul(String& rName) const;
110 	virtual void TakeObjNamePlural(String& rName) const;
111 
112 	// Lokale Parameter setzen/lesen mit Geometrieneuerzeugung
113 	void SetPolyPoly2D(const basegfx::B2DPolyPolygon& rNew);
114 	const basegfx::B2DPolyPolygon& GetPolyPoly2D() { return maPolyPoly2D; }
115 
116 	// Aufbrechen
117 	virtual sal_Bool IsBreakObjPossible();
118 	virtual SdrAttrObj* GetBreakObj();
119 };
120 
121 #endif			// _E3D_LATHE3D_HXX
122 
123