Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _E3D_VIEW3D_HXX
30 : : #define _E3D_VIEW3D_HXX
31 : :
32 : : #include <svx/svdview.hxx>
33 : : #include <svx/def3d.hxx>
34 : : #include <svx/deflt3d.hxx>
35 : : #include <basegfx/point/b2dpoint.hxx>
36 : : #include "svx/svxdllapi.h"
37 : :
38 : : //************************************************************
39 : : // Vorausdeklarationen
40 : : //************************************************************
41 : :
42 : : class E3dObject;
43 : : class E3dScene;
44 : : class Impl3DMirrorConstructOverlay;
45 : :
46 : : /*************************************************************************
47 : : |*
48 : : |* Ableitung von SdrView zur Bearbeitung von 3D-Objekten
49 : : |*
50 : : \************************************************************************/
51 : :
52 : : class SVX_DLLPUBLIC E3dView : public SdrView
53 : : {
54 : : protected:
55 : : E3dDefaultAttributes a3DDefaultAttr;
56 : : MouseEvent aMouseEvent; // Die Parameter der letzten Events (Mouse, Keyboard)
57 : : Color aDefaultLightColor; // dito mit den Farben
58 : : Color aDefaultAmbientColor;
59 : :
60 : : double fDefaultScaleX; // Verzerrungen
61 : : double fDefaultScaleY;
62 : : double fDefaultScaleZ;
63 : : double fDefaultRotateX; // und Drehungen
64 : : double fDefaultRotateY;
65 : : double fDefaultRotateZ;
66 : : double fDefaultExtrusionDeepth; // Extrusionstiefe
67 : : double fDefaultLightIntensity; // Intensitaeten der beiden (notwendigen) Licht-
68 : : double fDefaultAmbientIntensity; // quellen
69 : : long nHDefaultSegments; // wieviele HSegmente braucht mein Lathe-Ojekt
70 : : long nVDefaultSegments; // wieviele VSegmente braucht mein Lathe-Ojekt
71 : :
72 : : E3dDragConstraint eDragConstraint;
73 : :
74 : : // Migrate selections
75 : : Impl3DMirrorConstructOverlay* mpMirrorOverlay;
76 : :
77 : : sal_Bool bDoubleSided;
78 : :
79 : : void InitView();
80 : :
81 : : void ImpCreate3DObject(E3dScene* pScene, SdrObject* pObj, sal_Bool bExtrude, double fDepth, basegfx::B2DHomMatrix& rLatheMat);
82 : : void ImpCreateSingle3DObjectFlat(E3dScene* pScene, SdrObject* pObj, sal_Bool bExtrude, double fDepth, basegfx::B2DHomMatrix& rLatheMat);
83 : : void ImpChangeSomeAttributesFor3DConversion(SdrObject* pObj);
84 : : void ImpChangeSomeAttributesFor3DConversion2(SdrObject* pObj);
85 : :
86 : : void InitScene(E3dScene* pScene, double fW, double fH, double fCamZ);
87 : : void ImpIsConvertTo3DPossible(SdrObject* pObj, sal_Bool& rAny3D, sal_Bool& rGroupSelected) const;
88 : : void BreakSingle3DObj(E3dObject* pObj);
89 : :
90 : : public:
91 : : TYPEINFO();
92 : : E3dView(SdrModel* pModel, OutputDevice* pOut = 0L);
93 : : virtual ~E3dView();
94 : :
95 : : // Alle markierten Objekte auf dem angegebenen OutputDevice ausgeben.
96 : : virtual void DrawMarkedObj(OutputDevice& rOut) const;
97 : :
98 : : // Zugriff auf die Default-Attribute
99 : 0 : E3dDefaultAttributes& Get3DDefaultAttributes() { return a3DDefaultAttr; }
100 : : virtual sal_Bool BegDragObj(const Point& rPnt, OutputDevice* pOut = NULL, SdrHdl* pHdl = NULL, short nMinMov = -3, SdrDragMethod* pForcedMeth = NULL);
101 : : virtual void CheckPossibilities();
102 : :
103 : : // Event setzen/rausruecken
104 : 0 : void SetMouseEvent(const MouseEvent& rNew) { aMouseEvent = rNew; }
105 : : const MouseEvent& GetMouseEvent() { return aMouseEvent; }
106 : :
107 : : // Model holen ueberladen, da bei einzelnen 3D Objekten noch eine Szene
108 : : // untergeschoben werden muss
109 : : virtual SdrModel* GetMarkedObjModel() const;
110 : :
111 : : // Bei Paste muss - falls in eine Scene eingefuegt wird - die
112 : : // Objekte der Szene eingefuegt werden, die Szene selbst aber nicht
113 : : using SdrView::Paste;
114 : : virtual sal_Bool Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0);
115 : :
116 : : // #83403# Service routine used from local Clone() and from SdrCreateView::EndCreateObj(...)
117 : : sal_Bool ImpCloneAll3DObjectsToDestScene(E3dScene* pSrcScene, E3dScene* pDstScene, Point aOffset);
118 : :
119 : : sal_Bool IsConvertTo3DObjPossible() const;
120 : : void ConvertMarkedObjTo3D(sal_Bool bExtrude=sal_True, basegfx::B2DPoint aPnt1 = basegfx::B2DPoint(0.0, 0.0), basegfx::B2DPoint aPnt2 = basegfx::B2DPoint(0.0, 1.0));
121 : :
122 : : // Nachtraeglichhe Korrekturmoeglichkeit um alle Extrudes in einer
123 : : // bestimmten Tiefensortierung anzulegen
124 : : void DoDepthArrange(E3dScene* pScene, double fDepth);
125 : : void ConvertMarkedToPolyObj(sal_Bool bLineToArea);
126 : : E3dScene* SetCurrent3DObj(E3dObject* p3DObj);
127 : : void Start3DCreation();
128 : :
129 : : // migration of overlay
130 : 132 : sal_Bool Is3DRotationCreationActive() const { return (0L != mpMirrorOverlay); }
131 : :
132 : : virtual void MovAction(const Point& rPnt);
133 : : void End3DCreation(sal_Bool bUseDefaultValuesForMirrorAxes=sal_False);
134 : : void ResetCreationActive();
135 : :
136 : : double GetDefaultCamPosZ();
137 : :
138 : : double &DefaultScaleX ()
139 : : {
140 : : return fDefaultScaleX;
141 : : }
142 : :
143 : : double DefaultScaleX () const
144 : : {
145 : : return fDefaultScaleX;
146 : : }
147 : :
148 : : double &DefaultScaleY ()
149 : : {
150 : : return fDefaultScaleY;
151 : : }
152 : :
153 : : double DefaultScaleY () const
154 : : {
155 : : return fDefaultScaleY;
156 : : }
157 : :
158 : : double &DefaultScaleZ ()
159 : : {
160 : : return fDefaultScaleZ;
161 : : }
162 : :
163 : : double DefaultScaleZ () const
164 : : {
165 : : return fDefaultScaleZ;
166 : : }
167 : :
168 : : double &DefaultRotateX ()
169 : : {
170 : : return fDefaultRotateX;
171 : : }
172 : :
173 : : double DefaultRotateX () const
174 : : {
175 : : return fDefaultRotateX;
176 : : }
177 : :
178 : : double &DefaultRotateY ()
179 : : {
180 : : return fDefaultRotateY;
181 : : }
182 : :
183 : : double DefaultRotateY () const
184 : : {
185 : : return fDefaultRotateY;
186 : : }
187 : :
188 : : double &DefaultRotateZ ()
189 : : {
190 : : return fDefaultRotateZ;
191 : : }
192 : :
193 : : double DefaultRotateZ () const
194 : : {
195 : : return fDefaultRotateZ;
196 : : }
197 : :
198 : : double &DefaultExtrusionDeepth ()
199 : : {
200 : : return fDefaultExtrusionDeepth;
201 : : }
202 : :
203 : : double DefaultExtrusionDeepth () const
204 : : {
205 : : return fDefaultExtrusionDeepth;
206 : : }
207 : :
208 : : double GetDefaultCamFocal();
209 : :
210 : : double &DefaultLightIntensity ()
211 : : {
212 : : return fDefaultLightIntensity;
213 : : }
214 : :
215 : : double DefaultLightIntensity () const
216 : : {
217 : : return fDefaultLightIntensity;
218 : : }
219 : :
220 : : double &DefaultAmbientIntensity ()
221 : : {
222 : : return fDefaultAmbientIntensity;
223 : : }
224 : :
225 : : double DefaultAmbientIntensity () const
226 : : {
227 : : return fDefaultAmbientIntensity;
228 : : }
229 : :
230 : : const Color &DefaultLightColor () const
231 : : {
232 : : return aDefaultLightColor;
233 : : }
234 : :
235 : : Color DefaultLightColor ()
236 : : {
237 : : return aDefaultLightColor;
238 : : }
239 : :
240 : : const Color &DefaultAmbientColor () const
241 : : {
242 : : return aDefaultAmbientColor;
243 : : }
244 : :
245 : : Color DefaultAmbientColor ()
246 : : {
247 : : return aDefaultAmbientColor;
248 : : }
249 : :
250 : : long GetHDefaultSegments() const { return nHDefaultSegments; }
251 : : void SetHDefaultSegments(long nSegs) { nHDefaultSegments = nSegs; }
252 : :
253 : : long GetVDefaultSegments() const { return nVDefaultSegments; }
254 : : void SetVDefaultSegments(long nSegs) { nVDefaultSegments = nSegs; }
255 : :
256 : : sal_Bool IsBreak3DObjPossible() const;
257 : : void Break3DObj();
258 : :
259 : : sal_Bool DoubleSided () const
260 : : {
261 : : return bDoubleSided;
262 : : }
263 : :
264 : : sal_Bool &DoubleSided ()
265 : : {
266 : : return bDoubleSided;
267 : : }
268 : :
269 : : SfxItemSet Get3DAttributes(E3dScene* pInScene = NULL, sal_Bool bOnly3DAttr=sal_False) const;
270 : : void Set3DAttributes(const SfxItemSet& rAttr, E3dScene* pInScene = NULL, sal_Bool bOnly3DAttr=sal_False);
271 : : };
272 : :
273 : : #endif // _E3D_VIEW3D_HXX
274 : :
275 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|