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 .
22 #include <drawinglayer/drawinglayerdllapi.h>
24 #include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx>
25 #include <basegfx/matrix/b2dhommatrix.hxx>
28 namespace drawinglayer::primitive2d
30 /** DiscreteMetricDependentPrimitive2D class
32 tooling class for BufferedDecompositionPrimitive2D based classes which are view-dependent
33 regarding the size of a discrete unit. The implementation of get2DDecomposition
34 guards the buffered local decomposition and ensures that a create2DDecomposition
35 implementation may use an up-to-date DiscreteUnit accessible using getDiscreteUnit()
37 class DRAWINGLAYER_DLLPUBLIC DiscreteMetricDependentPrimitive2D
: public BufferedDecompositionPrimitive2D
40 /** the last used fDiscreteUnit definitions for decomposition. Since this
41 is checked and updated from get2DDecomposition() it will be current and
42 usable in create2DDecomposition()
44 double mfDiscreteUnit
;
48 DiscreteMetricDependentPrimitive2D()
54 double getDiscreteUnit() const { return mfDiscreteUnit
; }
56 /// Override standard getDecomposition to be view-dependent here
57 virtual void get2DDecomposition(Primitive2DDecompositionVisitor
& rVisitor
, const geometry::ViewInformation2D
& rViewInformation
) const override
;
60 /** ViewportDependentPrimitive2D class
62 tooling class for BufferedDecompositionPrimitive2D based classes which are view-dependent
63 regarding the viewport. The implementation of get2DDecomposition
64 guards the buffered local decomposition and ensures that a create2DDecomposition
65 implementation may use an up-to-date Viewport accessible using getViewport()
67 class DRAWINGLAYER_DLLPUBLIC ViewportDependentPrimitive2D
: public BufferedDecompositionPrimitive2D
70 /** the last used Viewport definition for decomposition. Since this
71 is checked and updated from get2DDecomposition() it will be current and
72 usable in create2DDecomposition()
74 basegfx::B2DRange maViewport
;
78 ViewportDependentPrimitive2D()
83 const basegfx::B2DRange
& getViewport() const { return maViewport
; }
85 /// Override standard getDecomposition to be view-dependent here
86 virtual void get2DDecomposition(Primitive2DDecompositionVisitor
& rVisitor
, const geometry::ViewInformation2D
& rViewInformation
) const override
;
89 /** ViewTransformationDependentPrimitive2D class
91 tooling class for BufferedDecompositionPrimitive2D based classes which are view-dependent
92 regarding the complete Viewtransformation. The implementation of get2DDecomposition
93 guards the buffered local decomposition and ensures that a create2DDecomposition
94 implementation may use an up-to-date ViewTransformation accessible using getViewTransformation()
96 class DRAWINGLAYER_DLLPUBLIC ViewTransformationDependentPrimitive2D
: public BufferedDecompositionPrimitive2D
99 /** the last used ViewTransformation definition for decomposition. Since this
100 is checked and updated from get2DDecomposition() it will be current and
101 usable in create2DDecomposition()
103 basegfx::B2DHomMatrix maViewTransformation
;
107 ViewTransformationDependentPrimitive2D()
112 const basegfx::B2DHomMatrix
& getViewTransformation() const { return maViewTransformation
; }
114 /// Override standard getDecomposition to be view-dependent here
115 virtual void get2DDecomposition(Primitive2DDecompositionVisitor
& rVisitor
, const geometry::ViewInformation2D
& rViewInformation
) const override
;
118 /** ObjectAndViewTransformationDependentPrimitive2D class
120 tooling class for BufferedDecompositionPrimitive2D based classes which are view-dependent
121 and Object-Transform dependent. The implementation of get2DDecomposition
122 guards the buffered local decomposition and ensures that a create2DDecomposition
123 implementation may use an up-to-date ViewTransformation accessible using getViewTransformation()
124 and an object transformation via getObjectTransformation()
126 class DRAWINGLAYER_DLLPUBLIC ObjectAndViewTransformationDependentPrimitive2D
: public BufferedDecompositionPrimitive2D
129 /** the last used ViewTransformation and the last ObjectTransformation
130 definition for decomposition. Since this is checked and updated from
131 get2DDecomposition() it will be current and usable in create2DDecomposition()
133 basegfx::B2DHomMatrix maViewTransformation
;
134 basegfx::B2DHomMatrix maObjectTransformation
;
138 ObjectAndViewTransformationDependentPrimitive2D()
143 const basegfx::B2DHomMatrix
& getViewTransformation() const { return maViewTransformation
; }
144 const basegfx::B2DHomMatrix
& getObjectTransformation() const { return maObjectTransformation
; }
146 /// Override standard getDecomposition to be view-dependent here
147 virtual void get2DDecomposition(Primitive2DDecompositionVisitor
& rVisitor
, const geometry::ViewInformation2D
& rViewInformation
) const override
;
149 } // end of namespace drawinglayer::primitive2d
151 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */