Line data Source code
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_SDR_CONTACT_VIEWCONTACTOFE3DSCENE_HXX
21 : #define INCLUDED_SVX_SDR_CONTACT_VIEWCONTACTOFE3DSCENE_HXX
22 :
23 : #include <svx/sdr/contact/viewcontactofsdrobj.hxx>
24 : #include <drawinglayer/primitive3d/baseprimitive3d.hxx>
25 : #include <drawinglayer/attribute/sdrsceneattribute3d.hxx>
26 : #include <drawinglayer/attribute/sdrlightingattribute3d.hxx>
27 : #include <drawinglayer/geometry/viewinformation3d.hxx>
28 : #include <basegfx/matrix/b2dhommatrix.hxx>
29 :
30 :
31 : // predeclarations
32 :
33 : class E3dScene;
34 :
35 : namespace basegfx {
36 : class B3DRange;
37 : }
38 :
39 :
40 :
41 : namespace sdr
42 : {
43 : namespace contact
44 : {
45 0 : class SVX_DLLPUBLIC ViewContactOfE3dScene : public ViewContactOfSdrObj
46 : {
47 : protected:
48 : // Create a Object-Specific ViewObjectContact, set ViewContact and
49 : // ObjectContact. Always needs to return something. Default is to create
50 : // a standard ViewObjectContact containing the given ObjectContact and *this
51 : virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact) SAL_OVERRIDE;
52 :
53 : public:
54 : // basic constructor, used from SdrObject.
55 : explicit ViewContactOfE3dScene(E3dScene& rScene);
56 :
57 : // access to SdrObject
58 0 : E3dScene& GetE3dScene() const
59 : {
60 0 : return (E3dScene&)GetSdrObject();
61 : }
62 :
63 : // React on changes of the object of this ViewContact
64 : virtual void ActionChanged() SAL_OVERRIDE;
65 :
66 : // access to ViewInformation3D and ObjectTransformation
67 : const drawinglayer::geometry::ViewInformation3D& getViewInformation3D(const ::basegfx::B3DRange& rContentRange) const;
68 : const drawinglayer::geometry::ViewInformation3D& getViewInformation3D() const;
69 : const basegfx::B2DHomMatrix& getObjectTransformation() const;
70 :
71 : // attribute providers
72 : const drawinglayer::attribute::SdrSceneAttribute& getSdrSceneAttribute() const;
73 : const drawinglayer::attribute::SdrLightingAttribute& getSdrLightingAttribute() const;
74 :
75 : // scene primitive creators. If pLayerVisibility is given, a visibility test with the LayerID and the
76 : // given SetOfByte is done.
77 : drawinglayer::primitive2d::Primitive2DSequence createScenePrimitive2DSequence(const SetOfByte* pLayerVisibility) const;
78 :
79 : // helpers to get the sequence of all contained 3D primitives and its range,
80 : // regardless of layer or visibility constraints and using a neutral ViewInformation3D
81 : drawinglayer::primitive3d::Primitive3DSequence getAllPrimitive3DSequence() const;
82 : basegfx::B3DRange getAllContentRange3D() const;
83 :
84 : protected:
85 : // the 3d transformation stack
86 : drawinglayer::geometry::ViewInformation3D maViewInformation3D;
87 :
88 : // the object transformation
89 : basegfx::B2DHomMatrix maObjectTransformation;
90 :
91 : // attributes
92 : drawinglayer::attribute::SdrSceneAttribute maSdrSceneAttribute;
93 : drawinglayer::attribute::SdrLightingAttribute maSdrLightingAttribute;
94 :
95 : // create methods for ViewInformation3D and ObjectTransformation
96 : void createViewInformation3D(const ::basegfx::B3DRange& rContentRange);
97 : void createObjectTransformation();
98 :
99 : // attribute creators
100 : void createSdrSceneAttribute();
101 : void createSdrLightingAttribute();
102 :
103 : // This method is responsible for creating the graphical visualisation data
104 : // ONLY based on model data
105 : virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const SAL_OVERRIDE;
106 : };
107 : } // end of namespace contact
108 : } // end of namespace sdr
109 :
110 :
111 :
112 : #endif // INCLUDED_SVX_SDR_CONTACT_VIEWCONTACTOFE3DSCENE_HXX
113 :
114 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|