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_SDR_CONTACT_VIEWCONTACTOFE3DSCENE_HXX
21 #define INCLUDED_SVX_SDR_CONTACT_VIEWCONTACTOFE3DSCENE_HXX
23 #include <svx/scene3d.hxx>
24 #include <svx/sdr/contact/viewcontactofsdrobj.hxx>
25 #include <drawinglayer/primitive3d/baseprimitive3d.hxx>
26 #include <drawinglayer/attribute/sdrsceneattribute3d.hxx>
27 #include <drawinglayer/attribute/sdrlightingattribute3d.hxx>
28 #include <drawinglayer/geometry/viewinformation3d.hxx>
29 #include <basegfx/matrix/b2dhommatrix.hxx>
35 namespace sdr::contact
{
37 class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC
) ViewContactOfE3dScene final
: public ViewContactOfSdrObj
40 // basic constructor, used from SdrObject.
41 explicit ViewContactOfE3dScene(E3dScene
& rScene
);
43 // access to SdrObject
44 const E3dScene
& GetE3dScene() const
46 return static_cast<const E3dScene
&>(GetSdrObject());
49 // React on changes of the object of this ViewContact
50 virtual void ActionChanged() override
;
52 // access to ViewInformation3D and ObjectTransformation
53 const drawinglayer::geometry::ViewInformation3D
& getViewInformation3D(const ::basegfx::B3DRange
& rContentRange
) const;
54 const drawinglayer::geometry::ViewInformation3D
& getViewInformation3D() const;
55 const basegfx::B2DHomMatrix
& getObjectTransformation() const;
57 // attribute providers
58 const drawinglayer::attribute::SdrSceneAttribute
& getSdrSceneAttribute() const;
59 const drawinglayer::attribute::SdrLightingAttribute
& getSdrLightingAttribute() const;
61 // scene primitive creators. If pLayerVisibility is given, a visibility test with the LayerID and the
62 // given SdrLayerIDSet is done.
63 drawinglayer::primitive2d::Primitive2DContainer
createScenePrimitive2DSequence(const SdrLayerIDSet
* pLayerVisibility
) const;
65 // helpers to get the sequence of all contained 3D primitives and its range,
66 // regardless of layer or visibility constraints and using a neutral ViewInformation3D
67 drawinglayer::primitive3d::Primitive3DContainer
getAllPrimitive3DContainer() const;
68 basegfx::B3DRange
getAllContentRange3D() const;
71 // Create an Object-Specific ViewObjectContact, set ViewContact and
72 // ObjectContact. Always needs to return something. Default is to create
73 // a standard ViewObjectContact containing the given ObjectContact and *this
74 virtual ViewObjectContact
& CreateObjectSpecificViewObjectContact(ObjectContact
& rObjectContact
) override
;
76 // create methods for ViewInformation3D and ObjectTransformation
77 void createViewInformation3D(const ::basegfx::B3DRange
& rContentRange
);
78 void createObjectTransformation();
81 void createSdrSceneAttribute();
82 void createSdrLightingAttribute();
84 // This method is responsible for creating the graphical visualisation data
85 // ONLY based on model data
86 virtual void createViewIndependentPrimitive2DSequence(drawinglayer::primitive2d::Primitive2DDecompositionVisitor
& rVisitor
) const override
;
88 // the 3d transformation stack
89 drawinglayer::geometry::ViewInformation3D maViewInformation3D
;
91 // the object transformation
92 basegfx::B2DHomMatrix maObjectTransformation
;
95 drawinglayer::attribute::SdrSceneAttribute maSdrSceneAttribute
;
96 drawinglayer::attribute::SdrLightingAttribute maSdrLightingAttribute
;
101 #endif // INCLUDED_SVX_SDR_CONTACT_VIEWCONTACTOFE3DSCENE_HXX
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */