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/deflt3d.hxx>
25 #include <basegfx/point/b2dpoint.hxx>
26 #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
43 E3dDefaultAttributes a3DDefaultAttr
;
44 MouseEvent aMouseEvent
; // The parameters of the last Events (Mouse, Keyboard)
47 std::unique_ptr
<Impl3DMirrorConstructOverlay
> mpMirrorOverlay
;
52 void ImpCreate3DObject(E3dScene
* pScene
, SdrObject
* pObj
, bool bExtrude
, double fDepth
, basegfx::B2DHomMatrix
const & rLatheMat
);
53 void ImpCreateSingle3DObjectFlat(E3dScene
* pScene
, SdrObject
* pObj
, bool bExtrude
, double fDepth
, basegfx::B2DHomMatrix
const & rLatheMat
);
54 void ImpChangeSomeAttributesFor3DConversion(SdrObject
* pObj
);
55 void ImpChangeSomeAttributesFor3DConversion2(SdrObject
* pObj
);
57 void InitScene(E3dScene
* pScene
, double fW
, double fH
, double fCamZ
);
58 void ImpIsConvertTo3DPossible(SdrObject
const * pObj
, bool& rAny3D
, bool& rGroupSelected
) const;
59 void BreakSingle3DObj(E3dObject
* pObj
);
66 virtual ~E3dView() override
;
68 // Output all marked Objects on the given OutputDevice.
69 virtual void DrawMarkedObj(OutputDevice
& rOut
) const override
;
71 // Access to the default attributes.
72 E3dDefaultAttributes
& Get3DDefaultAttributes() { return a3DDefaultAttr
; }
73 virtual bool BegDragObj(const Point
& rPnt
, OutputDevice
* pOut
, SdrHdl
* pHdl
, short nMinMov
= -3, SdrDragMethod
* pForcedMeth
= nullptr) override
;
74 virtual void CheckPossibilities() override
;
77 void SetMouseEvent(const MouseEvent
& rNew
) { aMouseEvent
= rNew
; }
78 const MouseEvent
& GetMouseEvent() const { return aMouseEvent
; }
80 // Override getting the model, as we need to supply a Scene together with individual 3D Objects.
81 virtual std::unique_ptr
<SdrModel
> CreateMarkedObjModel() const override
;
83 // On Paste: We need to insert the objects of the Scene, but not the Scene itself
86 const SdrModel
& rMod
, const Point
& rPos
, SdrObjList
* pLst
, SdrInsertFlags nOptions
) override
;
88 // #83403# Service routine used from local Clone() and from SdrCreateView::EndCreateObj(...)
89 bool ImpCloneAll3DObjectsToDestScene(E3dScene
const * pSrcScene
, E3dScene
* pDstScene
, Point aOffset
);
91 bool IsConvertTo3DObjPossible() const;
92 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));
94 // Means to create all Extrudes in a certain depth order.
95 static void DoDepthArrange(E3dScene
const * pScene
, double fDepth
);
96 void ConvertMarkedToPolyObj();
97 E3dScene
* SetCurrent3DObj(E3dObject
* p3DObj
);
98 void Start3DCreation();
100 // Migration of overlay
101 bool Is3DRotationCreationActive() const { return (nullptr != mpMirrorOverlay
); }
103 virtual void MovAction(const Point
& rPnt
) override
;
104 void End3DCreation(bool bUseDefaultValuesForMirrorAxes
=false);
105 void ResetCreationActive();
107 double GetDefaultCamPosZ();
109 double GetDefaultCamFocal();
111 bool IsBreak3DObjPossible() const;
114 SfxItemSet
Get3DAttributes() const;
115 void Set3DAttributes(const SfxItemSet
& rAttr
);
118 #endif // INCLUDED_SVX_VIEW3D_HXX
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */