tdf#149529 crash on deref deleted ScDocument*
[LibreOffice.git] / include / svx / viewpt3d.hxx
blob5d7856bd9ab01d23d159177613b8270a234dd939
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_VIEWPT3D_HXX
21 #define INCLUDED_SVX_VIEWPT3D_HXX
23 #include <svx/svxdllapi.h>
24 #include <basegfx/matrix/b3dhommatrix.hxx>
25 #include <basegfx/point/b3dpoint.hxx>
26 #include <basegfx/vector/b3dvector.hxx>
27 #include <tools/gen.hxx>
29 // predefines
30 namespace basegfx { class B3DRange; } // end of namespace basegfx
32 /*************************************************************************
34 |* enums for projection
36 \************************************************************************/
38 enum class ProjectionType { Parallel, Perspective };
41 /*************************************************************************
43 |* 3D viewport according to PHIGS
45 \************************************************************************/
47 class SVXCORE_DLLPUBLIC Viewport3D
49 protected:
50 basegfx::B3DHomMatrix aViewTf; // the real transformations matrix
51 basegfx::B3DPoint aVRP; // View Reference Point
52 basegfx::B3DVector aVPN; // View Plane Normal
53 basegfx::B3DVector aVUV; // View Up Vector
54 basegfx::B3DPoint aPRP; // Projection Reference Point(View-coordinates)
55 // up to now only the z-coordinate is considered
57 ProjectionType eProjection; // kind of the projection
58 tools::Rectangle aDeviceRect; // position and size of the output area
60 struct
62 double X, Y, W, H; // position and size of the view window
63 } aViewWin; // in view coordinates
65 basegfx::B3DPoint aViewPoint; //observers position in world coordinates;
66 // is calculated by the transformation
67 bool bTfValid; // flag, if transformation is valid
69 public:
70 Viewport3D();
72 void SetVRP(const basegfx::B3DPoint& rNewVRP);
73 void SetVPN(const basegfx::B3DVector& rNewVPN);
74 void SetVUV(const basegfx::B3DVector& rNewVUV);
75 void SetPRP(const basegfx::B3DPoint& rNewPRP);
77 const basegfx::B3DPoint& GetVRP() const { return aVRP; }
78 const basegfx::B3DVector& GetVUV() const { return aVUV; }
80 void SetProjection(ProjectionType ePrj)
81 { eProjection = ePrj; bTfValid = false; }
82 ProjectionType GetProjection() const { return eProjection; }
84 void SetViewWindow(double fX, double fY, double fW, double fH);
86 void SetDeviceWindow(const tools::Rectangle& rRect);
87 const tools::Rectangle& GetDeviceWindow() const { return aDeviceRect; }
89 // returns observers position in world coordinates
90 const basegfx::B3DPoint& GetViewPoint();
93 #endif // INCLUDED_SVX_VIEWPT3D_HXX
95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */