LibreOffice Module svx (master) 1
view3d.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#ifndef INCLUDED_SVX_VIEW3D_HXX
21#define INCLUDED_SVX_VIEW3D_HXX
22
23#include <svx/svdview.hxx>
24#include <svx/deflt3d.hxx>
26#include <svx/svxdllapi.h>
27#include <memory>
28
29/*
30 * Forward declarations
31 */
32
33class E3dObject;
34class E3dScene;
36
42{
43 E3dDefaultAttributes a3DDefaultAttr;
44 MouseEvent aMouseEvent; // The parameters of the last Events (Mouse, Keyboard)
45
46 // Migrate selections
47 std::unique_ptr<Impl3DMirrorConstructOverlay> mpMirrorOverlay;
48
49protected:
50 void InitView();
51
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);
56
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);
60
61public:
62 E3dView(
63 SdrModel& rSdrModel,
64 OutputDevice* pOut);
65
66 virtual ~E3dView() override;
67
68 // Output all marked Objects on the given OutputDevice.
69 virtual void DrawMarkedObj(OutputDevice& rOut) const override;
70
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;
75
76 // Get/Set Event
77 void SetMouseEvent(const MouseEvent& rNew) { aMouseEvent = rNew; }
78 const MouseEvent& GetMouseEvent() const { return aMouseEvent; }
79
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;
82
83 // On Paste: We need to insert the objects of the Scene, but not the Scene itself
84 using SdrView::Paste;
85 virtual bool Paste(
86 const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, SdrInsertFlags nOptions) override;
87
88 // #83403# Service routine used from local Clone() and from SdrCreateView::EndCreateObj(...)
89 bool ImpCloneAll3DObjectsToDestScene(E3dScene const * pSrcScene, E3dScene* pDstScene, Point aOffset);
90
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));
93
94 // Means to create all Extrudes in a certain depth order.
95 static void DoDepthArrange(E3dScene const * pScene, double fDepth);
97 rtl::Reference<E3dScene> SetCurrent3DObj(E3dObject* p3DObj);
98 void Start3DCreation();
99
100 // Migration of overlay
101 bool Is3DRotationCreationActive() const { return (nullptr != mpMirrorOverlay); }
102
103 virtual void MovAction(const Point& rPnt) override;
104 void End3DCreation(bool bUseDefaultValuesForMirrorAxes=false);
105 void ResetCreationActive();
106
107 double GetDefaultCamPosZ();
108
109 double GetDefaultCamFocal();
110
111 bool IsBreak3DObjPossible() const;
112 void Break3DObj();
113
114 SfxItemSet Get3DAttributes() const;
115 void Set3DAttributes(const SfxItemSet& rAttr);
116};
117
118#endif // INCLUDED_SVX_VIEW3D_HXX
119
120/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Derived class of SdrView to edit 3D objects.
Definition: view3d.hxx:42
E3dDefaultAttributes & Get3DDefaultAttributes()
Definition: view3d.hxx:72
bool Is3DRotationCreationActive() const
Definition: view3d.hxx:101
const MouseEvent & GetMouseEvent() const
Definition: view3d.hxx:78
MouseEvent aMouseEvent
Definition: view3d.hxx:44
std::unique_ptr< Impl3DMirrorConstructOverlay > mpMirrorOverlay
Definition: view3d.hxx:47
void SetMouseEvent(const MouseEvent &rNew)
Definition: view3d.hxx:77
E3dDefaultAttributes a3DDefaultAttr
Definition: view3d.hxx:43
virtual void MovAction(const Point &rPnt) override
Definition: svdcrtv.cxx:206
virtual bool BegDragObj(const Point &rPnt, OutputDevice *pOut, SdrHdl *pHdl, short nMinMov=-3, SdrDragMethod *pForcedMeth=nullptr)
Definition: svddrgv.cxx:184
virtual void CheckPossibilities()
Definition: svdedtv.cxx:475
void ConvertMarkedToPolyObj()
Definition: svdedtv2.cxx:2090
virtual void DrawMarkedObj(OutputDevice &rOut) const
Definition: svdxcgv.cxx:709
virtual bool Paste(const SdrModel &rMod, const Point &rPos, SdrObjList *pLst, SdrInsertFlags nOptions)
Definition: svdxcgv.cxx:230
virtual std::unique_ptr< SdrModel > CreateMarkedObjModel() const
Definition: svdxcgv.cxx:723
Abstract DrawObject.
Definition: svdobj.hxx:260
SdrInsertFlags
Definition: svdedtv.hxx:59
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35