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_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETOOLS2D_HXX
21 : #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETOOLS2D_HXX
22 :
23 : #include <drawinglayer/drawinglayerdllapi.h>
24 :
25 : #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
26 : #include <basegfx/matrix/b2dhommatrix.hxx>
27 :
28 :
29 :
30 : namespace drawinglayer
31 : {
32 : namespace primitive2d
33 : {
34 : /** DiscreteMetricDependentPrimitive2D class
35 :
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()
40 : */
41 7304 : class DRAWINGLAYER_DLLPUBLIC DiscreteMetricDependentPrimitive2D : public BufferedDecompositionPrimitive2D
42 : {
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()
47 : */
48 : double mfDiscreteUnit;
49 :
50 : protected:
51 : /// helper to update discrete unit
52 1919 : void updateDiscreteUnit(double fNew)
53 : {
54 1919 : mfDiscreteUnit = fNew;
55 1919 : }
56 :
57 : public:
58 : /// constructor
59 7332 : DiscreteMetricDependentPrimitive2D()
60 : : BufferedDecompositionPrimitive2D(),
61 7332 : mfDiscreteUnit(0.0)
62 : {
63 7332 : }
64 :
65 : /// data read access
66 4792 : double getDiscreteUnit() const { return mfDiscreteUnit; }
67 :
68 : /// get local decomposition. Overloaded since this decomposition is view-dependent
69 : virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
70 : };
71 : } // end of namespace primitive2d
72 : } // end of namespace drawinglayer
73 :
74 :
75 :
76 : namespace drawinglayer
77 : {
78 : namespace primitive2d
79 : {
80 : /** ViewportDependentPrimitive2D class
81 :
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()
86 : */
87 0 : class DRAWINGLAYER_DLLPUBLIC ViewportDependentPrimitive2D : public BufferedDecompositionPrimitive2D
88 : {
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()
93 : */
94 : basegfx::B2DRange maViewport;
95 :
96 : public:
97 : /// constructor
98 0 : ViewportDependentPrimitive2D()
99 : : BufferedDecompositionPrimitive2D(),
100 0 : maViewport()
101 : {
102 0 : }
103 :
104 : /// data read access
105 0 : const basegfx::B2DRange& getViewport() const { return maViewport; }
106 :
107 : /// get local decomposition. Overloaded since this decomposition is view-dependent
108 : virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
109 : };
110 : } // end of namespace primitive2d
111 : } // end of namespace drawinglayer
112 :
113 :
114 :
115 : namespace drawinglayer
116 : {
117 : namespace primitive2d
118 : {
119 : /** ViewTransformationDependentPrimitive2D class
120 :
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()
125 : */
126 0 : class DRAWINGLAYER_DLLPUBLIC ViewTransformationDependentPrimitive2D : public BufferedDecompositionPrimitive2D
127 : {
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()
132 : */
133 : basegfx::B2DHomMatrix maViewTransformation;
134 :
135 : public:
136 : /// constructor
137 0 : ViewTransformationDependentPrimitive2D()
138 : : BufferedDecompositionPrimitive2D(),
139 0 : maViewTransformation()
140 : {
141 0 : }
142 :
143 : /// data read access
144 0 : const basegfx::B2DHomMatrix& getViewTransformation() const { return maViewTransformation; }
145 :
146 : /// get local decomposition. Overloaded since this decomposition is view-dependent
147 : virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
148 : };
149 : } // end of namespace primitive2d
150 : } // end of namespace drawinglayer
151 :
152 :
153 :
154 : namespace drawinglayer
155 : {
156 : namespace primitive2d
157 : {
158 : /** ObjectAndViewTransformationDependentPrimitive2D class
159 :
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()
165 : */
166 0 : class DRAWINGLAYER_DLLPUBLIC ObjectAndViewTransformationDependentPrimitive2D : public BufferedDecompositionPrimitive2D
167 : {
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()
172 : */
173 : basegfx::B2DHomMatrix maViewTransformation;
174 : basegfx::B2DHomMatrix maObjectTransformation;
175 :
176 : public:
177 : /// constructor
178 0 : ObjectAndViewTransformationDependentPrimitive2D()
179 : : BufferedDecompositionPrimitive2D(),
180 : maViewTransformation(),
181 0 : maObjectTransformation()
182 : {
183 0 : }
184 :
185 : /// data read access
186 0 : const basegfx::B2DHomMatrix& getViewTransformation() const { return maViewTransformation; }
187 0 : const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; }
188 :
189 : /// get local decomposition. Overloaded since this decomposition is view-dependent
190 : virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
191 : };
192 : } // end of namespace primitive2d
193 : } // end of namespace drawinglayer
194 :
195 :
196 :
197 : #endif // INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETOOLS2D_HXX
198 :
199 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|