1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef _E3D_VIEW3D_HXX
21 #define _E3D_VIEW3D_HXX
23 #include <svx/svdview.hxx>
24 #include <svx/def3d.hxx>
25 #include <svx/deflt3d.hxx>
26 #include <basegfx/point/b2dpoint.hxx>
27 #include "svx/svxdllapi.h"
29 //************************************************************
30 // Vorausdeklarationen
31 //************************************************************
35 class Impl3DMirrorConstructOverlay
;
37 /*************************************************************************
39 |* Ableitung von SdrView zur Bearbeitung von 3D-Objekten
41 \************************************************************************/
43 class SVX_DLLPUBLIC E3dView
: public SdrView
46 E3dDefaultAttributes a3DDefaultAttr
;
47 MouseEvent aMouseEvent
; // Die Parameter der letzten Events (Mouse, Keyboard)
48 Color aDefaultLightColor
; // dito mit den Farben
49 Color aDefaultAmbientColor
;
51 double fDefaultScaleX
; // Verzerrungen
52 double fDefaultScaleY
;
53 double fDefaultScaleZ
;
54 double fDefaultRotateX
; // und Drehungen
55 double fDefaultRotateY
;
56 double fDefaultRotateZ
;
57 double fDefaultExtrusionDeepth
; // Extrusionstiefe
58 double fDefaultLightIntensity
; // Intensitaeten der beiden (notwendigen) Licht-
59 double fDefaultAmbientIntensity
; // quellen
60 long nHDefaultSegments
; // wieviele HSegmente braucht mein Lathe-Ojekt
61 long nVDefaultSegments
; // wieviele VSegmente braucht mein Lathe-Ojekt
63 E3dDragConstraint eDragConstraint
;
66 Impl3DMirrorConstructOverlay
* mpMirrorOverlay
;
68 sal_Bool bDoubleSided
;
72 void ImpCreate3DObject(E3dScene
* pScene
, SdrObject
* pObj
, bool bExtrude
, double fDepth
, basegfx::B2DHomMatrix
& rLatheMat
);
73 void ImpCreateSingle3DObjectFlat(E3dScene
* pScene
, SdrObject
* pObj
, bool bExtrude
, double fDepth
, basegfx::B2DHomMatrix
& rLatheMat
);
74 void ImpChangeSomeAttributesFor3DConversion(SdrObject
* pObj
);
75 void ImpChangeSomeAttributesFor3DConversion2(SdrObject
* pObj
);
77 void InitScene(E3dScene
* pScene
, double fW
, double fH
, double fCamZ
);
78 void ImpIsConvertTo3DPossible(SdrObject
* pObj
, bool& rAny3D
, bool& rGroupSelected
) const;
79 void BreakSingle3DObj(E3dObject
* pObj
);
83 E3dView(SdrModel
* pModel
, OutputDevice
* pOut
= 0L);
86 // Alle markierten Objekte auf dem angegebenen OutputDevice ausgeben.
87 virtual void DrawMarkedObj(OutputDevice
& rOut
) const;
89 // Zugriff auf die Default-Attribute
90 E3dDefaultAttributes
& Get3DDefaultAttributes() { return a3DDefaultAttr
; }
91 virtual sal_Bool
BegDragObj(const Point
& rPnt
, OutputDevice
* pOut
= NULL
, SdrHdl
* pHdl
= NULL
, short nMinMov
= -3, SdrDragMethod
* pForcedMeth
= NULL
);
92 virtual void CheckPossibilities();
94 // Event setzen/rausruecken
95 void SetMouseEvent(const MouseEvent
& rNew
) { aMouseEvent
= rNew
; }
96 const MouseEvent
& GetMouseEvent() { return aMouseEvent
; }
98 // Model holen ueberladen, da bei einzelnen 3D Objekten noch eine Szene
99 // untergeschoben werden muss
100 virtual SdrModel
* GetMarkedObjModel() const;
102 // Bei Paste muss - falls in eine Scene eingefuegt wird - die
103 // Objekte der Szene eingefuegt werden, die Szene selbst aber nicht
104 using SdrView::Paste
;
105 virtual sal_Bool
Paste(const SdrModel
& rMod
, const Point
& rPos
, SdrObjList
* pLst
=NULL
, sal_uInt32 nOptions
=0);
107 // #83403# Service routine used from local Clone() and from SdrCreateView::EndCreateObj(...)
108 bool ImpCloneAll3DObjectsToDestScene(E3dScene
* pSrcScene
, E3dScene
* pDstScene
, Point aOffset
);
110 bool IsConvertTo3DObjPossible() const;
111 void ConvertMarkedObjTo3D(bool bExtrude
=true, basegfx::B2DPoint aPnt1
= basegfx::B2DPoint(0.0, 0.0), basegfx::B2DPoint aPnt2
= basegfx::B2DPoint(0.0, 1.0));
113 // Nachtraeglichhe Korrekturmoeglichkeit um alle Extrudes in einer
114 // bestimmten Tiefensortierung anzulegen
115 void DoDepthArrange(E3dScene
* pScene
, double fDepth
);
116 void ConvertMarkedToPolyObj(sal_Bool bLineToArea
);
117 E3dScene
* SetCurrent3DObj(E3dObject
* p3DObj
);
118 void Start3DCreation();
120 // migration of overlay
121 bool Is3DRotationCreationActive() const { return (0L != mpMirrorOverlay
); }
123 virtual void MovAction(const Point
& rPnt
);
124 void End3DCreation(bool bUseDefaultValuesForMirrorAxes
=false);
125 void ResetCreationActive();
127 double GetDefaultCamPosZ();
129 double &DefaultScaleX ()
131 return fDefaultScaleX
;
134 double DefaultScaleX () const
136 return fDefaultScaleX
;
139 double &DefaultScaleY ()
141 return fDefaultScaleY
;
144 double DefaultScaleY () const
146 return fDefaultScaleY
;
149 double &DefaultScaleZ ()
151 return fDefaultScaleZ
;
154 double DefaultScaleZ () const
156 return fDefaultScaleZ
;
159 double &DefaultRotateX ()
161 return fDefaultRotateX
;
164 double DefaultRotateX () const
166 return fDefaultRotateX
;
169 double &DefaultRotateY ()
171 return fDefaultRotateY
;
174 double DefaultRotateY () const
176 return fDefaultRotateY
;
179 double &DefaultRotateZ ()
181 return fDefaultRotateZ
;
184 double DefaultRotateZ () const
186 return fDefaultRotateZ
;
189 double &DefaultExtrusionDeepth ()
191 return fDefaultExtrusionDeepth
;
194 double DefaultExtrusionDeepth () const
196 return fDefaultExtrusionDeepth
;
199 double GetDefaultCamFocal();
201 double &DefaultLightIntensity ()
203 return fDefaultLightIntensity
;
206 double DefaultLightIntensity () const
208 return fDefaultLightIntensity
;
211 double &DefaultAmbientIntensity ()
213 return fDefaultAmbientIntensity
;
216 double DefaultAmbientIntensity () const
218 return fDefaultAmbientIntensity
;
221 const Color
&DefaultLightColor () const
223 return aDefaultLightColor
;
226 Color
DefaultLightColor ()
228 return aDefaultLightColor
;
231 const Color
&DefaultAmbientColor () const
233 return aDefaultAmbientColor
;
236 Color
DefaultAmbientColor ()
238 return aDefaultAmbientColor
;
241 long GetHDefaultSegments() const { return nHDefaultSegments
; }
242 void SetHDefaultSegments(long nSegs
) { nHDefaultSegments
= nSegs
; }
244 long GetVDefaultSegments() const { return nVDefaultSegments
; }
245 void SetVDefaultSegments(long nSegs
) { nVDefaultSegments
= nSegs
; }
247 bool IsBreak3DObjPossible() const;
250 sal_Bool
DoubleSided () const
255 sal_Bool
&DoubleSided ()
260 SfxItemSet
Get3DAttributes(E3dScene
* pInScene
= NULL
, sal_Bool bOnly3DAttr
=sal_False
) const;
261 void Set3DAttributes(const SfxItemSet
& rAttr
, E3dScene
* pInScene
= NULL
, sal_Bool bOnly3DAttr
=sal_False
);
264 #endif // _E3D_VIEW3D_HXX
266 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */