Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / include / svx / view3d.hxx
blob4681121416b6307c8f47ca07cbcd7f4f90635e41
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 INCLUDED_SVX_VIEW3D_HXX
21 #define INCLUDED_SVX_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>
30 * Forward declarations
33 class E3dObject;
34 class E3dScene;
35 class Impl3DMirrorConstructOverlay;
37 /**
38 * Derived class of SdrView to edit 3D objects.
41 class SVX_DLLPUBLIC E3dView : public SdrView
43 protected:
44 E3dDefaultAttributes a3DDefaultAttr;
45 MouseEvent aMouseEvent; // The parameters of the last Events (Mouse, Keyboard)
46 Color aDefaultLightColor; // The paramaters for the last colors
47 Color aDefaultAmbientColor;
49 double fDefaultScaleX; // Scaling
50 double fDefaultScaleY;
51 double fDefaultScaleZ;
52 double fDefaultRotateX; // and Rotation
53 double fDefaultRotateY;
54 double fDefaultRotateZ;
55 double fDefaultExtrusionDeepth; // Extrusion depth
56 double fDefaultLightIntensity; // Intensity of the two (necessary) light sources.
57 double fDefaultAmbientIntensity;
58 long nHDefaultSegments; // Amount of HSegments required by the Lathe object
59 long nVDefaultSegments; // Amount of VSegments required by the Lathe object
61 E3dDragConstraint eDragConstraint;
63 // Migrate selections
64 Impl3DMirrorConstructOverlay* mpMirrorOverlay;
66 bool bDoubleSided;
68 void InitView();
70 void ImpCreate3DObject(E3dScene* pScene, SdrObject* pObj, bool bExtrude, double fDepth, basegfx::B2DHomMatrix& rLatheMat);
71 void ImpCreateSingle3DObjectFlat(E3dScene* pScene, SdrObject* pObj, bool bExtrude, double fDepth, basegfx::B2DHomMatrix& rLatheMat);
72 void ImpChangeSomeAttributesFor3DConversion(SdrObject* pObj);
73 void ImpChangeSomeAttributesFor3DConversion2(SdrObject* pObj);
75 void InitScene(E3dScene* pScene, double fW, double fH, double fCamZ);
76 void ImpIsConvertTo3DPossible(SdrObject* pObj, bool& rAny3D, bool& rGroupSelected) const;
77 void BreakSingle3DObj(E3dObject* pObj);
79 public:
80 TYPEINFO_OVERRIDE();
81 E3dView(SdrModel* pModel, OutputDevice* pOut = 0L);
82 virtual ~E3dView();
84 // Output all marked Objects on the given OutputDevice.
85 virtual void DrawMarkedObj(OutputDevice& rOut) const SAL_OVERRIDE;
87 // Access to the default attributes.
88 E3dDefaultAttributes& Get3DDefaultAttributes() { return a3DDefaultAttr; }
89 virtual bool BegDragObj(const Point& rPnt, OutputDevice* pOut = NULL, SdrHdl* pHdl = NULL, short nMinMov = -3, SdrDragMethod* pForcedMeth = NULL) SAL_OVERRIDE;
90 virtual void CheckPossibilities() SAL_OVERRIDE;
92 // Get/Set Event
93 void SetMouseEvent(const MouseEvent& rNew) { aMouseEvent = rNew; }
94 const MouseEvent& GetMouseEvent() { return aMouseEvent; }
96 // Override getting the model, as we need to supply a Scene together with individual 3D Objects.
97 virtual SdrModel* GetMarkedObjModel() const SAL_OVERRIDE;
99 // On Paste: We need to insert the objects of the Scene, but not the Scene itself
100 using SdrView::Paste;
101 virtual bool Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0) SAL_OVERRIDE;
103 // #83403# Service routine used from local Clone() and from SdrCreateView::EndCreateObj(...)
104 bool ImpCloneAll3DObjectsToDestScene(E3dScene* pSrcScene, E3dScene* pDstScene, Point aOffset);
106 bool IsConvertTo3DObjPossible() const;
107 void ConvertMarkedObjTo3D(bool bExtrude=true, basegfx::B2DPoint aPnt1 = basegfx::B2DPoint(0.0, 0.0), basegfx::B2DPoint aPnt2 = basegfx::B2DPoint(0.0, 1.0));
109 // Means to create all Extrudes in a certain depth order.
110 void DoDepthArrange(E3dScene* pScene, double fDepth);
111 void ConvertMarkedToPolyObj(bool bLineToArea);
112 E3dScene* SetCurrent3DObj(E3dObject* p3DObj);
113 void Start3DCreation();
115 // Migration of overlay
116 bool Is3DRotationCreationActive() const { return (0L != mpMirrorOverlay); }
118 virtual void MovAction(const Point& rPnt) SAL_OVERRIDE;
119 void End3DCreation(bool bUseDefaultValuesForMirrorAxes=false);
120 void ResetCreationActive();
122 double GetDefaultCamPosZ();
124 double &DefaultScaleX ()
126 return fDefaultScaleX;
129 double DefaultScaleX () const
131 return fDefaultScaleX;
134 double &DefaultScaleY ()
136 return fDefaultScaleY;
139 double DefaultScaleY () const
141 return fDefaultScaleY;
144 double &DefaultScaleZ ()
146 return fDefaultScaleZ;
149 double DefaultScaleZ () const
151 return fDefaultScaleZ;
154 double &DefaultRotateX ()
156 return fDefaultRotateX;
159 double DefaultRotateX () const
161 return fDefaultRotateX;
164 double &DefaultRotateY ()
166 return fDefaultRotateY;
169 double DefaultRotateY () const
171 return fDefaultRotateY;
174 double &DefaultRotateZ ()
176 return fDefaultRotateZ;
179 double DefaultRotateZ () const
181 return fDefaultRotateZ;
184 double &DefaultExtrusionDeepth ()
186 return fDefaultExtrusionDeepth;
189 double DefaultExtrusionDeepth () const
191 return fDefaultExtrusionDeepth;
194 double GetDefaultCamFocal();
196 double &DefaultLightIntensity ()
198 return fDefaultLightIntensity;
201 double DefaultLightIntensity () const
203 return fDefaultLightIntensity;
206 double &DefaultAmbientIntensity ()
208 return fDefaultAmbientIntensity;
211 double DefaultAmbientIntensity () const
213 return fDefaultAmbientIntensity;
216 const Color &DefaultLightColor () const
218 return aDefaultLightColor;
221 Color DefaultLightColor ()
223 return aDefaultLightColor;
226 const Color &DefaultAmbientColor () const
228 return aDefaultAmbientColor;
231 Color DefaultAmbientColor ()
233 return aDefaultAmbientColor;
236 long GetHDefaultSegments() const { return nHDefaultSegments; }
237 void SetHDefaultSegments(long nSegs) { nHDefaultSegments = nSegs; }
239 long GetVDefaultSegments() const { return nVDefaultSegments; }
240 void SetVDefaultSegments(long nSegs) { nVDefaultSegments = nSegs; }
242 bool IsBreak3DObjPossible() const;
243 void Break3DObj();
245 bool DoubleSided () const { return bDoubleSided; }
247 bool &DoubleSided () { return bDoubleSided; }
249 SfxItemSet Get3DAttributes(E3dScene* pInScene = NULL, bool bOnly3DAttr=false) const;
250 void Set3DAttributes(const SfxItemSet& rAttr, E3dScene* pInScene = NULL, bool bOnly3DAttr=false);
253 #endif // INCLUDED_SVX_VIEW3D_HXX
255 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */