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 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
35 class Impl3DMirrorConstructOverlay
;
38 * Derived class of SdrView to edit 3D objects.
41 class SVX_DLLPUBLIC E3dView
: public SdrView
44 E3dDefaultAttributes a3DDefaultAttr
;
45 MouseEvent aMouseEvent
; // The parameters of the last Events (Mouse, Keyboard)
46 Color aDefaultLightColor
; // The parameters 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
;
64 Impl3DMirrorConstructOverlay
* mpMirrorOverlay
;
68 void ImpCreate3DObject(E3dScene
* pScene
, SdrObject
* pObj
, bool bExtrude
, double fDepth
, basegfx::B2DHomMatrix
& rLatheMat
);
69 void ImpCreateSingle3DObjectFlat(E3dScene
* pScene
, SdrObject
* pObj
, bool bExtrude
, double fDepth
, basegfx::B2DHomMatrix
& rLatheMat
);
70 void ImpChangeSomeAttributesFor3DConversion(SdrObject
* pObj
);
71 void ImpChangeSomeAttributesFor3DConversion2(SdrObject
* pObj
);
73 void InitScene(E3dScene
* pScene
, double fW
, double fH
, double fCamZ
);
74 void ImpIsConvertTo3DPossible(SdrObject
* pObj
, bool& rAny3D
, bool& rGroupSelected
) const;
75 void BreakSingle3DObj(E3dObject
* pObj
);
78 E3dView(SdrModel
* pModel
, OutputDevice
* pOut
);
79 virtual ~E3dView() override
;
81 // Output all marked Objects on the given OutputDevice.
82 virtual void DrawMarkedObj(OutputDevice
& rOut
) const override
;
84 // Access to the default attributes.
85 E3dDefaultAttributes
& Get3DDefaultAttributes() { return a3DDefaultAttr
; }
86 virtual bool BegDragObj(const Point
& rPnt
, OutputDevice
* pOut
, SdrHdl
* pHdl
, short nMinMov
= -3, SdrDragMethod
* pForcedMeth
= nullptr) override
;
87 virtual void CheckPossibilities() override
;
90 void SetMouseEvent(const MouseEvent
& rNew
) { aMouseEvent
= rNew
; }
91 const MouseEvent
& GetMouseEvent() { return aMouseEvent
; }
93 // Override getting the model, as we need to supply a Scene together with individual 3D Objects.
94 virtual SdrModel
* GetMarkedObjModel() const override
;
96 // On Paste: We need to insert the objects of the Scene, but not the Scene itself
99 const SdrModel
& rMod
, const Point
& rPos
, SdrObjList
* pLst
, SdrInsertFlags nOptions
) override
;
101 // #83403# Service routine used from local Clone() and from SdrCreateView::EndCreateObj(...)
102 bool ImpCloneAll3DObjectsToDestScene(E3dScene
* pSrcScene
, E3dScene
* pDstScene
, Point aOffset
);
104 bool IsConvertTo3DObjPossible() const;
105 void ConvertMarkedObjTo3D(bool bExtrude
=true, const basegfx::B2DPoint
& rPnt1
= basegfx::B2DPoint(0.0, 0.0), const basegfx::B2DPoint
& rPnt2
= basegfx::B2DPoint(0.0, 1.0));
107 // Means to create all Extrudes in a certain depth order.
108 static void DoDepthArrange(E3dScene
* pScene
, double fDepth
);
109 void ConvertMarkedToPolyObj();
110 E3dScene
* SetCurrent3DObj(E3dObject
* p3DObj
);
111 void Start3DCreation();
113 // Migration of overlay
114 bool Is3DRotationCreationActive() const { return (nullptr != mpMirrorOverlay
); }
116 virtual void MovAction(const Point
& rPnt
) override
;
117 void End3DCreation(bool bUseDefaultValuesForMirrorAxes
=false);
118 void ResetCreationActive();
120 double GetDefaultCamPosZ();
122 double GetDefaultCamFocal();
124 bool IsBreak3DObjPossible() const;
127 SfxItemSet
Get3DAttributes() const;
128 void Set3DAttributes(const SfxItemSet
& rAttr
);
131 #endif // INCLUDED_SVX_VIEW3D_HXX
133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */