update credits
[LibreOffice.git] / include / drawinglayer / primitive2d / primitivetools2d.hxx
blob824306e4c77baa3ee09840bc139bd1a1def993c2
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_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETOOLS2D_HXX
21 #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETOOLS2D_HXX
23 #include <drawinglayer/drawinglayerdllapi.h>
25 #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
26 #include <basegfx/matrix/b2dhommatrix.hxx>
30 namespace drawinglayer
32 namespace primitive2d
34 /** DiscreteMetricDependentPrimitive2D class
36 tooling class for BufferedDecompositionPrimitive2D baseed classes which are view-dependent
37 regarding the size of a discrete unit. The implementation of get2DDecomposition
38 guards the buffered local decomposition and ensures that a create2DDecomposition
39 implementation may use an up-to-date DiscreteUnit accessible using getDiscreteUnit()
41 class DRAWINGLAYER_DLLPUBLIC DiscreteMetricDependentPrimitive2D : public BufferedDecompositionPrimitive2D
43 private:
44 /** the last used fDiscreteUnit definitions for decomposition. Since this
45 is checked and updated from get2DDecomposition() it will be current and
46 usable in create2DDecomposition()
48 double mfDiscreteUnit;
50 protected:
51 /// helper to update discrete unit
52 void updateDiscreteUnit(double fNew)
54 mfDiscreteUnit = fNew;
57 public:
58 /// constructor
59 DiscreteMetricDependentPrimitive2D()
60 : BufferedDecompositionPrimitive2D(),
61 mfDiscreteUnit(0.0)
65 /// data read access
66 double getDiscreteUnit() const { return mfDiscreteUnit; }
68 /// Override standard getDecomposition to be view-dependent here
69 virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
71 } // end of namespace primitive2d
72 } // end of namespace drawinglayer
76 namespace drawinglayer
78 namespace primitive2d
80 /** ViewportDependentPrimitive2D class
82 tooling class for BufferedDecompositionPrimitive2D baseed classes which are view-dependent
83 regarding the viewport. The implementation of get2DDecomposition
84 guards the buffered local decomposition and ensures that a create2DDecomposition
85 implementation may use an up-to-date Viewport accessible using getViewport()
87 class DRAWINGLAYER_DLLPUBLIC ViewportDependentPrimitive2D : public BufferedDecompositionPrimitive2D
89 private:
90 /** the last used Viewport definition for decomposition. Since this
91 is checked and updated from get2DDecomposition() it will be current and
92 usable in create2DDecomposition()
94 basegfx::B2DRange maViewport;
96 public:
97 /// constructor
98 ViewportDependentPrimitive2D()
99 : BufferedDecompositionPrimitive2D(),
100 maViewport()
104 /// data read access
105 const basegfx::B2DRange& getViewport() const { return maViewport; }
107 /// Override standard getDecomposition to be view-dependent here
108 virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
110 } // end of namespace primitive2d
111 } // end of namespace drawinglayer
115 namespace drawinglayer
117 namespace primitive2d
119 /** ViewTransformationDependentPrimitive2D class
121 tooling class for BufferedDecompositionPrimitive2D based classes which are view-dependent
122 regarding the complete Viewtransformation. The implementation of get2DDecomposition
123 guards the buffered local decomposition and ensures that a create2DDecomposition
124 implementation may use an up-to-date ViewTransformation accessible using getViewTransformation()
126 class DRAWINGLAYER_DLLPUBLIC ViewTransformationDependentPrimitive2D : public BufferedDecompositionPrimitive2D
128 private:
129 /** the last used ViewTransformation definition for decomposition. Since this
130 is checked and updated from get2DDecomposition() it will be current and
131 usable in create2DDecomposition()
133 basegfx::B2DHomMatrix maViewTransformation;
135 public:
136 /// constructor
137 ViewTransformationDependentPrimitive2D()
138 : BufferedDecompositionPrimitive2D(),
139 maViewTransformation()
143 /// data read access
144 const basegfx::B2DHomMatrix& getViewTransformation() const { return maViewTransformation; }
146 /// Override standard getDecomposition to be view-dependent here
147 virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
149 } // end of namespace primitive2d
150 } // end of namespace drawinglayer
154 namespace drawinglayer
156 namespace primitive2d
158 /** ObjectAndViewTransformationDependentPrimitive2D class
160 tooling class for BufferedDecompositionPrimitive2D based classes which are view-dependent
161 and Object-Transform dependent. The implementation of get2DDecomposition
162 guards the buffered local decomposition and ensures that a create2DDecomposition
163 implementation may use an up-to-date ViewTransformation accessible using getViewTransformation()
164 and an object transformation via getObjectTransformation()
166 class DRAWINGLAYER_DLLPUBLIC ObjectAndViewTransformationDependentPrimitive2D : public BufferedDecompositionPrimitive2D
168 private:
169 /** the last used ViewTransformation and the last ObjectTransformation
170 definition for decomposition. Since this is checked and updated from
171 get2DDecomposition() it will be current and usable in create2DDecomposition()
173 basegfx::B2DHomMatrix maViewTransformation;
174 basegfx::B2DHomMatrix maObjectTransformation;
176 public:
177 /// constructor
178 ObjectAndViewTransformationDependentPrimitive2D()
179 : BufferedDecompositionPrimitive2D(),
180 maViewTransformation(),
181 maObjectTransformation()
185 /// data read access
186 const basegfx::B2DHomMatrix& getViewTransformation() const { return maViewTransformation; }
187 const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; }
189 /// Override standard getDecomposition to be view-dependent here
190 virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
192 } // end of namespace primitive2d
193 } // end of namespace drawinglayer
197 #endif // INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETOOLS2D_HXX
199 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */