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