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>
31 * Forward declarations
36 class Impl3DMirrorConstructOverlay
;
39 * Derived class of SdrView to edit 3D objects.
42 class SVX_DLLPUBLIC E3dView
: public SdrView
44 E3dDefaultAttributes a3DDefaultAttr
;
45 MouseEvent aMouseEvent
; // The parameters of the last Events (Mouse, Keyboard)
48 std::unique_ptr
<Impl3DMirrorConstructOverlay
> mpMirrorOverlay
;
53 void ImpCreate3DObject(E3dScene
* pScene
, SdrObject
* pObj
, bool bExtrude
, double fDepth
, basegfx::B2DHomMatrix
const & rLatheMat
);
54 void ImpCreateSingle3DObjectFlat(E3dScene
* pScene
, SdrObject
* pObj
, bool bExtrude
, double fDepth
, basegfx::B2DHomMatrix
const & rLatheMat
);
55 void ImpChangeSomeAttributesFor3DConversion(SdrObject
* pObj
);
56 void ImpChangeSomeAttributesFor3DConversion2(SdrObject
* pObj
);
58 void InitScene(E3dScene
* pScene
, double fW
, double fH
, double fCamZ
);
59 void ImpIsConvertTo3DPossible(SdrObject
const * pObj
, bool& rAny3D
, bool& rGroupSelected
) const;
60 void BreakSingle3DObj(E3dObject
* pObj
);
67 virtual ~E3dView() override
;
69 // Output all marked Objects on the given OutputDevice.
70 virtual void DrawMarkedObj(OutputDevice
& rOut
) const override
;
72 // Access to the default attributes.
73 E3dDefaultAttributes
& Get3DDefaultAttributes() { return a3DDefaultAttr
; }
74 virtual bool BegDragObj(const Point
& rPnt
, OutputDevice
* pOut
, SdrHdl
* pHdl
, short nMinMov
= -3, SdrDragMethod
* pForcedMeth
= nullptr) override
;
75 virtual void CheckPossibilities() override
;
78 void SetMouseEvent(const MouseEvent
& rNew
) { aMouseEvent
= rNew
; }
79 const MouseEvent
& GetMouseEvent() { return aMouseEvent
; }
81 // Override getting the model, as we need to supply a Scene together with individual 3D Objects.
82 virtual std::unique_ptr
<SdrModel
> CreateMarkedObjModel() const override
;
84 // On Paste: We need to insert the objects of the Scene, but not the Scene itself
87 const SdrModel
& rMod
, const Point
& rPos
, SdrObjList
* pLst
, SdrInsertFlags nOptions
) override
;
89 // #83403# Service routine used from local Clone() and from SdrCreateView::EndCreateObj(...)
90 bool ImpCloneAll3DObjectsToDestScene(E3dScene
const * pSrcScene
, E3dScene
* pDstScene
, Point aOffset
);
92 bool IsConvertTo3DObjPossible() const;
93 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));
95 // Means to create all Extrudes in a certain depth order.
96 static void DoDepthArrange(E3dScene
const * pScene
, double fDepth
);
97 void ConvertMarkedToPolyObj();
98 E3dScene
* SetCurrent3DObj(E3dObject
* p3DObj
);
99 void Start3DCreation();
101 // Migration of overlay
102 bool Is3DRotationCreationActive() const { return (nullptr != mpMirrorOverlay
); }
104 virtual void MovAction(const Point
& rPnt
) override
;
105 void End3DCreation(bool bUseDefaultValuesForMirrorAxes
=false);
106 void ResetCreationActive();
108 double GetDefaultCamPosZ();
110 double GetDefaultCamFocal();
112 bool IsBreak3DObjPossible() const;
115 SfxItemSet
Get3DAttributes() const;
116 void Set3DAttributes(const SfxItemSet
& rAttr
);
119 #endif // INCLUDED_SVX_VIEW3D_HXX
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */